-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.h
55 lines (42 loc) · 1.25 KB
/
main.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
#ifndef MAIN_H
#define MAIN_H
#include <Watchy.h>
#include "brain_vis.h"
RTC_DATA_ATTR int face = 0;
RTC_DATA_ATTR int faces_vars[6][2] = {{1,0},{1,0},{1,0},{1,0},{2,0},{1,0}}; //variants, current
//Brutus, Bahn, Maze, Redub, Novel, Hobbit
class WatchyBrain : public Watchy {
using Watchy::Watchy;
public:
void drawWatchFace();
void drawBahn(int variant, float batt);
virtual void handleButtonPress();//Must be virtual in Watchy.h too
};
#include "bahn.h"
void WatchyBrain::handleButtonPress() {
if (guiState == WATCHFACE_STATE) {
//Up and Down switch watch faces
uint64_t wakeupBit = esp_sleep_get_ext1_wakeup_status();
if (wakeupBit & MENU_BTN_MASK) {
Watchy::handleButtonPress();
return;
}
RTC.read(currentTime);
showWatchFace(true);
} else {Watchy::handleButtonPress();}
return;
}
void WatchyBrain::drawWatchFace() {
// ** UPDATE **
//resets step counter at midnight everyday
if (currentTime.Hour == 00 && currentTime.Minute == 00) {
sensor.resetStepCounter();
}
// ** GET BATTERY **
Serial.print(getBatteryVoltage());
float batt = (getBatteryVoltage())-3.0;
//if (batt > 1) { batt = 1; } else if (batt < 0) { batt = 0; }
// ** DRAW WATCHFACE **
drawBahn(0, batt);
}
#endif