forked from espressif/esp-idf
example: add example for beacon sample feature
This commit is contained in:
@@ -145,4 +145,8 @@ menu "Example Configuration"
|
|||||||
default 26 if EXAMPLE_MIN_CPU_FREQ_26M
|
default 26 if EXAMPLE_MIN_CPU_FREQ_26M
|
||||||
default 13 if EXAMPLE_MIN_CPU_FREQ_13M
|
default 13 if EXAMPLE_MIN_CPU_FREQ_13M
|
||||||
|
|
||||||
|
config EXAMPLE_POWER_SAVE_RESAMPLE
|
||||||
|
bool "Resample beacon when beacon loss is unstable"
|
||||||
|
depends on ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@@ -58,6 +58,12 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
|||||||
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||||
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
|
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
|
||||||
ESP_LOGI(TAG, "got ip: " IPSTR, IP2STR(&event->ip_info.ip));
|
ESP_LOGI(TAG, "got ip: " IPSTR, IP2STR(&event->ip_info.ip));
|
||||||
|
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_BEACON_OFFSET_UNSTABLE) {
|
||||||
|
wifi_event_sta_beacon_offset_unstable_t* event = (wifi_event_sta_beacon_offset_unstable_t*)event_data;
|
||||||
|
ESP_LOGI(TAG, "unstable sample, beacon success rate: %.4f", event->beacon_success_rate);
|
||||||
|
#if CONFIG_EXAMPLE_POWER_SAVE_RESAMPLE
|
||||||
|
esp_wifi_beacon_offset_sample_beacon();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user