-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32-S3: How to know the device has been in light-sleep mode? (IDFGH-14254) #15048
Comments
The below is my code in which I have merged "wifi/power_save" and "console/basic": This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this #include <stdio.h> /*
static const char* TAG = "example"; /* Console command history can be stored to and loaded from a file.
#define MOUNT_PATH "/data" static void initialize_filesystem(void) static void initialize_nvs(void) #include <stdio.h> #include "esp_sleep.h" #define GPIO_WAKEUP_NUM 20 #include <string.h> #define DEFAULT_LISTEN_INTERVAL 3 #if CONFIG_EXAMPLE_POWER_SAVE_MIN_MODEM static void event_handler(void* arg, esp_event_base_t event_base, /init wifi as sta and set power save mode/
} static void sleep_wait_gpio_inactive(void)
} static void test_thread(void *param)
} void app_main(void)
#if CONFIG_CONSOLE_STORE_HISTORY
#if SOC_LIGHT_SLEEP_SUPPORTED #if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) || defined(CONFIG_ESP_CONSOLE_UART_CUSTOM) #elif defined(CONFIG_ESP_CONSOLE_USB_CDC) #elif defined(CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG) #else
#if CONFIG_PM_ENABLE
// xTaskCreate(test_thread, ((const char *)"test_thread"), 4096, NULL, tskIDLE_PRIORITY + 1, NULL); |
The logs as below: |
Even if it is set to WIFI_PS_MAX_MODEM, it can not know if the device is in the light-sleep mode. Is it because the device enters the light-sleep mode and goes out of the light-sleep mode too fast? only we can know it by capturing them with a power consumption measuring device? But even I enlarge the listening interval and beacon timeout, it doesn't enter light-sleep yet. #define DEFAULT_LISTEN_INTERVAL 2000 |
The source codes: The dumping log: |
Now I can observe the light-sleep mode by changing AP's parameters, therefore close this ticket. |
Answers checklist.
IDF version.
v5.2
Espressif SoC revision.
ESP32-S3
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32 V5.2
Power Supply used.
USB
What is the expected behavior?
I expected that the device entered the light-sleep mode.
What is the actual behavior?
Instead it could not be sure if the device was in the light-sleep mode.
Steps to reproduce.
I just compiled the sample code of "wifi/power_save". For the convenience of testing, I only modified the SSID and password in the code to our own ones, without changing any other code. Then, I flashed the firmware (FW) onto the device.
However, I didn't find any logs indicating that the device had entered the light sleep mode. Moreover, I could ping the device at any time. Since the simple code didn't include console configuration, I couldn't input anything via the console. Therefore, I'm not sure whether the device is actually in the light-sleep mode.
A. If the WiFi function is disabled:
After the device boots up, it's impossible to input anything into the console, which seems to be in line with our expectations. I guess it's in the sleep mode.
B. If the WiFi function is enabled:
After the device boots up, it's possible to input and output via the console all the time, and I can ping the device at any time.
The sample code of "wifi/power_save" is released along with the SDK package. I think it should have been well verified. Perhaps the behavior in the sleep mode doesn't match my expectations. So, please help me by giving some suggestions on how to tell whether the device is in the sleep mode.
Debug Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: