From ff7c624413ddaf71bd8f1dc8256c20be471946c6 Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Sun, 25 Sep 2022 16:52:32 +0200 Subject: [PATCH] fix compilation for TTTGO watch --- .../TTGO_TWatch_Library/src/axp20x.cpp | 2 +- .../tasmota_xdrv_driver/xdrv_83_esp32_watch.ino | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/libesp32_div/TTGO_TWatch_Library/src/axp20x.cpp b/lib/libesp32_div/TTGO_TWatch_Library/src/axp20x.cpp index e79820f72..0262ca91d 100644 --- a/lib/libesp32_div/TTGO_TWatch_Library/src/axp20x.cpp +++ b/lib/libesp32_div/TTGO_TWatch_Library/src/axp20x.cpp @@ -275,7 +275,7 @@ float AXP20X_Class::getTemp() { if (!_init) return AXP_NOT_INIT; - return _getRegistResult(AXP202_INTERNAL_TEMP_H8, AXP202_INTERNAL_TEMP_L4) * AXP202_INTERNAL_TEMP_STEP; + return (_getRegistResult(AXP202_INTERNAL_TEMP_H8, AXP202_INTERNAL_TEMP_L4) - 1447) * AXP202_INTERNAL_TEMP_STEP; } float AXP20X_Class::getTSTemp() diff --git a/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino b/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino index c4abb4825..14ce4eb12 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino @@ -23,7 +23,6 @@ #include #include #include -#include #define XDRV_83 83 @@ -71,7 +70,7 @@ struct TTGO_globs { void TTGO_Init(void) { ttgo_globs.ttgo_power = new AXP20X_Class(); ttgo_globs.i2c = new I2CBus(); - initPower(); + TTGO_initPower(); #ifdef USE_BMA423 ttgo_globs.bma = new BMA(*ttgo_globs.i2c); @@ -119,7 +118,7 @@ void TTGO_Init(void) { #endif // USE_BMA423 } -void initPower(void) { +void TTGO_initPower(void) { int ret = ttgo_globs.ttgo_power->begin(axpReadBytes, axpWriteBytes); if (ret == AXP_FAIL) { //DBGX("AXP Power begin failed"); @@ -247,14 +246,14 @@ void TTGO_WebShow(uint32_t json) { } -void enableLDO3(bool en = true) { +void TTGO_enableLDO3(bool en = true) { if (!ttgo_globs.ttgo_power) return; ttgo_globs.ttgo_power->setLDO3Mode(1); ttgo_globs.ttgo_power->setPowerOutPut(AXP202_LDO3, en); } -void TTGO_audio_power(bool power) { - enableLDO3(power); +void TTGO_audio_power(bool power) { // Not every watch has audio + TTGO_enableLDO3(power); } const char TTGO_Commands[] PROGMEM = "TTGO|" @@ -293,7 +292,7 @@ int32_t ttgo_sleeptime; SettingsSaveAll(); RtcSettingsSave(); ttgo_globs.lenergy = true; - rtc_clk_cpu_freq_set(RTC_CPU_FREQ_2M); + setCpuFrequencyMhz(10); xEventGroupSetBits(ttgo_globs.isr_group, WATCH_FLAG_SLEEP_MODE); gpio_wakeup_enable ((gpio_num_t)AXP202_INT, GPIO_INTR_LOW_LEVEL); gpio_wakeup_enable ((gpio_num_t)BMA423_INT1, GPIO_INTR_HIGH_LEVEL); @@ -319,7 +318,7 @@ int32_t ttgo_sleeptime; if (ttgo_sleeptime) { ttgo_globs.lenergy = false; - rtc_clk_cpu_freq_set(RTC_CPU_FREQ_240M); + setCpuFrequencyMhz(240); #ifdef USE_DISPLAY DisplayOnOff(1); #endif @@ -342,7 +341,7 @@ uint8_t data; if (bits & WATCH_FLAG_SLEEP_EXIT) { if (ttgo_globs.lenergy) { ttgo_globs.lenergy = false; - rtc_clk_cpu_freq_set(RTC_CPU_FREQ_240M); + setCpuFrequencyMhz(240); #ifdef USE_DISPLAY DisplayOnOff(1); #endif