![]() |
SatNOGS-COMMS
4.1.0
A COMMS subsystem for CubeSats
|
Store and retrieve reliably persistent settings. More...
#include <settings.hpp>
Classes | |
| struct | agc1 |
| struct | fsk |
| struct | basic_param_info |
| Extensible parameter descriptor. More... | |
| struct | is_param_info |
| struct | is_param_info< basic_param_info< Types... > > |
Public Member Functions | |
| settings (settings const &)=delete | |
| void | operator= (settings const &)=delete |
| void | incr_boot_cnt () |
| Increments the current boot count and stores it at the persistent storage. | |
| bool | deployed () |
| Retrieves the information regarding if this is the first time that the system deploys. | |
| void | get_tx_conf (lib::radio::interface iface, lib::radio::tx_conf &cnf) |
| Retrieve the TX configuration parameters for a specific interface. | |
| void | get_rx_conf (lib::radio::interface iface, lib::radio::rx_conf &cnf) |
| Retrieve the TX configuration parameters for a specific interface. | |
| lib::radio::clk_src | radio_clk_src () |
| Returns the current radio clock source. | |
| template<const auto Key, const auto & Map, auto & RuntimeMap, typename T, typename = std::enable_if_t<!std::is_same_v<decltype(Key), param>, void>> | |
| void | set (T x) |
| Sets a mission-defined setting in RAM shadow table. | |
| template<const auto Key, typename T, typename = std::enable_if_t<std::is_same_v<decltype(Key), param>, void>> | |
| void | set (T x) |
| Sets a specific core setting in RAM shadow table. | |
| template<const auto Key, const auto & Map, auto & RuntimeMap> | |
| void | reset () |
| Reset a mission specific setting in RAM shadow table. | |
| template<param P> | |
| void | reset () |
| Reset a specific core setting in RAM shadow table. | |
| template<param P> | |
| auto | get () |
| Get a specific core setting from RAM shadow table. | |
| template<const auto Key, const auto & Map, const auto & RuntimeMap> | |
| auto | get () |
| Get a mission-defined setting in RAM shadow table. | |
| template<const auto Key, const auto & Map, auto & RuntimeMap> | |
| void | load_one () |
| Load a mission-defined setting from FLASH to the RAM shadow table. | |
| template<param P> | |
| void | load_one () |
| Load a core setting from FLASH to the RAM shadow table. | |
| template<param P> | |
| void | save_one () |
| Save a core setting from RAM shadow table to FLASH. | |
| template<const auto Key, const auto & Map, auto & RuntimeMap> | |
| void | save_one () |
| Save a mission specific setting from RAM shadow table to FLASH. | |
| void | reset_all () |
| Resets all the settings to their default values. | |
| void | load () |
| Loads all the core settings from FLASH to the RAM shadow table. | |
| void | save () |
| Save all the core settings from the RAM shadow table to FLASH. | |
| template<const auto & Map, auto & RuntimeMap> | |
| constexpr void | load () |
| Load ALL mission-defined settings from FLASH to the RAM shadow table. | |
| template<const auto & Map, auto & RuntimeMap> | |
| constexpr void | reset_all () |
| Reset ALL mission-defined settings. | |
| template<const auto & Map, auto & RuntimeMap> | |
| constexpr void | save () |
| Save ALL mission-defined settings from the RAM shadow table to FLASH. | |
Static Public Member Functions | |
| static settings & | get_instance () |
| Get a singleton access to the settings subsystem. | |
| template<const auto Key, const auto & Map> | |
| static constexpr auto | defaults () |
| Returns the default value of a mission-defined setting. | |
| template<param P> | |
| static constexpr auto | defaults () |
| Returns the default value of a specific setting. | |
Static Public Attributes | |
| static constexpr uint32_t | TRUE_MAGIC = 0xA17E3C5D |
| static constexpr uint32_t | FALSE_MAGIC = 0x0CF18BE2 |
| static constexpr std::size_t | TABLE_SIZE |
| template<typename T> | |
| static constexpr bool | is_param_info_v = is_param_info<T>::value |
Protected Member Functions | |
| settings () | |
| Construct a new settings::settings object and mounts the LittleFS partition. | |
Store and retrieve reliably persistent settings.
The settings subsystem utilizes LittleFS to store reliably all the settings that should be persistent across power cycles. It uses the internal flash of the MCU.
All settings are mirrored to RAM for fast access via a runtime shadow table. Default values are applied on first boot or when data is missing.
Access to the subsystem itself is achieved using the singleton design pattern. All read or write operations are thread-safe.
To add a new setting, first a new file should be defined. All files should defined under the /lfs1 directory. In addition, a default setting value should be set, so it can be applied in case the flash area is formatted or has been previously erased.
Definition at line 59 of file settings.hpp.
Backward-compatible alias — zero extra types.
Definition at line 202 of file settings.hpp.
|
strong |
Specific setting identifier.
To efficiently discriminate between the available settings parameters, indexing is performed via this enumeration
Definition at line 70 of file settings.hpp.
|
delete |
|
protected |
Construct a new settings::settings object and mounts the LittleFS partition.
Definition at line 46 of file settings.cpp.
|
inlinestaticconstexpr |
Returns the default value of a specific setting.
| P | the settings::param setting |
Definition at line 262 of file settings.hpp.
|
inlinestaticconstexpr |
Returns the default value of a mission-defined setting.
| Key | the specific setting to get the default value |
| &Map | the constexpr map containing the mission defined settings |
Definition at line 244 of file settings.hpp.
| bool satnogs::comms::settings::deployed | ( | ) |
Retrieves the information regarding if this is the first time that the system deploys.
Definition at line 93 of file settings.cpp.
|
inline |
Get a mission-defined setting in RAM shadow table.
| param | the specific setting to set |
| &Map | the constexpr map containing the mission defined settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
Definition at line 366 of file settings.hpp.
|
inline |
Get a specific core setting from RAM shadow table.
| param | the specific setting to set |
Definition at line 348 of file settings.hpp.
|
inlinestatic |
Get a singleton access to the settings subsystem.
Definition at line 210 of file settings.hpp.
| void satnogs::comms::settings::get_rx_conf | ( | lib::radio::interface | iface, |
| lib::radio::rx_conf & | cnf ) |
Retrieve the TX configuration parameters for a specific interface.
| iface | the desired interface |
| cnf | reference to a TX configuration, to store the retrieved parameters |
Definition at line 139 of file settings.cpp.
| void satnogs::comms::settings::get_tx_conf | ( | lib::radio::interface | iface, |
| lib::radio::tx_conf & | cnf ) |
Retrieve the TX configuration parameters for a specific interface.
| iface | the desired interface |
| cnf | reference to a TX configuration, to store the retrieved parameters |
Definition at line 105 of file settings.cpp.
| void satnogs::comms::settings::incr_boot_cnt | ( | ) |
Increments the current boot count and stores it at the persistent storage.
Definition at line 76 of file settings.cpp.
|
inlineconstexpr |
Load ALL mission-defined settings from FLASH to the RAM shadow table.
| &Map | the constexpr map containing the mission defined settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
Definition at line 532 of file settings.hpp.
| void satnogs::comms::settings::load | ( | ) |
Loads all the core settings from FLASH to the RAM shadow table.
Definition at line 239 of file settings.cpp.
|
inline |
Load a core setting from FLASH to the RAM shadow table.
| param | the specific setting to set |
Definition at line 425 of file settings.hpp.
|
inline |
Load a mission-defined setting from FLASH to the RAM shadow table.
| Key | the specific setting to load |
| &Map | the constexpr map containing the mission defined settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
Definition at line 387 of file settings.hpp.
|
delete |
| radio::clk_src satnogs::comms::settings::radio_clk_src | ( | ) |
Returns the current radio clock source.
Definition at line 205 of file settings.cpp.
|
inline |
Reset a specific core setting in RAM shadow table.
| param | the specific setting to set |
Definition at line 337 of file settings.hpp.
|
inline |
Reset a mission specific setting in RAM shadow table.
| Key | the specific setting to set |
| &Map | the constexpr map containing the mission specific settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
Definition at line 321 of file settings.hpp.
|
inlineconstexpr |
Reset ALL mission-defined settings.
| &Map | the constexpr map containing the mission defined settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
Definition at line 545 of file settings.hpp.
| void satnogs::comms::settings::reset_all | ( | ) |
Resets all the settings to their default values.
Definition at line 225 of file settings.cpp.
|
inlineconstexpr |
Save ALL mission-defined settings from the RAM shadow table to FLASH.
| &Map | the constexpr map containing the mission defined settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
Definition at line 559 of file settings.hpp.
| void satnogs::comms::settings::save | ( | ) |
Save all the core settings from the RAM shadow table to FLASH.
Definition at line 253 of file settings.cpp.
|
inline |
Save a mission specific setting from RAM shadow table to FLASH.
| Key | the specific setting to load |
| &Map | the constexpr map containing the mission defined settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
Definition at line 494 of file settings.hpp.
|
inline |
Save a core setting from RAM shadow table to FLASH.
| Key | the specific setting to load |
| &Map | the constexpr map containing the mission defined settings |
Definition at line 464 of file settings.hpp.
|
inline |
Sets a specific core setting in RAM shadow table.
| param | the specific setting to set |
| x | the value to set |
Definition at line 303 of file settings.hpp.
|
inline |
Sets a mission-defined setting in RAM shadow table.
| Key | the specific setting to set |
| &Map | the constexpr map containing the mission specific settings |
| &RuntimeMap | the runtime map that holds the mission-defined settings stored in RAM |
| x | the value to set |
Definition at line 281 of file settings.hpp.
|
staticconstexpr |
Definition at line 63 of file settings.hpp.
|
staticconstexpr |
Definition at line 199 of file settings.hpp.
|
staticconstexpr |
Definition at line 151 of file settings.hpp.
|
staticconstexpr |
Definition at line 62 of file settings.hpp.