Commit Graph

109 Commits

Author SHA1 Message Date
Andrew Tridgell 37b2e23322 AP_Param: allow objects containing parameters to be dynamically loaded
this makes it possible for objects containing parameters to be
dynamically loaded.
2016-01-04 11:14:42 +11:00
Andrew Tridgell 8e4586b4a2 AP_Param: allow for nested groups without subclassing
this allows for param tables containing other unrelated objects
2015-12-31 15:30:31 +09:00
Lucas De Marchi 52ef8c10a5 AP_Param: stop using Progmem.h 2015-12-27 15:58:12 -02:00
Jonathan Challinger bde9a9421d AP_Param: panic on failure to load defaults file 2015-12-24 14:40:00 +11:00
Andrew Tridgell e873ff1e5f AP_Param: copter with vectors when sending parameters 2015-11-09 14:28:20 +11:00
Peter Barker 5f9b1c5f4e AP_Param: provide facility to notify GCS of param set 2015-11-09 09:23:20 +11:00
Peter Barker 046b008889 AP_Param: send saved param values to all GCS 2015-11-09 09:23:20 +11:00
Lucas De Marchi 68bef1ec64 AP_Param: fix wrong printf format for printf
"%S" is used for wide string, but we are passing a char*. Use lowercase
in this case to remove warnings like this:

libraries/AP_InertialSensor/AP_InertialSensor.cpp: In member function
'bool AP_InertialSensor::calibrate_accel(AP_InertialSensor_UserInteract*, float&, float&)':
libraries/AP_InertialSensor/AP_InertialSensor.cpp:620:61: warning:
format '%S' expects argument of type 'wchar_t*', but argument 3 has type 'const char*' [-Wformat=]
                 "Place vehicle %S and press any key.\n", msg);
                                                             ^
2015-10-30 14:35:45 +09:00
Lucas De Marchi 5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +09:00
Lucas De Marchi 1b07dabeb7 Replace prog_char and prog_char_t with char
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.

AVR-specific places were not changed.
2015-10-30 14:35:30 +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 6f4904189b Replace use of println_P() with println() 2015-10-30 14:35:22 +09:00
Lucas De Marchi 65e719ccc3 AP_Param: replace find_P() with find() 2015-10-30 14:35:19 +09:00
Lucas De Marchi d595e41003 Replace use of strncmp_P() with strncmp() 2015-10-30 14:35:14 +09:00
Lucas De Marchi 0aa117f65d Replace use of strnlen_P() with strnlen() 2015-10-30 14:35:13 +09:00
Lucas De Marchi 1336d621be Replace use of strcpy_P() with strcpy() 2015-10-30 14:35:12 +09:00
Lucas De Marchi f8f3f5a024 Replace use of strlen_P() with strlen() 2015-10-30 14:35:10 +09:00
Lucas De Marchi 6f0db45b57 Replace use of strcasecmp_P() with strcasecmp() 2015-10-30 14:35:08 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Jonathan Challinger 39246c13ad AP_Param: add set_default, configured 2015-10-26 11:15:54 +11:00
Grant Morphett ab35ac41a5 AP_Param: Add parameter to print out all the keys/indexes
For some debugging I was working on I needed to see all the token
indexs and group elements.
2015-09-02 11:12:31 +10:00
Lucas De Marchi fa060a6124 AP_Param: add missing header StorageManager.h 2015-08-18 17:19:14 +10:00
Gustavo Jose de Sousa 159c5b8b44 AP_Param: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:38:22 +10:00
Andrew Tridgell 269f1fd99a AP_Param: replaced set_param_by_name with set_float
read for bugfix in GCS_MAVLink
2015-08-10 17:25:29 +10:00
Andrew Tridgell 8454246fae AP_Param: make it safe to change the type of a parameter
if the type is changed then the value will revert to its default value
2015-05-27 15:29:40 +10:00
Andrew Tridgell 88fb7ddff8 AP_Param: fixed PSTR() usage 2015-05-05 13:54:15 +10:00
Andrew Tridgell bcc6c7d380 AP_Param: revert AP_Math class change 2015-05-05 13:27:07 +10:00
Tom Pittenger bfd1b2b11a AP_Param: compile warnings: format not a string literal, argument types not checked 2015-05-05 13:27:01 +10:00
Tom Pittenger b9771ca37c AP_Param: compile warnings: float to double. print statements require doubles 2015-05-05 13:27:00 +10:00
Tom Pittenger 440438fdda AP_Param: compiler warnings: apply is_zero(float) or is_equal(float)
due to an include cross-dependency between ap_param and ap_math, I punted and reimplemented is_equal() for this one function in the header
2015-05-05 13:26:58 +10:00
Tom Pittenger 66ddfdeae6 AP_Param: fix compile warnings re float constants 2015-04-24 14:04:04 +09:00
Andrew Tridgell 5a755c0400 AP_Param: allow a HAL_PARAM_DEFAULTS_PATH to override defaults
this allows a HAL_PARAM_DEFAULTS_PATH to be specified for a build to
override the default parameters for a build. This is useful to build a
firmware that has different default parameters
2015-04-04 09:01:40 -07:00
Andrew Tridgell 5ca38e3d75 AP_Param: added set_param_by_name()
this simplifies the GCS_MAVLink code
2015-04-04 09:01:39 -07:00
Andrew Tridgell fb5e53e1e4 AP_Param: cope with older gcc versions
Travis-CI uses 4.6.3
2015-01-01 18:55:11 +11:00
Andrew Tridgell 9ae0dd05f8 AP_Param: avoid build warning due to %S format 2015-01-01 18:25:05 +11:00
Andrew Tridgell ec17c5806e AP_Param: check parameter tables for bad suffix lengths 2014-11-10 08:09:08 +11:00
Andrew Tridgell f133f45c3c AP_Param: convert to using StorageManager 2014-08-13 18:46:43 +10:00
Andrew Tridgell 3474da6c97 AP_Param: added a method for example programs to set parameters in objects 2014-07-21 09:37:41 +10:00
Mike McCauley 2e061fc507 AP_Param: Fix compiler warning on Flymaple 2013-09-23 18:10:21 +10:00
Andrew Tridgell 16a7faa223 AP_Param: use %f not %.6f for param show 2013-09-21 15:45:19 +10:00
Randy Mackay 3f84e0adf6 AP_Param: explicitly print floats to 6 dec places
C++ default is to print 6 decimal places but nuttx displays none by
default
2013-09-20 22:12:33 +09: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 7fa1fe8590 AP_Param: use 0xFFFF not __UINT16_MAX__
MacOS doesn't have __UINT16_MAX__
2013-07-09 20:51:06 +10:00
Tobias 4a75351bd3 AP_Param: fixed a compiler warning with -Wsign-conversion 2013-07-08 14:57:33 +10:00
Tobias 27a5c28851 AP_Param: fixed some compiler warnings
* added comment
* replaced "~0" with the appropriate macro
* resolved -Wconversion
* saved some space by modifying AP_Param::add_vector_suffix (writing
behind buffer could happen, if buffer_size is almost uint16_max but this
can surely be ignored)

