@@ -68,21 +68,24 @@ void Network::WiFiReconnected(WiFiEvent_t event, WiFiEventInfo_t info){
6868 player.lockOutput = false ;
6969 delay (100 );
7070 display.putRequest (NEWMODE, PLAYER);
71- if (network.lostPlaying ) player.sendCommand ({PR_PLAY, config.store .lastStation });
71+ if (network.lostPlaying ) {
72+ config.setTitle (const_PlConnect);
73+ player.sendCommand ({PR_PLAY, config.store .lastStation });
74+ }
7275 #ifdef MQTT_ROOT_TOPIC
7376 connectToMqtt ();
7477 #endif
7578}
7679
7780void Network::WiFiLostConnection (WiFiEvent_t event, WiFiEventInfo_t info){
7881 if (!network.beginReconnect ){
79- Serial.println (" Lost connection, reconnecting..." );
82+ Serial.printf (" Lost connection, reconnecting to %s ...\n " , config. ssids [config. store . lastSSID - 1 ]. ssid );
8083 network.lostPlaying = player.isRunning ();
8184 if (network.lostPlaying ) { player.lockOutput = true ; player.sendCommand ({PR_STOP, 0 }); }
8285 display.putRequest (NEWMODE, LOST);
8386 }
8487 network.beginReconnect = true ;
85- WiFi.begin (config.ssids [config.store .lastSSID ].ssid , config.ssids [config.store .lastSSID ].password );
88+ WiFi.begin (config.ssids [config.store .lastSSID - 1 ].ssid , config.ssids [config.store .lastSSID - 1 ].password );
8689}
8790
8891#define DBGAP false
@@ -133,7 +136,7 @@ void Network::begin() {
133136 if (LED_BUILTIN!=255 ) digitalWrite (LED_BUILTIN, LOW);
134137 status = CONNECTED;
135138 WiFi.setSleep (false );
136- WiFi.onEvent (WiFiReconnected, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_CONNECTED );
139+ WiFi.onEvent (WiFiReconnected, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_GOT_IP );
137140 WiFi.onEvent (WiFiLostConnection, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
138141 weatherBuf=NULL ;
139142 trueWeather = false ;
0 commit comments