Commit Graph

141 Commits

Author SHA1 Message Date
Nick Exton 741abaf760 AP_Param: Add static assert on NVM struct sizes 2020-03-14 13:47:25 +11:00
Siddharth Purohit 1d2985e967 AP_Param: add method to find key of top level group variable by pointer 2020-02-19 13:59:53 +09:00
Peter Hall 5164eacc4a AP_Param: add get and set functions 2020-02-18 10:18:12 +11:00
Peter Hall 623c1aa3cd AP_Param: add singleton 2020-02-18 10:18:12 +11:00
Peter Hall 1ee14ffa75 AP_Param: use thread safe object buffer 2020-02-12 07:05:05 +11:00
Andrew Tridgell aa3642d9de AP_Param: save 7k flash for HAL_MINIMIZE_FEATURES boards 2020-02-01 06:58:43 +11:00
Michael du Breuil 1f20cc10f8 AP_Param: Fix failing to invalidate the cached parameter count
This would cause a GCS to download fewer then the requested number of
parameters
2020-01-15 14:02:59 +11:00
Andrew Tridgell 7ef86c9bb1 AP_Param: added convert_parameter_width()
this allows for easy conversion of the width of a parameter without
changing indexes
2020-01-14 14:23:11 +11:00
Andrew Tridgell 6573857a90 AP_Param: support @READONLY marker in param files
allows for read-only parameters embedded in firmware
2019-09-12 10:50:30 +10:00
Peter Barker b493805fb4 AP_Param: methods to provide amount of parameter space used
AP_Param: provide method for storage size
2019-08-28 11:51:09 +10:00
Andrew Tridgell f897eae89d AP_Param: enable reduced size support for AP_Periph 2019-08-27 10:29:56 +10:00
Peter Barker 2049e86dda AP_Param: optionally return parameter flags in AP_Param::find(...) 2019-08-22 09:23:56 +10:00
Peter Barker 70daf0010b AP_Param: add param flag bit indicating internal-use-only 2019-08-22 09:23:56 +10:00
Michael du Breuil 40753ab14e AP_Param: Remove non functional AP_Param ignore flags 2019-06-11 10:28:45 +10:00
Randy Mackay 2ccb9061d9 AP_Param: minor format fixes 2018-12-06 12:23:41 +09:00
Randy Mackay 98cd300885 AP_Param: add set_defaults_from_table 2018-12-06 12:23:41 +09:00
Andrew Tridgell 4d662a913a AP_Param: use background parameter save
this moves both the storage scan and the save code out of the main
thread and into the IO thread. It means that if we have more than 30
parameters saves in very rapid succession while armed that we can lose
parameter changes, but that is extremely unlikely.

This fixes an issue where parameter saves in flight can cause
considerable scheduling problems, sometimes several milliseconds
2018-08-16 12:40:10 +10:00
Lucas De Marchi 1a45aa12f5 AP_Param: warn on last pass only about unknown parameters
Do not warn about unknown parameters on the first pass, i.e. when
AP_Param:load_all() is called. This is because we may still not know
about dynamically loaded parameters. When we call the second (last)
time, we expect to already know all possible parameters, so print a
warning to both console and the debug terminal.
2018-06-28 10:18:19 -07:00
Lucas De Marchi 7f0d5ddf21 AP_Param: stop panic()'ing on unknown parameters
Our track record on keeping parameters up to date with master is not
great and panic()'ing when loading them apparently is not helping
because every and each vehicle has a different file.

On aerofc load_defaults_file() is used in the same way as
load_embedded_param_defaults() is in which the panic() behavior has been
previously removed.

