Commit Graph

551 Commits

Author SHA1 Message Date
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@gmail.com d8046957c6 Unit tests for scope-based address offsetting.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1418 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-04 08:50:24 +00:00
DrZiplok@gmail.com 63643f73fc Move the AP_Var ctor out of the class definition; it's big enough that we don't want to inline it.
AP_Vars with either a name or an address are 'interesting' (the latter so we can save_all).

Add the concept of address offsets to scopes.  Now we have a container that we can put AP_Vars into that can be moved around in the EEPROM.  This will make it easier for things like the PID library which need to support multiple instances getting their parameters from different parts of the ROM.

Improve documentation.

Suck it up and admit that we aren't going to do "identity"-based addressing for the EEPROM and just call the property "address".



git-svn-id: https://arducopter.googlecode.com/svn/trunk@1417 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-04 08:49:55 +00:00
DrZiplok@gmail.com d2bd744244 Metaclass improvements:
- Add a default ctor/dtor pair.  The dtor ensures that all dtors are virtual, and guarantees that there is something in the dtor vtable slot for classes that don't implement their own.
 - serialize must not alter the class, mark it const
 - Improve documentation
 - Fix handle validation to prevent trying to read 2 bytes beyond the end of memory


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1416 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-04 08:46:01 +00:00
DrZiplok 57f3f4e65b Beef up the unit tests for AP_Var. Most of the basic functionality is now covered.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1403 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-03 02:29:17 +00:00
DrZiplok 277105c437 Rename the base class for variables AP_Var; less confusing, less to type. Rename the template type instead.
We don't need any of the arithmetic overloads, so strip them.

Fix includes.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1402 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-03 02:28:35 +00:00
DrZiplok ea9c7859f8 Don't allow the default serialize/unserialize to be inlined.
Fix some includes and remove an old implementation of meta_cast.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1401 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-03 02:26:18 +00:00
DrZiplok a02136236f Add the ability to find the sketchbook when called from a Makefile in a library example.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1400 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-02 22:16:21 +00:00
DrZiplok a3a9fe59e3 Following discussions with James, a complete rewrite of AP_Var.
The overriding principle here is to keep the use of AP_Vars as simple as possible, whilst letting the implementation do useful things behind the scenes.  To that end, we define AP_Float, AP_Int8, AP_Int16 and AP_Int32.  These are strongly typed, so that there is no ambiguity about what a variable "really" is.

The classes behave like the variables they are storing; you can use an AP_Float in most places you would use a regular float; you can add to it, multiply by it, etc.  If it has been given an address in EEPROM you can load and save it.

Variables can be given names, and if they are named then they can be looked up.  This allows e.g. a GCS or a test tool to find and traffic in variables that it may not explicitly know about.

