50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
|
|
#include "appcontext.hpp"
|
||
|
|
#include "pin.h"
|
||
|
|
#include "statemachine.hpp"
|
||
|
|
|
||
|
|
enum class StateId
|
||
|
|
{
|
||
|
|
StartState,
|
||
|
|
NetworkInitializeState
|
||
|
|
};
|
||
|
|
|
||
|
|
class StartState : public State
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
StartState(AppContext *appContext) : State("StartState", StateId::StartState), appContext(appContext) {}
|
||
|
|
|
||
|
|
void onEnter(StateMachineBase &stateMachine) override {
|
||
|
|
if (appContext) {
|
||
|
|
appContext->pinR->setLedLevel(0);
|
||
|
|
appContext->pinG->setLedLevel(0);
|
||
|
|
appContext->pinB->setLedLevel(0);
|
||
|
|
appContext->pinCW->setLedLevel(0);
|
||
|
|
appContext->pinWW->setLedLevel(0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void onExit(StateMachineBase &stateMachine) override {
|
||
|
|
}
|
||
|
|
|
||
|
|
void onUpdate(StateMachineBase &stateMachine) override {
|
||
|
|
}
|
||
|
|
|
||
|
|
private:
|
||
|
|
AppContext *appContext = nullptr;
|
||
|
|
};
|
||
|
|
|
||
|
|
class NetworkInitializeState : public State
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
NetworkInitializeState() : State("NetworkInitializeState", StateId::NetworkInitializeState) {}
|
||
|
|
|
||
|
|
void onEnter(StateMachineBase &stateMachine) override {
|
||
|
|
}
|
||
|
|
|
||
|
|
void onExit(StateMachineBase &stateMachine) override {
|
||
|
|
}
|
||
|
|
|
||
|
|
void onUpdate(StateMachineBase &stateMachine) override {
|
||
|
|
}
|
||
|
|
};
|