mengchaoheng
5f83c186ee
Checks for identical parameter changes
2026-01-09 08:53:09 +01:00
Jukka Laitinen
f583406558
src/lib/parameters/parameters.cpp: Remove conversion of unaligned pointers
...
Parameter "void *val" passed to the functions in parameters.cpp are not always
4-byte aligned, so on some platforms direct casting to "int32_t *" or "float *"
leads to an unaligned exception. An example of such user is Logger, which directly packs
parameter values to character buffer.
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-03-11 07:50:47 +01:00
Eric Katzfey
f4ebfa6130
parameters: support for an optional remote parameter database ( #22836 )
...
The voxl2 has a split architecture. PX4 runs on a posix platform and a Qurt platform. The two communicate uorb topics back and forth with the muorb module. But each has it's own parameters database and they need to stay in sync with each other. This PR adds support to keep the 2 parameter databases in sync. The main parameters database running on Linux has file system support while the Qurt one does not. The Linux side is considered the primary and the Qurt side is considered the remote.
2024-03-11 13:52:22 -04:00
Silvan Fuhrer
584d8abe1e
params: change return type of param_modify_on_import to enum
...
Return early in param_import_callback() with 1 if we do a param_set in the param translation.
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-02-07 08:08:37 +01:00
Thomas Debrunner
fd267fb9a5
param save: Add a blocking API for param saves to be used from shell.
2023-06-21 08:19:52 +02:00
Beat Küng
db18a94382
refactor param: reduce flash usage
...
Reduces usage by ~1.5KB
2023-05-31 07:45:20 +02:00
Beat Küng
1bfca24fa9
refactor param: move autosave to px4::wq_configurations::lp_default work queue
...
Changes initialization order as param_init now depends on wq manager
2023-05-31 07:45:20 +02:00
Thomas Debrunner
f0dd9fa445
param: Add contained-params-bitset export interface to the param layers
...
Allows for efficient looping over the contained data
2023-05-31 07:45:20 +02:00
Thomas Debrunner
bc872822bc
params: Overhaul param system to use a layered approach without locking
...
- Instead we disable interrups on Nuttx where needed
- No lock is held during param export. Params can be changed
concurrently and we rely on the fact that another export will be
triggered in that case.
2023-05-31 07:45:20 +02:00
Daniel Agar
f2cd7667dc
systemcmds/bsondump: new command line utility (extracted from parameters)
2022-12-21 10:14:00 -05:00
Daniel Agar
3f3a5f19f0
parameters: open export files O_TRUNC to discard previous data
...
- rcS parameter backup try to directly restore param (FRAM) from backup (in case SD card is removed before successful export)
- rcS parameter backup logging rearrange to capture more logging output (param_import_fail.txt)
- posix rcS try to keep param backup and restore roughly in sync with NuttX rcS
- tinybson fix debug printf format
- param_export_internal ensure file descriptor positioned at 0 (precaution)
2022-09-09 16:20:16 -04:00
Jukka Laitinen
0d31aadcc3
src/lib/paramters: Add a new interface library for protected build user side
...
Implement an interface for protected build to access parameters.
The implementation only does IOCTL calls to the kernel, where the parameters
live.
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-03-15 07:52:26 +01:00
Jukka Laitinen
41a7ae3db2
src/lib/parameters: Refactor common functions to an own file
...
Put all functions which are commont to flat build and protected kernel and
userspace to an own source file
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-03-15 07:52:26 +01:00
Daniel Agar
ece09064c4
parameters: perform verification pass twice
...
- on NuttX with MTD storage this is to ensure we are verifying what's
actually stored on ramtron or eeprom, not just what's cached by bchlib
2022-01-18 09:47:28 -05:00
Daniel Agar
673d4544d1
parameters: verify param backup after export
2022-01-02 10:46:34 -05:00
Daniel Agar
80ef6e19df
tinybson: explicitly append int32 or int64
2022-01-02 10:46:34 -05:00
Daniel Agar
9cbb5c9920
parameters: fix export shutdown locking
...
- in NuttX bchlib keeps a sector sized buffer that might not be written
out to RAMTRON until the file is closed
2022-01-02 10:46:34 -05:00
Daniel Agar
1b6700592b
parameters: require valid BSON document size
2021-12-30 16:36:23 -05:00
Daniel Agar
236794235a
parameters: export empty BSON document even if there are no parameters to save
...
- otherwise a 'param reset_all' won't be saved until a parameter is changed
2021-12-27 09:17:00 -05:00
Daniel Agar
33d7b42040
parameters: import quietly retry if there's no data (as a precuation)
2021-12-27 09:17:00 -05:00
Daniel Agar
20d3e6f4e1
parameters: add simple BSON verification pass after export
2021-12-27 09:17:00 -05:00
Daniel Agar
3f3836afa8
parameters: simplify import mark_unsaved and don't fail bson decode unnecessarily
2021-12-24 14:32:40 -05:00
Daniel Agar
d1cd4904dc
parameters: param_value_is_default avoid locking if value unchanged
2021-12-24 14:32:40 -05:00
Daniel Agar
c0b8f2952c
parameters: param_get_default_value avoid locking if value is static default
2021-12-24 14:32:40 -05:00
Daniel Agar
27a113ecab
parameters: param_get avoid locking if value is static default
2021-12-24 14:32:40 -05:00
Daniel Agar
cd8ce4d01e
parameters: remove obsolete perf_end
2021-12-24 14:32:40 -05:00
Daniel Agar
38731662c6
parameters use bitset for mark_unsaved
2021-12-24 14:32:40 -05:00
Daniel Agar
1f6acd0171
parameters: add simple backup and restore mechanism
2021-12-06 09:37:08 -05:00
Daniel Agar
674b92df18
parameters: sleep 10 ms before retrying a failed import/export
2021-12-06 09:37:08 -05:00
Daniel Agar
7bfebf5289
parameters: add param dump to read and decode bson to console
2021-12-06 09:37:08 -05:00
Daniel Agar
7560d45c61
parameters: import tolerate unhanlded BSON types
2021-12-06 09:37:08 -05:00
Daniel Agar
1af068179e
parameters: tinybson print errors and count imported types
2021-12-06 09:37:08 -05:00
Jukka Laitinen
351f679c2f
parameters: Use px4::atomic_bool instead of px4::atomic<bool>
...
This enables us to define the actual atomic bool type in px4_platform
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-10-13 15:01:26 -04:00
Beat Küng
540c024cbb
parameters: avoid printing errors for erased flash devices
...
Errors:
ERROR [parameters] param import failed (-1) attempt 1, retrying
ERROR [parameters] param import failed (-1) attempt 2, retrying
ERROR [parameters] param import failed (-1) attempt 3, retrying
ERROR [parameters] param import failed (-1) attempt 4, retrying
ERROR [param] importing from '/fs/mtd_caldata' failed (-1)
2021-10-04 10:25:32 -04:00
Daniel Agar
99d7cf4255
parameters: only warn on invalid parameter import
2021-09-01 15:16:00 -04:00
Daniel Agar
65745a3676
purge broken qurt support and atlflight boards
2021-07-16 08:53:36 -04:00
David Sidrane
f50b238c78
lib/parameters:Use inttypes
2021-06-16 17:07:47 +02:00
Daniel Agar
e78a4287f9
parameters: attempt import multiple times
2021-05-02 13:48:16 -04:00
Daniel Agar
c266c3e43a
parameters: remove unnecessary param_get_system_default_value() locking
2021-04-26 09:49:15 +02:00
Beat Küng
1730cd1971
param: avoid warning for 'param show -c' or 'param show -a'
2021-04-23 16:44:55 -04:00
Daniel Agar
f44f497e3f
parameters: better handle export failures and retry
2021-04-12 21:26:50 -04:00
Daniel Agar
edc445a1b2
parameters: tinybson fill total document length for bson compatibility
2021-04-12 21:26:50 -04:00
Beat Küng
b512a3d8f7
param: add param_get_system_default_value
2021-03-12 13:44:10 +01:00
Daniel Agar
7d78cf8505
parameters: param_value_is_default() add note about params_changed bitset usage
2021-03-11 11:30:43 -05:00
Daniel Agar
a991e78e18
parameters: fix runtime default edge case
2021-03-11 11:30:43 -05:00
Daniel Agar
684424bf73
parameters: delete unused BSON_BINDATA handling
2021-03-09 19:29:42 -05:00
Daniel Agar
711a69854b
uthash: move remaining utarray usage to parameters and delete unused
...
- this is to discourage further use until utarray can be dropped entirely
2021-02-20 11:28:22 +01:00
Daniel Agar
ce64951578
parameter_update.msg: add basic status info
2021-02-12 08:27:47 -05:00
Daniel Agar
b8b13bb882
parameters runtime defaults
2021-02-12 08:27:47 -05:00
Daniel Agar
da1a38b44e
parameters: merge generated files ito single static constexpr header
...
- store parameter type and if volatile separately (saves kilobytes of flash)
- use Bitset for tracking active and changed parameters
- use atomic for autosave_enabled flag
- compile at ${MAX_CUSTOM_OPT_LEVEL} (-O2 on non flash constrained boards)
2021-02-12 08:27:47 -05:00