mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-15 00:46:31 +02:00
Remove dependency from StateMachine
This commit is contained in:
@ -759,47 +759,3 @@ void StateMachine::executeCo2Calibration(void) {
|
||||
void StateMachine::executeLedBarTest(void) {
|
||||
handleLeds(AgStateMachineLedBarTest);
|
||||
}
|
||||
|
||||
void StateMachine::executeOTA(StateMachine::OtaState state, String msg,
|
||||
int processing) {
|
||||
switch (state) {
|
||||
case OtaState::OTA_STATE_BEGIN: {
|
||||
if (ag->isOne()) {
|
||||
disp.showNewFirmwareVersion(msg);
|
||||
} else {
|
||||
logInfo("New firmware: " + msg);
|
||||
}
|
||||
delay(2500);
|
||||
break;
|
||||
}
|
||||
case OtaState::OTA_STATE_FAIL: {
|
||||
if (ag->isOne()) {
|
||||
disp.showNewFirmwareFailed();
|
||||
} else {
|
||||
logError("Firmware update: failed");
|
||||
}
|
||||
|
||||
delay(2500);
|
||||
break;
|
||||
}
|
||||
case OtaState::OTA_STATE_PROCESSING: {
|
||||
if (ag->isOne()) {
|
||||
disp.showNewFirmwareUpdating(String(processing));
|
||||
} else {
|
||||
logInfo("Firmware update: " + String(processing) + String("%"));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case OtaState::OTA_STATE_SUCCESS: {
|
||||
if (ag->isOne()) {
|
||||
disp.showNewFirmwareSuccess(String(processing));
|
||||
} else {
|
||||
logInfo("Rebooting... " + String(processing));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -49,14 +49,6 @@ public:
|
||||
AgStateMachineState getLedState(void);
|
||||
void executeCo2Calibration(void);
|
||||
void executeLedBarTest(void);
|
||||
|
||||
enum OtaState {
|
||||
OTA_STATE_BEGIN,
|
||||
OTA_STATE_FAIL,
|
||||
OTA_STATE_PROCESSING,
|
||||
OTA_STATE_SUCCESS
|
||||
};
|
||||
void executeOTA(OtaState state, String msg, int processing);
|
||||
};
|
||||
|
||||
#endif /** _AG_STATE_MACHINE_H_ */
|
||||
|
Reference in New Issue
Block a user