mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/ot_sleep_idle_time' into 'master'
fix(ci): Add a timer to print ot sleepy device status See merge request espressif/esp-idf!26352
This commit is contained in:
commit
d7aa99ac2d
@ -28,6 +28,13 @@
|
||||
#include "openthread/logging.h"
|
||||
#include "openthread/thread.h"
|
||||
|
||||
#if CONFIG_ESP_SLEEP_DEBUG
|
||||
#include "esp_timer.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_private/esp_pmu.h"
|
||||
#include "esp_private/esp_sleep_internal.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#include "esp_pm.h"
|
||||
#endif
|
||||
@ -68,6 +75,17 @@ static esp_netif_t *init_openthread_netif(const esp_openthread_platform_config_t
|
||||
return netif;
|
||||
}
|
||||
|
||||
#if CONFIG_ESP_SLEEP_DEBUG
|
||||
static esp_sleep_context_t s_sleep_ctx;
|
||||
|
||||
static void print_sleep_flag(void *arg)
|
||||
{
|
||||
ESP_LOGD(TAG, "sleep_flags %lu", s_sleep_ctx.sleep_flags);
|
||||
ESP_LOGD(TAG, "PMU_SLEEP_PD_TOP: %s", (s_sleep_ctx.sleep_flags & PMU_SLEEP_PD_TOP) ? "True":"False");
|
||||
ESP_LOGD(TAG, "PMU_SLEEP_PD_MODEM: %s", (s_sleep_ctx.sleep_flags & PMU_SLEEP_PD_MODEM) ? "True":"False");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ot_task_worker(void *aContext)
|
||||
{
|
||||
esp_openthread_platform_config_t config = {
|
||||
@ -90,6 +108,23 @@ static void ot_task_worker(void *aContext)
|
||||
|
||||
create_config_network(esp_openthread_get_instance());
|
||||
|
||||
#if CONFIG_ESP_SLEEP_DEBUG
|
||||
esp_sleep_set_sleep_context(&s_sleep_ctx);
|
||||
esp_log_level_set(TAG, ESP_LOG_DEBUG);
|
||||
|
||||
// create a timer to print the status of sleepy device
|
||||
int periods = 2000;
|
||||
const esp_timer_create_args_t timer_args = {
|
||||
.name = "print_sleep_flag",
|
||||
.arg = NULL,
|
||||
.callback = &print_sleep_flag,
|
||||
.skip_unhandled_events = true,
|
||||
};
|
||||
esp_timer_handle_t periodic_timer;
|
||||
ESP_ERROR_CHECK(esp_timer_create(&timer_args, &periodic_timer));
|
||||
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, periods * 1000));
|
||||
#endif
|
||||
|
||||
// Run the main loop
|
||||
esp_openthread_launch_mainloop();
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
CONFIG_IDF_TARGET="esp32c6"
|
||||
CONFIG_IDF_TARGET_ESP32C6=y
|
||||
CONFIG_OPENTHREAD_NETWORK_CHANNEL=12
|
||||
CONFIG_OPENTHREAD_NETWORK_MASTERKEY="aabbccddeeff00112233445566778899"
|
||||
CONFIG_ESP_SLEEP_DEBUG=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
|
@ -3,4 +3,4 @@ CONFIG_IDF_TARGET_ESP32H2=y
|
||||
CONFIG_OPENTHREAD_NETWORK_CHANNEL=12
|
||||
CONFIG_OPENTHREAD_NETWORK_MASTERKEY="aabbccddeeff00112233445566778899"
|
||||
CONFIG_ESP_SLEEP_DEBUG=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
|
||||
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
||||
|
@ -577,14 +577,13 @@ def test_ot_sleepy_device(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
leader_para.setextpanid('dead00beef00cafe')
|
||||
leader_para.setnetworkkey('aabbccddeeff00112233445566778899')
|
||||
leader_para.setpskc('104810e2315100afd6bc9215a6bfac53')
|
||||
ocf.clean_buffer(sleepy_device)
|
||||
ocf.joinThreadNetwork(leader, leader_para)
|
||||
ocf.wait(leader, 5)
|
||||
ocf.clean_buffer(sleepy_device)
|
||||
sleepy_device.serial.hard_reset()
|
||||
sleepy_device.expect('detached -> child', timeout=20)
|
||||
sleepy_device.expect('PMU_SLEEP_PD_TOP: True', timeout=10)
|
||||
sleepy_device.expect('PMU_SLEEP_PD_MODEM: True', timeout=20)
|
||||
ocf.clean_buffer(sleepy_device)
|
||||
output = sleepy_device.expect(pexpect.TIMEOUT, timeout=5)
|
||||
assert 'rst:' not in str(output) and 'boot:' not in str(output)
|
||||
finally:
|
||||
|
Loading…
Reference in New Issue
Block a user