Commit Graph

443 Commits

Author SHA1 Message Date
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
deweibel@gmail.com 5e0fff1618 Add back AP_GPS_IMU to provide Xplane functionality
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1504 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-17 01:50:34 +00:00
jasonshort 80689920af Added getter functions to accels
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1503 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-16 20:42:11 +00:00
DrZiplok@gmail.com 96d2dc33fe Formatting and naming changes for conformance with the ArduPilot Coding Conventions.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1502 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-16 09:14:21 +00:00
DrZiplok 5113a12144 Deal more gracefully with the case where the incoming PPM stream has more than 8 channels encoded.
This makes it possible to move one resistor on the APM board and feed it PPM directly from a receiver emitting a PPM stream.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@1498 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-15 19:32:04 +00:00
DrZiplok cbdf462acc Update to current MAVLink dev branch protocol version. This has NOT been tested yet.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1494 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-12 08:57:54 +00:00
DrZiplok aaf125e441 Based on explaining AP_VarNoAddress to Doug, improve the description of the value.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1491 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-12 02:43:25 +00:00
DrZiplok@gmail.com 52a0a03d56 Bring AP_GPS_Auto closer to ready for prime-time:
- disable NMEA autodetection; false positives are still a risk
 - trim down the console output to a minimum; we still need something to help users diagnose potential problems, but the old output was much too verbose
 - rather than block forever, only do one autodetect pass for each ::read call.  That's still too long (five seconds or so) but better than blocking forever.
 - don't block forever if no GPS is attached.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1480 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 08:20:41 +00:00
DrZiplok@gmail.com fdde092213 Extend the logic that preserves buffer sizing on re-begin by also avoiding freeing and re-allocating buffers when they don't change in size.
This can make re-opening a port faster (as the free/malloc pair can be avoided) and possibly more robust (in the case where e.g. the heap has been corrupted).

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1479 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 08:17:31 +00:00
DrZiplok@gmail.com eb39264834 Update the NMEA example code in conjunction with the new parser.
Added an init string for SiRF receivers that will bring them back out of the binary mode configuration that AP_GPS_Auto sets them to.  

Picked up the GPS logging format from the AP_GPS_Auto test.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@1469 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:57:16 +00:00
DrZiplok@gmail.com cad260a481 Implement a completely new NMEA parser based on the TinyGPS parser by Mikal Hart.
Major new features:

 - No RAM buffer for the NMEA message being parsed; saves 120 bytes of RAM.
 - More robust parser, a little less likely to be confused by bad messages.
 - Added configuration strings for SiRF, ublox and MediaTek GPS in NMEA mode to select just the messages of interest.

Note that the issue that TinyGPS has with co-ordinates with "different" numbers of decimal digits is addressed in this code.

Size is comparable to the old parser.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1468 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:55:45 +00:00
DrZiplok@gmail.com 1bfcdaa2cb Add a delay after sending the GPS mode switch strings in an attempt to give any NMEA data time to drain before we attempt to sniff again.
Otherwise, we can end up settling on NMEA as a mode just after switching a SiRF GPS to binary mode.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1467 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:50:42 +00:00
DrZiplok@gmail.com dd6ede36ee Add more unit tests for AP_Var.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1466 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:44:23 +00:00
DrZiplok@gmail.com 6366cdc094 Add more documentation for AP_MetaClass.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1465 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:43:41 +00:00
DrZiplok@gmail.com 44cac7a853 Add a new macro PROGMEM_STRING that can be used to define a constant string in program memory.
This is a partial workaround for not being able to use PSTR at global scope, e.g. in an argument to a constructor; it makes the intent of the otherwise somewhat bulky declaration of the string more obvious.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1464 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:42:59 +00:00
DrZiplok 07dec5e1b7 Use operator new from AP_Common rather than our own. This also makes AP_Common available to the GPS drivers that work with AP_GPS_Auto.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1463 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:19:15 +00:00
DrZiplok@gmail.com 8c9a5d36d8 Add documentation and reformat closer to our current code standard.
Add support for re-opening a port without changing the baudrate or buffer sizes.  By passing zero for the parameters that aren't to be changed, code can reconfigure a port without needing to know how it was originally configured.





git-svn-id: https://arducopter.googlecode.com/svn/trunk@1462 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:17:03 +00:00
DrZiplok 2c0e8515d5 Add a date field to the standard GPS data. This may be zero, and its format is TBD (may be GPS-dependent).
Increase the no-data timeout to slightly more than a second, so that GPS' with a 1Hz update rate don't cause problems.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1461 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 00:44:09 +00:00
rmackay9@yahoo.com 1448b6991e AP_RangeFinder_test.pde - corrected some inaccurate comments in the code
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1459 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-09 14:20:26 +00:00
DrZiplok e299d5f58a Add a flags byte to variables, and implement a "no auto load" bit that opts variables out of load_all / save_all.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1449 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-05 17:56:46 +00:00
DrZiplok c0de571afd Save AP_Var's initial value as a default value, and add a function for restoring the default value.
Fix the AP_Var::lookup cache, which was very busted.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1448 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-05 09:25:07 +00:00
DrZiplok 0e868ca343 More unit tests.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1447 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-05 07:40:35 +00:00
DrZiplok 765cef724d Fix the assignment operator overload for AP_VarT so that direct assignments to the type work correctly.
Add a variant of AP_Float that stores the value as Q5.10 (16-bit fixed-point) to save EEPROM space.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1446 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-05 07:40:06 +00:00
DrZiplok 814a16000a Simplify FastSerial::begin baudrate calculations in line with the changes made in Arduino-0022
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1424 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-04 18:41:27 +00:00