From 7d4c77abfd95c3f73d0630d9bc3dddb532696626 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Fri, 27 Nov 2020 14:49:44 -0800 Subject: [PATCH] Fix for #533 - deinitWifi() will de initialize the radio even if it was never initialized --- src/meshwifi/meshwifi.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/meshwifi/meshwifi.cpp b/src/meshwifi/meshwifi.cpp index a20cebede..71c4d2277 100644 --- a/src/meshwifi/meshwifi.cpp +++ b/src/meshwifi/meshwifi.cpp @@ -50,9 +50,11 @@ void deinitWifi() saving on the 2.4g transceiver. */ - WiFi.mode(WIFI_MODE_NULL); - DEBUG_MSG("WiFi Turned Off\n"); - // WiFi.printDiag(Serial); + if (isWifiAvailable()) { + WiFi.mode(WIFI_MODE_NULL); + DEBUG_MSG("WiFi Turned Off\n"); + // WiFi.printDiag(Serial); + } } // Startup WiFi @@ -118,7 +120,7 @@ void initWifi() } } - if (!MDNS.begin( "Meshtastic" )) { + if (!MDNS.begin("Meshtastic")) { DEBUG_MSG("Error setting up MDNS responder!\n"); while (1) {