Skip to content

Commit 6aa2b55

Browse files
committed
os_core: optimize wakeup key hold time
1 parent b4dad20 commit 6aa2b55

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

main/Kconfig.projbuild

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ config ENABLE_WAKEUP_KEY
125125
help
126126
Select this to enable WakeUp Key.
127127

128-
config WAKEUP_KEY_HOLD_TIME
129-
int "WakeUp Key Hold Time (ms)"
130-
default 1000
128+
config WAKEUP_KEY_EXTRA_HOLD_TIME
129+
int "WakeUp Key Extra Hold Time (ms)"
130+
default 0
131131
depends on ENABLE_WAKEUP_KEY
132132

133133
choice WAKEUP_KEY_ACTIVE_LEVEL

main/src/os/core.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,18 @@ void os_enter_sleep_mode(void)
3636
void core_init(void)
3737
{
3838
#ifdef CONFIG_ENABLE_WAKEUP_KEY
39-
portTickType xLastWakeTime = xTaskGetTickCount();
40-
39+
ESP_LOGI(TAG, "checking wakeup cause");
4140
if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_UNDEFINED) {
42-
vTaskDelayUntil(&xLastWakeTime, CONFIG_WAKEUP_KEY_HOLD_TIME / portTICK_RATE_MS);
41+
vTaskDelay(CONFIG_WAKEUP_KEY_EXTRA_HOLD_TIME / portTICK_RATE_MS);
4342

4443
#ifdef CONFIG_WAKEUP_KEY_ACTIVE_LOW
4544
if (gpio_get_level(CONFIG_WAKEUP_KEY_PIN) == 0) {
4645
#else
4746
if (gpio_get_level(CONFIG_WAKEUP_KEY_PIN) == 1) {
4847
#endif
49-
ESP_LOGI(TAG, "wakeup from sleep mode");
48+
ESP_LOGI(TAG, "resuming from sleep mode");
5049
} else {
51-
ESP_LOGI(TAG, "wakeup aborted");
50+
ESP_LOGI(TAG, "resume aborted");
5251

5352
os_enter_sleep_mode();
5453
}

0 commit comments

Comments
 (0)