diff --git a/include/utils/SettingsStore.h b/include/utils/SettingsStore.h index 6069c3d..77ea426 100644 --- a/include/utils/SettingsStore.h +++ b/include/utils/SettingsStore.h @@ -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(); diff --git a/src/utils/SettingsStore.cpp b/src/utils/SettingsStore.cpp index ae50aac..156e4b1 100644 --- a/src/utils/SettingsStore.cpp +++ b/src/utils/SettingsStore.cpp @@ -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;