Display Battery Volts TTGO 2.1.6

pull/71/head
Eben van Ellewee 2021-03-29 08:47:42 +02:00
rodzic cd3b34c494
commit 684253ce0e
2 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -1767,6 +1767,7 @@ void setup()
axp.clearIRQ();
}
int ndevices = scanI2Cdevice();
if (sonde.fingerprint == 31) { pinMode(35, INPUT); }
if (sonde.fingerprint != 17 || ndevices > 0) break; // only retry for fingerprint 17 (startup problems of new t-beam with oled)
delay(500);
}

Wyświetl plik

@ -1445,7 +1445,23 @@ void Display::drawGPS(DispEntry *de) {
void Display::drawBatt(DispEntry *de) {
float val;
char buf[30];
if(!axp192_found) return;
// if(!axp192_found) return;
if (!axp192_found && sonde.fingerprint == 31)
{
xSemaphoreTake(axpSemaphore, portMAX_DELAY);
switch (de->extra[0])
{
case 'V':
val = (float)(analogRead(35)) / 4095 * 2 * 3.3 * 1.1;
snprintf(buf, 30, "%.2f%s", val, de->extra + 1);
break;
default:
*buf = 0;
}
xSemaphoreGive(axpSemaphore);
rdis->setFont(de->fmt);
drawString(de, buf);
} else {
xSemaphoreTake( axpSemaphore, portMAX_DELAY );
switch(de->extra[0]) {
@ -1487,6 +1503,7 @@ void Display::drawBatt(DispEntry *de) {
xSemaphoreGive( axpSemaphore );
rdis->setFont(de->fmt);
drawString(de, buf);
}
}
void Display::drawText(DispEntry *de) {