Merge branch 'master' into tft-gui-work

This commit is contained in:
Manuel 2024-06-06 21:17:07 +02:00 committed by GitHub
commit d49fd46f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 13 deletions

View File

@ -108,8 +108,10 @@ static void onNetworkConnected()
} }
// FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected' // FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected'
#ifndef MESHTASTIC_EXCLUDE_MQTT
if (mqtt) if (mqtt)
mqtt->reconnect(); mqtt->reconnect();
#endif
} }
static int32_t reconnectWiFi() static int32_t reconnectWiFi()

View File

@ -26,6 +26,11 @@
#if !MESHTASTIC_EXCLUDE_GPS #if !MESHTASTIC_EXCLUDE_GPS
#include "GPS.h" #include "GPS.h"
#endif #endif
#if MESHTASTIC_EXCLUDE_GPS
#include "modules/PositionModule.h"
#endif
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
#include "AccelerometerThread.h" #include "AccelerometerThread.h"
#endif #endif
@ -751,7 +756,9 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
if (conn.wifi.status.is_connected) { if (conn.wifi.status.is_connected) {
conn.wifi.rssi = WiFi.RSSI(); conn.wifi.rssi = WiFi.RSSI();
conn.wifi.status.ip_address = WiFi.localIP(); conn.wifi.status.ip_address = WiFi.localIP();
#ifndef MESHTASTIC_EXCLUDE_MQTT
conn.wifi.status.is_mqtt_connected = mqtt && mqtt->isConnectedDirectly(); conn.wifi.status.is_mqtt_connected = mqtt && mqtt->isConnectedDirectly();
#endif
conn.wifi.status.is_syslog_connected = false; // FIXME wire this up conn.wifi.status.is_syslog_connected = false; // FIXME wire this up
} }
#endif #endif

View File

@ -396,6 +396,7 @@ bool MQTT::wantsLink() const
int32_t MQTT::runOnce() int32_t MQTT::runOnce()
{ {
#ifdef HAS_NETWORKING
if (!moduleConfig.mqtt.enabled || !(moduleConfig.mqtt.map_reporting_enabled || channels.anyMqttEnabled())) if (!moduleConfig.mqtt.enabled || !(moduleConfig.mqtt.map_reporting_enabled || channels.anyMqttEnabled()))
return disable(); return disable();
@ -408,7 +409,7 @@ int32_t MQTT::runOnce()
publishQueuedMessages(); publishQueuedMessages();
return 200; return 200;
} }
#ifdef HAS_NETWORKING
else if (!pubSub.loop()) { else if (!pubSub.loop()) {
if (!wantConnection) if (!wantConnection)
return 5000; // If we don't want connection now, check again in 5 secs return 5000; // If we don't want connection now, check again in 5 secs

View File

@ -24,17 +24,23 @@
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH
void setBluetoothEnable(bool enable) void setBluetoothEnable(bool enable)
{ {
if (!isWifiAvailable() && config.bluetooth.enabled == true) { #ifndef MESHTASTIC_EXCLUDE_WIFI
if (!nimbleBluetooth) { if (!isWifiAvailable() && config.bluetooth.enabled == true)
nimbleBluetooth = new NimbleBluetooth(); #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 #else
void setBluetoothEnable(bool enable) {} void setBluetoothEnable(bool enable) {}
@ -214,8 +220,8 @@ void cpuDeepSleep(uint32_t msecToWake)
#endif #endif
// Not needed because both of the current boards have external pullups // 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 // FIXME change polarity in hw so we can wake on ANY_HIGH instead - that would allow us to use all three buttons (instead
// just the first) gpio_pullup_en((gpio_num_t)BUTTON_PIN); // of just the first) gpio_pullup_en((gpio_num_t)BUTTON_PIN);
#if SOC_PM_SUPPORT_EXT_WAKEUP #if SOC_PM_SUPPORT_EXT_WAKEUP
#ifdef CONFIG_IDF_TARGET_ESP32 #ifdef CONFIG_IDF_TARGET_ESP32