rename error state to fault
This commit is contained in:
+3
-1
@@ -68,6 +68,8 @@ void MainLoop::setup() noexcept
|
|||||||
for (uint8_t i = 0; i < 3; i++) {
|
for (uint8_t i = 0; i < 3; i++) {
|
||||||
motors[i].commitMoveImmediately();
|
motors[i].commitMoveImmediately();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateMachine::getInstance().setState(StateMachine::STATE::IDLING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainLoop::update() noexcept
|
void MainLoop::update() noexcept
|
||||||
@@ -108,7 +110,7 @@ void MainLoop::update() noexcept
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case StateMachine::STATE::ERROR:
|
case StateMachine::STATE::FAULT:
|
||||||
default:
|
default:
|
||||||
// Freeze in place until error clears or device reset
|
// Freeze in place until error clears or device reset
|
||||||
yield();
|
yield();
|
||||||
|
|||||||
+3
-3
@@ -28,12 +28,12 @@ bool StateMachine::setState(const STATE newState) noexcept
|
|||||||
bool StateMachine::canSwitchToState(const STATE newState) const noexcept
|
bool StateMachine::canSwitchToState(const STATE newState) const noexcept
|
||||||
{
|
{
|
||||||
// Error state is final
|
// Error state is final
|
||||||
if (state == STATE::ERROR) {
|
if (state == STATE::FAULT) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error state only settable via raiseError()
|
// Error state only settable via raiseError()
|
||||||
if (newState == STATE::ERROR) {
|
if (newState == STATE::FAULT) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ bool StateMachine::canSwitchToState(const STATE newState) const noexcept
|
|||||||
|
|
||||||
bool StateMachine::raiseError(const String &reason) noexcept
|
bool StateMachine::raiseError(const String &reason) noexcept
|
||||||
{
|
{
|
||||||
state = STATE::ERROR;
|
state = STATE::FAULT;
|
||||||
lastError = reason;
|
lastError = reason;
|
||||||
digitalWrite(ERROR_INDICATOR_LED_PIN, HIGH);
|
digitalWrite(ERROR_INDICATOR_LED_PIN, HIGH);
|
||||||
UartHandler& uart = UartHandler::getInstance();
|
UartHandler& uart = UartHandler::getInstance();
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class StateMachine
|
|||||||
INITIALIZING,
|
INITIALIZING,
|
||||||
IDLING,
|
IDLING,
|
||||||
MOVING,
|
MOVING,
|
||||||
ERROR
|
FAULT
|
||||||
};
|
};
|
||||||
|
|
||||||
StateMachine(const StateMachine&) = delete;
|
StateMachine(const StateMachine&) = delete;
|
||||||
|
|||||||
Reference in New Issue
Block a user