sforkowany z mirror/meshtastic-firmware
Fix to turn WiFi back on after the bluetooth radio is reenabled.
rodzic
e508306395
commit
f5c939fb10
11
src/main.cpp
11
src/main.cpp
|
@ -427,15 +427,6 @@ void loop()
|
|||
// TODO: This should go into a thread handled by FreeRTOS.
|
||||
handleWebResponse();
|
||||
#endif
|
||||
/*
|
||||
const char *wifiName = radioConfig.preferences.wifi_ssid;
|
||||
const char *wifiPsw = radioConfig.preferences.wifi_password;
|
||||
Serial.print("-------------------");
|
||||
Serial.print(wifiName);
|
||||
Serial.print(" ");
|
||||
Serial.println(wifiPsw);
|
||||
Serial.println("+++++++++++++++++++");
|
||||
Serial.println("");
|
||||
*/
|
||||
|
||||
delay(msecstosleep);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ void initWifi()
|
|||
DEBUG_MSG("Not using WIFI\n");
|
||||
}
|
||||
|
||||
|
||||
void WiFiEvent(WiFiEvent_t event)
|
||||
{
|
||||
DEBUG_MSG("************ [WiFi-event] event: %d ************\n", event);
|
||||
|
@ -124,9 +125,17 @@ void WiFiEvent(WiFiEvent_t event)
|
|||
}
|
||||
|
||||
void reconnectWiFi() {
|
||||
if ( WiFi.status() != WL_CONNECTED ) {
|
||||
DEBUG_MSG("... Reconnecting to WiFi access point");
|
||||
WiFi.begin( );
|
||||
}
|
||||
const char *wifiName = radioConfig.preferences.wifi_ssid;
|
||||
const char *wifiPsw = radioConfig.preferences.wifi_password;
|
||||
|
||||
if (radioConfig.has_preferences) {
|
||||
|
||||
if (*wifiName) {
|
||||
|
||||
DEBUG_MSG("... Reconnecting to WiFi access point");
|
||||
|
||||
WiFi.mode(WIFI_MODE_STA);
|
||||
WiFi.begin(wifiName, wifiPsw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "services/gap/ble_svc_gap.h"
|
||||
#include "services/gatt/ble_svc_gatt.h"
|
||||
#include <Arduino.h>
|
||||
#include "meshwifi/meshwifi.h"
|
||||
|
||||
static bool pinShowing;
|
||||
|
||||
|
@ -503,6 +504,7 @@ void reinitBluetooth()
|
|||
}
|
||||
|
||||
bool bluetoothOn;
|
||||
bool firstTime = 1;
|
||||
|
||||
// Enable/disable bluetooth.
|
||||
void setBluetoothEnable(bool on)
|
||||
|
@ -515,7 +517,12 @@ void setBluetoothEnable(bool on)
|
|||
Serial.printf("Pre BT: %u heap size\n", ESP.getFreeHeap());
|
||||
// ESP_ERROR_CHECK( heap_trace_start(HEAP_TRACE_LEAKS) );
|
||||
reinitBluetooth();
|
||||
//initWifi();
|
||||
|
||||
if (firstTime) {
|
||||
firstTime = 0;
|
||||
} else {
|
||||
reconnectWiFi();
|
||||
}
|
||||
} else {
|
||||
// We have to totally teardown our bluetooth objects to prevent leaks
|
||||
deinitBLE();
|
||||
|
|
Ładowanie…
Reference in New Issue