Sat, 27 Oct 2018 15:55:16 +0200
Boot now checks got IP status before installing the http and vnc servers.
main/brewboard.c | file | annotate | diff | comparison | revisions | |
main/task_wifi.c | file | annotate | diff | comparison | revisions | |
main/task_wifi.h | file | annotate | diff | comparison | revisions |
--- a/main/brewboard.c Fri Oct 26 23:32:32 2018 +0200 +++ b/main/brewboard.c Sat Oct 27 15:55:16 2018 +0200 @@ -19,7 +19,6 @@ extern SemaphoreHandle_t xSemaphoreWiFi; extern WIFI_State *wifi_state; - int Main_Screen = MAIN_MODE_UNKNOWN; ///< Screen number int Old_Screen = MAIN_MODE_UNKNOWN; ///< Previous screen number bool System_TimeOk = false; ///< System time status @@ -82,7 +81,7 @@ TFT_print("Ok\r\n", LASTX, LASTY); // Just to debug, list the /spiffs filesystem. -#if 1 +#if 0 DIR *dir = opendir("/spiffs"); struct dirent* de = readdir(dir); while (de) { @@ -132,7 +131,6 @@ /* lower the wifi logging level */ esp_log_level_set("wifi", ESP_LOG_ERROR); xTaskCreate(&task_wifi, "task_wifi", 4096, NULL, 3, &xTaskWifi); - // Task for MQTT TFT_print(" Ok\r\nConnecting ", LASTX, LASTY); int wait = 20; @@ -140,7 +138,7 @@ vTaskDelay(500 / portTICK_PERIOD_MS); TFT_print(".", LASTX, LASTY); if (xSemaphoreTake(xSemaphoreWiFi, 25) == pdTRUE) { - if (wifi_state->STA_connected == true) + if (wifi_state->STA_online == true) wait = 0; else wait--;
--- a/main/task_wifi.c Fri Oct 26 23:32:32 2018 +0200 +++ b/main/task_wifi.c Sat Oct 27 15:55:16 2018 +0200 @@ -161,6 +161,7 @@ ESP_LOGI(TAG, "Event STA disconnected, turn on AP"); if (xSemaphoreTake(xSemaphoreWiFi, 10) == pdTRUE) { wifi_state->STA_connected = false; + wifi_state->STA_online = false; wifi_state->STA_rssi = 0; xSemaphoreGive(xSemaphoreWiFi); } @@ -185,6 +186,7 @@ memset(&ip, 0, sizeof(tcpip_adapter_ip_info_t)); if (tcpip_adapter_get_ip_info(ESP_IF_WIFI_STA, &ip) == 0) { if (xSemaphoreTake(xSemaphoreWiFi, 10) == pdTRUE) { + wifi_state->STA_online = true; snprintf(wifi_state->STA_ip, 15, IPSTR, IP2STR(&ip.ip)); snprintf(wifi_state->STA_nm, 15, IPSTR, IP2STR(&ip.netmask)); snprintf(wifi_state->STA_gw, 15, IPSTR, IP2STR(&ip.gw)); @@ -200,6 +202,7 @@ wifi_state->STA_ip[0] = '\0'; wifi_state->STA_nm[0] = '\0'; wifi_state->STA_gw[0] = '\0'; + wifi_state->STA_online = false; xSemaphoreGive(xSemaphoreWiFi); } break; @@ -299,6 +302,7 @@ wifi_state->AP_clients = 0; wifi_state->AP_active = false; wifi_state->STA_connected = false; + wifi_state->STA_online = false; wifi_state->STA_rssi = 0; /* wifi scanner config */
--- a/main/task_wifi.h Fri Oct 26 23:32:32 2018 +0200 +++ b/main/task_wifi.h Sat Oct 27 15:55:16 2018 +0200 @@ -30,6 +30,7 @@ bool AP_active; ///< Is the AP active. uint8_t AP_clients; ///< Connected AP clients. bool STA_connected; ///< Connected to AP as station. + bool STA_online; ///< Connected and online. char STA_ssid[33]; ///< Connected to this SSID. int8_t STA_rssi; ///< Signal strength. char STA_ip[16]; ///< IP address.