forked from DCC-EX/CommandStation-EX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhmi.h
87 lines (76 loc) · 2.12 KB
/
hmi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* La Box Project
* HMI Class
*
* @Author : Cedric Bellec
* @Organization : Locoduino.org
*/
#ifndef _HMI
#define _HMI
#ifdef USE_HMI
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#include "OneButton.h"
#include "Wire.h"
#include "hmiConfig.h"
#include "HmiInterface.hpp"
#include "hmiTrain.h"
#include "hmiGlobals.h"
class MenuManagement;
class hmi : public Adafruit_SSD1306, public HmiInterface
{
public:
//----- Members
hmi(TwoWire *twi);
void begin();
void update();
byte laBoxState;
MenuManagement *menu;
float voltage;
float current;
int nbTrainToView;
bool stopStateMachine;
//int executionCore;
//----- functions
void addNotification(int addr, uint8_t order, uint8_t value, bool functionState=false);
void addNotification(uint8_t order);
void addNotification(const char* msg);
void readVoltage();
void readCurrent();
protected:
//----- Members
char messageStack[HMI_StackNbCarElt][HMI_MessageSize];
char message[LineCarNbMax];
unsigned long millisEffect;
unsigned long millisRefreshData;
unsigned long millisParamsMenu;
unsigned long millisRefreshDisplay;
unsigned long millisWifiEffect;
byte positioneventlst; // index in event list
byte wifiCircle ; // Juste for visual effect
OneButton *BtnUp;
OneButton *BtnDown;
OneButton *BtnSelect;
hmiTrain tabTrains[HMI_NbMemorisedTrain];
bool needToRefreshDisplay();
//----- functions
void stateMachine();
void pushMessageOnStack(const char *msg, uint8_t len);
void setTrainState(int addr, uint8_t order, uint8_t value, bool state=false);
void dashboard();
void showWifiWaiting();
void dashboard1TrainView();
void dashboard2TrainsView();
void dashboard3TrainsView();
void ParametersMenu();
//void MenuSelect();
void BrowseEventLst();
static void BtnUpPressed();
static void BtnDownPressed();
static void BtnSelectPressed();
// HmiInterface
bool HmiInterfaceLoop();
void HmiInterfaceUpdateDrawing();
};
#endif
#endif