Commit Graph

139 Commits

Author SHA1 Message Date
Tom Pittenger 41746733fe AP_Common: remove crazy #define float double
- not creating a warning buuuuuut this is just sooooo bad that it must be nuked on the spot
2015-12-07 15:50:07 +09:00
Lucas De Marchi d19c5035b6 Global: Rename printf format attribute
As commented in 8218140 ("AP_Common: add scanf format macro"), "FORMAT"
was a bad name for this macro since there's also the scanf. Rename to
FMT_PRINTF to follow the scanf name.
2015-12-01 07:22:12 +11:00
Andrew Tridgell 8739c55d27 AP_Common: added ID for FMUv4 2015-11-27 18:54:30 +11:00
Andrew Tridgell 090c02e6bd AP_Common: rename is_bounded() to is_bounded_int32() and make inclusive
we will probably want float versions in future, and inclusive is
better for the RC_Channel case
2015-11-11 13:45:05 +11:00
Grant Morphett ba8dbf6696 AP_Common: Added a new is_bounded global function. 2015-11-11 13:39:39 +11:00
Lucas De Marchi 821814007e AP_Common: add scanf format macro
Add a macro to annotate functions that act like scanf.  Calling the
printf format macro as FORMAT was bad as can be seen now. Later we need
to rename it to FMT_PRINTF.
2015-11-10 17:05:34 +11:00
Lucas De Marchi b734777b95 AP_Common: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:11 +11:00
Lucas De Marchi 9203e2b929 AP_Common: remove PSTR definition 2015-10-30 14:35:48 +09:00
Lucas De Marchi 20c6ffc5e3 Replace use of UARTDriver::printf_P() with UARTDriver::printf()
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi dc95145de2 AP_Common: add attribute to sanitize prinf-like functions
Make the compiler emit warnings if the variables don't match the
printf format string. To be added in functions with printf-like
arguments.
2015-10-24 14:26:36 +11:00
Randy Mackay acd8252e4b Common: add location alt max definition 2015-10-19 16:15:05 +09:00
Lucas De Marchi 7ba6f92eb5 AP_Common: give some type safety to ARRAY_SIZE macro
Now that most places in the code use the ARRAY_SIZE macro instead of
coding it by hand, let's use some type safety in its definition. This is
a C++ version of similar macros used in kmod, Linux kernel and the
source of them, ccan.

A C++ version like this is used in V8 (the JS engine) and other open
source projects.

The main benefit of this version is that you get a compile error if you
pass in a variable that's not an array. For example,

     Bla y[10];
     Bla *y_ptr = y;

     void foo(Bla x[])
     {
         // build error since x[] decay to a pointer in function
         // parameter
         for (int i = 0; i < ARRAY_SIZE(x); i++) {
             ...
         }

         // build error since y_ptr is not an array
	 for (int i = 0; i < ARRAY_SIZE(y_ptr); i++) {
             ...
	 }
     }

I added the additional specialization to allow arrays of size 0.
2015-09-28 18:20:14 +10:00
Lucas De Marchi 82314ee4a3 AP_Common: add helper macro ARRAY_SIZE 2015-07-06 10:07:21 +10:00
Andrew Tridgell a1a3212131 AP_Common: moved NOINLINE define to AP_Common.h 2015-05-21 09:35:26 +10:00
Andrew Tridgell a53395cdb8 AP_Common: added HomeState enum from copter 2015-02-21 10:13:17 +11:00
Andrew Tridgell 26ac29840c AP_Common: added UNUSED_FUNCTION macro
useful for functions that are only in some builds
2015-02-18 11:12:43 +11:00
Grant Morphett 0b4ac5d256 AP_Common: Changes to fix the warnings in rover sitl build.
We are starting the process of resolving all the warnings in the
ardupilot builds of all vehicles and platforms.
2015-02-11 18:16:45 +11:00
Andrew Tridgell 5980ff8e1c AP_Common: removed map_baudrate()
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2015-01-29 15:47:48 +11:00
Andrew Tridgell 37dea4e367 AP_Common: added MPU9250 product ID 2014-10-24 12:10:39 +11:00
Andrew Tridgell 8a48f06d18 AP_Common: added terrain_alt flag to Location
signifies that the altitude is a above terrain altitude
2014-07-24 21:50:19 +10:00
Victor Mayoral Vilches 1445781104 AP_Common: added fire cape product ID 2014-07-14 08:16:29 +10:00
Randy Mackay b79f729540 AP_Common: add LOWBYTE, HIGHBYTE macros 2014-06-17 20:53:47 +10:00
Randy Mackay fa16e0967f AP_Common: remove unused location mask definitions 2014-06-17 20:53:45 +10:00
Andrew Tridgell 42c1501563 AP_Common: moved map_baudrate() into AP_Common
this version supports a much wider range of baudrates
2014-05-21 12:45:25 +10:00
Randy Mackay e3ffd5c0dd Common: remove RallyLocation defintion 2014-04-19 15:00:28 +09:00
Emile Castelnuovo 7b5c002d2f AP_Common: new board ID for VRBRAIN 2014-04-08 16:19:19 +10:00
Andrew Tridgell 959cafef8d AP_Common: make alt in Location 24 bit
this allows for up to 83km mission altitudes, while allowing for 1
more byte in the command structure, making p1 16 bits
2014-03-20 16:57:09 +11:00
Randy Mackay 865a4de33d Common: use PACKED instead of pragma pack for Location 2014-03-19 12:12:49 +09:00
Randy Mackay af186fba05 AP_Common: pack Location structure
This resolves issues storing and retrieving Location to eeprom as part
of AP_Mission
2014-03-19 12:11:13 +09:00
Randy Mackay 87126c9b71 Common: remove id and p1 from Location structure
id and p1 are now part of AP_Mission's Mission_Command structure
2014-03-19 12:10:46 +09:00
Randy Mackay 9ef27955b5 Common: add location options masks 2014-03-19 12:10:20 +09:00
Andrew Tridgell 77e8061170 AP_Common: added product ID for L3G4200D 2013-10-08 11:50:53 +11:00
Andrew Tridgell 86b58314c4 AP_Common: pack the RallyLocation structure
so it can be written as a single binary block
2013-10-03 12:21:08 +10:00
Michael Day 823a40c203 AP_Common: Added RallyLocation struct. 2013-10-03 12:21:08 +10:00
Andrew Tridgell f1e120113c AP_Common: added OPTIMIZE() macro
this can be used to change the compiler optimization level of
individual functions

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-10-03 12:21:07 +10:00
Andrew Tridgell c1d56f74b5 AP_Common: change flymaple product ID to 0x100
keep it well away from the Invensense product IDs for the MPU6000
2013-09-24 13:51:28 +10:00
Mike McCauley 8f61a36e58 AP_Common: Flymaple compatibility 2013-09-24 13:33:25 +10:00
Andrew Tridgell 8b80beadc4 PX4: make FMUv2 identify itself differently
so we can tell which is which in logs
2013-09-09 18:04:40 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell 62b9a580e8 AP_Common: make PACKED depend on architecture
this will remove lots of warnings when building with arduino
2013-05-09 20:10:31 +10:00
Andrew Tridgell 3659b532be AP_Common: added BIT_IS_SET() macro
makes bit mask testing safer on PX4

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-04-23 23:05:02 +10:00
Andrew Tridgell 4fe5ce8a09 AP_Common: added a define for PACKED
neater than a pragma
2013-04-20 13:52:36 +10:00
Jochen Tuchbreiter c5f19f5df8 Plane: Implement issue 80: counterclockwise loiter
- libraries/AP_Common/AP_Common.h: Use bit 2 of Location.options to store
  loiter direction
