mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 19:56:30 +00:00
fix esp32 watch init bug
This commit is contained in:
parent
ee7b64692b
commit
ddac266857
@ -64,6 +64,7 @@ struct TTGO_globs {
|
|||||||
bool bma_double_click = false;
|
bool bma_double_click = false;
|
||||||
bool bma_click = false;
|
bool bma_click = false;
|
||||||
bool bma_button = false;
|
bool bma_button = false;
|
||||||
|
bool power_ok = false;
|
||||||
} ttgo_globs;
|
} ttgo_globs;
|
||||||
|
|
||||||
|
|
||||||
@ -115,15 +116,19 @@ void TTGO_Init(void) {
|
|||||||
ttgo_globs.bma->enableWakeupInterrupt(true);
|
ttgo_globs.bma->enableWakeupInterrupt(true);
|
||||||
ttgo_globs.bma->enableAnyNoMotionInterrupt(true);
|
ttgo_globs.bma->enableAnyNoMotionInterrupt(true);
|
||||||
ttgo_globs.bma->enableAccel();
|
ttgo_globs.bma->enableAccel();
|
||||||
#endif
|
#endif // USE_BMA423
|
||||||
}
|
}
|
||||||
|
|
||||||
void initPower(void) {
|
void initPower(void) {
|
||||||
int ret = ttgo_globs.ttgo_power->begin(axpReadBytes, axpWriteBytes);
|
int ret = ttgo_globs.ttgo_power->begin(axpReadBytes, axpWriteBytes);
|
||||||
if (ret == AXP_FAIL) {
|
if (ret == AXP_FAIL) {
|
||||||
//DBGX("AXP Power begin failed");
|
//DBGX("AXP Power begin failed");
|
||||||
|
// Serial.printf("AXP202 failed\n" );
|
||||||
} else {
|
} else {
|
||||||
I2cSetActiveFound(AXP202_SLAVE_ADDRESS, "AXP202");
|
I2cSetActiveFound(AXP202_SLAVE_ADDRESS, "AXP202");
|
||||||
|
ttgo_globs.power_ok = true;
|
||||||
|
// Serial.printf("AXP202 OK\n" );
|
||||||
|
|
||||||
//Change the button boot time to 4 seconds
|
//Change the button boot time to 4 seconds
|
||||||
ttgo_globs.ttgo_power->setShutdownTime(AXP_POWER_OFF_TIME_4S);
|
ttgo_globs.ttgo_power->setShutdownTime(AXP_POWER_OFF_TIME_4S);
|
||||||
// Turn off the charging instructions, there should be no
|
// Turn off the charging instructions, there should be no
|
||||||
@ -162,6 +167,7 @@ void initPower(void) {
|
|||||||
portYIELD_FROM_ISR ();
|
portYIELD_FROM_ISR ();
|
||||||
}
|
}
|
||||||
}, FALLING);
|
}, FALLING);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -205,6 +211,8 @@ const char HTTP_TTGO_BMA[] PROGMEM =
|
|||||||
|
|
||||||
void TTGO_WebShow(uint32_t json) {
|
void TTGO_WebShow(uint32_t json) {
|
||||||
|
|
||||||
|
if (ttgo_globs.power_ok == false) return;
|
||||||
|
|
||||||
TTGO_GetADC();
|
TTGO_GetADC();
|
||||||
|
|
||||||
char vstring[32];
|
char vstring[32];
|
||||||
@ -276,8 +284,9 @@ int32_t ttgo_sleeptime;
|
|||||||
|
|
||||||
ttgo_sleeptime = stime;
|
ttgo_sleeptime = stime;
|
||||||
|
|
||||||
|
#ifdef USE_DISPLAY
|
||||||
DisplayOnOff(0);
|
DisplayOnOff(0);
|
||||||
|
#endif
|
||||||
if (ttgo_sleeptime>=0) {
|
if (ttgo_sleeptime>=0) {
|
||||||
// ligh sleep mode
|
// ligh sleep mode
|
||||||
WifiShutdown();
|
WifiShutdown();
|
||||||
@ -311,7 +320,9 @@ int32_t ttgo_sleeptime;
|
|||||||
if (ttgo_sleeptime) {
|
if (ttgo_sleeptime) {
|
||||||
ttgo_globs.lenergy = false;
|
ttgo_globs.lenergy = false;
|
||||||
rtc_clk_cpu_freq_set(RTC_CPU_FREQ_240M);
|
rtc_clk_cpu_freq_set(RTC_CPU_FREQ_240M);
|
||||||
|
#ifdef USE_DISPLAY
|
||||||
DisplayOnOff(1);
|
DisplayOnOff(1);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
while (ttgo_globs.lenergy == true) {
|
while (ttgo_globs.lenergy == true) {
|
||||||
TTGO_loop(0);
|
TTGO_loop(0);
|
||||||
@ -332,7 +343,9 @@ uint8_t data;
|
|||||||
if (ttgo_globs.lenergy) {
|
if (ttgo_globs.lenergy) {
|
||||||
ttgo_globs.lenergy = false;
|
ttgo_globs.lenergy = false;
|
||||||
rtc_clk_cpu_freq_set(RTC_CPU_FREQ_240M);
|
rtc_clk_cpu_freq_set(RTC_CPU_FREQ_240M);
|
||||||
|
#ifdef USE_DISPLAY
|
||||||
DisplayOnOff(1);
|
DisplayOnOff(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_BMA423
|
#ifdef USE_BMA423
|
||||||
|
Loading…
x
Reference in New Issue
Block a user