display SH1106 added

This commit is contained in:
richonguzman 2023-08-02 00:02:43 -04:00
parent 4337afb0a1
commit 152974f1e3
7 changed files with 133 additions and 57 deletions

View File

@ -1,7 +1,7 @@
{ {
"beacons": [ "beacons": [
{ {
"callsign": "NOCALL-7", "callsign": "CD2RXU-6",
"symbol": "[", "symbol": "[",
"overlay": "/", "overlay": "/",
"comment": "", "comment": "",
@ -18,7 +18,7 @@
} }
}, },
{ {
"callsign": "NOCALL-7", "callsign": "CD2RXU-6",
"symbol": ">", "symbol": ">",
"overlay": "/", "overlay": "/",
"comment": "", "comment": "",
@ -35,7 +35,7 @@
} }
}, },
{ {
"callsign": "NOCALL-7", "callsign": "CD2RXU-6",
"symbol": "j", "symbol": "j",
"overlay": "/", "overlay": "/",
"comment": "", "comment": "",

View File

@ -30,6 +30,7 @@ lib_deps =
peterus/esp-logger @ 1.0.0 peterus/esp-logger @ 1.0.0
lewisxhe/XPowersLib@^0.1.7 lewisxhe/XPowersLib@^0.1.7
h2zero/NimBLE-Arduino@^1.4.1 h2zero/NimBLE-Arduino@^1.4.1
adafruit/Adafruit SH110X@^2.1.8
check_tool = cppcheck check_tool = cppcheck
check_flags = check_flags =
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK
@ -39,6 +40,10 @@ check_skip_packages = yes
board = ttgo-t-beam board = ttgo-t-beam
build_flags = -Werror -Wall -DTTGO_T_Beam_V1_0 build_flags = -Werror -Wall -DTTGO_T_Beam_V1_0
[env:ttgo-t-beam-v1-SH1106]
board = ttgo-t-beam
build_flags = -Werror -Wall -DTTGO_T_Beam_V1_0_SH1106
[env:ttgo-t-beam-v0_7] [env:ttgo-t-beam-v0_7]
board = ttgo-t-beam board = ttgo-t-beam
build_flags = -Werror -Wall -DTTGO_T_Beam_V0_7 build_flags = -Werror -Wall -DTTGO_T_Beam_V0_7

View File

@ -82,7 +82,7 @@ void setup() {
MSG_Utils::loadNumMessages(); MSG_Utils::loadNumMessages();
GPS_Utils::setup(); GPS_Utils::setup();
LoRa_Utils::setup(); //LoRa_Utils::setup();
WiFi.mode(WIFI_OFF); WiFi.mode(WIFI_OFF);
btStop(); btStop();

View File

@ -1,5 +1,9 @@
#ifdef TTGO_T_Beam_V1_0
#include <Adafruit_SSD1306.h> #include <Adafruit_SSD1306.h>
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
#include <Adafruit_SH110X.h>
#endif
#include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
#include <logger.h> #include <logger.h>
#include <Wire.h> #include <Wire.h>
@ -27,7 +31,12 @@ const uint8_t *symbolsAPRS[] = {runnerSymbol, carSymbol, jeepSymbol, bikeSymbol
extern logging::Logger logger; extern logging::Logger logger;
#ifdef TTGO_T_Beam_V1_0
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST); Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
Adafruit_SH1106G display(128, 64, &Wire, OLED_RST);
#endif
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void setup_display() { void setup_display() {
@ -40,39 +49,66 @@ void setup_display() {
#endif #endif
Wire.begin(OLED_SDA, OLED_SCL); Wire.begin(OLED_SDA, OLED_SCL);
#ifdef TTGO_T_Beam_V1_0
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "SSD1306", "allocation failed!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "SSD1306", "allocation failed!");
while (true) { while (true) {
} }
} }
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
if (!display.begin(0x3c, true)) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "SH1106", "allocation failed!");
while (true) {
}
}
#endif
display.clearDisplay(); display.clearDisplay();
#ifdef TTGO_T_Beam_V1_0
display.setTextColor(WHITE); display.setTextColor(WHITE);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(1); display.setTextSize(1);
display.setCursor(0, 0); display.setCursor(0, 0);
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1); display.ssd1306_command(1);
#endif
display.display(); display.display();
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void display_toggle(bool toggle) { void display_toggle(bool toggle) {
if (toggle) { if (toggle) {
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_DISPLAYON); display.ssd1306_command(SSD1306_DISPLAYON);
#endif
} else { } else {
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_DISPLAYOFF); display.ssd1306_command(SSD1306_DISPLAYOFF);
#endif
} }
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void show_display(String header, int wait) { void show_display(String header, int wait) {
display.clearDisplay(); display.clearDisplay();
#ifdef TTGO_T_Beam_V1_0
display.setTextColor(WHITE); display.setTextColor(WHITE);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2); display.setTextSize(2);
display.setCursor(0, 0); display.setCursor(0, 0);
display.println(header); display.println(header);
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1); display.ssd1306_command(1);
#endif
display.display(); display.display();
delay(wait); delay(wait);
} }
@ -80,15 +116,22 @@ void show_display(String header, int wait) {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void show_display(String header, String line1, int wait) { void show_display(String header, String line1, int wait) {
display.clearDisplay(); display.clearDisplay();
#ifdef TTGO_T_Beam_V1_0
display.setTextColor(WHITE); display.setTextColor(WHITE);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2); display.setTextSize(2);
display.setCursor(0, 0); display.setCursor(0, 0);
display.println(header); display.println(header);
display.setTextSize(1); display.setTextSize(1);
display.setCursor(0, 16); display.setCursor(0, 16);
display.println(line1); display.println(line1);
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1); display.ssd1306_command(1);
#endif
display.display(); display.display();
delay(wait); delay(wait);
} }
@ -96,7 +139,12 @@ void show_display(String header, String line1, int wait) {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void show_display(String header, String line1, String line2, int wait) { void show_display(String header, String line1, String line2, int wait) {
display.clearDisplay(); display.clearDisplay();
#ifdef TTGO_T_Beam_V1_0
display.setTextColor(WHITE); display.setTextColor(WHITE);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2); display.setTextSize(2);
display.setCursor(0, 0); display.setCursor(0, 0);
display.println(header); display.println(header);
@ -105,8 +153,10 @@ void show_display(String header, String line1, String line2, int wait) {
display.println(line1); display.println(line1);
display.setCursor(0, 26); display.setCursor(0, 26);
display.println(line2); display.println(line2);
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1); display.ssd1306_command(1);
#endif
display.display(); display.display();
delay(wait); delay(wait);
} }
@ -114,7 +164,12 @@ void show_display(String header, String line1, String line2, int wait) {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void show_display(String header, String line1, String line2, String line3, int wait) { void show_display(String header, String line1, String line2, String line3, int wait) {
display.clearDisplay(); display.clearDisplay();
#ifdef TTGO_T_Beam_V1_0
display.setTextColor(WHITE); display.setTextColor(WHITE);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2); display.setTextSize(2);
display.setCursor(0, 0); display.setCursor(0, 0);
display.println(header); display.println(header);
@ -125,8 +180,10 @@ void show_display(String header, String line1, String line2, String line3, int w
display.println(line2); display.println(line2);
display.setCursor(0, 36); display.setCursor(0, 36);
display.println(line3); display.println(line3);
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1); display.ssd1306_command(1);
#endif
display.display(); display.display();
delay(wait); delay(wait);
} }
@ -134,7 +191,12 @@ void show_display(String header, String line1, String line2, String line3, int w
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void show_display(String header, String line1, String line2, String line3, String line4, int wait) { void show_display(String header, String line1, String line2, String line3, String line4, int wait) {
display.clearDisplay(); display.clearDisplay();
#ifdef TTGO_T_Beam_V1_0
display.setTextColor(WHITE); display.setTextColor(WHITE);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2); display.setTextSize(2);
display.setCursor(0, 0); display.setCursor(0, 0);
display.println(header); display.println(header);
@ -147,8 +209,10 @@ void show_display(String header, String line1, String line2, String line3, Strin
display.println(line3); display.println(line3);
display.setCursor(0, 46); display.setCursor(0, 46);
display.println(line4); display.println(line4);
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1); display.ssd1306_command(1);
#endif
display.display(); display.display();
delay(wait); delay(wait);
} }
@ -156,7 +220,12 @@ void show_display(String header, String line1, String line2, String line3, Strin
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait) { void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait) {
display.clearDisplay(); display.clearDisplay();
#ifdef TTGO_T_Beam_V1_0
display.setTextColor(WHITE); display.setTextColor(WHITE);
#endif
#ifdef TTGO_T_Beam_V1_0_SH1106
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2); display.setTextSize(2);
display.setCursor(0, 0); display.setCursor(0, 0);
display.println(header); display.println(header);
@ -171,8 +240,10 @@ void show_display(String header, String line1, String line2, String line3, Strin
display.println(line4); display.println(line4);
display.setCursor(0, 56); display.setCursor(0, 56);
display.println(line5); display.println(line5);
#ifdef TTGO_T_Beam_V1_0
display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1); display.ssd1306_command(1);
#endif
if (menuDisplay==0 && Config.showSymbolOnScreen) { if (menuDisplay==0 && Config.showSymbolOnScreen) {
int symbol = 100; int symbol = 100;

View File

@ -16,7 +16,7 @@
#define GPS_TX 12 #define GPS_TX 12
#endif #endif
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SH1106)
#define GPS_RX 12 #define GPS_RX 12
#define GPS_TX 34 #define GPS_TX 34
#endif #endif

View File

@ -8,7 +8,7 @@ extern logging::Logger logger;
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
bool PowerManagement::begin(TwoWire &port) { bool PowerManagement::begin(TwoWire &port) {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
bool result = axp.begin(port, AXP192_SLAVE_ADDRESS); bool result = axp.begin(port, AXP192_SLAVE_ADDRESS);
if (!result) { if (!result) {
axp.setDCDC1Voltage(3300); axp.setDCDC1Voltage(3300);
@ -38,7 +38,7 @@ bool PowerManagement::begin(TwoWire &port) {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateLoRa() { void PowerManagement::activateLoRa() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); axp.setPowerOutPut(AXP192_LDO2, AXP202_ON);
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -49,7 +49,7 @@ void PowerManagement::activateLoRa() {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::deactivateLoRa() { void PowerManagement::deactivateLoRa() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -59,7 +59,7 @@ void PowerManagement::deactivateLoRa() {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateGPS() { void PowerManagement::activateGPS() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); axp.setPowerOutPut(AXP192_LDO2, AXP202_ON);
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -70,7 +70,7 @@ void PowerManagement::activateGPS() {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::deactivateGPS() { void PowerManagement::deactivateGPS() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -80,35 +80,35 @@ void PowerManagement::deactivateGPS() {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateOLED() { void PowerManagement::activateOLED() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
#endif #endif
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::decativateOLED() { void PowerManagement::decativateOLED() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF); axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
#endif #endif
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::disableChgLed() { void PowerManagement::disableChgLed() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setChgLEDMode(AXP20X_LED_OFF); axp.setChgLEDMode(AXP20X_LED_OFF);
#endif #endif
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::enableChgLed() { void PowerManagement::enableChgLed() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.setChgLEDMode(AXP20X_LED_LOW_LEVEL); axp.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
#endif #endif
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::activateMeasurement() { void PowerManagement::activateMeasurement() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.adc1Enable(AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, true); axp.adc1Enable(AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, true);
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -122,14 +122,14 @@ void PowerManagement::activateMeasurement() {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void PowerManagement::deactivateMeasurement() { void PowerManagement::deactivateMeasurement() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
axp.adc1Enable(AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, false); axp.adc1Enable(AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, false);
#endif #endif
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
double PowerManagement::getBatteryVoltage() { double PowerManagement::getBatteryVoltage() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
return axp.getBattVoltage() / 1000.0; return axp.getBattVoltage() / 1000.0;
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -139,7 +139,7 @@ double PowerManagement::getBatteryVoltage() {
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
double PowerManagement::getBatteryChargeDischargeCurrent() { double PowerManagement::getBatteryChargeDischargeCurrent() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
if (axp.isChargeing()) { if (axp.isChargeing()) {
return axp.getBattChargeCurrent(); return axp.getBattChargeCurrent();
} }
@ -151,7 +151,7 @@ double PowerManagement::getBatteryChargeDischargeCurrent() {
} }
bool PowerManagement::isBatteryConnected() { bool PowerManagement::isBatteryConnected() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
return axp.isBatteryConnect(); return axp.isBatteryConnect();
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -160,7 +160,7 @@ bool PowerManagement::isBatteryConnected() {
} }
bool PowerManagement::isChargeing() { bool PowerManagement::isChargeing() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
return axp.isChargeing(); return axp.isChargeing();
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -169,7 +169,7 @@ bool PowerManagement::isChargeing() {
} }
void PowerManagement::setup() { void PowerManagement::setup() {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
Wire.begin(SDA, SCL); Wire.begin(SDA, SCL);
if (!begin(Wire)) { if (!begin(Wire)) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "AXP192", "init done!"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "AXP192", "init done!");
@ -199,7 +199,7 @@ void PowerManagement::setup() {
} }
void PowerManagement::lowerCpuFrequency() { void PowerManagement::lowerCpuFrequency() {
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SH1106)
if (setCpuFrequencyMhz(80)) { if (setCpuFrequencyMhz(80)) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "CPU frequency set to 80MHz"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "CPU frequency set to 80MHz");
} else { } else {
@ -221,7 +221,7 @@ void PowerManagement::obtainBatteryInfo() {
if (!(rate_limit_check_battery++ % 60)) if (!(rate_limit_check_battery++ % 60))
BatteryIsConnected = isBatteryConnected(); BatteryIsConnected = isBatteryConnected();
if (BatteryIsConnected) { if (BatteryIsConnected) {
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
batteryVoltage = String(getBatteryVoltage(), 2); batteryVoltage = String(getBatteryVoltage(), 2);
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -244,7 +244,7 @@ bool PowerManagement::getBatteryInfoIsConnected() {
} }
void PowerManagement::batteryManager() { void PowerManagement::batteryManager() {
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SH1106)
obtainBatteryInfo(); obtainBatteryInfo();
handleChargingLed(); handleChargingLed();
#endif #endif

View File

@ -2,7 +2,7 @@
#define POWER_UTILS_H_ #define POWER_UTILS_H_
#include <Arduino.h> #include <Arduino.h>
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
#include <axp20x.h> #include <axp20x.h>
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2
@ -49,7 +49,7 @@ private:
bool isBatteryConnected(); bool isBatteryConnected();
#ifdef TTGO_T_Beam_V1_0 #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SH1106)
AXP20X_Class axp; AXP20X_Class axp;
#endif #endif
#ifdef TTGO_T_Beam_V1_2 #ifdef TTGO_T_Beam_V1_2