wifi working async
This commit is contained in:
parent
ef73f2c7ac
commit
b4f71f60fa
@ -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 _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_MQTT
|
||||||
// #define ENABLE_WIFI
|
#define ENABLE_WIFI
|
||||||
// #define ENABLE_FS
|
// #define ENABLE_FS
|
||||||
// #define ENABLE_PINFINDER
|
// #define ENABLE_PINFINDER
|
||||||
#define ENABLE_COLORS
|
#define ENABLE_COLORS
|
||||||
|
|||||||
29
src/Wifi.cpp
29
src/Wifi.cpp
@ -20,21 +20,32 @@ 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);
|
||||||
|
|
||||||
Serial.println("Wifi_setup()");
|
while (true)
|
||||||
WiFi.mode(WIFI_STA);
|
{
|
||||||
//TODO:
|
while (WiFi.status() != WL_CONNECTED)
|
||||||
WiFi.begin(WIFI_ESSID, WIFI_PASSWORD);
|
{
|
||||||
|
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
Serial.println("Wifi waiting...");
|
||||||
delay(500);
|
|
||||||
Serial.print(".");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
Serial.println("WiFi connected");
|
Serial.println("WiFi connected");
|
||||||
Serial.println("IP address: ");
|
Serial.println("IP address: ");
|
||||||
Serial.println(WiFi.localIP());
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user