sforkowany z mirror/meshtastic-firmware
New method to deinit the wifi stack.
rodzic
b2a6a4000b
commit
066d9d48a4
|
@ -5,6 +5,12 @@
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "meshwifi/meshhttp.h"
|
#include "meshwifi/meshhttp.h"
|
||||||
|
|
||||||
|
void deinitWifi()
|
||||||
|
{
|
||||||
|
WiFi.mode(WIFI_MODE_NULL);
|
||||||
|
DEBUG_MSG("WiFi Turned Off\n");
|
||||||
|
}
|
||||||
|
|
||||||
void initWifi()
|
void initWifi()
|
||||||
{
|
{
|
||||||
strcpy(radioConfig.preferences.wifi_ssid, WiFi_SSID_NAME);
|
strcpy(radioConfig.preferences.wifi_ssid, WiFi_SSID_NAME);
|
||||||
|
@ -68,6 +74,7 @@ void WiFiEvent(WiFiEvent_t event)
|
||||||
|
|
||||||
// Start web server
|
// Start web server
|
||||||
initWebServer();
|
initWebServer();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SYSTEM_EVENT_STA_LOST_IP:
|
case SYSTEM_EVENT_STA_LOST_IP:
|
||||||
DEBUG_MSG("Lost IP address and IP address is reset to 0");
|
DEBUG_MSG("Lost IP address and IP address is reset to 0");
|
||||||
|
|
|
@ -8,5 +8,7 @@ void reconnectWiFi();
|
||||||
|
|
||||||
void initWifi();
|
void initWifi();
|
||||||
|
|
||||||
|
void deinitWifi();
|
||||||
|
|
||||||
void WiFiEvent(WiFiEvent_t event);
|
void WiFiEvent(WiFiEvent_t event);
|
||||||
|
|
||||||
|
|
|
@ -518,6 +518,8 @@ void setBluetoothEnable(bool on)
|
||||||
// ESP_ERROR_CHECK( heap_trace_start(HEAP_TRACE_LEAKS) );
|
// ESP_ERROR_CHECK( heap_trace_start(HEAP_TRACE_LEAKS) );
|
||||||
reinitBluetooth();
|
reinitBluetooth();
|
||||||
|
|
||||||
|
// Don't try to reconnect wifi before bluetooth is configured.
|
||||||
|
// WiFi is initialized from main.cpp in setup() .
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
firstTime = 0;
|
firstTime = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -526,7 +528,8 @@ void setBluetoothEnable(bool on)
|
||||||
} else {
|
} else {
|
||||||
// We have to totally teardown our bluetooth objects to prevent leaks
|
// We have to totally teardown our bluetooth objects to prevent leaks
|
||||||
deinitBLE();
|
deinitBLE();
|
||||||
//WiFi.mode(WIFI_MODE_NULL); // shutdown wifi
|
WiFi.mode(WIFI_MODE_NULL); // shutdown wifi
|
||||||
|
|
||||||
Serial.printf("Shutdown BT: %u heap size\n", ESP.getFreeHeap());
|
Serial.printf("Shutdown BT: %u heap size\n", ESP.getFreeHeap());
|
||||||
// ESP_ERROR_CHECK( heap_trace_stop() );
|
// ESP_ERROR_CHECK( heap_trace_stop() );
|
||||||
// heap_trace_dump();
|
// heap_trace_dump();
|
||||||
|
|
Ładowanie…
Reference in New Issue