2020-03-18 19:15:51 -07:00
|
|
|
#pragma once
|
2020-02-22 12:01:59 -08:00
|
|
|
|
2020-02-27 21:45:20 -08:00
|
|
|
#include <Fsm.h>
|
2020-02-22 12:01:59 -08:00
|
|
|
|
|
|
|
|
// See sw-design.md for documentation
|
|
|
|
|
|
2020-03-18 19:15:51 -07:00
|
|
|
#define EVENT_PRESS 1
|
2020-02-22 12:01:59 -08:00
|
|
|
#define EVENT_WAKE_TIMER 2
|
2021-08-02 22:07:39 -07:00
|
|
|
// #define EVENT_RECEIVED_PACKET 3
|
2020-02-22 12:01:59 -08:00
|
|
|
#define EVENT_PACKET_FOR_PHONE 4
|
2023-05-01 16:10:27 -05:00
|
|
|
#define EVENT_RECEIVED_MSG 5
|
2020-03-18 15:00:17 -07:00
|
|
|
// #define EVENT_BOOT 6 // now done with a timed transition
|
2020-02-22 18:02:44 -08:00
|
|
|
#define EVENT_BLUETOOTH_PAIR 7
|
2020-03-18 19:15:51 -07:00
|
|
|
#define EVENT_NODEDB_UPDATED 8 // NodeDB has a big enough change that we think you should turn on the screen
|
2020-02-23 08:53:52 -08:00
|
|
|
#define EVENT_CONTACT_FROM_PHONE 9 // the phone just talked to us over bluetooth
|
2020-09-21 12:41:39 -07:00
|
|
|
#define EVENT_LOW_BATTERY 10 // Battery is critically low, go to sleep
|
2020-06-08 16:35:26 -07:00
|
|
|
#define EVENT_SERIAL_CONNECTED 11
|
|
|
|
|
#define EVENT_SERIAL_DISCONNECTED 12
|
2020-09-21 12:41:39 -07:00
|
|
|
#define EVENT_POWER_CONNECTED 13
|
|
|
|
|
#define EVENT_POWER_DISCONNECTED 14
|
2021-03-23 14:44:50 +08:00
|
|
|
#define EVENT_FIRMWARE_UPDATE 15 // We just received a new firmware update packet from the phone
|
2023-01-21 14:34:29 +01:00
|
|
|
#define EVENT_SHUTDOWN 16 // force a full shutdown now (not just sleep)
|
|
|
|
|
#define EVENT_INPUT 17 // input broker wants something, we need to wake up and enable screen
|
2020-02-22 12:01:59 -08:00
|
|
|
|
2020-02-22 13:14:10 -08:00
|
|
|
extern Fsm powerFSM;
|
2023-03-23 11:32:04 -05:00
|
|
|
extern State stateON, statePOWER, stateSERIAL, stateDARK;
|
2020-02-22 13:14:10 -08:00
|
|
|
|
2020-02-27 21:45:20 -08:00
|
|
|
void PowerFSM_setup();
|