| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #include "Arduino.h"
- #include "states/state_impl/state_impl.h"
- StateLock state_lock;
- StateTarget state_target;
- IState *states[_STATES_COUNT] = {
- &state_lock,
- &state_target
- };
- StateID curr_state_id = LOCK;
- StateID next_state_id = LOCK;
- void setup()
- {
- M5.begin();
- Serial.begin(115200);
- states[curr_state_id]->setup();
- }
- void loop()
- {
- next_state_id = states[curr_state_id]->loop();
- if (next_state_id != curr_state_id)
- {
- curr_state_id = next_state_id;
- states[curr_state_id]->setup();
-
- }
- M5.update();
-
- }
|