Commit Graph

466 Commits

Author SHA1 Message Date
DrZiplok 991acad1f0 Add a constant that can be used to identify groups.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1653 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 07:11:42 +00:00
DrZiplok@gmail.com 944825772d Use AP_Var to store PID scaling values.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1652 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:45:31 +00:00
DrZiplok@gmail.com 1dd50ec263 Use AP_Var to store channel calibration.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1651 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:43:44 +00:00
DrZiplok@gmail.com 86fda84749 Use AP_Var to store accel/gyro calibration.
Refactor AP_IMU_Oilpan and remove all the old EEPROM code.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1650 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:42:37 +00:00
DrZiplok@gmail.com a4e791dc92 Line ending property changes.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1649 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:27:07 +00:00
DrZiplok@gmail.com f10cbb011f ::transposed does not change the matrix; make it const.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1648 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:26:05 +00:00
DrZiplok@gmail.com cc06f07067 Major update including AP_Var support.
Most of the compass functionality is now abstracted in a base class, with the various sub-classes implementing just their unique functionality.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1647 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:25:20 +00:00
DrZiplok@gmail.com 0ea1845f38 Eclipse project config changes.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1646 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 03:16:03 +00:00
DrZiplok@gmail.com 0b60757b43 Add a template AP_VarS that handles arbitrary structure/class types.
Note that the object must still be <= 32 bytes in size to be saved/loaded.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1644 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 01:47:24 +00:00
jasonshort 0436916609 updated formatting, baud
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1643 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 00:43:35 +00:00
jasonshort b6c552212e updated formatting, baud
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1642 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 00:43:11 +00:00
deweibel@gmail.com 0b6454aa0b Speed IMU initialization
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1641 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-13 23:25:04 +00:00
deweibel@gmail.com 8e542512da Change ADC overflow correction
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1640 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-13 23:24:37 +00:00
james.goppert 253307e2f0 AP_RcChannel demos updated for AP_Var.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1632 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-13 01:24:32 +00:00
mich146@hotmail.com 4ea9192ab8 Mavlink update
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1630 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-11 11:04:52 +00:00
mich146@hotmail.com 152f0a12df Fix Mavlink include
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1628 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-11 00:04:39 +00:00
DrZiplok 61d65f652c Fix for log() being a bad idea.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1617 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-09 23:15:11 +00:00
mich146@hotmail.com dbdabd8707 MavLink Update
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1616 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-08 23:16:58 +00:00
deweibel 8c76c8c936 Add code for auto magnetometer offset nulling.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1615 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-08 20:17:16 +00:00
DrZiplok 4632dd2f29 Implement a cast_to_float method for convenience; at a cost of a couple of bytes in the vtable this will save many callers having to play type introspection games.
It might be possible to implement a set of virtual cast operator overrides, but only float lets us return NAN to indicate that a cast can't be made, so for now we'll stick with just this one.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1614 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-08 10:17:45 +00:00
DrZiplok 3108d661d2 Correct knots -> m/sec conversion. Thanks to Paul M. for spotting this.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1613 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-08 07:06:47 +00:00
james.goppert 2584f9a1f1 APO Compiling with new AP_Var!
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1612 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-08 01:58:51 +00:00
james.goppert af1ee477b9 Working on updating AP_Controller/RC_Channel for new AP_Var
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1611 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-07 23:33:12 +00:00
deweibel e620eb1326 Change MediaTek timestamps to millisecond Time of Day
Add epoch method to return timestamp epoch.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1589 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-01 23:50:36 +00:00
DrZiplok@gmail.com b614aca274 Add a template AP_VarA that defines a variable that is an array of some basic type. This is like AP_VarT for arrays, with minor changes in behaviour consistent with the difference between regular variables and arrays.
Note that AP_VarA arrays are still limited by the constraints on the total size of a variable (AP_Var::k_size_max).

Add a basic unit test for arrays; more are needed.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1579 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-30 20:58:34 +00:00
DrZiplok@gmail.com ca0005db2a Comments, minor consting, use a better target for sizeof in AP_VarT
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1578 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-30 20:14:42 +00:00
DrZiplok@gmail.com b60480fac0 Minor whitespace fixes.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1577 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-30 20:13:07 +00:00
deweibel@gmail.com b3c9bf270f Add FinishWrite method to the DataFlash class to support using an index system.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1575 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-30 01:53:04 +00:00
deweibel@gmail.com 3443a7817d Add reversing for PWM outputs in angle_to_pwm case.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1566 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-27 18:16:22 +00:00
james.goppert 82a257982a Started updating AP_Controller and AP_RcChannel for AP_Var
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1559 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-26 07:05:22 +00:00
mich146@hotmail.com 000eaf6a68 Mavlink update
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1555 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-25 00:31:38 +00:00
DrZiplok c18fd76449 Try to pre-empt subsequent inclusions of wiring.h by grabbing it here and giving ourselves a chance to undo some of the less well-advised macros it defines.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1554 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-24 02:44:31 +00:00
jasonshort c9227dbcaf fixed a scaling bug in imax
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1553 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-24 02:07:25 +00:00
DrZiplok@gmail.com 34f43934da Move the unit test framework out of the unit tests. Add unit tests for the k_typeid_* constants.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1543 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 23:59:26 +00:00
DrZiplok@gmail.com b58693f203 Add a function to AP_Var for finding a variable by name. It is not efficient, but convenient for e.g. interactive use.
Add pseudo-constant copies of the AP_Meta_calss::Type_id for the standard AP_VarT subclasses.  This makes checking the type of a possible AP_Var much cheaper than calling ::meta_cast, as there is no object con/destruction involved.

