Fix missing IFNDEF and IFDEF in main-esp32.cpp when EXCLUDE_WIFI is defined.

Moved IFDEF HAS_NETWORK to beginning of MQTT:runOnce (to catch when EXCLUDE_WIFI is defined)
This commit is contained in:
Talie5in 2024-06-06 22:52:11 +09:30
parent 1f9f885aca
commit a5c96a29d5
2 changed files with 128 additions and 122 deletions

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,7 +24,12 @@
#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)
{ {
#ifndef MESHTASTIC_EXCLUDE_WIFI
if (!isWifiAvailable() && config.bluetooth.enabled == true) { if (!isWifiAvailable() && config.bluetooth.enabled == true) {
#endif
#ifdef MESHTASTIC_EXCLUDE_WIFI
if (config.bluetooth.enabled == true) {
#endif
if (!nimbleBluetooth) { if (!nimbleBluetooth) {
nimbleBluetooth = new NimbleBluetooth(); nimbleBluetooth = new NimbleBluetooth();
} }
@ -214,8 +219,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