display battery voltage
This commit is contained in:
parent
3e768e76f1
commit
c60b82e2f8
|
@ -74,6 +74,7 @@ RTC_DATA_ATTR int timeDigits[4] = { 9, 5, 0, 0 }; // start time: 23:59
|
||||||
RTC_DATA_ATTR char calName[5][31];
|
RTC_DATA_ATTR char calName[5][31];
|
||||||
RTC_DATA_ATTR char calStart[5][26];
|
RTC_DATA_ATTR char calStart[5][26];
|
||||||
RTC_DATA_ATTR char calTitle[5][81];
|
RTC_DATA_ATTR char calTitle[5][81];
|
||||||
|
RTC_DATA_ATTR double voltage;
|
||||||
|
|
||||||
Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode
|
Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode
|
||||||
Network network; //Our networking functions, see Network.cpp for info
|
Network network; //Our networking functions, see Network.cpp for info
|
||||||
|
@ -83,6 +84,7 @@ void drawTime();
|
||||||
void drawCal();
|
void drawCal();
|
||||||
void drawCalLine1(int entry);
|
void drawCalLine1(int entry);
|
||||||
void drawCalLine2(int entry);
|
void drawCalLine2(int entry);
|
||||||
|
void drawBat();
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
bool networking = false;
|
bool networking = false;
|
||||||
|
@ -95,11 +97,14 @@ void setup() {
|
||||||
//restore old bitmap (before the deep sleep)
|
//restore old bitmap (before the deep sleep)
|
||||||
drawTime();
|
drawTime();
|
||||||
drawCal();
|
drawCal();
|
||||||
|
drawBat();
|
||||||
display.load1b();
|
display.load1b();
|
||||||
|
|
||||||
//Update data
|
//Update data
|
||||||
if ((timeDigits[1] == 5) && (timeDigits[0] == 9)) {
|
if ((timeDigits[1] == 5) && (timeDigits[0] == 9)) { // every hour read the battery voltage and set the time from internet
|
||||||
network.begin(); // every hour set the time from internet
|
adc_power_on();
|
||||||
|
voltage = display.readBattery();
|
||||||
|
network.begin();
|
||||||
network.off();
|
network.off();
|
||||||
networking = true;
|
networking = true;
|
||||||
}
|
}
|
||||||
|
@ -109,6 +114,7 @@ void setup() {
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
drawTime();
|
drawTime();
|
||||||
drawCal();
|
drawCal();
|
||||||
|
drawBat();
|
||||||
|
|
||||||
//Actually display all data
|
//Actually display all data
|
||||||
if (timeDigits[0]+timeDigits[1] == 0 || networking) {
|
if (timeDigits[0]+timeDigits[1] == 0 || networking) {
|
||||||
|
@ -215,3 +221,12 @@ void drawCalLine2(int entry)
|
||||||
display.setTextWrap(false);
|
display.setTextWrap(false);
|
||||||
display.print(calTitle[entry]);
|
display.print(calTitle[entry]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawBat()
|
||||||
|
{
|
||||||
|
display.setFont(NULL);
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setCursor(275, 10);
|
||||||
|
display.print(voltage);
|
||||||
|
display.print("V");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue