Merge pull request #232 from bobbycar-graz/statusdisplay-blinker
This commit is contained in:
@ -202,6 +202,7 @@ struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> {
|
||||
#ifdef FEATURE_OTA
|
||||
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
|
||||
#endif
|
||||
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
|
||||
#endif
|
||||
|
||||
// Battery
|
||||
|
@ -22,6 +22,7 @@ constexpr char TEXT_ANIMATION_BLINKLEFT[] = "Blink Left";
|
||||
constexpr char TEXT_ANIMATION_BLINKRIGHT[] = "Blink Right";
|
||||
constexpr char TEXT_ANIMATION_BLINKBOTH[] = "Blink Both";
|
||||
constexpr char TEXT_LEDSTRIP_EN_BLINK_ANIM[] = "Animated Blink";
|
||||
constexpr char TEXT_LEDSTRIP_VISUALIZE_BLINK[] = "Visualize Blink";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
class CurrentSelectedBlinkAnimationText : public virtual espgui::TextInterface
|
||||
@ -42,6 +43,7 @@ LedstripSelectBlinkMenu::LedstripSelectBlinkMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BLINKRIGHT>, LedstripAnimationBlinkRightAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BLINKBOTH>, LedstripAnimationBlinkBothAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP_EN_BLINK_ANIM>, BobbyCheckbox, LedstripEnableBlinkAnimationAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP_VISUALIZE_BLINK>, BobbyCheckbox, LedstripEnableVisualizeBlinkAnimationAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,43 @@ void StatusDisplay::redraw()
|
||||
lastRedraw = now;
|
||||
}
|
||||
|
||||
if (configs.handbremse.enable.value && configs.handbremse.visualize.value && handbremse::angezogen)
|
||||
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_RED);
|
||||
else if (configs.handbremse.enable.value && configs.handbremse.visualize.value && handbremse::stateWish == handbremse::StateWish::brake)
|
||||
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_YELLOW);
|
||||
else
|
||||
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_BLACK);
|
||||
{
|
||||
static bool handbremse_fill_with_black;
|
||||
if (configs.handbremse.enable.value && configs.handbremse.visualize.value && handbremse::angezogen)
|
||||
{
|
||||
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_RED);
|
||||
handbremse_fill_with_black = true;
|
||||
}
|
||||
else if (configs.handbremse.enable.value && configs.handbremse.visualize.value && handbremse::stateWish == handbremse::StateWish::brake)
|
||||
{
|
||||
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_YELLOW);
|
||||
handbremse_fill_with_black = true;
|
||||
}
|
||||
else if (handbremse_fill_with_black)
|
||||
{
|
||||
handbremse_fill_with_black = false;
|
||||
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_BLACK);
|
||||
}
|
||||
}
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
{
|
||||
static bool blink_fill_with_black;
|
||||
if (configs.ledstrip.enableVisualizeBlink.value && (espchrono::utc_clock::now().time_since_epoch() % 750ms < 375ms) && (blinkAnimation > 0))
|
||||
{
|
||||
if (BLINK_LEFT_EXPR)
|
||||
tft.fillRect(0, 0, tft.width() / 2, 6, TFT_YELLOW);
|
||||
if (BLINK_RIGHT_EXPR)
|
||||
tft.fillRect(tft.width() / 2, 0, tft.width() / 2, 6, TFT_YELLOW);
|
||||
|
||||
blink_fill_with_black = true;
|
||||
}
|
||||
else if (blink_fill_with_black)
|
||||
{
|
||||
blink_fill_with_black = false;
|
||||
tft.fillRect(0, 0, tft.width(), 6, TFT_BLACK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
tft.setTextFont(2);
|
||||
m_labelRawGas.redraw(raw_gas ? std::to_string(*raw_gas) : "?");
|
||||
|
@ -244,6 +244,7 @@ public:
|
||||
ConfigWrapper<bool> enableAnimBlink {false, DoReset, {}, "enAnimBlink" };
|
||||
ConfigWrapper<OtaAnimationModes> otaMode {OtaAnimationModes::GreenProgressBar, DoReset, {}, "ledOtaAnim" };
|
||||
ConfigWrapper<uint32_t> maxMilliamps {3000, DoReset, {}, "ledMaxMilliamps" };
|
||||
ConfigWrapper<bool> enableVisualizeBlink {false, DoReset, {}, "enVisualBlink" };
|
||||
} ledstrip;
|
||||
|
||||
struct {
|
||||
@ -530,6 +531,7 @@ public:
|
||||
x(ledstrip.enableAnimBlink) \
|
||||
x(ledstrip.otaMode) \
|
||||
x(ledstrip.maxMilliamps) \
|
||||
x(ledstrip.enableVisualizeBlink) \
|
||||
\
|
||||
x(battery.cellsSeries) \
|
||||
x(battery.cellsParallel) \
|
||||
|
Reference in New Issue
Block a user