From f4e51674afd5cba57593454e0739653f20f77697 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 27 Oct 2024 19:21:57 -0500 Subject: [PATCH] Cherry picks (#5166) * fix compiler error std::find() * fix wifi/bt connection status * try-fix crash * added 1200baud reset --------- Co-authored-by: mverch67 --- boards/bpi_picow_esp32_s3.json | 2 ++ src/gps/GPS.cpp | 1 + src/modules/AdminModule.cpp | 12 ++++++++---- src/modules/ExternalNotificationModule.cpp | 2 +- src/modules/ExternalNotificationModule.h | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/boards/bpi_picow_esp32_s3.json b/boards/bpi_picow_esp32_s3.json index 9a20dd57f9..75983d8450 100644 --- a/boards/bpi_picow_esp32_s3.json +++ b/boards/bpi_picow_esp32_s3.json @@ -28,6 +28,8 @@ "flash_size": "8MB", "maximum_ram_size": 327680, "maximum_size": 8388608, + "use_1200bps_touch": true, + "wait_for_upload_port": true, "require_upload_port": true, "speed": 921600 }, diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 3a9516c842..2dda776e11 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -20,6 +20,7 @@ #ifdef ARCH_PORTDUINO #include "PortduinoGlue.h" #include "meshUtils.h" +#include #include #endif diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index c0580ab335..90722f5472 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -900,7 +900,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r #ifdef ARCH_PORTDUINO conn.wifi.status.is_connected = true; #else - conn.wifi.status.is_connected = WiFi.status() != WL_CONNECTED; + conn.wifi.status.is_connected = WiFi.status() == WL_CONNECTED; #endif strncpy(conn.wifi.ssid, config.network.wifi_ssid, 33); if (conn.wifi.status.is_connected) { @@ -932,10 +932,14 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r conn.has_bluetooth = true; conn.bluetooth.pin = config.bluetooth.fixed_pin; #ifdef ARCH_ESP32 - conn.bluetooth.is_connected = nimbleBluetooth->isConnected(); - conn.bluetooth.rssi = nimbleBluetooth->getRssi(); + if (config.bluetooth.enabled && nimbleBluetooth) { + conn.bluetooth.is_connected = nimbleBluetooth->isConnected(); + conn.bluetooth.rssi = nimbleBluetooth->getRssi(); + } #elif defined(ARCH_NRF52) - conn.bluetooth.is_connected = nrf52Bluetooth->isConnected(); + if (config.bluetooth.enabled && nrf52Bluetooth) { + conn.bluetooth.is_connected = nrf52Bluetooth->isConnected(); + } #endif #endif conn.has_serial = true; // No serial-less devices diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index a35a742068..87387f0a49 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -184,7 +184,7 @@ int32_t ExternalNotificationModule::runOnce() } #endif // now let the PWM buzzer play - if (moduleConfig.external_notification.use_pwm) { + if (moduleConfig.external_notification.use_pwm && config.device.buzzer_gpio) { if (rtttl::isPlaying()) { rtttl::play(); } else if (isNagging && (nagCycleCutoff >= millis())) { diff --git a/src/modules/ExternalNotificationModule.h b/src/modules/ExternalNotificationModule.h index a5dff36518..20d02d68b6 100644 --- a/src/modules/ExternalNotificationModule.h +++ b/src/modules/ExternalNotificationModule.h @@ -32,7 +32,7 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency: public: ExternalNotificationModule(); - uint32_t nagCycleCutoff = UINT32_MAX; + uint32_t nagCycleCutoff = 1; void setExternalOn(uint8_t index = 0); void setExternalOff(uint8_t index = 0);