Skip to content

Commit

Permalink
Output RSSI to console log on WIFI connection
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartpittaway committed Nov 6, 2023
1 parent 178a611 commit e6b128e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ESPController/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,11 @@ static void event_handler(void *, esp_event_base_t event_base,
{
// We have joined the access point - now waiting for IP address IP_EVENT_STA_GOT_IP
wifi_ap_connect_retry_num = 0;

wifi_ap_record_t ap;
esp_wifi_sta_get_ap_info(&ap);

ESP_LOGI(TAG, "WIFI_EVENT_STA_CONNECTED channel=%u, rssi=%i", ap.primary, ap.rssi);
}
else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED)
{
Expand All @@ -1620,7 +1625,7 @@ static void event_handler(void *, esp_event_base_t event_base,

if (wifi_ap_connect_retry_num < 25)
{
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_connect());
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_connect());
ESP_LOGI(TAG, "WIFI connect quick retry %i", wifi_ap_connect_retry_num);
}
else
Expand All @@ -1634,11 +1639,7 @@ static void event_handler(void *, esp_event_base_t event_base,
ESP_LOGI(TAG, "IP_EVENT_STA_LOST_IP");

ShutdownAllNetworkServices();
// ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_disconnect());
wake_up_tft(true);

// Try and reconnect
// esp_wifi_connect();
}
else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP)
{
Expand Down Expand Up @@ -3759,7 +3760,6 @@ ESP32 Chip model = %u, Rev %u, Cores=%u, Features=%u)",

InitializeNVS();


if (!LittleFS.begin(false))
{
ESP_LOGE(TAG, "LittleFS mount failed, did you upload file system image?");
Expand Down

0 comments on commit e6b128e

Please sign in to comment.