Add some helper functions for manipulating AP_Vars from Menu interfaces.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1541 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 23:58:07 +00:00
DrZiplok@gmail.com 2caea855cd Don't include AP_Vector (in preparation for retirement) and AP_Loop (because it's not being used by APM*). Interested clients can still include AP_Loop if they need it.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1540 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 23:48:07 +00:00
DrZiplok@gmail.com 2f263229f9 Rename AP_Meta_class::AP_Type_id to AP_Meta_class::Type_id in keeping with the coding standard.
Add a non-static version of AP_Meta_class::meta_cast that can be used against any subclass object directly.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1539 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 23:46:58 +00:00
DrZiplok 8c9ece1f37 Fix a serious typo, add more documentation.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1538 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 20:33:20 +00:00
DrZiplok 7a3d33844a Move the Test unit test framework out into its own header, so that it can be used by other libraries.
Add some documentation explaining how it is used.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1537 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 20:26:11 +00:00
DrZiplok@gmail.com 8cc7e658b0 Simplify AP_Var_group::_serialize_unserialize slightly by removing some variables.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1535 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 10:04:24 +00:00
DrZiplok@gmail.com 4b21f3485a Improve performance when saving a number of variables that don't have space allocated in the EEPROM. This avoids scanning the entire EEPROM every time a variable that has not yet had space allocated is written.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1534 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 09:56:58 +00:00
DrZiplok@gmail.com 655f7a21ff Fix ::save_all/::load_all so that they check the correct criteria for opt-out. Now load/save_all work.
Fix prototype for AP_Var_group::serialize so that it's called correctly when saving a group.  Now group load/save works.

Add load/save_all and group load/save unit tests.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1533 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 09:27:58 +00:00
DrZiplok@gmail.com e7da843d90 Fixes for EEPROM space allocation and mapping.
- We can't count on the first EEPROM scan knowing about everything; new variables may be constructed later so be willing to go back and re-scan the EEPROM if we encounter a new variable that hasn't been loaded yet.
- Sort out where _key actually points (the variable's data) in the EEPROM and get everyone to use the same interpretation.
- Fix return values from ::save and ::load.
- Make it possible to re-save after ::erase_all by de-locating all variables before the EEPROM is blown away.
- Fix args to eeprom_read_block/eeprom_write_block so that we don't spam random memory.

Add unit tests for basic save/load operations.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1532 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 08:11:53 +00:00
DrZiplok@gmail.com 39fea200ca I never liked the plan that variable groups could only be statically scoped; it was much too fragile. These changes address that issue by splitting the global variable list into two lists, one for standalone variables (including groups), and one for variables that are members of a group.
Now a variable belonging to a group can safely be constructed before the group it belongs to, and the group can be destroyed before its member variables.  This greatly simplifies the AP_Var constructor(s).

Remove the lookup-by-index and lookup-by-key interfaces to AP_Var and replace them with first/next interfaces for all variables, and for variables belonging to a specific group.  Document their usage.  Add an accessor for the key associated with a variable so that search-by-key can be performed by a consumer.  Throw away the lookup cache implementation, as it's not required anymore.

Re-layout the EEPROM variable header and tweak the EEPROM space allocator so that it's more resistant to interruptions during variable save.

Fix the global constants so that they work.

Add an interface for erasing all variables in EEPROM (only writes one byte).

Fix unit tests so that they work with the changed interfaces.  Also tweak the unit test framework so that it doesn't inline all its code.  This is a WIP - many more tests need to be written still.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1531 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 06:52:59 +00:00
DrZiplok@gmail.com de71731994 Add a templated version of AP_Meta_class::meta_type_id so that you can get a type ID for any named type without having to have an instance of the type lying around. Update the comments about caching type IDs to reflect its availability.
Fix the comments around AP_Meta_class::meta_cast; they were leftovers from an earlier implementation and entirely not helpful.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1530 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-23 06:44:07 +00:00
DrZiplok@gmail.com 39b718fce0 Implement the missing AP_Var_group::*serialize functions.
Rather than implementing empty default constructors, make sure that AP_Var and friends have useful default constructors instead.  This works around AP_Meta_class::meta_cast requiring a default constructor without having empty ctors scattered around.

Add accessors to AP_Var so that the global variable list can be traversed and the group/variable relationship comprehended by outsiders.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1523 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-22 18:42:44 +00:00
DrZiplok@gmail.com 30d9a92c4e Implement a pure data serialisation load/save model for AP_Var.
The format is a simple TLV format; a tag identifying the variable, a length for the variable, and then the actual data.  This format could ultimately be extended to include waypoint/commands as well.

This allows us to load and save groups of variables to EEPROM without having to have a static EEPROM map.

Still needs unit tests and (probably) bugfixing.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1522 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-22 08:37:52 +00:00
james.goppert 05622fe225 Updated AP_RcChannel for AP_Var.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1509 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-18 04:56:45 +00:00
mich146@hotmail.com 0328f926b5 Reinstate Float loading and saving
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1507 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-17 22:57:48 +00:00
deweibel@gmail.com 50c3b2e4fd Add initial values for scaling and dead zone to RC_Channel constructor
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1506 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-17 04:05:48 +00:00