diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index a259d161b..ffb16bd3e 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -108,8 +108,10 @@ static void onNetworkConnected() } // FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected' +#ifndef MESHTASTIC_EXCLUDE_MQTT if (mqtt) mqtt->reconnect(); +#endif } static int32_t reconnectWiFi() diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index c9416a9b5..091586462 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -26,6 +26,11 @@ #if !MESHTASTIC_EXCLUDE_GPS #include "GPS.h" #endif + +#if MESHTASTIC_EXCLUDE_GPS +#include "modules/PositionModule.h" +#endif + #if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #include "AccelerometerThread.h" #endif @@ -751,7 +756,9 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r if (conn.wifi.status.is_connected) { conn.wifi.rssi = WiFi.RSSI(); conn.wifi.status.ip_address = WiFi.localIP(); +#ifndef MESHTASTIC_EXCLUDE_MQTT conn.wifi.status.is_mqtt_connected = mqtt && mqtt->isConnectedDirectly(); +#endif conn.wifi.status.is_syslog_connected = false; // FIXME wire this up } #endif diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 2e367420a..f3eda6d7c 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -396,6 +396,7 @@ bool MQTT::wantsLink() const int32_t MQTT::runOnce() { +#ifdef HAS_NETWORKING if (!moduleConfig.mqtt.enabled || !(moduleConfig.mqtt.map_reporting_enabled || channels.anyMqttEnabled())) return disable(); @@ -408,7 +409,7 @@ int32_t MQTT::runOnce() publishQueuedMessages(); return 200; } -#ifdef HAS_NETWORKING + else if (!pubSub.loop()) { if (!wantConnection) return 5000; // If we don't want connection now, check again in 5 secs diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index 57f466594..1dd7a389a 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -24,17 +24,23 @@ #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH void setBluetoothEnable(bool enable) { - if (!isWifiAvailable() && config.bluetooth.enabled == true) { - if (!nimbleBluetooth) { - nimbleBluetooth = new NimbleBluetooth(); +#ifndef MESHTASTIC_EXCLUDE_WIFI + if (!isWifiAvailable() && config.bluetooth.enabled == true) +#endif +#ifdef MESHTASTIC_EXCLUDE_WIFI + if (config.bluetooth.enabled == true) +#endif + { + if (!nimbleBluetooth) { + nimbleBluetooth = new NimbleBluetooth(); + } + if (enable && !nimbleBluetooth->isActive()) { + nimbleBluetooth->setup(); + } + // For ESP32, no way to recover from bluetooth shutdown without reboot + // BLE advertising automatically stops when MCU enters light-sleep(?) + // For deep-sleep, shutdown hardware with nimbleBluetooth->deinit(). Requires reboot to reverse } - if (enable && !nimbleBluetooth->isActive()) { - nimbleBluetooth->setup(); - } - // For ESP32, no way to recover from bluetooth shutdown without reboot - // BLE advertising automatically stops when MCU enters light-sleep(?) - // For deep-sleep, shutdown hardware with nimbleBluetooth->deinit(). Requires reboot to reverse - } } #else void setBluetoothEnable(bool enable) {} @@ -214,8 +220,8 @@ void cpuDeepSleep(uint32_t msecToWake) #endif // Not needed because both of the current boards have external pullups - // FIXME change polarity in hw so we can wake on ANY_HIGH instead - that would allow us to use all three buttons (instead of - // just the first) gpio_pullup_en((gpio_num_t)BUTTON_PIN); + // FIXME change polarity in hw so we can wake on ANY_HIGH instead - that would allow us to use all three buttons (instead + // of just the first) gpio_pullup_en((gpio_num_t)BUTTON_PIN); #if SOC_PM_SUPPORT_EXT_WAKEUP #ifdef CONFIG_IDF_TARGET_ESP32