further reading:
http://stackoverflow.com/questions/809227/is-it-safe-to-use-1-to-set-all-bits-to-true
2013-07-08 14:57:33 +10:00
Andrew Tridgell f44f7308e8 AP_Param: we don't need to avoid writes in AP_Param now
now handled in the HAL
2013-06-04 14:02:49 +10:00
Andrew Tridgell 26b7de668a AP_Param: fixed parameter save bug
This bug affected parameters where the defaults are overridden in the
object constructor. For example, a PID object may have a default value
for PID_D of 0.0, but have a constructor based default of 0.2. If the
user tries to set the value to exactly 0.0, then the set wouldn't happen,
as the value matches the value in the object default var_info[]
table. 

This change ensures we force a save to eeprom if the value is changing
from the current value, regardless of the var_info[] default.

Thanks to Tom Coyle for finding this bug!
2013-06-02 14:49:34 +10:00
Andrew Tridgell ad2f6e1217 AP_Param: add support for converting between old and new parameters
this allows for a conversion table between old parameters and new
parameters, making firmware upgrades with moved parameters much easier
for users
2013-05-31 07:58:29 +10:00
Andrew Tridgell 9171d5587d AP_Param: make it easier to show the value of a parameter 2013-04-20 13:52:36 +10:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell 7be1335b3a AP_Param: removed copy_name() and add token to find_by_index()
this allows callers to avoid another var_info traverse
2013-01-09 13:30:51 +11:00
Andrew Tridgell c8ae665ac3 AP_Param: added copy_name_token()
this avoids an expensive var_info traversal on every copy_name call
2013-01-08 14:37:39 -08:00
Andrew Tridgell 3a762f891e AP_Param: fixup for ARM compiler 2013-01-02 14:45:08 +11:00
Andrew Tridgell ceb3f577d8 libraries: use new math functions 2012-12-20 14:53:22 +11:00
Andrew Tridgell af12c18dea AP_Param: setup var_info and num_vars earlier
needed for AP_HAL startup
2012-12-20 14:52:29 +11:00
Andrew Tridgell 95d4cc2ce9 AP_Param: change method of loading defaults
this avoids a dependency on the constructor ordering by loading
defaults for each object separately
2012-12-20 14:51:38 +11:00
Pat Hickey ec53515648 AP_Param: eeprom translated to use AP_HAL. No unit tests available! 2012-12-20 14:51:29 +11:00
Pat Hickey f2b21ecc41 AP_Param: Port to work with AP_HAL class instead of FastSerial 2012-12-20 14:51:24 +11:00
Pat Hickey c4dbe8c627 AP_Param: move from AP_Common to its own library 2012-12-20 14:51:19 +11:00