- ArduPlane/defines.h: New bitmask MASK_OPTIONS_LOITER_DIRECTION for struct
  Location bit 2
- ArduPlane/ArduPlane.pde: New variable loiter_direction
- ArduPlane/GCS_Mavlink.pde: For mavlink loiter-commands use sign of param3 to
  detemine direction. Set Location.option flag accordingly
- ArduPlane/commands.pde: Make sure loiter-directions get saved into EEPROM
  correctly
- ArduPlane/commands_logic.pde: Set loiter_direction on all loiter-actions
  as well as RTL/instant loiter
- ArduPlane/navigation.pde: Yield loiter_direction in update_loiter
2013-02-05 10:29:31 +11:00
Andrew Tridgell cf5d102912 AP_Common: added board ID for PX4 2013-01-04 14:26:28 +11:00
Andrew Tridgell 456e8bfb6e AP_Common: include stdlib.h for abs() 2013-01-02 14:45:09 +11:00
Andrew Tridgell ac8fcd5b23 AP_Common: include stdbool.h for ARM 2013-01-02 14:45:09 +11:00
Andrew Tridgell 3c0440b0b4 Math: use common degrees() and radians() functions 2012-12-20 14:53:22 +11:00
Pat Hickey 5c738810e2 AP_Progmem created: progmem macros per specific platform
* derived from AP_Common
2012-12-20 14:51:28 +11:00
Pat Hickey 0d342a3293 AP_Common: use EXCLUDECORE macro to hack some debug messages away 2012-12-20 14:51:19 +11:00
Pat Hickey 3f1d9d7f69 AP_Param: #include <AP_Param.h> fixups for libraries & sketches
* I mostly went through with grep and added an #include <AP_Param.h> below
  every #include <AP_Common.h>. Not all of these example sketches might
  strictly need AP_Param.
2012-12-20 14:51:19 +11:00
Pat Hickey 1bf21aae20 AP_Menu: create new library with menu from AP_Common 2012-10-18 20:50:16 -07:00
Pat Hickey 76e93e9fd7 AP_Common: PSTR def has specific version for avr-gcc 4.6 compatibility
* Also a small change in FastSerial/vprintf.cpp, which duplicates the
  PSTR definition
* Won't effect others using earlier versions of avr-gcc
2012-10-15 20:42:18 -07:00
uncrustify 6bb8e4e8ac uncrustify libraries/AP_Common/AP_Common.h 2012-08-21 19:01:02 -07:00
Andrew Tridgell 9d221b3625 AP_Common: fixed some duplicate product ID warnings 2012-05-17 23:37:32 +10:00
Craig Elder 69bf5700cd IMU: expose IMU_PRODUCT_ID as EEPROM Variable
this will allow us to log the Product ID in tlogs
2012-05-09 18:30:36 -07:00
Craig Elder 4c46955612 PRODUCT: Define product IDs for all supported products 2012-05-09 18:30:36 -07:00
Andrew Tridgell 601a991a46 added SITL_debug() macro
this can be used to print a message into the logs in the SITL
simulator. This will be used for critical conditions.
2012-02-15 08:50:45 +11:00
Andrew Tridgell 74bbc72b11 move AP_Var code and example into libraries/AP_Var
you can use AP_Var by defining USE_AP_VAR
2012-02-13 16:22:53 +11:00
Andrew Tridgell 497a400841 hacks to get AP_Param to compile 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
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 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
James Goppert 77da85648d Clean up formatting for AP_Common 2011-10-28 14:43:43 -04:00
Andrew Tridgell 41dd8d60ba use ifdef for DESKTOP_BUILD 2011-10-09 22:16:14 +11:00
Andrew Tridgell 28ebca1bf6 fixed PROGMEM declaration for desktop build 2011-10-09 22:16:13 +11: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
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
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 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 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 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 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 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
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 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
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 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