light sleep on button press improving power consumption

This commit is contained in:
Alberto Merciai
2020-07-10 18:17:30 +02:00
parent 727495b03c
commit 7b17cd2f02

View File

@@ -85,6 +85,12 @@ void low_energy()
WiFi.mode(WIFI_OFF);
// rtc_clk_cpu_freq_set(RTC_CPU_FREQ_2M);
setCpuFrequencyMhz(20);
Serial.println("ENTER IN LIGHT SLEEEP 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);
esp_sleep_enable_gpio_wakeup ();
esp_light_sleep_start();
}
} else {
ttgo->startLvglTick();