diff --git a/main/accessors/settingsaccessors.h b/main/accessors/settingsaccessors.h index 2a7efd5..2f5f49b 100644 --- a/main/accessors/settingsaccessors.h +++ b/main/accessors/settingsaccessors.h @@ -158,6 +158,7 @@ struct CenterOffsetAccessor : public RefAccessorSaveSettings { int16_t struct SmallOffsetAccessor : public RefAccessorSaveSettings { int16_t &getRef() const override { return settings.ledstrip.smallOffset; } }; struct BigOffsetAccessor : public RefAccessorSaveSettings { int16_t &getRef() const override { return settings.ledstrip.bigOffset; } }; struct DeziampereAccessor : public RefAccessorSaveSettings { int16_t &getRef() const override { return settings.ledstrip.deziampere; } }; +struct EnableBeepWhenBlinkAccessor : public RefAccessorSaveSettings { bool &getRef() const override { return settings.ledstrip.enableBeepWhenBlink; } }; #endif struct LockscreenAllowPresetSwitchAccessor : public RefAccessorSaveSettings { bool &getRef() const override { return settings.lockscreen.allowPresetSwitch; } }; diff --git a/main/displays/menus/ledstripmenu.h b/main/displays/menus/ledstripmenu.h index 9f71162..63dfb72 100644 --- a/main/displays/menus/ledstripmenu.h +++ b/main/displays/menus/ledstripmenu.h @@ -1,5 +1,4 @@ #pragma once - // local includes #include "menudisplay.h" #include "menuitem.h" diff --git a/main/ledstrip.h b/main/ledstrip.h index 4e8aca1..a3ec98a 100644 --- a/main/ledstrip.h +++ b/main/ledstrip.h @@ -39,6 +39,11 @@ void updateLedStrip() if (espchrono::millis_clock::now().time_since_epoch() % 750ms < 375ms) { + if (settings.ledstrip.enableBeepWhenBlink) + { + for (Controller &controller : controllers) + controller.command.buzzer.freq = 3; + } auto color = CRGB{255, 255, 0}; const auto center = (std::begin(leds) + (leds.size() / 2) + settings.ledstrip.centerOffset); @@ -53,6 +58,12 @@ void updateLedStrip() if (blinkAnimation != LEDSTRIP_OVERWRITE_BLINKRIGHT) std::fill(center + settings.ledstrip.smallOffset, center + settings.ledstrip.bigOffset, color); #endif + } else { + if (settings.ledstrip.enableBeepWhenBlink) + { + for (Controller &controller : controllers) + controller.command.buzzer.freq = 0; + } } } else diff --git a/main/presets.h b/main/presets.h index 460a290..5518604 100644 --- a/main/presets.h +++ b/main/presets.h @@ -232,12 +232,12 @@ constexpr Settings::Ledstrip defaultLedstrip { .smallOffset = 4, .bigOffset = 10, .deziampere = 30, + .enableBeepWhenBlink = false, #ifdef LEDSTRIP_ANIMATION_DEFAULT .animationType = LEDSTRIP_ANIMATION_DEFAULT #else .animationType = LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW #endif - }; #endif diff --git a/main/settings.h b/main/settings.h index d7936dd..edc5b3f 100644 --- a/main/settings.h +++ b/main/settings.h @@ -161,6 +161,7 @@ struct Settings int16_t smallOffset; int16_t bigOffset; int16_t deziampere; + bool enableBeepWhenBlink; int16_t animationType; } ledstrip; #endif @@ -260,8 +261,9 @@ void Settings::executeForEveryCommonSetting(T &&callable) callable("centerOffset", ledstrip.centerOffset); callable("smallOffset", ledstrip.smallOffset); callable("bigOffset", ledstrip.bigOffset); - //callable("deziampere", ledstrip.deziampere); - callable("animationType", ledstrip.animationType); + callable("deziampere", ledstrip.deziampere); + callable("beeppwhenblink", ledstrip.enableBeepWhenBlink); +// callable("animationType", ledstrip.animationType); #endif callable("lockAlwPresetSw", lockscreen.allowPresetSwitch); diff --git a/main/texts.h b/main/texts.h index 3fd3ebe..49cc0a0 100644 --- a/main/texts.h +++ b/main/texts.h @@ -249,6 +249,7 @@ constexpr char TEXT_CENTEROFFSET[] = "Center Offset"; constexpr char TEXT_SMALLOFFSET[] = "Small Offset"; constexpr char TEXT_BIGOFFSET[] = "Big Offset"; constexpr char TEXT_LEDSTRIP_MILLIAMP[] = "Ledstrip 0.1A"; +constexpr char TEXT_BLINKBEEP[] = "Blink Beep"; //constexpr char TEXT_BACK[] = "Back"; //LedstripSelectAnimationMenu