This finishes the removal of the panic param and add warnings to the
debug console when reading the parameters (rather than when counting
them).
2018-06-28 10:18:19 -07:00
Andrew Tridgell c6c5603382 AP_Param: added back key dumping code
this is essential for working out conversion tables.
2018-01-24 18:23:59 +11:00
Michael du Breuil a1a5665213 AP_Param: Support marking a param group as ignoring the enable flag 2018-01-17 22:21:55 +00:00
Andrew Tridgell 4ac49483c8 AP_Param: added support for embedded parameters
use a block of flash to hold embedded parameters that can be changed
using apj_tool.py
2017-12-18 11:14:59 +11:00
Jacob Walser d5896287b7 AP_Param: Add set_by_name and set_and_save_by_name helpers 2017-10-25 21:07:09 +11:00
Peter Barker e3599ab4f9 AP_Param: remove CLI 2017-08-14 10:23:50 +09:00
Andrew Tridgell 7e24be95c9 AP_Param: added macro for var table extension in object 2017-05-03 20:12:04 +10:00
Andrew Tridgell 47803e73e4 AP_Param: allow for dynamic var_info tables
this allows the var_info entry in a table to be a constant pointer,
allowing the selection of a type for a parameter class at runtime.
2017-03-25 16:22:10 +11:00
Peter Barker c93942695f AP_Param: load parameters from a comma-separated-list
This patch will break things for anyone who is using
a comma in their filenames for their ardupilot defaults
files.
2017-02-23 22:46:33 -08:00
Peter Barker fe189fefbc AP_Param: Factor load_defaults_file (NFC) 2017-02-23 22:46:33 -08:00
Andrew Tridgell 79b0c856b2 AP_Param: added support for frame specific parameters
this allows for libraries that have parameters that are only activated
on particular frame types
2017-02-14 19:49:29 +11:00
Lucas De Marchi 85eadca7ad AP_Param: shut up float comparison warning
We want to compare the value previously set in memory.
2017-02-06 09:27:22 -08:00
Andrew Tridgell 4687785185 AP_Param: fixed a bug in default file handling
this fixes a bug in how default file values are handled that affects
any common sub-objects. When we had a default value for something like
SERVO12_FUNCTION then configured_in_defaults_file() would return true
for SERVO1_FUNCTION as it shares a common default value pointer

this changes the implementation to use the object pointer instead
2017-01-24 09:50:25 +11:00
Peter Barker a481e52861 AP_Param: make configured() const 2017-01-20 13:02:53 +09:00
Andrew Tridgell d005cbffd8 AP_Param: added convert_parent_class() 2017-01-12 17:39:37 +11:00
Andrew Tridgell 05e9462a9c AP_Param: added CONVERT_FLAG_REVERSE and CONVERT_FLAG_FORCE 2017-01-12 17:39:37 +11:00
Andrew Tridgell 0c32178d07 AP_Param: added reload_defaults_file()
this allows defaults to be set for parameters in pointer objects
2017-01-12 17:39:37 +11:00
Andrew Tridgell 0d6801fbe6 AP_Param: added find_old_parameter() method
allows for custom conversion of parameters
2016-12-31 10:55:59 +09:00
Andrew Tridgell be9ac273ce AP_Param: apply notify check to AP_ParamV too
thanks to Francisco
2016-12-09 14:36:01 -08:00
Andrew Tridgell eaa68f32e3 AP_Param: avoid a notify if value is already correct 2016-12-09 14:36:01 -08:00
Francisco Ferreira a3fcebc501 AP_Param: add set_and_notify to vectors 2016-11-15 11:42:54 -08:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Peter Barker 2bd13af43d AP_Param: unhide groups when generating parameters in autotest 2016-10-26 09:53:14 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Andrew Tridgell 68f0777dac AP_Param: fixed bug with deeply nested parameter trees
enumeration could loop forever if the IDs overlapped due to 8 bit
masking
2016-10-23 15:27:42 +11:00
Lucas De Marchi e6d5bac527 AP_Param: don't used reserved word in macros
`class` is a reserved word and should not be used as macro arguments.
It's very common in C++ to use "clazz" instead in these cases.
2016-10-15 15:19:17 -03:00
Andy Little 0d113b265c Examples: fix examples for px4
The change to use AP_BoardConfig messed up the examples. Here are some
updated but there are plenty more to do.
2016-10-04 12:50:47 -03:00
Francisco Ferreira af6d8e3c36 AP_Param: explicitly cast to float to avoid Clang warning
/home/travis/build/ArduPilot/ardupilot/libraries/AP_Param/AP_Param.h:542:22: warning: using floating point absolute value function 'fabsf' when argument is of integer type [-Wabsolute-value]
        bool force = fabsf(_value - v) < FLT_EPSILON;
