Andrew Tridgell
d55a0c3a71
added AP_Param::show_all()
...
this moves the logic into common code
2012-02-13 16:22:52 +11:00
Andrew Tridgell
9175ebe33a
change back to 256 max variables in _var_info[]
...
this keeps the header to 24 bits, and allows the token to be 16
bits. If we need more variables we can put them in a nested group.
2012-02-13 16:22:52 +11:00
Andrew Tridgell
f2a6a31645
AP_Param: added group idx, and change packing of header elements
...
adding a idx element to the GroupInfo will make it less likely that a
developer will change the IDs of group elements, and make it easier to
see that these IDs are important for identifying a variable in EEPROM
The header packing has changed to make it 24 bits on all platforms,
which allows us to lower the EEPROM variable max size to 1024 bytes
again
2012-02-13 16:22:52 +11:00
Andrew Tridgell
678a1df3be
fixed support for AP_PARAM_SPARE
...
spare group elements are needed if we remove a group parameter
2012-02-13 16:22:52 +11:00
Andrew Tridgell
accaf9bb30
fixed build on arduino 1.0
2012-02-13 16:22:52 +11:00
Andrew Tridgell
5418302b38
AP_Param: fixed desktop build
2012-02-13 16:22:51 +11:00
Andrew Tridgell
95e107ab75
AP_Param: added generic cast_to_float
2012-02-13 16:22:51 +11:00
Andrew Tridgell
9509c69f42
AP_Param: disable debug ready for production
2012-02-13 16:22:51 +11:00
Andrew Tridgell
5d03f13aa5
AP_Param: make ptype in first() and next() optional
2012-02-13 16:22:51 +11:00
Andrew Tridgell
e8c4ecf9fa
added nested group support and validation
2012-02-13 16:22:51 +11:00
Andrew Tridgell
94a86204ee
added size of Vector6f
2012-02-13 16:22:51 +11:00
Andrew Tridgell
497a400841
hacks to get AP_Param to compile
2012-02-13 16:22:50 +11:00
Andrew Tridgell
5b842a447f
new AP_Param subsystem
2012-02-13 16:22:50 +11:00
Randy Mackay
ed19c25a97
Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".
...
Modified FastSerial's write function to return size_t (number of bytes written).
2012-01-28 12:25:47 +09:00
Mike Smith
9c5a776456
Teach the Makefile about the new Arduino sourcefile suffix
2012-01-15 11:51:38 -08:00
Jason Short
e2830ca147
fixed type error
2012-01-10 23:43:44 -08:00
Michael Oborne
92886cfa10
make file relax
2011-12-17 20:42:51 +08:00
Michael Oborne
f4b7aea1ee
add relax
2011-12-17 16:53:14 +08:00
Doug Weibel
997ddde7f5
Added back the feature to prompt users when an invalid CLI command is entered.
...
Thanks to Yury Smirnov for this patch!
2011-11-26 21:10:53 -07:00
Andrew Tridgell
0da5125b7f
upload: force hex file format for upload
...
this should fix a problem with hex file format detection on MacOS
2011-11-27 09:36:10 +11:00
Andrew Tridgell
7fa59a6849
AP_Common: added typesafe wrapper for memcpy_P()
2011-11-26 17:17:50 +11:00
Andrew Tridgell
92e0e929a4
AP_Common: replace strlcat_P() with a C implementation
...
the one in the Arduino libc was giving us bogus results on one
machine, and is suspect. We couldn't spot what is wrong in the
assembler, but replacing the implementation with a C one fixes the
bug, so we replaced it
2011-11-26 17:02:56 +11:00
Andrew Tridgell
6e9e857157
make configure default to 2560
...
1280 is less common for devs these days
2011-11-25 20:00:17 -08:00
Pat Hickey
a159669cee
build: added jtag-program make target
...
useful for when you have hosed your USB
2011-11-25 20:00:16 -08:00
James Goppert
7ef8578029
Separated controller block class.
...
Also improved documentation of AP_ControllerBlock.
2011-11-24 13:28:14 -05:00
Wenyao Xie
8017b0415e
Working on new hil message for mavlink.
2011-11-15 17:15:54 -05:00
Andrew Tridgell
b927e64440
desktop: fixed 2 crashes in the menu code
...
handle an empty line gracefully, and use pgm_read_pointer() for
functions pointers in progmem
2011-11-07 22:56:13 +11:00
Andrew Tridgell
d78bbb1a40
added pgm_read_pointer()
...
this will be used by the menu code to make reading pointers from
progmem portable
2011-11-07 22:56:13 +11:00
Andrew Tridgell
251cf7d87c
force LANG=C for MacOS awk
2011-11-07 13:33:38 +11:00
James Goppert
77da85648d
Clean up formatting for AP_Common
2011-10-28 14:43:43 -04:00
James Goppert
32af63f734
Added battery monitoring, arming to apo.
...
Arming added for quadrotor. Need to add to rover still. Battery
monitoring added with auto shut-off in quadrotor controller.
Finally split apo header and source files to allow faster
compiling/ fix cyclic header inclusions.
2011-10-16 02:55:34 -04:00
Andrew Tridgell
bcb8fb1c7f
desktop: silence an implicit cast warning
2011-10-11 20:53:43 +11:00
Andrew Tridgell
0939b51a4c
added build makefiles
2011-10-10 07:18:38 +11:00
Andrew Tridgell
41dd8d60ba
use ifdef for DESKTOP_BUILD
2011-10-09 22:16:14 +11:00
Andrew Tridgell
7098e8cfa1
first rough build for desktop CPUs
...
this allows ArduPlane to build and startup on 'desktop' systems (eg. a
Linux box). Very rough for now, and only for HIL so far
2011-10-09 22:16:13 +11:00
Andrew Tridgell
28ebca1bf6
fixed PROGMEM declaration for desktop build
2011-10-09 22:16:13 +11:00
Andrew Tridgell
bcc2aed8fb
initialise spare bits in AP_Var headers
...
if we ever need these bits, it would be nice to know that they are
zero in existing eeproms
2011-10-09 22:09:00 +11:00
Andrew Tridgell
00d52a8bd7
ap_common: use intptr_t for pointer casts
...
this allows building on systems with pointers that aren't 16 bits long
2011-10-09 22:08:59 +11:00
Amilcar Lucas
45950489d1
More improvements to MS Windows
...
Now the avr-gdb, avrdude and avarice tools do not need to be in the path.
2011-10-03 19:16:55 +02:00
amilcar
7a510084b1
Fix serial port on windows
2011-10-03 12:10:27 +02:00
amilcar
550deffbe8
Make it work on windows "out-of-the-box"
2011-10-03 12:08:19 +02:00
Amilcar Lucas
c37fabea66
Added a comment to the BOARD type of teh make configure output file
2011-10-02 00:04:21 +02:00
Amilcar Lucas
eaaf44e2c8
Fix Arduino version detection on some systems
2011-10-02 00:03:57 +02:00
James Goppert
0c7c508541
Optional recursion added.
2011-09-30 17:17:51 -04:00
James Goppert
9e6b47184a
Arduino version directory updated to lib/version.txt
...
Also updated cmake files.
2011-09-29 22:10:26 -04:00
James Goppert
5489b84f8e
Improvements to cmake.
2011-09-29 21:23:26 -04:00
James Goppert
71fbdf721a
Added APO branch.
2011-09-28 20:51:12 -04:00
Amilcar Lucas
03740469fd
fix quotes and indentation
2011-09-27 04:40:00 +02:00
James Goppert
9c766d6373
Added override for mega upload protocol.
2011-09-26 20:29:09 -04:00
James Goppert
6abb8a0796
Modified Arduino.mk to use correct upload protocol if not overrided.
...
The previous comment of upload protocol not working cannot be verified on
linux. If this problem persists on cygwin, please override with
UPLOAD_PROTOCOL=arduino in the enivornment before calling Arduino.mk
2011-09-22 13:35:26 -04:00
Andrew Tridgell
ba6c58a33c
build: cope with more depths for libraries
...
this finds the libraries at more levels up from the current directory
2011-09-17 14:58:02 +10:00
Janne M
d5e5240e19
Issue #415 : Modified spotlight search string. Added UPLOAD_PROTOCOL parameter to makefile to use different programmer.
2011-09-15 22:38:22 +03:00
Mike Smith
42abbb41fd
Add options to generate assembly listings for all of the compiled
...
files. This is a possible starting point for a tool to analyse the
call graph and stack usage of APM.
It's also interesting by itself.
2011-09-14 22:39:34 -07:00
unknown
a4e001bbcf
Adding CMake support
2011-09-14 15:44:55 +02:00
DrZiplok
c0b4cb661f
GNU sed wants -r, Darwin/BSD sed wants -E.
2011-09-12 18:43:31 +00:00
Mike Smith
c1460add3b
Reinstate a Cygwin workround that was backed out by the previous changes.
...
Not all platforms support (or require) the -r argument to sed.
2011-09-11 22:20:54 -07:00
joeholdsworth@gmail.com
6dbfd78197
updated make file for cygwin compatibility
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3277 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-09-05 17:15:01 +00:00
tridge60@gmail.com
dab8c0cca8
AP_Var: added EEPROM wear levelling
...
This adds a variable length dummy variable at the front of the EEPROM
when we erase it, which has the effect of moving the location of any
hot variables within the EEPROM. This should improve EEPROM
life. Thanks to Mike for the implementation.
Pair-Programmed-With: Mike Smith
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3234 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-09-04 06:39:57 +00:00
tridge60@gmail.com
06c4f60490
AP_Var: avoid wearing out EEPROM by re-writing the same value
...
when saving a variable, this avoids EEPROM wear by checking if the
existing value is already the same as the value being written, and
avoiding the write.
Thanks to Mike Smith for the implementation
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3233 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-09-04 06:39:49 +00:00
tridge60@gmail.com
e099079cc0
AP_Var: fixed a logic bug in APVar::key()
...
We were using && instead of & for a bit check. Thanks to Mike for
spotting this!
Pair-Programmed-With: Mike Smith
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3232 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-09-04 06:39:40 +00:00
tridge60@gmail.com
b8b8b7e8ca
AP_Var: fill all of EEPROM with 0xFF on erase_all()
...
This wipes all parameter values, and also clears out any waypoints as
the waypoint format could have changed between firmware revisions.
This also ensures that the AP_Var code can't re-use any key values
from the old EEPROM state, which makes us less dependent on the old
EEPROM being in a good state
Pair-Programmed-With: Mike Smith
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3231 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-09-04 06:39:28 +00:00
james.goppert
5b3079bcd6
Fixed debug command.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3196 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-30 17:33:51 +00:00
joeholdsworth@gmail.com
1e08040002
update to arduino.mk file to allow easier use with cygwin.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3166 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-23 23:02:39 +00:00
mich146@hotmail.com
88d59ccc2d
perl version of eedump
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3037 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-07 10:36:31 +00:00
tridge60@gmail.com
a9278b6fcd
build: added EXTRAFLAGS to make rules
...
this allows you to create a local makefile like this:
include Makefile
hil:
make -f Makefile EXTRAFLAGS="-DHIL_MODE=HIL_MODE_ATTITUDE -DSERIAL3_BAUD=115200"
and then use 'make hil'
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2843 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-13 09:07:09 +00:00
DrZiplok
cd864714ea
Add a simple tool for dumping AP_Var data from an EEPROM dump.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2676 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-25 07:56:38 +00:00
james.goppert
56483bc322
Added debug/ upload targets to Arduino.mk
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2656 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-23 21:36:20 +00:00
james.goppert
a3950ca63e
Added config.mk file inclusion for global configurations settings on make based builds. See ArduPilotOne for scripts/configure to see an example. config.mk should be located in the temporary directory where the rest of the build results are placed.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2655 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-23 19:01:06 +00:00
DrZiplok
582cc1e229
Enable map file generation.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2636 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-22 05:54:55 +00:00
tridge60@gmail.com
ea728060f3
disable the re-ordered initialisation warnings
...
these are not useful for us, and will always happen with our parameter
code
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2561 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-15 12:25:10 +00:00
tridge60@gmail.com
9cb9a54d64
fixed a warning in AP_Var.h
...
index is in system headers as a string function
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2558 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-15 12:24:40 +00:00
james.goppert
7809b0ca2a
Massive warning fixes.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2089 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-04 19:12:27 +00:00
DrZiplok
4f7402eee9
Suppress warnings from the Arduino core, since we can't do anything about them.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2076 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-03 05:04:27 +00:00
DrZiplok
f5ba77f23b
Rename some ctor arguments to suppress shadow-related warnings.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2071 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-02 05:55:34 +00:00
tridge60@gmail.com
fe648644ce
added a few more warning flags for when building with the Makefile
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2070 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-02 05:50:13 +00:00
james.goppert
5a273e52d2
Added const AP_Var access.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1958 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-01 19:29:33 +00:00
jasonshort
e6d86e7efa
removed yaw towards WP option. Should now be handled with a mission script.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1954 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-01 04:55:07 +00:00
jasonshort
e74dabca33
Added more wp options
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1884 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-04-16 04:49:46 +00:00
DrZiplok
0a00e4ff21
Print the key associated with a variable when the variable is printed using AP_Var_menu_show.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1812 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-25 02:51:03 +00:00
DrZiplok
76a5a48206
Add an interface for locating a variable by key.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1811 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-25 02:46:45 +00:00
deweibel@gmail.com
596b33a08b
Change waypoint/command storage to include options byte.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1809 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-23 03:29:46 +00:00
tridge60@gmail.com
a633617eef
added -Wformat in Arduino.mk
...
when building with 'make' we get warnings related to printf() format
strings
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1798 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-21 07:26:03 +00:00
tridge60@gmail.com
860998d337
implemented typesafe PSTR()
...
This makes PSTR() type safe by using a 1 byte wrapper
structure. Attempts to use the wrong varient of a print function will
generate a compilation error.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1797 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-21 07:25:48 +00:00
jasonshort
bb715378a1
removed options - not going to go that route without proper GCS support.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1760 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-09 06:38:46 +00:00
jasonshort
852b3874d5
Added Options Bitmask to Location Struct
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1741 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-05 04:39:23 +00:00
DrZiplok@gmail.com
86ca9562b5
Fix ::set_and_save to return the result of the ::save call.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1707 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-21 05:12:58 +00:00
DrZiplok@gmail.com
5fe288dd43
Fix the return value from ::save() on AP_Var_groups so that the caller can verify that a save was successful.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1706 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-21 05:11:02 +00:00
DrZiplok@gmail.com
e85b2d3c17
Increase the maximum save size to 64B, so that a Vector3f can be saved.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1704 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-21 04:42:28 +00:00
DrZiplok@gmail.com
72e112e8c0
Fix AP_Var::load - it has to ask the serialiser, not the unserialiser, for the variable's size.
...
Fix AP_Float16 - scaling was being done in the wrong direction, and the unserialiser wasn't reporting errors.
Add test cases for the above.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1696 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-20 00:38:09 +00:00
DrZiplok@gmail.com
bffe20ed5e
Add a little code to track the amount of memory used by AP_Var subclasses.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1661 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-16 07:01:17 +00:00
DrZiplok@gmail.com
e2d4c9e901
Use a more explicit loop termination condition.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1657 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 17:49:02 +00:00
DrZiplok@gmail.com
fabcfd942b
Don't return a name for a variable if it has no name, even if it's in a group that does have a name.
...
When displaying variables, don't display variables with no name, or that are groups.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1656 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 17:44:33 +00:00
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
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
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
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@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
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
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
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
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
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
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@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