AP_Var does not attempt to solve the problem of EEPROM address space management.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1399 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-02 22:14:36 +00:00
DrZiplok 68be029a17 Don't define constant AP_Var's extern
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1381 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-01 00:31:39 +00:00
james.goppert 634f2734b5 Added AP_Controller library.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1379 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-31 06:20:28 +00:00
james.goppert 8bc3fc599d Fixed casting issues with EEPROM Registry
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1371 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-30 06:46:40 +00:00
james.goppert 86feb8bf7b Fixed issues with RcChannel EEPROM var ownership.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1369 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-30 05:25:28 +00:00
DrZiplok 23e78d0f4b Fix/improve depdendency handling. Deps are autogenerated on the first compile pass and consumed on subsequent builds. This helps work around the difficulty of building the 'clean' target with Eclipse.
Don't depend on the build directory anywhere; we automake it as required.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@1368 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-30 03:45:50 +00:00
DrZiplok 7bc153f038 More awk-related changes. mawk hangs on the parser scripts, so try gawk; it's what we'll need for cygwin anyway.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1367 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-30 03:20:33 +00:00
DrZiplok f0f13752d0 We need TOOLPATH even when ARDUINO is defined. Refactor.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1366 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-30 02:25:55 +00:00
DrZiplok f65076dccc Adjust the awk scanners to deal with the somewhat less featureful awk found on many Linux systems.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1365 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-30 02:16:01 +00:00
DrZiplok 0dac8fca62 Better TOOLPATH handling for Linux
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1364 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-29 23:13:44 +00:00
DrZiplok 4d490359e7 Try to find the AVR tools on Linux
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1363 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-29 22:39:39 +00:00
DrZiplok@gmail.com 2ec1d69a0f Move Arduino.mk here. This library should always be present in a constant location for our projects.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1361 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-29 19:43:58 +00:00
james.goppert e3041f08fe RcChannel now owns channel config params.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1354 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-29 08:26:21 +00:00
DrZiplok faa2b9909e Break AP_Var and friends out into their own header.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1345 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 23:51:12 +00:00
DrZiplok 632d0f574a Don't actually implement __cxa_pure_virtual, we'd prefer to have link-time errors rather than classes with pure virtual functions.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1341 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 23:33:27 +00:00
DrZiplok 6f4e63e8b3 Move ToRad here to match ToDeg
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1338 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 23:30:09 +00:00
DrZiplok 9b1863f4b2 operator new[] should return a zeroed class object just like operator new does.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1337 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 23:29:46 +00:00
james.goppert 482f124212 Added macros to AP_Common.h
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1332 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 21:30:29 +00:00
james.goppert 54fa069f10 Fixed include problem in AP_RcChannel.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1316 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 18:50:22 +00:00
james.goppert 76b4dd5f73 Fixed RC_ChannelB errors.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1261 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-25 19:03:38 +00:00
james.goppert 60f9a6d216 Added AP_Variable.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1259 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-25 07:09:37 +00:00
james.goppert 0a4bc9b172 Added Loop class.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1251 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-24 23:59:10 +00:00
james.goppert 9e983c452e Some EEProm cleanup.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1244 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-24 05:25:13 +00:00
james.goppert 125b971173 Updated mavlink added eeprom class.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1239 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-23 23:02:51 +00:00
jasonshort 80a5016658 Wasn't compiling.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1213 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-20 02:34:46 +00:00
james.goppert 4e4a1bc375 Added inclusion guard to menu.h
git-svn-id: https://arducopter.googlecode.com/svn/trunk@962 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-28 00:35:59 +00:00
DrZiplok@gmail.com 458dfde81d Move the warning controls for APM out to AP_Common. This makes it easier to grab these for libraries uniformly.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@960 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-27 23:27:08 +00:00
DrZiplok@gmail.com a468abcdbf Add a better workaround for a GCC bug that generates spurious warnings for PSTR()
git-svn-id: https://arducopter.googlecode.com/svn/trunk@920 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-25 02:59:30 +00:00
DrZiplok f345d5392f Back out the workaround for PSTR() warnings; it doesn't.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@912 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-24 08:06:09 +00:00
DrZiplok@gmail.com 906239160d Add a workaround for a GCC bug that generates spurious warnings for PSTR()
git-svn-id: https://arducopter.googlecode.com/svn/trunk@900 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-23 09:07:47 +00:00
DrZiplok d2a2ee0fd8 More runtime magic; this time support required for static class objects at function scope.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@855 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-18 17:52:41 +00:00
james.goppert 33a7d26846 Adding missing loop counter for menu.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@809 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-09 01:58:00 +00:00
DrZiplok@gmail.com c39639045c Default un-supplied command arguments to the empty string and zero rather than leaving them potentially un-initialised. This makes it safe for commands to compare argument strings without adding the expense of checking argc first.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@760 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-01 03:40:54 +00:00
DrZiplok 23ccff2ccd Add support for 'new' and 'delete', so we can cons things on the fly.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@668 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-10-17 04:02:06 +00:00
DrZiplok 58c1714bd3 Add more documentation to the Menu class.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@569 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-30 04:28:10 +00:00
DrZiplok@gmail.com 6838829428 Use strtok_r rather than strtok. Saves a stack frame, two bytes of global, and fixes backwards compatibility with older avr-libc versions.
Fixes issue #131

git-svn-id: https://arducopter.googlecode.com/svn/trunk@554 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-25 18:13:08 +00:00
DrZiplok@gmail.com 4b09c9fade Fell asleep before committing these, oops.
Cut menu entry return type down to int8_t, make menu command checks case-insensitive.

Fixes issue #135

git-svn-id: https://arducopter.googlecode.com/svn/trunk@553 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-25 18:02:41 +00:00
DrZiplok@gmail.com e2184615d9 Change the way pre-prompt printing works to avoid having to deal with "magic" menu entries.
Add a default 'exit' command to back out of a menu.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@546 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-24 07:31:59 +00:00
DrZiplok@gmail.com 064dda10bf Provide an easy way to print stuff before displaying the prompt.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@545 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-24 06:18:59 +00:00
DrZiplok@gmail.com eb6113e685 Add a simple commandline menu library.
The library has an interface suitable for both interactive and automated use (i.e. Arduino console or GCS operation).


git-svn-id: https://arducopter.googlecode.com/svn/trunk@544 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-24 05:50:02 +00:00
DrZiplok@gmail.com dc85377587 Don't count on things including <stdint.h> before AP_Common.h.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@456 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-11 06:15:12 +00:00
DrZiplok@gmail.com 10f3a6f9cb Drop a couple things in here in support of code moving to libraries.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@455 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-11 06:13:28 +00:00