Display Battery Volts TTGO 2.1.6
This commit is contained in:
parent
cd3b34c494
commit
684253ce0e
|
|
@ -1767,6 +1767,7 @@ void setup()
|
||||||
axp.clearIRQ();
|
axp.clearIRQ();
|
||||||
}
|
}
|
||||||
int ndevices = scanI2Cdevice();
|
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)
|
if (sonde.fingerprint != 17 || ndevices > 0) break; // only retry for fingerprint 17 (startup problems of new t-beam with oled)
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1445,7 +1445,23 @@ void Display::drawGPS(DispEntry *de) {
|
||||||
void Display::drawBatt(DispEntry *de) {
|
void Display::drawBatt(DispEntry *de) {
|
||||||
float val;
|
float val;
|
||||||
char buf[30];
|
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 );
|
xSemaphoreTake( axpSemaphore, portMAX_DELAY );
|
||||||
switch(de->extra[0]) {
|
switch(de->extra[0]) {
|
||||||
|
|
@ -1488,6 +1504,7 @@ void Display::drawBatt(DispEntry *de) {
|
||||||
rdis->setFont(de->fmt);
|
rdis->setFont(de->fmt);
|
||||||
drawString(de, buf);
|
drawString(de, buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Display::drawText(DispEntry *de) {
|
void Display::drawText(DispEntry *de) {
|
||||||
rdis->setFont(de->fmt);
|
rdis->setFont(de->fmt);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue