wifi working async

This commit is contained in:
Daan Meijer 2025-01-24 22:53:18 +01:00
parent ef73f2c7ac
commit b4f71f60fa
2 changed files with 21 additions and 10 deletions

View File

@ -9,7 +9,7 @@
#define _TASK_STATUS_REQUEST // Compile with support for StatusRequest functionality - triggering tasks on status change events in addition to time only
// #define ENABLE_MQTT
// #define ENABLE_WIFI
#define ENABLE_WIFI
// #define ENABLE_FS
// #define ENABLE_PINFINDER
#define ENABLE_COLORS

View File

@ -20,16 +20,18 @@ void Wifi_setup_softap(){
}
void Wifi_setup(){
void Wifi_loop(void* params){
Serial.println("Wifi_setup()");
WiFi.mode(WIFI_STA);
//TODO:
WiFi.begin(WIFI_ESSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
while (true)
{
while (WiFi.status() != WL_CONNECTED)
{
vTaskDelay(500 / portTICK_PERIOD_MS);
Serial.println("Wifi waiting...");
}
Serial.println("");
@ -37,4 +39,13 @@ void Wifi_setup(){
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
vTaskDelay(60*1000 / portTICK_PERIOD_MS);
}
}
void Wifi_setup(){
TaskHandle_t taskWifi = NULL;
xTaskCreate(Wifi_loop, "Wifi_loop", 10000, NULL, tskIDLE_PRIORITY, &taskWifi);
}