27 extern WIFI_State *wifi_state; ///< WiFi state |
27 extern WIFI_State *wifi_state; ///< WiFi state |
28 extern EventGroupHandle_t xEventGroupUser; |
28 extern EventGroupHandle_t xEventGroupUser; |
29 extern bool _wifi_ScanDone; |
29 extern bool _wifi_ScanDone; |
30 extern int8_t _wifi_RSSI; |
30 extern int8_t _wifi_RSSI; |
31 extern int count_pub; ///< Published MQTT messages in transit |
31 extern int count_pub; ///< Published MQTT messages in transit |
32 extern uint32_t AlarmTimer; ///< Alarm timer |
32 extern uint32_t LoopTimer; ///< Loop timer |
33 extern uint32_t err_connect; ///< Connect error counter |
33 extern uint32_t err_connect; ///< Connect error counter |
34 |
34 |
35 char hostname[32]; |
35 char hostname[32]; |
36 char uuid[37]; |
36 char uuid[37]; |
37 |
37 |
169 switch (Main_Loop1) { |
169 switch (Main_Loop1) { |
170 case ML1_INIT: |
170 case ML1_INIT: |
171 Main_Loop1 = ML1_CONNECT; |
171 Main_Loop1 = ML1_CONNECT; |
172 request_ds18b20(); |
172 request_ds18b20(); |
173 request_adc(); |
173 request_adc(); |
174 AlarmTimer = 30 * 100; |
174 LoopTimer = MAINLOOP_TIMER; |
175 if (! ready_WiFi()) { /* If WiFi was lost, try a new connection */ |
175 if (! ready_WiFi()) { /* If WiFi was lost, try a new connection */ |
176 ESP_LOGI(TAG, "Try WiFi restore"); |
176 ESP_LOGI(TAG, "Try WiFi restore"); |
177 request_WiFi(); |
177 request_WiFi(); |
178 err_connect++; |
178 err_connect++; |
179 } |
179 } |