diff --git a/firmware/fiatlux.c b/firmware/fiatlux.c index 2ae2637..20249e9 100644 --- a/firmware/fiatlux.c +++ b/firmware/fiatlux.c @@ -20,6 +20,8 @@ void user_init(void) system_init_config(); + wifi_available_semaphore = xSemaphoreCreateBinary(); + xTaskCreate(wifi_task, "wifi_task", 512, NULL, 2, NULL); } diff --git a/firmware/wifi.cpp b/firmware/wifi.cpp index 5526068..aaf3e8d 100644 --- a/firmware/wifi.cpp +++ b/firmware/wifi.cpp @@ -30,6 +30,7 @@ char *wifi_sta_password = nullptr; char *wifi_ap_ssid = nullptr; char *wifi_ap_password = nullptr; +SemaphoreHandle_t wifi_available_semaphore = nullptr; [[noreturn]] static void dns_task(void *pvParameters) { char *wifi_ap_ip_addr = nullptr; @@ -352,6 +353,8 @@ extern "C" [[noreturn]] void wifi_task(void *pvParameters) { if(wifi_ap_ssid) free(wifi_ap_ssid); if(wifi_ap_password) free(wifi_ap_password); + xSemaphoreGive( wifi_available_semaphore); + while (1) { //monitor connection here vTaskDelay(5000); diff --git a/firmware/wifi.h b/firmware/wifi.h index 58f957c..9fec7da 100644 --- a/firmware/wifi.h +++ b/firmware/wifi.h @@ -5,10 +5,15 @@ #ifndef FIRMWARE_WIFI_H #define FIRMWARE_WIFI_H +#include +#include + #ifdef __cplusplus extern "C" { #endif +extern SemaphoreHandle_t wifi_available_semaphore; + void wifi_task(void *pvParameters); #ifdef __cplusplus