Skip to content
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

esp_pm_light_sleep_register_cbs not work ? (IDFGH-14470) #15244

Open
ArvinHou opened this issue Jan 21, 2025 · 0 comments
Open

esp_pm_light_sleep_register_cbs not work ? (IDFGH-14470) #15244

ArvinHou opened this issue Jan 21, 2025 · 0 comments
Assignees
Labels
Status: Opened Issue is new

Comments

@ArvinHou
Copy link

IDF v5.4
ESP32

already enable light sleep callback option in menuconfig

the func esp_pm_light_sleep_register_cbs register functions,but don't run when enter and after light sleep mode?
the code as below:

esp_err_t before_sleep_callback(int64_t sleep_time_us, void *arg)
{
    ESP_LOGI(TAG, "Entering light sleep mode,%lld",sleep_time_us);
    // led1^=1;
    // gpio_set_level(18, led1);
    return -1;
}
 

esp_err_t after_wake_up_callback(int64_t sleep_time_us, void *arg)
{
    ESP_LOGI(TAG, "Woken up from light sleep mode,%lld",sleep_time_us);
    // led2^=1;
    // gpio_set_level(4, led2);
    return -1;
}
esp_pm_sleep_cbs_register_config_t pm_callbacks = {
        .enter_cb = before_sleep_callback,
        .exit_cb = after_wake_up_callback,
        .enter_cb_prior=5,
        .exit_cb_prior=5,
        .enter_cb_user_arg=0,
        .exit_cb_user_arg=0
    };
 
    esp_err_t ret = esp_pm_light_sleep_register_cbs(&pm_callbacks);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "Failed to register power management callbacks: %s", esp_err_to_name(ret));
    }

esp_sleep_enable_timer_wakeup(1000000);
while (true) {
    uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);

    /* Enter sleep mode */
        esp_light_sleep_start();

  vTaskDelay(100);
    
}

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 21, 2025
@github-actions github-actions bot changed the title esp_pm_light_sleep_register_cbs not work ? esp_pm_light_sleep_register_cbs not work ? (IDFGH-14470) Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

3 participants