mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 19:54:39 +00:00
Preallocate enough vectors for common app settings #1535
This commit is contained in:
parent
0bacb31d17
commit
a11929d2ca
@ -250,7 +250,7 @@ SettingsManager::SettingsManager(
|
|||||||
settings_.options = options;
|
settings_.options = options;
|
||||||
|
|
||||||
// Pre-alloc enough for app settings and additional settings.
|
// Pre-alloc enough for app settings and additional settings.
|
||||||
additional_settings.reserve(17 + additional_settings.size());
|
additional_settings.reserve(COMMON_APP_SETTINGS_COUNT + additional_settings.size());
|
||||||
bindings_ = std::move(additional_settings);
|
bindings_ = std::move(additional_settings);
|
||||||
|
|
||||||
// Settings should always be loaded because apps now rely
|
// Settings should always be loaded because apps now rely
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
// Bring in the string_view literal.
|
// Bring in the string_view literal.
|
||||||
using std::literals::operator""sv;
|
using std::literals::operator""sv;
|
||||||
|
|
||||||
|
#define COMMON_APP_SETTINGS_COUNT 19
|
||||||
|
|
||||||
/* Represents a named setting bound to a variable instance. */
|
/* Represents a named setting bound to a variable instance. */
|
||||||
/* Using void* instead of std::variant, because variant is a pain to dispatch over. */
|
/* Using void* instead of std::variant, because variant is a pain to dispatch over. */
|
||||||
class BoundSetting {
|
class BoundSetting {
|
||||||
@ -143,8 +145,8 @@ struct AppSettings {
|
|||||||
uint8_t nbfm_config_index = 0;
|
uint8_t nbfm_config_index = 0;
|
||||||
uint8_t wfm_config_index = 0;
|
uint8_t wfm_config_index = 0;
|
||||||
uint8_t squelch = 80;
|
uint8_t squelch = 80;
|
||||||
|
|
||||||
uint8_t volume;
|
uint8_t volume;
|
||||||
|
// NOTE: update COMMON_APP_SETTINGS_COUNT when adding to this
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Copies common values to the receiver/transmitter models. */
|
/* Copies common values to the receiver/transmitter models. */
|
||||||
|
Loading…
Reference in New Issue
Block a user