"WIFI roaming" by channel scan (AP switching at low RSSI) (#2120)

* Activate 802.11kv wifi mesh roaming

* Activate roaming by scanning

* Revert stack reducation
This commit is contained in:
Slider0007
2023-03-04 11:49:08 +01:00
committed by GitHub
parent 39b8b5b07c
commit 6ca7897fa0
7 changed files with 253 additions and 68 deletions

View File

@@ -909,11 +909,11 @@ void task_autodoFlow(void *pvParameter)
LogFile.RemoveOldDataLog();
}
//Round finished -> Logfile
// Round finished -> Logfile
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Round #" + std::to_string(countRounds) +
" completed (" + std::to_string(getUpTime() - roundStartTime) + " seconds)");
//CPU Temp -> Logfile
// CPU Temp -> Logfile
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CPU Temperature: " + std::to_string((int)temperatureRead()) + "°C");
// WIFI Signal Strength (RSSI) -> Logfile
@@ -925,6 +925,16 @@ void task_autodoFlow(void *pvParameter)
StatusLED(TIME_CHECK, 1, false);
}
#if (defined WLAN_USE_MESH_ROAMING && defined WLAN_USE_MESH_ROAMING_ACTIVATE_CLIENT_TRIGGERED_QUERIES)
wifiRoamingQuery();
#endif
// Scan channels and check if an AP with better RSSI is available, then disconnect and try to reconnect to AP with better RSSI
// NOTE: Keep this direct before the following task delay, because scan is done in blocking mode and this takes ca. 1,5 - 2s.
#ifdef WLAN_USE_ROAMING_BY_SCANNING
wifiRoamByScanning();
#endif
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
if (auto_interval > fr_delta_ms)
{
@@ -945,11 +955,12 @@ void TFliteDoAutoStart()
ESP_LOGD(TAG, "getESPHeapInfo: %s", getESPHeapInfo().c_str());
xReturned = xTaskCreatePinnedToCore(&task_autodoFlow, "task_autodoFlow", 16 * 1024, NULL, tskIDLE_PRIORITY+2, &xHandletask_autodoFlow, 0);
//xReturned = xTaskCreate(&task_autodoFlow, "task_autodoFlow", 16 * 1024, NULL, tskIDLE_PRIORITY+2, &xHandletask_autodoFlow);
uint32_t stackSize = 16 * 1024;
xReturned = xTaskCreatePinnedToCore(&task_autodoFlow, "task_autodoFlow", stackSize, NULL, tskIDLE_PRIORITY+2, &xHandletask_autodoFlow, 0);
if( xReturned != pdPASS )
{
ESP_LOGD(TAG, "ERROR task_autodoFlow konnte nicht erzeugt werden!");
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Creation task_autodoFlow failed. Requested stack size:" + std::to_string(stackSize));
LogFile.WriteHeapInfo("Creation task_autodoFlow failed");
}
ESP_LOGD(TAG, "getESPHeapInfo: %s", getESPHeapInfo().c_str());
}