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
feedbackparser.cpp
globals.cpp
handbremse.cpp
icons/alert.cpp
icons/battery.cpp
icons/bluetooth.cpp

View File

@ -70,7 +70,7 @@ void StatusDisplay::initScreen()
void StatusDisplay::redraw()
{
Base::redraw();
if (modes::defaultMode.overrideHandbremse)
if (modes::defaultMode.overrideHandbremse || handbremse::handbremseAngezogen)
tft.fillRect(0, 0, tft.width(), 2, TFT_RED);
else
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(SPEED_0)
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)))
{
handbremse::handbremseAngezogen = true;
fixCommonParams();
for (bobbycar::protocol::serial::MotorState &motor : motors())
@ -95,6 +96,7 @@ void DefaultMode::update()
else
{
hell:
handbremse::handbremseAngezogen = false;
float pwm;
if (gas_processed >= settings.defaultMode.add_schwelle)
{