mirror of
https://github.com/ravinrabbid/DonCon2040.git
synced 2024-11-20 03:37:07 +01:00
Add trigger threshold level to settings store
This commit is contained in:
parent
01536cc45d
commit
578ea62bb2
@ -20,10 +20,11 @@ class SettingsStore {
|
||||
uint8_t in_use;
|
||||
usb_mode_t usb_mode;
|
||||
Peripherals::Drum::Config::Thresholds trigger_thresholds;
|
||||
uint8_t trigger_threshold_scale_level;
|
||||
uint8_t led_brightness;
|
||||
|
||||
uint8_t _padding[m_store_size - sizeof(uint8_t) - sizeof(usb_mode_t) -
|
||||
sizeof(Peripherals::Drum::Config::Thresholds) - sizeof(uint8_t)];
|
||||
sizeof(Peripherals::Drum::Config::Thresholds) - sizeof(uint8_t) - sizeof(uint8_t)];
|
||||
};
|
||||
static_assert(sizeof(Storecache) == m_store_size);
|
||||
|
||||
@ -50,6 +51,9 @@ class SettingsStore {
|
||||
void setTriggerThresholds(Peripherals::Drum::Config::Thresholds thresholds);
|
||||
Peripherals::Drum::Config::Thresholds getTriggerThresholds();
|
||||
|
||||
void setTriggerThresholdScaleLevel(uint8_t threshold_scale_level);
|
||||
uint8_t getTriggerThresholdScaleLevel();
|
||||
|
||||
void setLedBrightness(uint8_t brightness);
|
||||
uint8_t getLedBrightness();
|
||||
|
||||
|
@ -14,6 +14,7 @@ SettingsStore::SettingsStore()
|
||||
: m_store_cache({m_magic_byte,
|
||||
Config::Default::usb_mode,
|
||||
Config::Default::drum_config.trigger_thresholds,
|
||||
Config::Default::drum_config.trigger_threshold_scale_level,
|
||||
Config::Default::led_config.brightness,
|
||||
{}}),
|
||||
m_dirty(true), m_scheduled_reboot(RebootType::None) {
|
||||
@ -57,6 +58,14 @@ void SettingsStore::setTriggerThresholds(Peripherals::Drum::Config::Thresholds t
|
||||
}
|
||||
Peripherals::Drum::Config::Thresholds SettingsStore::getTriggerThresholds() { return m_store_cache.trigger_thresholds; }
|
||||
|
||||
void SettingsStore::setTriggerThresholdScaleLevel(uint8_t threshold_scale_level) {
|
||||
if (threshold_scale_level != m_store_cache.trigger_threshold_scale_level) {
|
||||
m_store_cache.trigger_threshold_scale_level = threshold_scale_level;
|
||||
m_dirty = true;
|
||||
}
|
||||
}
|
||||
uint8_t SettingsStore::getTriggerThresholdScaleLevel() { return m_store_cache.trigger_threshold_scale_level; }
|
||||
|
||||
void SettingsStore::setLedBrightness(uint8_t brightness) {
|
||||
if (m_store_cache.led_brightness != brightness) {
|
||||
m_store_cache.led_brightness = brightness;
|
||||
|
Loading…
Reference in New Issue
Block a user