Added optional beep when blinking
This commit is contained in:
@ -158,6 +158,7 @@ struct CenterOffsetAccessor : public RefAccessorSaveSettings<int16_t> { int16_t
|
||||
struct SmallOffsetAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.smallOffset; } };
|
||||
struct BigOffsetAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.bigOffset; } };
|
||||
struct DeziampereAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.deziampere; } };
|
||||
struct EnableBeepWhenBlinkAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.ledstrip.enableBeepWhenBlink; } };
|
||||
#endif
|
||||
|
||||
struct LockscreenAllowPresetSwitchAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.lockscreen.allowPresetSwitch; } };
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define FEATURE_LEDSTRIP
|
||||
// local includes
|
||||
#include "menudisplay.h"
|
||||
#include "menuitem.h"
|
||||
@ -88,7 +88,9 @@ public:
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDANIMATION>, ToggleBoolAction, CheckboxIcon, EnableLedAnimationAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BRAKELIGHTS>, ToggleBoolAction, CheckboxIcon, EnableBrakeLightsAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLINKBEEP>, ToggleBoolAction, CheckboxIcon, EnableBeepWhenBlinkAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTANIMATION>, SwitchScreenAction<LedstripSelectAnimationMenu>>>();
|
||||
|
||||
// constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BLINKANIMATION, BlinkAnimationAccessor>, SwitchScreenAction<BlinkAnimationChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, SwitchScreenAction<LedsCountChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, SwitchScreenAction<CenterOffsetChangeScreen>>>();
|
||||
|
@ -37,6 +37,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);
|
||||
|
||||
@ -51,6 +56,12 @@ void updateLedStrip()
|
||||
if (blinkAnimation != LEDSTRIP_ANIMATION_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
|
||||
|
@ -230,7 +230,8 @@ constexpr Settings::Ledstrip defaultLedstrip {
|
||||
.centerOffset = 1,
|
||||
.smallOffset = 4,
|
||||
.bigOffset = 10,
|
||||
.deziampere = 30
|
||||
.deziampere = 30,
|
||||
.enableBeepWhenBlink = false
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -161,6 +161,7 @@ struct Settings
|
||||
int16_t smallOffset;
|
||||
int16_t bigOffset;
|
||||
int16_t deziampere;
|
||||
bool enableBeepWhenBlink;
|
||||
} ledstrip;
|
||||
#endif
|
||||
|
||||
@ -260,6 +261,7 @@ void Settings::executeForEveryCommonSetting(T &&callable)
|
||||
callable("smallOffset", ledstrip.smallOffset);
|
||||
callable("bigOffset", ledstrip.bigOffset);
|
||||
callable("deziampere", ledstrip.deziampere);
|
||||
callable("beeppwhenblink", ledstrip.enableBeepWhenBlink);
|
||||
#endif
|
||||
|
||||
callable("lockAlwPresetSw", lockscreen.allowPresetSwitch);
|
||||
|
@ -248,6 +248,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
|
||||
|
Reference in New Issue
Block a user