got motor running
This commit is contained in:
+12
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user