From 684253ce0ed20f91ac232f3696d4126881637744 Mon Sep 17 00:00:00 2001 From: Eben van Ellewee Date: Mon, 29 Mar 2021 08:47:42 +0200 Subject: [PATCH 1/3] Display Battery Volts TTGO 2.1.6 --- RX_FSK/RX_FSK.ino | 1 + libraries/SondeLib/Display.cpp | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 1738764..02c39f9 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -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); } diff --git a/libraries/SondeLib/Display.cpp b/libraries/SondeLib/Display.cpp index f4cbb40..a6a34a4 100644 --- a/libraries/SondeLib/Display.cpp +++ b/libraries/SondeLib/Display.cpp @@ -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) { From 2db65cc2bdda2e411850734282ea6efe433c2c23 Mon Sep 17 00:00:00 2001 From: Eben van Ellewee Date: Mon, 29 Mar 2021 09:55:34 +0200 Subject: [PATCH 2/3] fix if statement --- libraries/SondeLib/Display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/SondeLib/Display.cpp b/libraries/SondeLib/Display.cpp index a6a34a4..a8b54fc 100644 --- a/libraries/SondeLib/Display.cpp +++ b/libraries/SondeLib/Display.cpp @@ -1445,7 +1445,7 @@ void Display::drawGPS(DispEntry *de) { void Display::drawBatt(DispEntry *de) { float val; char buf[30]; - // if(!axp192_found) return; + if(!axp192_found && sonde.fingerprint != 31) return; if (!axp192_found && sonde.fingerprint == 31) { xSemaphoreTake(axpSemaphore, portMAX_DELAY); From 519c656cb0eeddb20c02dd69c2e92e222c0438d4 Mon Sep 17 00:00:00 2001 From: Eben van Ellewee Date: Tue, 30 Mar 2021 20:58:50 +0200 Subject: [PATCH 3/3] Edited OLED Battery screen to show just Volts --- RX_FSK/data/screens1.txt | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/RX_FSK/data/screens1.txt b/RX_FSK/data/screens1.txt index 0c425d8..9704bc1 100644 --- a/RX_FSK/data/screens1.txt +++ b/RX_FSK/data/screens1.txt @@ -203,7 +203,7 @@ timeaction=#,#,# 7,0=gV 7,2=xd= 7,4=gD -7,12=gI° +7,12=gI° ############ @BatteryOLED @@ -211,16 +211,17 @@ timer=-1,-1,-1 key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# -fonts=0,1 -0,0=xBat.Status: -0,12=bS -1,0=xBatt: -1,6=bVV -2,0=bCmA (charge) -3,0=bDmA (disch.) -4,0=xUSB: -4,5=bUV -5,5=bImA -6,0=xTemp: -6,5=bT C +fonts=1,1 +0,0=xBattery Status +0,16=bS +2,0=xVoltage: +fonts=7,7 +6,10=bVV +#2,0=bCmA (charge) +#3,0=bDmA (disch.) +#4,0=xUSB: +#4,5=bUV +#5,5=bImA +#6,0=xTemp: +#6,5=bT C