diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a2c56fad9..f546d4cfd 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,7 +1,7 @@ # trunk-ignore-all(terrascan/AC_DOCKER_0002): Known terrascan issue # trunk-ignore-all(hadolint/DL3008): Do not pin apt package versions # trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions -FROM mcr.microsoft.com/devcontainers/cpp:2-debian-12 +FROM mcr.microsoft.com/devcontainers/cpp:2-debian-13 USER root diff --git a/alpine.Dockerfile b/alpine.Dockerfile index 0469874e4..bdee57d79 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -8,7 +8,8 @@ ARG PIO_ENV=native ENV PIP_ROOT_USER_ACTION=ignore RUN apk --no-cache add \ - bash g++ libstdc++-dev linux-headers zip git ca-certificates libgpiod-dev yaml-cpp-dev bluez-dev \ + bash g++ libstdc++-dev linux-headers zip git ca-certificates libbsd-dev \ + libgpiod-dev yaml-cpp-dev bluez-dev \ libusb-dev i2c-tools-dev libuv-dev openssl-dev pkgconf argp-standalone \ libx11-dev libinput-dev libxkbcommon-dev \ && rm -rf /var/cache/apk/* \ @@ -40,8 +41,8 @@ LABEL org.opencontainers.image.title="Meshtastic" \ USER root RUN apk --no-cache add \ - shadow libstdc++ libgpiod yaml-cpp libusb i2c-tools libuv \ - libx11 libinput libxkbcommon \ + shadow libstdc++ libbsd libgpiod yaml-cpp libusb \ + i2c-tools libuv libx11 libinput libxkbcommon \ && rm -rf /var/cache/apk/* \ && mkdir -p /var/lib/meshtasticd \ && mkdir -p /etc/meshtasticd/config.d \ diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 36effe017..e60d47ce7 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -7,7 +7,7 @@ extends = arduino_base platform_packages = ; our custom Git version until they merge our PR # TODO renovate - platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino#e13f5820002a4fb2a5e6754b42ace185277e5adf + platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino#c770c8a16a351b55b86e347a3d9d7b74ad0bbf39 ; Don't renovate toolchain-gccarmnoneeabi platformio/toolchain-gccarmnoneeabi@~1.90301.0 diff --git a/bin/device-install.bat b/bin/device-install.bat index 9c206d718..519073b08 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -15,12 +15,12 @@ SET "LOGCOUNTER=0" SET "BPS_RESET=0" @REM FIXME: Determine mcu from PlatformIO variant, this is unmaintainable. -SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone t-eth-elite tlora-pager mesh-tab dreamcatcher ESP32-S3-Pico seeed-sensecap-indicator heltec_capsule_sensor_v3 vision-master icarus tracksenger elecrow-adv" +SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone t-eth-elite tlora-pager mesh-tab dreamcatcher ESP32-S3-Pico seeed-sensecap-indicator heltec_capsule_sensor_v3 vision-master icarus tracksenger elecrow-adv heltec-v4" SET "C3=esp32c3" @REM FIXME: Determine flash size from PlatformIO variant, this is unmaintainable. SET "BIGDB_8MB=crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger" SET "MUIDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator" -SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite tlora-pager t-watch-s3 elecrow-adv" +SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite tlora-pager t-watch-s3 elecrow-adv heltec-v4" GOTO getopts :help diff --git a/debian/control b/debian/control index 761383a5c..679a444c9 100644 --- a/debian/control +++ b/debian/control @@ -3,6 +3,7 @@ Section: misc Priority: optional Maintainer: Austin Lane Build-Depends: debhelper-compat (= 13), + libc6-dev (>= 2.38) | libbsd-dev, lsb-release, tar, gzip, diff --git a/meshtasticd.spec.rpkg b/meshtasticd.spec.rpkg index eb4ab5ae7..f3b2e6960 100644 --- a/meshtasticd.spec.rpkg +++ b/meshtasticd.spec.rpkg @@ -33,6 +33,7 @@ BuildRequires: python3dist(grpcio[protobuf]) BuildRequires: python3dist(grpcio-tools) BuildRequires: git-core BuildRequires: gcc-c++ +BuildRequires: (glibc-devel >= 2.38) or pkgconfig(libbsd-overlay) BuildRequires: pkgconfig(yaml-cpp) BuildRequires: pkgconfig(libgpiod) BuildRequires: pkgconfig(bluez) diff --git a/platformio.ini b/platformio.ini index fe2f5e28a..80f65a9e7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -115,7 +115,7 @@ lib_deps = [radiolib_base] lib_deps = # renovate: datasource=custom.pio depName=RadioLib packageName=jgromes/library/RadioLib - jgromes/RadioLib@7.3.0 + jgromes/RadioLib@7.4.0 [device-ui_base] lib_deps = diff --git a/src/configuration.h b/src/configuration.h index baf24a636..524dacdea 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -228,6 +228,7 @@ along with this program. If not, see . #define ICM20948_ADDR_ALT 0x68 #define BHI260AP_ADDR 0x28 #define BMM150_ADDR 0x13 +#define DA217_ADDR 0x26 // ----------------------------------------------------------------------------- // LED diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index e7bdf58c5..cca867851 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -83,7 +83,8 @@ class ScanI2C BMM150, TSL2561, DRV2605, - BH1750 + BH1750, + DA217 } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 95ae5d31e..66697c109 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -465,8 +465,23 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) break; SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3", (uint8_t)addr.address); - SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555", (uint8_t)addr.address); SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700", (uint8_t)addr.address); + case TCA9555_ADDR: + registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x01), 1); + if (registerValue == 0x13) { + registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1); + if (registerValue == 0x81) { + type = DA217; + logFoundDevice("DA217", (uint8_t)addr.address); + } else { + type = TCA9555; + logFoundDevice("TCA9555", (uint8_t)addr.address); + } + } else { + type = TCA9555; + logFoundDevice("TCA9555", (uint8_t)addr.address); + } + break; case TSL25911_ADDR: registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x12), 1); if (registerValue == 0x50) { diff --git a/src/input/InputBroker.cpp b/src/input/InputBroker.cpp index 39fc665c5..7e3ff3de9 100644 --- a/src/input/InputBroker.cpp +++ b/src/input/InputBroker.cpp @@ -1,5 +1,7 @@ #include "InputBroker.h" #include "PowerFSM.h" // needed for event trigger +#include "configuration.h" +#include "modules/ExternalNotificationModule.h" InputBroker *inputBroker = nullptr; @@ -48,6 +50,12 @@ void InputBroker::processInputEventQueue() int InputBroker::handleInputEvent(const InputEvent *event) { powerFSM.trigger(EVENT_INPUT); // todo: not every input should wake, like long hold release + + if (event && event->inputEvent != INPUT_BROKER_NONE && externalNotificationModule && + moduleConfig.external_notification.enabled) { + externalNotificationModule->stopNow(); + } + this->notifyObservers(event); return 0; } diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index b047e04c2..4fe49cc1b 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -325,6 +325,10 @@ void ExternalNotificationModule::stopNow() drv.stop(); #endif + // Prevent the state machine from immediately re-triggering outputs after a manual stop. + isNagging = false; + nagCycleCutoff = UINT32_MAX; + #ifdef HAS_I2S // GPIO0 is used as mclk for I2S audio and set to OUTPUT by the sound library // T-Deck uses GPIO0 as trackball button, so restore the mode diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 53b23124d..9b5abfba0 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -191,6 +191,8 @@ #define HW_VENDOR meshtastic_HardwareModel_CROWPANEL #elif defined(RAK3312) #define HW_VENDOR meshtastic_HardwareModel_RAK3312 +#elif defined(RAK_WISMESH_TAP_V2) +#define HW_VENDOR meshtastic_HardwareModel_WISMESH_TAP_V2 #elif defined(LINK_32) #define HW_VENDOR meshtastic_HardwareModel_LINK_32 #elif defined(T_DECK_PRO) diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index cee0e5a10..c74f02c44 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -60,6 +60,8 @@ // MAke sure all custom RAK4630 boards are defined before the generic RAK4630 #elif defined(RAK4630) #define HW_VENDOR meshtastic_HardwareModel_RAK4631 +#elif defined(RAK3401) +#define HW_VENDOR meshtastic_HardwareModel_RAK3401 #elif defined(TTGO_T_ECHO) #define HW_VENDOR meshtastic_HardwareModel_T_ECHO #elif defined(T_ECHO_LITE) diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 8ce74d5f7..7eea46f6e 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -4,6 +4,13 @@ #include #include #include + +#define NRFX_WDT_ENABLED 1 +#define NRFX_WDT0_ENABLED 1 +#define NRFX_WDT_CONFIG_NO_IRQ 1 +#include +#include + #include #include #include @@ -19,6 +26,9 @@ #include "BQ25713.h" #endif +static nrfx_wdt_t nrfx_wdt = NRFX_WDT_INSTANCE(0); +static nrfx_wdt_channel_id nrfx_wdt_channel_id_nrf52_main; + static inline void debugger_break(void) { __asm volatile("bkpt #0x01\n\t" @@ -202,6 +212,15 @@ void checkSDEvents() void nrf52Loop() { + { + static bool watchdog_running = false; + if (!watchdog_running) { + nrfx_wdt_enable(&nrfx_wdt); + watchdog_running = true; + } + } + nrfx_wdt_channel_feed(&nrfx_wdt, nrfx_wdt_channel_id_nrf52_main); + checkSDEvents(); reportLittleFSCorruptionOnce(); } @@ -269,6 +288,20 @@ void nrf52Setup() LOG_DEBUG("Set random seed %u", seed.seed32); randomSeed(seed.seed32); nRFCrypto.end(); + + // Set up nrfx watchdog. Do not enable the watchdog yet (we do that + // the first time through the main loop), so that other threads can + // allocate their own wdt channel to protect themselves from hangs. + nrfx_wdt_config_t wdt0_config = { + .behaviour = NRF_WDT_BEHAVIOUR_RUN_SLEEP, .reload_value = 2000, + // Note: Not using wdt interrupts. + // .interrupt_priority = NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY + }; + nrfx_err_t r = nrfx_wdt_init(&nrfx_wdt, &wdt0_config, + nullptr // Watchdog event handler, not used, we just reset. + ); + + r = nrfx_wdt_channel_alloc(&nrfx_wdt, &nrfx_wdt_channel_id_nrf52_main); } void cpuDeepSleep(uint32_t msecToWake) diff --git a/variants/native/portduino/platformio.ini b/variants/native/portduino/platformio.ini index 49a8a71c7..474d45492 100644 --- a/variants/native/portduino/platformio.ini +++ b/variants/native/portduino/platformio.ini @@ -18,6 +18,7 @@ build_flags = ${native_base.build_flags} !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : !pkg-config --cflags --libs sdl2 --silence-errors || : + !pkg-config --cflags --libs libbsd-overlay --silence-errors || : [env:native-tft] extends = native_base @@ -43,6 +44,7 @@ build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunctio !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : !pkg-config --cflags --libs sdl2 --silence-errors || : + !pkg-config --cflags --libs libbsd-overlay --silence-errors || : build_src_filter = ${native_base.build_src_filter} @@ -71,6 +73,7 @@ build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections -D MAP_FULL_REDRAW !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : + !pkg-config --cflags --libs libbsd-overlay --silence-errors || : build_src_filter = ${native_base.build_src_filter} @@ -103,6 +106,7 @@ build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -l -D VIEW_320x240 !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : + !pkg-config --cflags --libs libbsd-overlay --silence-errors || : build_src_filter = ${env:native-tft.build_src_filter} [env:coverage]