got motor running

This commit is contained in:
Leonetienne
2025-12-14 18:57:28 +01:00
parent d339f5b297
commit bd906add53
14 changed files with 123 additions and 78 deletions
+12 -1
View File
@@ -1,5 +1,13 @@
#include "StateMachine.hpp"
constexpr uint8_t ERROR_INDICATOR_LED_PIN = 3;
StateMachine::StateMachine() noexcept
{
pinMode(ERROR_INDICATOR_LED_PIN, OUTPUT);
digitalWrite(ERROR_INDICATOR_LED_PIN, LOW);
}
StateMachine& StateMachine::getInstance() noexcept
{
static StateMachine instance;
@@ -77,9 +85,12 @@ bool StateMachine::canSwitchToState(const State newState) const noexcept
return false;
}
bool StateMachine::raiseError(const String &reason) noexcept
{
state = State::ERROR;
lastError = reason;
digitalWrite(ERROR_INDICATOR_LED_PIN, HIGH);
if (Serial) {
Serial.println(String("Error!: ") + reason);
}
}