kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
Stop crash if not enabled or in AP mode
rodzic
87be88c19a
commit
7f436d54db
|
@ -2130,7 +2130,9 @@ void loopDecoder() {
|
|||
tncclient.write(raw, rawlen);
|
||||
}
|
||||
}
|
||||
sondehub_send_data(&shclient, s, &sonde.config.sondehub);
|
||||
if (sonde.config.sondehub.active) {
|
||||
sondehub_send_data(&shclient, s, &sonde.config.sondehub);
|
||||
}
|
||||
}
|
||||
|
||||
// send to MQTT if enabled
|
||||
|
@ -2315,6 +2317,9 @@ String translateEncryptionType(wifi_auth_mode_t encryptionType) {
|
|||
}
|
||||
}
|
||||
|
||||
enum t_wifi_state { WIFI_DISABLED, WIFI_SCAN, WIFI_CONNECT, WIFI_CONNECTED, WIFI_APMODE };
|
||||
|
||||
static t_wifi_state wifi_state = WIFI_DISABLED;
|
||||
|
||||
void enableNetwork(bool enable) {
|
||||
if (enable) {
|
||||
|
@ -2334,8 +2339,10 @@ void enableNetwork(bool enable) {
|
|||
mqttclient.init(sonde.config.mqtt.host, sonde.config.mqtt.port, sonde.config.mqtt.id, sonde.config.mqtt.username, sonde.config.mqtt.password, sonde.config.mqtt.prefix);
|
||||
}
|
||||
|
||||
//shclient.setInsecure(); // Skip verification
|
||||
sondehub_station_update(&shclient, &sonde.config.sondehub);
|
||||
if (sonde.config.sondehub.active && wifi_state != WIFI_APMODE) {
|
||||
sondehub_station_update(&shclient, &sonde.config.sondehub);
|
||||
}
|
||||
|
||||
connected = true;
|
||||
} else {
|
||||
MDNS.end();
|
||||
|
@ -2343,11 +2350,6 @@ void enableNetwork(bool enable) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
enum t_wifi_state { WIFI_DISABLED, WIFI_SCAN, WIFI_CONNECT, WIFI_CONNECTED, WIFI_APMODE };
|
||||
|
||||
static t_wifi_state wifi_state = WIFI_DISABLED;
|
||||
|
||||
// Events used only for debug output right now
|
||||
void WiFiEvent(WiFiEvent_t event)
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue