From d9b287880f0fc0760cbf73c35067d673c49da90a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 21 Dec 2024 07:48:47 -0600 Subject: [PATCH 01/13] Revert "Separate host/port before checking for private IP (#5630)" (#5635) This reverts commit 398d29064e770fbf1e79eec26542ec9fe9677fa4. --- src/mqtt/MQTT.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 74a3f357d..ff7162db6 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -231,16 +231,6 @@ bool isPrivateIpAddress(const IPAddress &ip) } return false; } - -std::pair parseHostAndPort(std::string address, uint16_t port = 0) -{ - const size_t delimIndex = address.find_first_of(':'); - if (delimIndex > 0) { - port = std::stoul(address.substr(delimIndex + 1, address.length())); - address.resize(delimIndex); - } - return std::make_pair(std::move(address), port); -} } // namespace void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length) @@ -318,8 +308,7 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE) } IPAddress ip; - isMqttServerAddressPrivate = - ip.fromString(parseHostAndPort(moduleConfig.mqtt.address).first.c_str()) && isPrivateIpAddress(ip); + isMqttServerAddressPrivate = ip.fromString(moduleConfig.mqtt.address) && isPrivateIpAddress(ip); #if HAS_NETWORKING if (!moduleConfig.mqtt.proxy_to_client_enabled) @@ -435,9 +424,14 @@ void MQTT::reconnect() pubSub.setClient(mqttClient); #endif - std::pair hostAndPort = parseHostAndPort(serverAddr, serverPort); - serverAddr = hostAndPort.first.c_str(); - serverPort = hostAndPort.second; + String server = String(serverAddr); + int delimIndex = server.indexOf(':'); + if (delimIndex > 0) { + String port = server.substring(delimIndex + 1, server.length()); + server[delimIndex] = 0; + serverPort = port.toInt(); + serverAddr = server.c_str(); + } pubSub.setServer(serverAddr, serverPort); pubSub.setBufferSize(512); From fb7866fca7276a230a081d1f5caa75da0d18ceb2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 21 Dec 2024 07:49:25 -0600 Subject: [PATCH 02/13] Revert "Check if MQTT remote IP is private (#5627)" (#5636) This reverts commit 9a10907a2d79bee4c76b5618e177897bb4643b10. --- src/mqtt/MQTT.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index ff7162db6..e1481d42c 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -444,9 +444,6 @@ void MQTT::reconnect() enabled = true; // Start running background process again runASAP = true; reconnectCount = 0; -#if !defined(ARCH_PORTDUINO) - isMqttServerAddressPrivate = isPrivateIpAddress(mqttClient.remoteIP()); -#endif publishNodeInfo(); sendSubscriptions(); From 8e6ef4ea0468c87f28371e802ba94bc34c7b9883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 21 Dec 2024 14:57:01 +0100 Subject: [PATCH 03/13] add nugget and nibble boards for 38c3 (#5609) * add nugget and nibble boards for 38c3 * mark those boards extra for now --- boards/esp32-s3-zero.json | 41 ++++++++++++++++++++++++++ src/platform/rp2xx0/architecture.h | 2 ++ variants/nibble_esp32/platformio.ini | 6 ++++ variants/nibble_esp32/variant.h | 18 +++++++++++ variants/nibble_rp2040/platformio.ini | 17 +++++++++++ variants/nibble_rp2040/variant.h | 18 +++++++++++ variants/nugget_s2_lora/platformio.ini | 6 ++++ variants/nugget_s2_lora/variant.h | 23 +++++++++++++++ variants/nugget_s3_lora/platformio.ini | 6 ++++ variants/nugget_s3_lora/variant.h | 23 +++++++++++++++ 10 files changed, 160 insertions(+) create mode 100644 boards/esp32-s3-zero.json create mode 100644 variants/nibble_esp32/platformio.ini create mode 100644 variants/nibble_esp32/variant.h create mode 100644 variants/nibble_rp2040/platformio.ini create mode 100644 variants/nibble_rp2040/variant.h create mode 100644 variants/nugget_s2_lora/platformio.ini create mode 100644 variants/nugget_s2_lora/variant.h create mode 100644 variants/nugget_s3_lora/platformio.ini create mode 100644 variants/nugget_s3_lora/variant.h diff --git a/boards/esp32-s3-zero.json b/boards/esp32-s3-zero.json new file mode 100644 index 000000000..76cb34fa0 --- /dev/null +++ b/boards/esp32-s3-zero.json @@ -0,0 +1,41 @@ +{ + "build": { + "arduino": { + "partitions": "default.csv", + "memory_type": "qio_qspi" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ESP32S3_DEV", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DBOARD_HAS_PSRAM" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "qio", + "hwids": [["0x303A", "0x1001"]], + "mcu": "esp32s3", + "variant": "esp32s3" + }, + "connectivity": ["wifi", "bluetooth"], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": ["esp-builtin"], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino", "espidf"], + "platforms": ["espressif32"], + "name": "Espressif ESP32-S3-FH4R2 (4 MB QD, 2MB PSRAM)", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 921600 + }, + "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html", + "vendor": "Espressif" +} diff --git a/src/platform/rp2xx0/architecture.h b/src/platform/rp2xx0/architecture.h index 8c7dfc0cd..506c19c83 100644 --- a/src/platform/rp2xx0/architecture.h +++ b/src/platform/rp2xx0/architecture.h @@ -33,4 +33,6 @@ #define HW_VENDOR meshtastic_HardwareModel_RP2040_LORA #elif defined(RP2040_FEATHER_RFM95) #define HW_VENDOR meshtastic_HardwareModel_RP2040_FEATHER_RFM95 +#elif defined(PRIVATE_HW) +#define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #endif \ No newline at end of file diff --git a/variants/nibble_esp32/platformio.ini b/variants/nibble_esp32/platformio.ini new file mode 100644 index 000000000..24d2ee2a5 --- /dev/null +++ b/variants/nibble_esp32/platformio.ini @@ -0,0 +1,6 @@ +[env:nibble-esp32] +extends = esp32s3_base +board = esp32-s3-zero +board_level = extra +build_flags = + ${esp32_base.build_flags} -D PRIVATE_HW -I variants/nibble_esp32 \ No newline at end of file diff --git a/variants/nibble_esp32/variant.h b/variants/nibble_esp32/variant.h new file mode 100644 index 000000000..8ffbd9d59 --- /dev/null +++ b/variants/nibble_esp32/variant.h @@ -0,0 +1,18 @@ +#define I2C_SDA 11 // I2C pins for this board +#define I2C_SCL 10 + +#define LED_PIN 1 // If defined we will blink this LED + +#define BUTTON_PIN 0 // If defined, this will be used for user button presses +#define BUTTON_NEED_PULLUP + +#define USE_RF95 +#define LORA_SCK 6 +#define LORA_MISO 7 +#define LORA_MOSI 8 +#define LORA_CS 9 +#define LORA_DIO0 5 // a No connect on the SX1262 module +#define LORA_RESET 4 + +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 RADIOLIB_NC \ No newline at end of file diff --git a/variants/nibble_rp2040/platformio.ini b/variants/nibble_rp2040/platformio.ini new file mode 100644 index 000000000..ad987895f --- /dev/null +++ b/variants/nibble_rp2040/platformio.ini @@ -0,0 +1,17 @@ +[env:nibble-rp2040] +extends = rp2040_base +board = rpipico +board_level = extra +upload_protocol = picotool + +# add our variants files to the include and src paths +build_flags = ${rp2040_base.build_flags} + -DPRIVATE_HW + -Ivariants/nibble_rp2040 + -DDEBUG_RP2040_PORT=Serial + -DHW_SPI1_DEVICE + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" +lib_deps = + ${rp2040_base.lib_deps} +debug_build_flags = ${rp2040_base.build_flags}, -g +debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/nibble_rp2040/variant.h b/variants/nibble_rp2040/variant.h new file mode 100644 index 000000000..ac105b439 --- /dev/null +++ b/variants/nibble_rp2040/variant.h @@ -0,0 +1,18 @@ +#define ARDUINO_ARCH_AVR + +#define BUTTON_PIN -1 // Pin 17 used for antenna switching via DIO4 + +#define LED_PIN 1 + +#define HAS_CPU_SHUTDOWN 1 + +#define USE_RFM95 +#define LORA_SCK 10 +#define LORA_MISO 12 +#define LORA_MOSI 11 +#define LORA_CS 13 + +#define LORA_DIO0 14 +#define LORA_RESET 15 +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 RADIOLIB_NC diff --git a/variants/nugget_s2_lora/platformio.ini b/variants/nugget_s2_lora/platformio.ini new file mode 100644 index 000000000..2a7ff1013 --- /dev/null +++ b/variants/nugget_s2_lora/platformio.ini @@ -0,0 +1,6 @@ +[env:nugget-s2-lora] +extends = esp32s2_base +board = lolin_s2_mini +board_level = extra +build_flags = + ${esp32s2_base.build_flags} -D PRIVATE_HW -I variants/nugget_s2_lora \ No newline at end of file diff --git a/variants/nugget_s2_lora/variant.h b/variants/nugget_s2_lora/variant.h new file mode 100644 index 000000000..2d123d603 --- /dev/null +++ b/variants/nugget_s2_lora/variant.h @@ -0,0 +1,23 @@ +#define I2C_SDA 34 // I2C pins for this board +#define I2C_SCL 36 + +#define LED_PIN 15 // If defined we will blink this LED + +#define HAS_NEOPIXEL // Enable the use of neopixels +#define NEOPIXEL_COUNT 3 // How many neopixels are connected +#define NEOPIXEL_DATA 12 // gpio pin used to send data to the neopixels +#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use + +#define BUTTON_PIN 0 // If defined, this will be used for user button presses +#define BUTTON_NEED_PULLUP + +#define USE_RF95 +#define LORA_SCK 6 +#define LORA_MISO 8 +#define LORA_MOSI 10 +#define LORA_CS 13 +#define LORA_DIO0 16 +#define LORA_RESET 5 + +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 RADIOLIB_NC \ No newline at end of file diff --git a/variants/nugget_s3_lora/platformio.ini b/variants/nugget_s3_lora/platformio.ini new file mode 100644 index 000000000..729a3ef23 --- /dev/null +++ b/variants/nugget_s3_lora/platformio.ini @@ -0,0 +1,6 @@ +[env:nugget-s3-lora] +extends = esp32s3_base +board = lolin_s3_mini +board_level = extra +build_flags = + ${esp32s3_base.build_flags} -D PRIVATE_HW -I variants/nugget_s3_lora \ No newline at end of file diff --git a/variants/nugget_s3_lora/variant.h b/variants/nugget_s3_lora/variant.h new file mode 100644 index 000000000..488fe4e44 --- /dev/null +++ b/variants/nugget_s3_lora/variant.h @@ -0,0 +1,23 @@ +#define I2C_SDA 34 // I2C pins for this board +#define I2C_SCL 38 + +#define LED_PIN 15 // If defined we will blink this LED + +#define HAS_NEOPIXEL // Enable the use of neopixels +#define NEOPIXEL_COUNT 3 // How many neopixels are connected +#define NEOPIXEL_DATA 10 // gpio pin used to send data to the neopixels +#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use + +#define BUTTON_PIN 0 // If defined, this will be used for user button presses +#define BUTTON_NEED_PULLUP + +#define USE_RF95 +#define LORA_SCK 6 +#define LORA_MISO 7 +#define LORA_MOSI 8 +#define LORA_CS 9 +#define LORA_DIO0 16 // a No connect on the SX1262 module +#define LORA_RESET 4 + +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 RADIOLIB_NC \ No newline at end of file From 1c8b1654087000a96a90eede34a62c1bd1b8f99e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 21 Dec 2024 11:03:17 -0600 Subject: [PATCH 04/13] Add libusb to dockerfile for ch341 (#5641) --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fc34fbd4c..ca216e04b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ USER root # trunk-ignore(hadolint/DL3008): Use latest version of packages for buildchain RUN apt-get update && apt-get install --no-install-recommends -y wget python3 python3-pip python3-wheel python3-venv g++ zip git \ ca-certificates libgpiod-dev libyaml-cpp-dev libbluetooth-dev \ - libulfius-dev liborcania-dev libssl-dev pkg-config && \ + libusb-1.0-0-dev libulfius-dev liborcania-dev libssl-dev pkg-config && \ apt-get clean && rm -rf /var/lib/apt/lists/* && mkdir /tmp/firmware RUN groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 mesh && chown mesh:mesh /tmp/firmware @@ -37,7 +37,7 @@ ENV TZ=Etc/UTC # trunk-ignore(terrascan/AC_DOCKER_0002): Known terrascan issue # trunk-ignore(hadolint/DL3008): Use latest version of packages for buildchain -RUN apt-get update && apt-get --no-install-recommends -y install libc-bin libc6 libgpiod2 libyaml-cpp0.7 libulfius2.7 liborcania2.3 libssl3 && \ +RUN apt-get update && apt-get --no-install-recommends -y install libc-bin libc6 libgpiod2 libyaml-cpp0.7 libulfius2.7 libusb-1.0-0-dev liborcania2.3 libssl3 && \ apt-get clean && rm -rf /var/lib/apt/lists/* RUN groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 mesh @@ -51,4 +51,4 @@ VOLUME /home/mesh/data CMD [ "sh", "-cx", "./meshtasticd -d /home/mesh/data --hwid=${HWID:-$RANDOM}" ] -HEALTHCHECK NONE +HEALTHCHECK NONE \ No newline at end of file From f4cff334503deab564da47b6550444c8722e14f7 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 21 Dec 2024 18:13:03 +0100 Subject: [PATCH 05/13] Portduino: specify C++ version and add link pthread (#5642) --- arch/portduino/portduino.ini | 4 +++- variants/portduino-buildroot/platformio.ini | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 34f0dd8c9..e4e32693c 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -34,7 +34,9 @@ build_flags = -Isrc/platform/portduino -DRADIOLIB_EEPROM_UNSUPPORTED -DPORTDUINO_LINUX_HARDWARE + -lpthread -lstdc++fs -lbluetooth -lgpiod - -lyaml-cpp \ No newline at end of file + -lyaml-cpp + -std=c++17 \ No newline at end of file diff --git a/variants/portduino-buildroot/platformio.ini b/variants/portduino-buildroot/platformio.ini index 683a3cecc..3fbd26910 100644 --- a/variants/portduino-buildroot/platformio.ini +++ b/variants/portduino-buildroot/platformio.ini @@ -3,7 +3,6 @@ extends = portduino_base ; Optional libraries should be appended to `PLATFORMIO_BUILD_FLAGS` ; environment variable in the buildroot environment. build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino-buildroot - -std=c++17 board = buildroot lib_deps = ${portduino_base.lib_deps} -build_src_filter = ${portduino_base.build_src_filter} +build_src_filter = ${portduino_base.build_src_filter} \ No newline at end of file From 2fd5a4848af5b73b6a030df7e517e25da3778c6d Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Sat, 21 Dec 2024 12:07:20 -0800 Subject: [PATCH 06/13] Separate host:port before checking for private IP (x2) (#5643) --- src/mqtt/MQTT.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index e1481d42c..d61e87855 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -231,6 +231,23 @@ bool isPrivateIpAddress(const IPAddress &ip) } return false; } + +// Separate a [:] string. Returns a pair containing the parsed host and port. If the port is +// not present in the input string, or is invalid, the value of the `port` argument will be returned. +std::pair parseHostAndPort(String server, uint16_t port = 0) +{ + const int delimIndex = server.indexOf(':'); + if (delimIndex > 0) { + const long parsedPort = server.substring(delimIndex + 1, server.length()).toInt(); + if (parsedPort < 1 || parsedPort > UINT16_MAX) { + LOG_WARN("Invalid MQTT port %d: %s", parsedPort, server.c_str()); + } else { + port = parsedPort; + } + server[delimIndex] = 0; + } + return std::make_pair(std::move(server), port); +} } // namespace void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length) @@ -308,7 +325,8 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE) } IPAddress ip; - isMqttServerAddressPrivate = ip.fromString(moduleConfig.mqtt.address) && isPrivateIpAddress(ip); + isMqttServerAddressPrivate = + ip.fromString(parseHostAndPort(moduleConfig.mqtt.address).first.c_str()) && isPrivateIpAddress(ip); #if HAS_NETWORKING if (!moduleConfig.mqtt.proxy_to_client_enabled) @@ -424,14 +442,9 @@ void MQTT::reconnect() pubSub.setClient(mqttClient); #endif - String server = String(serverAddr); - int delimIndex = server.indexOf(':'); - if (delimIndex > 0) { - String port = server.substring(delimIndex + 1, server.length()); - server[delimIndex] = 0; - serverPort = port.toInt(); - serverAddr = server.c_str(); - } + std::pair hostAndPort = parseHostAndPort(serverAddr, serverPort); + serverAddr = hostAndPort.first.c_str(); + serverPort = hostAndPort.second; pubSub.setServer(serverAddr, serverPort); pubSub.setBufferSize(512); From fa1a1fd869716fdfdc5a1efecb53f51c725b6af4 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:04:18 +0200 Subject: [PATCH 07/13] Update Femtofox configs (#5646) * Delete bin/config.d/femtofox/femtofox_EByte-E22-900M30S_Ebyte-E22-900M22S.yaml * Delete bin/config.d/femtofox/femtofox_EByte-E22-900MM22S.yaml * Delete bin/config.d/femtofox/femtofox_Heltec-HT-RA62_Seeed-WIO-SX1262.yaml * Delete bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml * Add files via upload * Update and rename bin/config.d/femtofox_SX1262_XTAL.yaml to bin/config.d/femtofox/femtofox_SX1262_XTAL.yaml * Update and rename bin/config.d/femtofox_LR1121_TCXO.yaml to bin/config.d/femtofox/femtofox_LR1121_TCXO.yaml * Update and rename bin/config.d/femtofox_SX1262_TCXO.yaml to bin/config.d/femtofox/femtofox_SX1262_TCXO.yaml --- ...x_EByte-E22-900M30S_Ebyte-E22-900M22S.yaml | 16 -------------- .../femtofox/femtofox_EByte-E22-900MM22S.yaml | 16 -------------- ...tofox_Heltec-HT-RA62_Seeed-WIO-SX1262.yaml | 14 ------------- .../femtofox/femtofox_LR1121_TCXO.yaml | 20 ++++++++++++++++++ .../femtofox/femtofox_SX1262_TCXO.yaml | 21 +++++++++++++++++++ .../femtofox/femtofox_SX1262_XTAL.yaml | 21 +++++++++++++++++++ ...eshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml | 13 ------------ 7 files changed, 62 insertions(+), 59 deletions(-) delete mode 100644 bin/config.d/femtofox/femtofox_EByte-E22-900M30S_Ebyte-E22-900M22S.yaml delete mode 100644 bin/config.d/femtofox/femtofox_EByte-E22-900MM22S.yaml delete mode 100644 bin/config.d/femtofox/femtofox_Heltec-HT-RA62_Seeed-WIO-SX1262.yaml create mode 100644 bin/config.d/femtofox/femtofox_LR1121_TCXO.yaml create mode 100644 bin/config.d/femtofox/femtofox_SX1262_TCXO.yaml create mode 100644 bin/config.d/femtofox/femtofox_SX1262_XTAL.yaml delete mode 100644 bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml diff --git a/bin/config.d/femtofox/femtofox_EByte-E22-900M30S_Ebyte-E22-900M22S.yaml b/bin/config.d/femtofox/femtofox_EByte-E22-900M30S_Ebyte-E22-900M22S.yaml deleted file mode 100644 index 6c88b1eb2..000000000 --- a/bin/config.d/femtofox/femtofox_EByte-E22-900M30S_Ebyte-E22-900M22S.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -Lora: -## Ebyte E22-900M30S, E22-900M22S with no external RF switching setup -## Will work with any module without RF switching, and with TCXO - Module: sx1262 - gpiochip: 1 # subtract 32 from the gpio numbers - DIO2_AS_RF_SWITCH: true - DIO3_TCXO_VOLTAGE: true - CS: 16 #pin6 / GPIO48 1C0 - IRQ: 23 #pin17 / GPIO55 1C7 - Busy: 22 #pin16 / GPIO54 1C6 - Reset: 25 #pin13 / GPIO57 1D1 - RXen: 24 #pin12 / GPIO56 1D0 - #TXen: bridge to DIO2 on E22 module - spidev: spidev0.0 - spiSpeed: 2000000 \ No newline at end of file diff --git a/bin/config.d/femtofox/femtofox_EByte-E22-900MM22S.yaml b/bin/config.d/femtofox/femtofox_EByte-E22-900MM22S.yaml deleted file mode 100644 index 451d5d3f4..000000000 --- a/bin/config.d/femtofox/femtofox_EByte-E22-900MM22S.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -Lora: -## Ebyte E22-900MM22S with no external RF switching setup -## Will work with any module without RF switching and no TCXO - Module: sx1262 - gpiochip: 1 # subtract 32 from the gpio numbers - DIO2_AS_RF_SWITCH: true - DIO3_TCXO_VOLTAGE: true - CS: 16 #pin6 / GPIO48 1C0 - IRQ: 23 #pin17 / GPIO55 1C7 - Busy: 22 #pin16 / GPIO54 1C6 - Reset: 25 #pin13 / GPIO57 1D1 - RXen: 24 #pin12 / GPIO56 1D0 - #TXen: bridge to DIO2 on E22 module - spidev: spidev0.0 - spiSpeed: 2000000 \ No newline at end of file diff --git a/bin/config.d/femtofox/femtofox_Heltec-HT-RA62_Seeed-WIO-SX1262.yaml b/bin/config.d/femtofox/femtofox_Heltec-HT-RA62_Seeed-WIO-SX1262.yaml deleted file mode 100644 index d5f02b42c..000000000 --- a/bin/config.d/femtofox/femtofox_Heltec-HT-RA62_Seeed-WIO-SX1262.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -Lora: -## Heltec HT-RA62, Seeed WIO SX1262 -## Will work with any module with automatic RF switching, and with TCXO - Module: sx1262 - gpiochip: 1 # subtract 32 from the gpio numbers - DIO2_AS_RF_SWITCH: true - DIO3_TCXO_VOLTAGE: true - CS: 16 #pin6 (GPIO pin 48 1C0) - IRQ: 23 #pin17 (GPIO pin 55 1C7) - Reset: 25 #pin13 (GPIO pin 57 1D1) - Busy: 22 #pin16 (GPIO pin 54 1C6) - spidev: spidev0.0 #pins are (CS=6, CLK=7, MOSI=8, MISO=9) - spiSpeed: 2000000 \ No newline at end of file diff --git a/bin/config.d/femtofox/femtofox_LR1121_TCXO.yaml b/bin/config.d/femtofox/femtofox_LR1121_TCXO.yaml new file mode 100644 index 000000000..7aa860f61 --- /dev/null +++ b/bin/config.d/femtofox/femtofox_LR1121_TCXO.yaml @@ -0,0 +1,20 @@ +--- +Lora: +## Ebyte E80-900M22S +## This is a bit experimental +## +## + Module: lr1121 + gpiochip: 1 # subtract 32 from the gpio numbers + DIO3_TCXO_VOLTAGE: 1.8 + CS: 16 #pin6 / GPIO48 1C0 + IRQ: 23 #pin17 / GPIO55 1C7 + Busy: 22 #pin16 / GPIO54 1C6 + Reset: 25 #pin13 / GPIO57 1D1 + + + spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19) + spiSpeed: 2000000 + +General: + MACAddressSource: eth0 diff --git a/bin/config.d/femtofox/femtofox_SX1262_TCXO.yaml b/bin/config.d/femtofox/femtofox_SX1262_TCXO.yaml new file mode 100644 index 000000000..a4dec870a --- /dev/null +++ b/bin/config.d/femtofox/femtofox_SX1262_TCXO.yaml @@ -0,0 +1,21 @@ +--- +Lora: +## Ebyte E22-900M30S, E22-900M22S with or without external RF switching setup +## HT-RA62 (Has internal switching, but whatever) +## Seeed WIO SX1262 (already has TXEN-DIO2 link, but needs RXEN) +## Will work with any module with or without RF switching, and with TCXO + Module: sx1262 + gpiochip: 1 # subtract 32 from the gpio numbers + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: true + CS: 16 #pin6 / GPIO48 1C0 + IRQ: 23 #pin17 / GPIO55 1C7 + Busy: 22 #pin16 / GPIO54 1C6 + Reset: 25 #pin13 / GPIO57 1D1 + RXen: 24 #pin12 / GPIO56 1D0 # Not strictly needed for auto-switching, but why complicate things? +# TXen: bridge to DIO2 on E22 module + spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19) + spiSpeed: 2000000 + +General: + MACAddressSource: eth0 diff --git a/bin/config.d/femtofox/femtofox_SX1262_XTAL.yaml b/bin/config.d/femtofox/femtofox_SX1262_XTAL.yaml new file mode 100644 index 000000000..6b956f3e3 --- /dev/null +++ b/bin/config.d/femtofox/femtofox_SX1262_XTAL.yaml @@ -0,0 +1,21 @@ +--- +Lora: +## Ebyte E22-900MM22S with no external RF switching setup +## Waveshare SX126X XXXM, AI Thinker RA-01SH +## Will work with any module with or without RF switching and no TCXO + + Module: sx1262 + gpiochip: 1 # subtract 32 from the gpio numbers + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: false + CS: 16 #pin6 / GPIO48 1C0 + IRQ: 23 #pin17 / GPIO55 1C7 + Busy: 22 #pin16 / GPIO54 1C6 + Reset: 25 #pin13 / GPIO57 1D1 + RXen: 24 #pin12 / GPIO56 1D0 # Not strictly needed for auto-switching, but why complicate things? +# TXen: bridge to DIO2 on E22 module + spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19) + spiSpeed: 2000000 + +General: + MACAddressSource: eth0 diff --git a/bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml b/bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml deleted file mode 100644 index 23834adec..000000000 --- a/bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -Lora: -## Waveshare SX126X XXXM, AI Thinker RA-01SH -## Will work with any module with automatic RF switching, and with no TCXO - Module: sx1262 - gpiochip: 1 # subtract 32 from the gpio numbers - DIO2_AS_RF_SWITCH: true - CS: 16 #pin6 (GPIO pin 48 1C0) - IRQ: 23 #pin17 (GPIO pin 55 1C7) - Reset: 25 #pin13 (GPIO pin 57 1D1) - Busy: 22 #pin16 (GPIO pin 54 1C6) - spidev: spidev0.0 #pins are (CS=6, CLK=7, MOSI=8, MISO=9) - spiSpeed: 2000000 From 80fc0f2bdafe2cca248afec92589bad341143d75 Mon Sep 17 00:00:00 2001 From: nebman Date: Sun, 22 Dec 2024 05:02:50 +0100 Subject: [PATCH 08/13] Detect charging status by measuring current flow with configured INA battery sensor (#5271) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * INA219 charging detection minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging * Update Power.cpp added comments and 2 extra defines to disable and swap detection direction * Update Power.cpp fix disabled case * move getCurrentMa() to new CurrentSensor class * INA219 charging detection minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging * Update Power.cpp added comments and 2 extra defines to disable and swap detection direction * Update Power.cpp fix disabled case * move getCurrentMa() to new CurrentSensor class * add INA3221 charging detection * RP2040: Update core; add mDNS support (#5355) * Update arduino-pico core * RP2040: Add mDNS support * SimpleMDNS `begin` now returns a bool * Add `-g` option to `debug_build_flags` to link files for gdb * RAK11310 needs old platform as well * Change defines to specific architecture * Core version 4.2.1 is out * Add sudo to apt-get commands for Raspbian Build (#5364) Without sudo, inadequate permissions to runs the commands meant the build was failing. * Typo fix in build_raspbian.yml (#5365) s/sudp/sudo :(:(:( * Rework some things * Trunk * Separate littlefs bundle * version tags * Diag * Add littlefswebui * Bug fixed in ExternalNotificationModule (#5375) While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled. Possible fix for #5348 * Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376) * Cleanup static files from bad Web UI bundle on 2.5.13 release * Check existence first * Esp32 is the only one we care about * Move some actions to after `startTransmit()` (#5383) To minimize the time between channel scan and actual transmit * [create-pull-request] automated change (#5380) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368) * more userPrefs.h Added PKI Admin keys to userPrefs.h * Update userPrefs.h Allows all 3 PKI keys to be added to userPrefs.h (#4969) * Update NodeDB.cpp Trunk * Update userPrefs.h Changed wording * Create base64_to_hex.py A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand. * more userPrefs.h Added PKI Admin keys to userPrefs.h * Update userPrefs.h Allows all 3 PKI keys to be added to userPrefs.h (#4969) * Update NodeDB.cpp Trunk * Update userPrefs.h Changed wording * Create base64_to_hex.py A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand. * [create-pull-request] automated change (#5388) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * add smiley emoji (#5391) * add smiley emoji * clang-formatted * Anable trace route function on wismeshtap platform (#5389) * fix 'symbal' typo (#5395) * [create-pull-request] automated change (#5399) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * /api/v1/fromradio: add OPTIONS handler for CORS. (#5386) This avoids hitting the 404 Not Found handler, which breaks connection keep-alive, so this change fixes a big performance regression for Web Client in Chrome: https://github.com/meshtastic/firmware/issues/5385 Tested on Heltec V3. Co-authored-by: Ben Meadors * Make heart emoji usable (#5403) * Create a specific hw_model for WisMesh Tap (#5400) * Create a specific hw_model for WisMesh Tap * Trunk * HAS_ETHERNET * Remove it altogether * Don't need these either * Fix RTC time injection and consolidate position logic (#5396) * Fix RTC time injection and consolidate position logic * Comment out unused var warning * Backerds * Update arduino-pico core to fix sporadic hangs (#5406) * Update platform-raspberrypi also (#5407) * Update arduino-pico core to fix sporadic hangs * Update platform-raspberrypi also * --web added to device-install(.sh/.bat) (#5405) * Add --web * Update device-install.bat Forgot a "-" a few places. --------- Co-authored-by: Ben Meadors * add GPS in indicator board (#5411) * Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412) * --web littlefswebui-* typo fix (#5416) * Add --web * Update device-install.bat Forgot a "-" a few places. * Typo fix. * Typo fix --------- Co-authored-by: Ben Meadors Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com> * Temporarily disable MDNS when MQTT is enabled (#5418) Leads to a panic * Check for OkToMqtt flag presence before uplinking to MQTT (#5413) * Check for oktomqtt flag presence before uplinking to MQTT * Move to mqtt->onSend * Temetry can respond to want-response for LocalStats variant (#5414) * Seems like the last DIY board that's not "extra" (#5420) * Cherry pick tdeck fixes (#5422) * Try-fix (workaround) T-Deck audio crash * set T-Deck audio to unused 48 (mem mclk) * swap mclk to gpio 21 * dreamcatcher: assign GPIO44 to audio mclk --------- Co-authored-by: mverch67 * add canned message and keyboard in indicator board (#5410) * add canned message and keyboard in indicator board * Added virtual keyboard macro and enabled for Indicator * Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME --------- Co-authored-by: Ben Meadors * Update build-native.sh (#5415) * Update build-native.sh Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead. * Update build-native.sh Skip native-run.sh copy * Cleans up visibility in GPS.h (#5426) Signed-off-by: Christopher Hoover * Fix admin key loading from userPrefs.h (#5417) * Fix LED pinout for T-Echo board marked v1.0, date 2021-6-28 * Merge PR #420 * Fixed double and missing Default class. * Use correct format specifier and fixed typo. * Removed duplicate code. * Fix error: #if with no expression * Fix warning: extra tokens at end of #endif directive. * Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board. * Fix deprecated macros. * Set RP2040 in dormant mode when deep sleep is triggered. * Fix array out of bounds read. * Admin key count needs to be set otherwise the key will be zero loaded after reset. * Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible. * Remove log spam when reading INA voltage sensor. * Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots. * Removed newlines from log. --------- Co-authored-by: Ben Meadors Co-authored-by: Thomas Göttgens * try to detect dfrobot station to tell it apart from an ublox gps. (#5393) * Remove BMA-423 and STK8X by default (#5429) * Remove BMA-423 by default * STK * Wrong macro * Helps if you include the file * [create-pull-request] automated change (#5431) Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com> * Support for the ClimateGuard RadSens Geiger-Muller tube (#5425) * fixes https://github.com/meshtastic/firmware/issues/5434 (#5435) * update libpax * fix interval init * Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439) This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios. * Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436) Co-authored-by: Tom Fifield * A second round of cleanup on GPS.h. (#5433) * Move yet more stuff out of GPS.h and into file scope. * Protect code macros from eating semicolons. * Remove unused (and unimplemented) getDOPString. * clang-format with project style file on affected files. Signed-off-by: Christopher Hoover * enable MQTT with TLS on RPi picow (#5442) Co-authored-by: Ben Meadors * Don't powersave on Wifi (#5443) * Don't go into light sleep with wifi enabled * Move * Trunk * Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446) This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03. * Actually gunzip all the files when building a .deb (#5449) * [create-pull-request] automated change (#5457) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455) * Cleanup i2c scan logs and macro to save some bytes and remain consistent * Functions are better than macros * Exclude i2c scan for STM32 * Useless log * Clean up some inline functions (#5454) * Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453) * fix cors for meshtasticd to allow use of cross origin clients (#5463) * Remove ATECC crypto chip placeholder code (#5461) * GPS.h cleanups round 3. (#5447) * GPS.h cleanups round 3. No effective behavior change. Protected members can be private so make it so. (Supporting subclasses needs a lot more work.) Moves uBloxGnssModelInfo into file scope. Moves uBloxProtocolVersion into uBloxGnssModelInfo. Moves baud rate arrays into file scope. Removes unused/ unimplemented powerStateToString. Signed-off-by: Christopher Hoover * Trunk Format. --------- Signed-off-by: Christopher Hoover Co-authored-by: Tom Fifield * Fix ukrainian fonts (#5468) * FIX: rollback to !4624 * UPDATE: new 16 and 24 UA Fonts and fixes * fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470) * Trunk * Warnings and log cleanup (#5472) * Don't log if keyboard not found * Signed comparison issue * [create-pull-request] automated change (#5475) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Adds libusb dev package to Raspbian build steps (#5480) * [create-pull-request] automated change (#5478) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Portduino fixes (#5479) * Set config.yaml defaults even if General is missing * Unsigned values should get %u in logging * Update arduino-pico core and remove MDNS restriction (#5483) * Update xiao_esp32 fully support L67K (#5488) L67K module hardware changed * Convert userprefs to a json file instead of header file which has to be included everywhere (#5471) * WIP * Got string quoting and macro expansion working * Need the placeholder * Cleanup * Missed a user prefs reference * Update jsonc * SimRadio: clean-up and emulate collisions (#5487) * Clean up SimRadio and don't let it use PKC * Add collision emulation for SimRadio * Add stats from SimRadio to LocalStats * Make emulating collisions optional * add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493) * Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494) Co-authored-by: Ben Meadors * Extend Length of Source and Destination Node IDs Logged (#5492) * show 8 chars for logging source and destination ids * extend legnth of source and destination nodes in log * Added femtofox configs (#5477) * added femtofox configs * Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml * moved femtofox configs to subdir * [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496) * Update main.cpp * Update PortduinoGlue.h * Update PortduinoGlue.cpp * Update PortduinoGlue.cpp * Update PortduinoGlue.cpp * Update main.cpp * [create-pull-request] automated change (#5500) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Fix minor typos in package workflows (#5505) * Don't use channel index for encrypted packet (#5509) * Don't use channel index for encrypted packet * Remove assert in `getKey`, set invalid key length So encrypting will fail without reboot * Reset channel to 0 when unable to encrypt Such that the NAK doesn't use the failing channel hash * Always Announce MDNS meshtastic service (#5503) * refactor server api port into define * always announce MDNS meshtastic service * fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519) Co-authored-by: mverch67 * Add heltec capsule back * Revert "Add heltec capsule back" This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e. * Lets try this again minus device ui * Add popular nrf52 pro micro to the builds (#5523) * Add MACAddress to config.yaml (#5506) * Add MACAddress to config.yaml * Better error handling on native, including failing to launch with blank MAC Address and real hardware. * Re-arrange Mac Address handling and add MACAddressSource * Bump portduino to remove macaddr function there --------- Co-authored-by: Ben Meadors * Configure Seeed Xiao S3 RX enable pin (#5517) * Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529) * tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535) Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button. Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality. Signed-off-by: Andrew Yong * [create-pull-request] automated change (#5530) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Fix detection for some RadSens hardware versions (#5542) Co-authored-by: Jake-B * Initialize dmac array to nulls (#5538) * Initialize dmac array to nulls * Use std::cout for print before console is init. * Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544) * Add portduino-buildroot variant (#5540) * Add portduino-buildroot variant * Update platform-native for platform-buildroot * portduino-buildroot: Define c standard (#5547) * Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548) * Portduino: fix transitional symlinks (#5550) * Windows Support - Trunk and Platformio (#5397) (#5518) * Add support for GPG * Add usb device support * Add trunk.io to devcontainer * Trunk things * trunk fmt * formatting * fix trivy/DS002, checkov/CKV_DOCKER_3 * hide docker extension popup * fix trivy/DS026, checkov/CKV_DOCKER_2 Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> * Synch minor changes from TFT branch (#5520) * Synch minor changes from TFT branch Includes: * New nordicnrf52 minor version (10.5.0 --> 10.6.0) * Optimisations for T_DECK * preparation for MESH_TAB * add ext notification module to portduino --------- Co-authored-by: mverch67 * DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558) * Support TLORA_V3.0 (#5563) - Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector. - 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these! - update trunk to latest version * Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564) * Portduino: fix setting hwId via argument (#5565) * INA219 charging detection minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging * Update Power.cpp added comments and 2 extra defines to disable and swap detection direction * Trunk Fixes * Add INA226 support --------- Signed-off-by: Christopher Hoover Signed-off-by: Andrew Yong Co-authored-by: Ben Meadors Co-authored-by: Jonathan Bennett Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Co-authored-by: Tom Fifield Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com> Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com> Co-authored-by: Catalin Patulea Co-authored-by: dylanli Co-authored-by: mverch67 Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com> Co-authored-by: Christopher Hoover Co-authored-by: Mictronics Co-authored-by: Thomas Göttgens Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com> Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com> Co-authored-by: César de Tassis Filho Co-authored-by: Tomas Dubec Co-authored-by: Liam Cottle Co-authored-by: panaceya Co-authored-by: virgil Co-authored-by: Robert Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com> Co-authored-by: Mark Trevor Birss Co-authored-by: broglep <20624281+broglep@users.noreply.github.com> Co-authored-by: Matthias Granberry Co-authored-by: Andrew Yong Co-authored-by: Jake-B Co-authored-by: Austin Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> --- platformio.ini | 3 +- src/Power.cpp | 39 ++++++++++++- src/modules/Telemetry/PowerTelemetry.cpp | 6 +- src/modules/Telemetry/Sensor/CurrentSensor.h | 13 +++++ src/modules/Telemetry/Sensor/INA219Sensor.cpp | 5 ++ src/modules/Telemetry/Sensor/INA219Sensor.h | 4 +- src/modules/Telemetry/Sensor/INA226Sensor.cpp | 58 +++++++++++++++++++ src/modules/Telemetry/Sensor/INA226Sensor.h | 30 ++++++++++ .../Telemetry/Sensor/INA3221Sensor.cpp | 5 ++ src/modules/Telemetry/Sensor/INA3221Sensor.h | 4 +- src/power.h | 6 +- 11 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 src/modules/Telemetry/Sensor/CurrentSensor.h create mode 100644 src/modules/Telemetry/Sensor/INA226Sensor.cpp create mode 100644 src/modules/Telemetry/Sensor/INA226Sensor.h diff --git a/platformio.ini b/platformio.ini index 08d21665f..41f1ca764 100644 --- a/platformio.ini +++ b/platformio.ini @@ -160,4 +160,5 @@ lib_deps = https://github.com/KodinLanewave/INA3221@1.0.1 mprograms/QMC5883LCompass@1.2.3 dfrobot/DFRobot_RTU@1.0.3 - https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d \ No newline at end of file + https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d + robtillaart/INA226@0.6.0 diff --git a/src/Power.cpp b/src/Power.cpp index a354b74e2..ae0908ec6 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -72,8 +72,9 @@ static const uint8_t ext_chrg_detect_value = EXT_CHRG_DETECT_VALUE; #endif #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) -INA260Sensor ina260Sensor; INA219Sensor ina219Sensor; +INA226Sensor ina226Sensor; +INA260Sensor ina260Sensor; INA3221Sensor ina3221Sensor; #endif @@ -413,7 +414,20 @@ class AnalogBatteryLevel : public HasBatteryLevel #ifdef EXT_CHRG_DETECT return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value; #else +#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && \ + !defined(DISABLE_INA_CHARGING_DETECTION) + if (hasINA()) { + // get current flow from INA sensor - negative value means power flowing into the battery + // default assuming BATTERY+ <--> INA_VIN+ <--> SHUNT RESISTOR <--> INA_VIN- <--> LOAD + LOG_DEBUG("Using INA on I2C addr 0x%x for charging detection", config.power.device_battery_ina_address); +#if defined(INA_CHARGING_DETECTION_INVERT) + return getINACurrent() > 0; +#else + return getINACurrent() < 0; +#endif + } return isBatteryConnect() && isVbusIn(); +#endif #endif } @@ -450,6 +464,9 @@ class AnalogBatteryLevel : public HasBatteryLevel { if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) { return ina219Sensor.getBusVoltageMv(); + } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first == + config.power.device_battery_ina_address) { + return ina226Sensor.getBusVoltageMv(); } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA260].first == config.power.device_battery_ina_address) { return ina260Sensor.getBusVoltageMv(); @@ -460,6 +477,20 @@ class AnalogBatteryLevel : public HasBatteryLevel return 0; } + int16_t getINACurrent() + { + if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) { + return ina219Sensor.getCurrentMa(); + } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first == + config.power.device_battery_ina_address) { + return ina226Sensor.getCurrentMa(); + } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA3221].first == + config.power.device_battery_ina_address) { + return ina3221Sensor.getCurrentMa(); + } + return 0; + } + bool hasINA() { if (!config.power.device_battery_ina_address) { @@ -469,6 +500,10 @@ class AnalogBatteryLevel : public HasBatteryLevel if (!ina219Sensor.isInitialized()) return ina219Sensor.runOnce() > 0; return ina219Sensor.isRunning(); + } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first == + config.power.device_battery_ina_address) { + if (!ina226Sensor.isInitialized()) + return ina226Sensor.runOnce() > 0; } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA260].first == config.power.device_battery_ina_address) { if (!ina260Sensor.isInitialized()) @@ -1154,4 +1189,4 @@ bool Power::lipoInit() { return false; } -#endif \ No newline at end of file +#endif diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index 367643849..10133fca5 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -56,6 +56,8 @@ int32_t PowerTelemetryModule::runOnce() // therefore, we should only enable the sensor loop if measurement is also enabled if (ina219Sensor.hasSensor() && !ina219Sensor.isInitialized()) result = ina219Sensor.runOnce(); + if (ina226Sensor.hasSensor() && !ina226Sensor.isInitialized()) + result = ina226Sensor.runOnce(); if (ina260Sensor.hasSensor() && !ina260Sensor.isInitialized()) result = ina260Sensor.runOnce(); if (ina3221Sensor.hasSensor() && !ina3221Sensor.isInitialized()) @@ -170,6 +172,8 @@ bool PowerTelemetryModule::getPowerTelemetry(meshtastic_Telemetry *m) #if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) if (ina219Sensor.hasSensor()) valid = ina219Sensor.getMetrics(m); + if (ina226Sensor.hasSensor()) + valid = ina226Sensor.getMetrics(m); if (ina260Sensor.hasSensor()) valid = ina260Sensor.getMetrics(m); if (ina3221Sensor.hasSensor()) @@ -253,4 +257,4 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) return false; } -#endif +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/CurrentSensor.h b/src/modules/Telemetry/Sensor/CurrentSensor.h new file mode 100644 index 000000000..9827a9aa4 --- /dev/null +++ b/src/modules/Telemetry/Sensor/CurrentSensor.h @@ -0,0 +1,13 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#pragma once + +class CurrentSensor +{ + public: + virtual int16_t getCurrentMa() = 0; +}; + +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA219Sensor.cpp b/src/modules/Telemetry/Sensor/INA219Sensor.cpp index de69163b4..ea47e265d 100644 --- a/src/modules/Telemetry/Sensor/INA219Sensor.cpp +++ b/src/modules/Telemetry/Sensor/INA219Sensor.cpp @@ -45,4 +45,9 @@ uint16_t INA219Sensor::getBusVoltageMv() return lround(ina219.getBusVoltage_V() * 1000); } +int16_t INA219Sensor::getCurrentMa() +{ + return lround(ina219.getCurrent_mA()); +} + #endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA219Sensor.h b/src/modules/Telemetry/Sensor/INA219Sensor.h index 9dded067b..9b6a2fcca 100644 --- a/src/modules/Telemetry/Sensor/INA219Sensor.h +++ b/src/modules/Telemetry/Sensor/INA219Sensor.h @@ -3,11 +3,12 @@ #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "CurrentSensor.h" #include "TelemetrySensor.h" #include "VoltageSensor.h" #include -class INA219Sensor : public TelemetrySensor, VoltageSensor +class INA219Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor { private: Adafruit_INA219 ina219; @@ -20,6 +21,7 @@ class INA219Sensor : public TelemetrySensor, VoltageSensor virtual int32_t runOnce() override; virtual bool getMetrics(meshtastic_Telemetry *measurement) override; virtual uint16_t getBusVoltageMv() override; + virtual int16_t getCurrentMa() override; }; #endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA226Sensor.cpp b/src/modules/Telemetry/Sensor/INA226Sensor.cpp new file mode 100644 index 000000000..1ee7cd92e --- /dev/null +++ b/src/modules/Telemetry/Sensor/INA226Sensor.cpp @@ -0,0 +1,58 @@ +#include "configuration.h" + +#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "INA226.h" +#include "INA226Sensor.h" +#include "TelemetrySensor.h" + +INA226Sensor::INA226Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_INA226, "INA226") {} + +int32_t INA226Sensor::runOnce() +{ + LOG_INFO("Init sensor: %s", sensorName); + if (!hasSensor()) { + return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; + } + + begin(nodeTelemetrySensorsMap[sensorType].second, nodeTelemetrySensorsMap[sensorType].first); + + if (!status) { + status = ina226.begin(); + } + return initI2CSensor(); +} + +void INA226Sensor::setup() {} + +void INA226Sensor::begin(TwoWire *wire, uint8_t addr) +{ + _wire = wire; + _addr = addr; + ina226 = INA226(_addr, _wire); + _wire->begin(); +} + +bool INA226Sensor::getMetrics(meshtastic_Telemetry *measurement) +{ + measurement->variant.environment_metrics.has_voltage = true; + measurement->variant.environment_metrics.has_current = true; + + // mV conversion to V + measurement->variant.environment_metrics.voltage = ina226.getBusVoltage() / 1000; + measurement->variant.environment_metrics.current = ina226.getCurrent_mA(); + return true; +} + +uint16_t INA226Sensor::getBusVoltageMv() +{ + return lround(ina226.getBusVoltage()); +} + +int16_t INA226Sensor::getCurrentMa() +{ + return lround(ina226.getCurrent_mA()); +} + +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA226Sensor.h b/src/modules/Telemetry/Sensor/INA226Sensor.h new file mode 100644 index 000000000..2f71c5b86 --- /dev/null +++ b/src/modules/Telemetry/Sensor/INA226Sensor.h @@ -0,0 +1,30 @@ +#include "configuration.h" + +#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "CurrentSensor.h" +#include "TelemetrySensor.h" +#include "VoltageSensor.h" +#include + +class INA226Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor +{ + private: + uint8_t _addr = INA_ADDR; + TwoWire *_wire = &Wire; + INA226 ina226 = INA226(_addr, _wire); + + protected: + virtual void setup() override; + void begin(TwoWire *wire = &Wire, uint8_t addr = INA_ADDR); + + public: + INA226Sensor(); + virtual int32_t runOnce() override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; + virtual uint16_t getBusVoltageMv() override; + virtual int16_t getCurrentMa() override; +}; + +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA3221Sensor.cpp b/src/modules/Telemetry/Sensor/INA3221Sensor.cpp index ed09856e2..7ac11dfde 100644 --- a/src/modules/Telemetry/Sensor/INA3221Sensor.cpp +++ b/src/modules/Telemetry/Sensor/INA3221Sensor.cpp @@ -102,4 +102,9 @@ uint16_t INA3221Sensor::getBusVoltageMv() return lround(ina3221.getVoltage(BAT_CH) * 1000); } +int16_t INA3221Sensor::getCurrentMa() +{ + return lround(ina3221.getCurrent(BAT_CH)); +} + #endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA3221Sensor.h b/src/modules/Telemetry/Sensor/INA3221Sensor.h index d5121aab6..8eeda3e02 100644 --- a/src/modules/Telemetry/Sensor/INA3221Sensor.h +++ b/src/modules/Telemetry/Sensor/INA3221Sensor.h @@ -3,11 +3,12 @@ #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "CurrentSensor.h" #include "TelemetrySensor.h" #include "VoltageSensor.h" #include -class INA3221Sensor : public TelemetrySensor, VoltageSensor +class INA3221Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor { private: INA3221 ina3221 = INA3221(INA3221_ADDR42_SDA); @@ -35,6 +36,7 @@ class INA3221Sensor : public TelemetrySensor, VoltageSensor int32_t runOnce() override; bool getMetrics(meshtastic_Telemetry *measurement) override; virtual uint16_t getBusVoltageMv() override; + virtual int16_t getCurrentMa() override; }; struct _INA3221Measurement { diff --git a/src/power.h b/src/power.h index 63335104b..ab55fc7e1 100644 --- a/src/power.h +++ b/src/power.h @@ -42,10 +42,12 @@ extern RTC_NOINIT_ATTR uint64_t RTC_reg_b; #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) #include "modules/Telemetry/Sensor/INA219Sensor.h" +#include "modules/Telemetry/Sensor/INA226Sensor.h" #include "modules/Telemetry/Sensor/INA260Sensor.h" #include "modules/Telemetry/Sensor/INA3221Sensor.h" -extern INA260Sensor ina260Sensor; extern INA219Sensor ina219Sensor; +extern INA226Sensor ina226Sensor; +extern INA260Sensor ina260Sensor; extern INA3221Sensor ina3221Sensor; #endif @@ -99,4 +101,4 @@ class Power : private concurrency::OSThread #endif }; -extern Power *power; \ No newline at end of file +extern Power *power; From 6a2a4ffa2a89b531963072d1123d9b99c5645aad Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 22 Dec 2024 21:25:48 -0600 Subject: [PATCH 09/13] Add libi2c-dev to native builds --- .github/workflows/build_native.yml | 2 +- .github/workflows/build_raspbian.yml | 2 +- .github/workflows/build_raspbian_armv7l.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_native.yml b/.github/workflows/build_native.yml index a57da5dfb..74bc074aa 100644 --- a/.github/workflows/build_native.yml +++ b/.github/workflows/build_native.yml @@ -14,7 +14,7 @@ jobs: shell: bash run: | sudo apt-get update --fix-missing - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev + sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index 1826504f0..ac63dfea4 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -14,7 +14,7 @@ jobs: shell: bash run: | sudo apt-get update -y --fix-missing - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev + sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/build_raspbian_armv7l.yml b/.github/workflows/build_raspbian_armv7l.yml index fd53585a5..565d9a0dc 100644 --- a/.github/workflows/build_raspbian_armv7l.yml +++ b/.github/workflows/build_raspbian_armv7l.yml @@ -14,7 +14,7 @@ jobs: shell: bash run: | sudo apt-get update -y --fix-missing - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev + sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev - name: Checkout code uses: actions/checkout@v4 From 32719f69c9d733d329eb29e55e0722a26fbbc4e0 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 22 Dec 2024 22:53:54 -0600 Subject: [PATCH 10/13] Add NXP_SE050 detection (#5651) * Add NXP_SE050 detection * Put the flag in the right place * Include libi2c0 dependency in .deb packages --- .github/workflows/package_amd64.yml | 4 +-- .github/workflows/package_raspbian.yml | 4 +-- .github/workflows/package_raspbian_armv7l.yml | 4 +-- arch/portduino/portduino.ini | 3 +- src/detect/ScanI2C.h | 3 +- src/detect/ScanI2CTwoWire.cpp | 32 ++++++++++++++++--- 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/package_amd64.yml b/.github/workflows/package_amd64.yml index 782ef479b..c6e82e1be 100644 --- a/.github/workflows/package_amd64.yml +++ b/.github/workflows/package_amd64.yml @@ -79,7 +79,7 @@ jobs: maintainer: Jonathan Bennett version: ${{ steps.version.outputs.version }} # refs/tags/v*.*.* arch: amd64 - depends: libyaml-cpp0.7, openssl, libulfius2.7 + depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 desc: Native Linux Meshtastic binary. - uses: actions/upload-artifact@v4 @@ -87,4 +87,4 @@ jobs: name: meshtasticd_${{ steps.version.outputs.version }}_amd64.deb overwrite: true path: | - ./*.deb \ No newline at end of file + ./*.deb diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml index aef8905f8..a4cd49573 100644 --- a/.github/workflows/package_raspbian.yml +++ b/.github/workflows/package_raspbian.yml @@ -79,7 +79,7 @@ jobs: maintainer: Jonathan Bennett version: ${{ steps.version.outputs.version }} # refs/tags/v*.*.* arch: arm64 - depends: libyaml-cpp0.7, openssl, libulfius2.7 + depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 desc: Native Linux Meshtastic binary. - uses: actions/upload-artifact@v4 @@ -87,4 +87,4 @@ jobs: name: meshtasticd_${{ steps.version.outputs.version }}_arm64.deb overwrite: true path: | - ./*.deb \ No newline at end of file + ./*.deb diff --git a/.github/workflows/package_raspbian_armv7l.yml b/.github/workflows/package_raspbian_armv7l.yml index ddb84d4a7..c4cc5c673 100644 --- a/.github/workflows/package_raspbian_armv7l.yml +++ b/.github/workflows/package_raspbian_armv7l.yml @@ -79,7 +79,7 @@ jobs: maintainer: Jonathan Bennett version: ${{ steps.version.outputs.version }} # refs/tags/v*.*.* arch: armhf - depends: libyaml-cpp0.7, openssl, libulfius2.7 + depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 desc: Native Linux Meshtastic binary. - uses: actions/upload-artifact@v4 @@ -87,4 +87,4 @@ jobs: name: meshtasticd_${{ steps.version.outputs.version }}_armhf.deb overwrite: true path: | - ./*.deb \ No newline at end of file + ./*.deb diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index e4e32693c..777ce1e02 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated). [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#73bd1a21183ca8b00c4ea58bb21315df31a50dff +platform = https://github.com/meshtastic/platform-native.git#562d189828f09fbf4c4093b3c0104bae9d8e9ff9 framework = arduino build_src_filter = @@ -39,4 +39,5 @@ build_flags = -lbluetooth -lgpiod -lyaml-cpp + -li2c -std=c++17 \ No newline at end of file diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 2473a6573..2561a8e17 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -64,7 +64,8 @@ class ScanI2C TPS65233, MPR121KB, CGRADSENS, - INA226 + INA226, + NXP_SE050, } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 79c0deccf..6e695c22f 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -154,9 +154,14 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) } i2cBus->beginTransmission(addr.address); #ifdef ARCH_PORTDUINO - if (i2cBus->read() != -1) - err = 0; - else + err = 2; + if ((addr.address >= 0x30 && addr.address <= 0x37) || (addr.address >= 0x50 && addr.address <= 0x5F)) { + if (i2cBus->read() != -1) + err = 0; + } else { + err = i2cBus->writeQuick((uint8_t)0); + } + if (err != 0) err = 2; #else err = i2cBus->endTransmission(); @@ -396,7 +401,6 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(OPT3001_ADDR, OPT3001, "OPT3001", (uint8_t)addr.address); SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632", (uint8_t)addr.address); SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802", (uint8_t)addr.address); - SCAN_SIMPLE_CASE(FT6336U_ADDR, FT6336U, "FT6336U", (uint8_t)addr.address); SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048", (uint8_t)addr.address); #ifdef HAS_TPS65233 SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address); @@ -444,6 +448,26 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) } break; + case 0x48: { + i2cBus->beginTransmission(addr.address); + uint8_t getInfo[] = {0x5A, 0xC0, 0x00, 0xFF, 0xFC}; + uint8_t expectedInfo[] = {0xa5, 0xE0, 0x00, 0x3F, 0x19}; + uint8_t info[5]; + size_t len = 0; + i2cBus->write(getInfo, 5); + i2cBus->endTransmission(); + len = i2cBus->readBytes(info, 5); + if (len == 5 && memcmp(expectedInfo, info, len) == 0) { + LOG_INFO("NXP SE050 crypto chip found\n"); + type = NXP_SE050; + + } else { + LOG_INFO("FT6336U touchscreen found\n"); + type = FT6336U; + } + break; + } + default: LOG_INFO("Device found at address 0x%x was not able to be enumerated", (uint8_t)addr.address); } From 143e1d1a0d0014332b1aa44222329f74a2df2455 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Mon, 23 Dec 2024 07:48:07 -0800 Subject: [PATCH 11/13] Check if MQTT remote IP is private (#5647) Co-authored-by: Ben Meadors --- src/mqtt/MQTT.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index d61e87855..ba47e26e3 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -457,6 +457,7 @@ void MQTT::reconnect() enabled = true; // Start running background process again runASAP = true; reconnectCount = 0; + isMqttServerAddressPrivate = isPrivateIpAddress(mqttClient.remoteIP()); publishNodeInfo(); sendSubscriptions(); From b4b2fd6122e965adf69839a69b75df391436248e Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Tue, 24 Dec 2024 10:47:27 +1100 Subject: [PATCH 12/13] LIS3DH (WisMesh Pocket) - Honor Wake On Tap Or Motion (#5625) As reported by @Mason10198, the WisMesh Pocket was always waking on accelerometer motion. This change gates the LIS3DH sensor's call to wakeScreen based on config.display.wake_on_tap_or_motion . fixes https://github.com/meshtastic/firmware/issues/5579 --- src/motion/LIS3DHSensor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/motion/LIS3DHSensor.cpp b/src/motion/LIS3DHSensor.cpp index f3f5a62d1..995f74abe 100755 --- a/src/motion/LIS3DHSensor.cpp +++ b/src/motion/LIS3DHSensor.cpp @@ -22,7 +22,7 @@ int32_t LIS3DHSensor::runOnce() { if (sensor.getClick() > 0) { uint8_t click = sensor.getClick(); - if (!config.device.double_tap_as_button_press) { + if (!config.device.double_tap_as_button_press && config.display.wake_on_tap_or_motion) { wakeScreen(); } @@ -34,4 +34,4 @@ int32_t LIS3DHSensor::runOnce() return MOTION_SENSOR_CHECK_INTERVAL_MS; } -#endif \ No newline at end of file +#endif From 57af51cc1822f03dbffdb0c5deae07f62171ee95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 24 Dec 2024 09:04:57 +0100 Subject: [PATCH 13/13] fix typo in nugget radio def --- variants/nibble_rp2040/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/nibble_rp2040/variant.h b/variants/nibble_rp2040/variant.h index ac105b439..0f71b98e9 100644 --- a/variants/nibble_rp2040/variant.h +++ b/variants/nibble_rp2040/variant.h @@ -6,7 +6,7 @@ #define HAS_CPU_SHUTDOWN 1 -#define USE_RFM95 +#define USE_RF95 #define LORA_SCK 10 #define LORA_MISO 12 #define LORA_MOSI 11