2024-04-03 07:04:55 +07:00
|
|
|
#ifndef _AG_STATE_MACHINE_H_
|
|
|
|
#define _AG_STATE_MACHINE_H_
|
|
|
|
|
2024-04-03 21:26:04 +07:00
|
|
|
#include "AgOledDisplay.h"
|
|
|
|
#include "AgValue.h"
|
|
|
|
#include "AgConfigure.h"
|
|
|
|
#include "Main/PrintLog.h"
|
|
|
|
#include "App/AppDef.h"
|
|
|
|
|
|
|
|
class AgStateMachine : public PrintLog {
|
|
|
|
private:
|
|
|
|
// AgStateMachineState state;
|
|
|
|
AgStateMachineState ledState;
|
|
|
|
AgStateMachineState dispState;
|
2024-04-04 10:36:59 +07:00
|
|
|
AirGradient *ag;
|
2024-04-03 21:26:04 +07:00
|
|
|
AgOledDisplay &disp;
|
|
|
|
AgValue &value;
|
|
|
|
AgConfigure &config;
|
|
|
|
|
|
|
|
bool addToDashBoard = false;
|
|
|
|
uint32_t addToDashboardTime;
|
|
|
|
int wifiConnectCountDown;
|
|
|
|
int ledBarAnimationCount;
|
|
|
|
|
|
|
|
void ledBarSingleLedAnimation(uint8_t r, uint8_t g, uint8_t b);
|
|
|
|
void ledStatusBlinkDelay(uint32_t delay);
|
|
|
|
void sensorLedHandle(void);
|
|
|
|
void co2LedHandle(void);
|
|
|
|
void pm25LedHandle(void);
|
|
|
|
|
|
|
|
public:
|
2024-04-04 10:36:59 +07:00
|
|
|
AgStateMachine(AgOledDisplay &disp, Stream &log,
|
2024-04-03 21:26:04 +07:00
|
|
|
AgValue &value, AgConfigure& config);
|
|
|
|
~AgStateMachine();
|
2024-04-04 10:36:59 +07:00
|
|
|
void setAirGradient(AirGradient* ag);
|
2024-04-03 21:26:04 +07:00
|
|
|
void displayHandle(AgStateMachineState state);
|
|
|
|
void displayHandle(void);
|
|
|
|
void displaySetAddToDashBoard(void);
|
|
|
|
void displayClearAddToDashBoard(void);
|
|
|
|
void displayWiFiConnectCountDown(int count);
|
|
|
|
void ledAnimationInit(void);
|
|
|
|
void ledHandle(AgStateMachineState state);
|
|
|
|
void ledHandle(void);
|
|
|
|
void setDisplayState(AgStateMachineState state);
|
|
|
|
AgStateMachineState getDisplayState(void);
|
2024-04-04 18:35:15 +07:00
|
|
|
AgStateMachineState getLedState(void);
|
2024-04-03 07:04:55 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /** _AG_STATE_MACHINE_H_ */
|