-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice.h
More file actions
84 lines (58 loc) · 1.58 KB
/
Copy pathdevice.h
File metadata and controls
84 lines (58 loc) · 1.58 KB
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
#ifndef DEVICE_H_
#define DEVICE_H_
#define JST 3600* 9
#define CONFIG_LWIP_SNTP_UPDATE_DELAY 3600000
#define LED_PIN 12
#define BUTTON_A_PIN 5
#define BUTTON_B_PIN 4
#define BUTTON_A 0
#define BUTTON_B 1
#define BUTTON_NOTPRESS 0
#define BUTTON_PRESSED 1
#define BUTTON_PRESSING 2
#define BUTTON_RELEASE 3
#include "user_interface.h"
ADC_MODE(ADC_VCC);
//RTC_DATA_ATTR unsigned long millisOffset = 0;
class Device{
private:
volatile uint8_t button_state;
volatile uint8_t button_pressed;
volatile uint8_t button_pressing;
volatile uint8_t button_release;
String serverssid = "";
String serverpass = "yakoshin";
String ssid;
String pass;
const char* settings = "/wifi_setting.txt";
struct tm *tm;
public:
bool isServerStarted;
bool tryWiFiConnect;
bool isWiFiConnected;
volatile bool isTimeConfigured;
volatile unsigned long last_millis;
unsigned long timeOut_time;
Device();
void setButtonState(uint8_t states);
bool getButtonState(uint8_t button,uint8_t state);
void serverBegin();
void serverWaitAccess();
void serverEnd();
String getServerssid();
String getServerpass();
void WiFiBegin();
void WiFiConnectCheck();
void WiFiEnd();
void setTime();
void getTime();
uint8_t getHour();
uint8_t getMinute();
uint8_t getSecond();
bool readSettings();
bool save(uint8_t life, uint8_t stomach, int8_t favorability, int8_t hiddenFavorability);
void sleep();
void timeLog();
void readTimeLog();
};
#endif