Added handbremse variable (statusdisplay.cpp)

This commit is contained in:
CommanderRedYT
2021-12-05 23:18:56 +01:00
parent 0ab293ee07
commit d32b46ed3f
5 changed files with 12 additions and 1 deletions

View File

@ -327,6 +327,7 @@ set(sources
esptexthelpers.cpp esptexthelpers.cpp
feedbackparser.cpp feedbackparser.cpp
globals.cpp globals.cpp
handbremse.cpp
icons/alert.cpp icons/alert.cpp
icons/battery.cpp icons/battery.cpp
icons/bluetooth.cpp icons/bluetooth.cpp

View File

@ -70,7 +70,7 @@ void StatusDisplay::initScreen()
void StatusDisplay::redraw() void StatusDisplay::redraw()
{ {
Base::redraw(); Base::redraw();
if (modes::defaultMode.overrideHandbremse) if (modes::defaultMode.overrideHandbremse || handbremse::handbremseAngezogen)
tft.fillRect(0, 0, tft.width(), 2, TFT_RED); tft.fillRect(0, 0, tft.width(), 2, TFT_RED);
else else
tft.fillRect(0, 0, tft.width(), 2, TFT_BLACK); tft.fillRect(0, 0, tft.width(), 2, TFT_BLACK);

4
main/handbremse.cpp Normal file
View File

@ -0,0 +1,4 @@
#include "handbremse.h"
namespace handbremse {
bool handbremseAngezogen{false};
} // namespace

View File

@ -11,3 +11,7 @@
x(OPENMODE) \ x(OPENMODE) \
x(SPEED_0) x(SPEED_0)
DECLARE_TYPESAFE_ENUM(HandbremseMode, : uint8_t, HandbremseModeValues) DECLARE_TYPESAFE_ENUM(HandbremseMode, : uint8_t, HandbremseModeValues)
namespace handbremse {
extern bool handbremseAngezogen;
} // namespace

View File

@ -69,6 +69,7 @@ void DefaultMode::update()
} }
else if ((abs(avgSpeedKmh) <= 2) && (overrideHandbremse || espchrono::ago(*m_stillSince) >= espchrono::milliseconds32(settings.handbremse.triggerTimeout))) else if ((abs(avgSpeedKmh) <= 2) && (overrideHandbremse || espchrono::ago(*m_stillSince) >= espchrono::milliseconds32(settings.handbremse.triggerTimeout)))
{ {
handbremse::handbremseAngezogen = true;
fixCommonParams(); fixCommonParams();
for (bobbycar::protocol::serial::MotorState &motor : motors()) for (bobbycar::protocol::serial::MotorState &motor : motors())
@ -95,6 +96,7 @@ void DefaultMode::update()
else else
{ {
hell: hell:
handbremse::handbremseAngezogen = false;
float pwm; float pwm;
if (gas_processed >= settings.defaultMode.add_schwelle) if (gas_processed >= settings.defaultMode.add_schwelle)
{ {