Skip to content

Commit 94098f1

Browse files
committed
Report Ethernet/WiFi connectivity changes on serial console
Signed-off-by: John Walicki <[email protected]>
1 parent d787279 commit 94098f1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

WatsonIoT/src/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,10 @@ void NetworkEvent(WiFiEvent_t event) {
668668
eth_connected = true;
669669

670670
// Switch the MQTT connection to Ethernet from WiFi (or initially)
671-
// Preference the Ethernet wired interence if its available
671+
// Preference the Ethernet wired interface if its available
672672
// Disconnect the MQTT session
673673
if( mqtt.connected() ){
674+
Serial.println("Previously connected to WiFi, try to switch the MQTT connection to Ethernet");
674675
mqtt.disconnect();
675676
// No need to call mqtt.setClient(ETH); because ETH is a ETHClient which is not the same class as WiFi client
676677
// Connect2MQTTbroker(); // The MQTT reconnect will be handled by the main loop()
@@ -681,6 +682,7 @@ void NetworkEvent(WiFiEvent_t event) {
681682
eth_connected = false;
682683
// Disconnect the MQTT client
683684
if( mqtt.connected() ){
685+
Serial.println("Previously connected to Ethernet, try to switch the MQTT connection to WiFi");
684686
mqtt.disconnect();
685687
}
686688
break;

0 commit comments

Comments
 (0)