2016-04-22 17:33:06 +01:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Andrew Tridgell 86416e8f05 AP_Param: added set_default_by_name() 2016-04-01 16:39:51 +11:00
Andrew Tridgell 0530af93aa AP_Param: allow top level parameters to be pointers
this will allow for the attitude_control variable in quadplane to be a
pointer
2016-04-01 16:16:03 +11:00
Andrew Tridgell 7d92202db9 AP_Param: save flash space for parameter strings
now that we no longer need AVR support we can use nul terminated
strings for parameter names, saving a couple of k of flash space
2016-03-18 13:03:18 +11:00
Andrew Tridgell 018c7425a4 AP_Param: added AP_PARAM_NO_SHIFT
used for cases where we know the shift is not needed
2016-03-18 12:33:16 +11:00
Randy Mackay c15fa950c0 AP_Param: convert_old_parameter becomes public and accepts scaling 2016-03-18 10:04:55 +11:00
Andrew Tridgell 12067b27b3 AP_Param: cope with multi-level nesting and zero-idx
this copes properly with multi-level nesting of groups, and fixes an
issue with an idx of zero in nested groups
2016-03-18 10:04:55 +11:00
Andrew Tridgell ff04871fc5 AP_Param: fixed a reporting problem with AP_Vector3f
if we load an element other than the X element of a Vector3f via
MAVLink then the value reported back to the GCS would be at the wrong
offset in memory. This led to some very confusing results for users
2016-03-16 17:03:30 +11:00
Andrew Tridgell 93f0707679 AP_Param: added count_parameters() API
this auto-clears when an ENABLE parameter changes
2016-01-06 14:44:34 +11:00
Andrew Tridgell 1b8cf84801 AP_Param: allow for up to 512 top level vehicle parameters
this will make life a bit easier for copter
2016-01-04 11:14:43 +11:00
Andrew Tridgell 29cb0dcf2c AP_Param: enable variables to be marked as enable variables
used to hide unused subtrees of variables
2016-01-04 11:14:42 +11:00
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
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
Lucas De Marchi 65e719ccc3 AP_Param: replace find_P() with find() 2015-10-30 14:35:19 +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
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
tcr3dr 41e4c2720d AP_Param: Explicitly casts AP_CLASSTYPE parameter. 2015-07-01 11:32:11 +10:00
Andrew Tridgell fb97c16a84 AP_Param: make data pointer const 2015-05-21 07:48:52 +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
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 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
Andrew Tridgell 688f61c087 AP_Param: expose check_var_info() as a public symbol 2014-01-31 13:07:41 +11: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 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 813e767efb AP_Param: use const refs in a few more places
reduces code size by a couple of hundred bytes
2013-05-02 10:18:36 +10:00
Andrew Tridgell 01a4fabf9e AP_Param: make things a bit more efficient 2013-04-22 12:21:59 +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
Andrew Tridgell fa493a0fb3 AP_Param: added ops needed for ArduCopter build 2013-04-18 11:12:46 +10:00
tobias fbe7daa477 AP_Param: fixed assignment handling and const
this fixes radio_min = radio_max = radio_trim = 0; in RC_Channel
2013-04-18 10:52:40 +10: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 4764a03aaa AP_Param: fixed ARM PX4 build 2013-01-02 14:45:09 +11:00
Andrew Tridgell 3a762f891e AP_Param: fixup for ARM compiler 2013-01-02 14:45:08 +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 c4dbe8c627 AP_Param: move from AP_Common to its own library 2012-12-20 14:51:19 +11:00