From 067d01b8324071ef0146a6d109ea66e3afe92947 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 23 May 2025 16:35:13 -0400 Subject: [PATCH 01/41] Bosch bsec2: Switch back to official releases (#6870) --- platformio.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index 458aabed2..7502de0d7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -147,8 +147,6 @@ lib_deps = emotibit/EmotiBit MLX90632@1.0.8 # renovate: datasource=custom.pio depName=Adafruit MLX90614 packageName=adafruit/library/Adafruit MLX90614 Library adafruit/Adafruit MLX90614 Library@2.1.5 - # renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library - boschsensortec/BME68x Sensor Library@1.2.40408 # renovate: datasource=github-tags depName=INA3221 packageName=KodinLanewave/INA3221 https://github.com/KodinLanewave/INA3221/archive/1.0.1.zip # renovate: datasource=custom.pio depName=QMC5883L Compass packageName=mprograms/library/QMC5883LCompass @@ -185,7 +183,9 @@ lib_deps = sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6 # renovate: datasource=custom.pio depName=ClosedCube OPT3001 packageName=closedcube/library/ClosedCube OPT3001 ClosedCube OPT3001@1.1.2 - # renovate: datasource=git-refs depName=Bosch BSEC2 packageName=https://github.com/meshtastic/Bosch-BSEC2-Library gitBranch=extra_script - https://github.com/meshtastic/Bosch-BSEC2-Library/archive/e16952dfe5addd4287e1eb8c4f6ecac0fa3dd3de.zip + # renovate: datasource=custom.pio depName=Bosch BSEC2 packageName=boschsensortec/library/bsec2 + boschsensortec/bsec2@1.10.2610 + # renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library + boschsensortec/BME68x Sensor Library@1.3.40408 # renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip From 2c9e1694514961791f93dca91ce857822f44d53a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 May 2025 11:33:21 +0200 Subject: [PATCH 02/41] Update meshtastic/device-ui digest to 0e9bb79 (#6880) fix bluetooth fixedPin during restart (#135) --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 7502de0d7..836b723af 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/405ca495322b7dc3b61f7588d28267d49b2ebc38.zip + https://github.com/meshtastic/device-ui/archive/0e9bb792bb4b015b487397427781eda2767c87e6.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 30e83d36b7474159524952bdef83f5e7a345a582 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 May 2025 19:55:19 -0500 Subject: [PATCH 03/41] Update meshtastic/device-ui digest to 2fba9de (#6882) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 836b723af..c1012c810 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/0e9bb792bb4b015b487397427781eda2767c87e6.zip + https://github.com/meshtastic/device-ui/archive/2fba9def30b52bbfd13cc5b76f61f257428325e7.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 9b69c2a9af7f950c825869000d908da17a12dd33 Mon Sep 17 00:00:00 2001 From: Chiho Sin Date: Sun, 25 May 2025 19:08:41 +0800 Subject: [PATCH 04/41] graphics: Add GDEY0213B74 E-Ink display driver (#6879) Implement the GDEY0213B74 driver with configuration methods for scanning, waveform, update sequence, and polling for refresh completion. This driver supports both fast and full update types for the 2.13 inch E-Ink display. Signed-off-by: ChihoSin chihosin@icloud.com Signed-off-by: ChihoSin chihosin@icloud.com --- .../niche/Drivers/EInk/GDEY0213B74.cpp | 61 +++++++++++++++++++ src/graphics/niche/Drivers/EInk/GDEY0213B74.h | 42 +++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/graphics/niche/Drivers/EInk/GDEY0213B74.cpp create mode 100644 src/graphics/niche/Drivers/EInk/GDEY0213B74.h diff --git a/src/graphics/niche/Drivers/EInk/GDEY0213B74.cpp b/src/graphics/niche/Drivers/EInk/GDEY0213B74.cpp new file mode 100644 index 000000000..a0ff63258 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/GDEY0213B74.cpp @@ -0,0 +1,61 @@ +#include "./GDEY0213B74.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +using namespace NicheGraphics::Drivers; + +// Map the display controller IC's output to the connected panel +void GDEY0213B74::configScanning() +{ + // "Driver output control" + sendCommand(0x01); + sendData(0xF9); + sendData(0x00); + sendData(0x00); + + // To-do: delete this method? + // Values set here might be redundant: F9, 00, 00 seems to be default +} + +// Specify which information is used to control the sequence of voltages applied to move the pixels +// - For this display, configUpdateSequence() specifies that a suitable LUT will be loaded from +// the controller IC's OTP memory, when the update procedure begins. +void GDEY0213B74::configWaveform() +{ + sendCommand(0x3C); // Border waveform: + sendData(0x05); // Screen border should follow LUT1 waveform (actively drive pixels white) + + sendCommand(0x18); // Temperature sensor: + sendData(0x80); // Use internal temperature sensor to select an appropriate refresh waveform +} + +void GDEY0213B74::configUpdateSequence() +{ + switch (updateType) { + case FAST: + sendCommand(0x22); // Set "update sequence" + sendData(0xFF); // Will load LUT from OTP memory, Display mode 2 "differential refresh" + break; + + case FULL: + default: + sendCommand(0x22); // Set "update sequence" + sendData(0xF7); // Will load LUT from OTP memory + break; + } +} + +// Once the refresh operation has been started, +// begin periodically polling the display to check for completion, using the normal Meshtastic threading code +// Only used when refresh is "async" +void GDEY0213B74::detachFromUpdate() +{ + switch (updateType) { + case FAST: + return beginPolling(50, 500); // At least 500ms for fast refresh + case FULL: + default: + return beginPolling(100, 2000); // At least 2 seconds for full refresh + } +} +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/GDEY0213B74.h b/src/graphics/niche/Drivers/EInk/GDEY0213B74.h new file mode 100644 index 000000000..2212fe92a --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/GDEY0213B74.h @@ -0,0 +1,42 @@ +/* + +E-Ink display driver + - GDEY0213B74 + - Manufacturer: Goodisplay + - Size: 2.13 inch + - Resolution: 250px x 122px + - Flex connector marking: FPC-A002 + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "configuration.h" + +#include "./SSD16XX.h" + +namespace NicheGraphics::Drivers +{ +class GDEY0213B74 : public SSD16XX +{ + // Display properties + private: + static constexpr uint32_t width = 122; + static constexpr uint32_t height = 250; + static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); + + public: + GDEY0213B74() : SSD16XX(width, height, supported) {} + + protected: + virtual void configScanning() override; + virtual void configWaveform() override; + virtual void configUpdateSequence() override; + void detachFromUpdate() override; +}; + +} // namespace NicheGraphics::Drivers + +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file From e29588d2e20acde737dc15e6137956efc72e7234 Mon Sep 17 00:00:00 2001 From: Andrew Yong Date: Sun, 25 May 2025 18:26:31 +0700 Subject: [PATCH 05/41] feat(RadioInterface): Tx power gain calculation rework (#6796) - Rename REGULATORY_GAIN_LORA to TX_GAIN_LORA - Move gain-based Tx power clamping from RadioInterface::applyModemConfig() to RadioInterface::limitPower() - User-configured Tx power now matches the Tx power out of the device connector - Re-order [LoRa Chip]Interface.cpp limitPower() to take place before the final Tx power clamping so we clamp based on the pre-PA Tx power rather than user-configured Tx power Tested on XIAO BLE variant. Signed-off-by: Andrew Yong Co-authored-by: Ben Meadors --- src/configuration.h | 8 ++++---- src/mesh/LR11x0Interface.cpp | 4 ++-- src/mesh/RF95Interface.cpp | 4 ++-- src/mesh/RadioInterface.cpp | 11 ++++++++--- src/mesh/STM32WLE5JCInterface.cpp | 4 ++-- src/mesh/SX126xInterface.cpp | 4 ++-- src/mesh/SX128xInterface.cpp | 4 ++-- variants/xiao_ble/variant.h | 4 ++-- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index d319ddb0a..5f6930646 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -80,10 +80,10 @@ along with this program. If not, see . // Override user saved region, for producing region-locked builds // #define REGULATORY_LORA_REGIONCODE meshtastic_Config_LoRaConfig_RegionCode_SG_923 -// Total system gain in dBm to subtract from Tx power to remain within regulatory ERP limit for non-licensed operators -// This value should be set in variant.h and is PA gain + antenna gain (if system ships with an antenna) -#ifndef REGULATORY_GAIN_LORA -#define REGULATORY_GAIN_LORA 0 +// Total system gain in dBm to subtract from Tx power to remain within regulatory and Tx PA limits +// This value should be set in variant.h and is PA gain + antenna gain (if variant has a non-removable antenna) +#ifndef TX_GAIN_LORA +#define TX_GAIN_LORA 0 #endif // ----------------------------------------------------------------------------- diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index aecc8f722..8cc05994c 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -71,6 +71,8 @@ template bool LR11x0Interface::init() RadioLibInterface::init(); + limitPower(); + if (power > LR1110_MAX_POWER) // Clamp power to maximum defined level power = LR1110_MAX_POWER; @@ -80,8 +82,6 @@ template bool LR11x0Interface::init() preambleLength = 12; // 12 is the default for operation above 2GHz } - limitPower(); - #ifdef LR11X0_RF_SWITCH_SUBGHZ pinMode(LR11X0_RF_SWITCH_SUBGHZ, OUTPUT); digitalWrite(LR11X0_RF_SWITCH_SUBGHZ, getFreq() < 1e9 ? HIGH : LOW); diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 1dfc72708..943a79a5f 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -122,11 +122,11 @@ bool RF95Interface::init() power = dacDbValues.db; #endif + limitPower(); + if (power > RF95_MAX_POWER) // This chip has lower power limits than some power = RF95_MAX_POWER; - limitPower(); - iface = lora = new RadioLibRF95(&module); #ifdef RF95_TCXO diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 86903153b..06398e6c3 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -528,8 +528,8 @@ void RadioInterface::applyModemConfig() power = loraConfig.tx_power; - if ((power == 0) || ((power + REGULATORY_GAIN_LORA > myRegion->powerLimit) && !devicestate.owner.is_licensed)) - power = myRegion->powerLimit - REGULATORY_GAIN_LORA; + if ((power == 0) || ((power > myRegion->powerLimit) && !devicestate.owner.is_licensed)) + power = myRegion->powerLimit; if (power == 0) power = 17; // Default to this power level if we don't have a valid regional power limit (powerLimit of myRegion defaults @@ -616,7 +616,12 @@ void RadioInterface::limitPower() power = maxPower; } - LOG_INFO("Set radio: final power level=%d", power); + if (TX_GAIN_LORA > 0) { + LOG_INFO("Requested Tx power: %d dBm; Device LoRa Tx gain: %d dB", power, TX_GAIN_LORA); + power -= TX_GAIN_LORA; + } + + LOG_INFO("Final Tx power: %d dBm", power); } void RadioInterface::deliverToReceiver(meshtastic_MeshPacket *p) diff --git a/src/mesh/STM32WLE5JCInterface.cpp b/src/mesh/STM32WLE5JCInterface.cpp index 6a340dd28..3c8bf89c3 100644 --- a/src/mesh/STM32WLE5JCInterface.cpp +++ b/src/mesh/STM32WLE5JCInterface.cpp @@ -25,11 +25,11 @@ bool STM32WLE5JCInterface::init() lora.setRfSwitchTable(rfswitch_pins, rfswitch_table); + limitPower(); + if (power > STM32WLx_MAX_POWER) // This chip has lower power limits than some power = STM32WLx_MAX_POWER; - limitPower(); - int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage); LOG_INFO("STM32WLx init result %d", res); diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index c867466b7..e5ecd9302 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -69,11 +69,11 @@ template bool SX126xInterface::init() RadioLibInterface::init(); + limitPower(); + if (power > SX126X_MAX_POWER) // Clamp power to maximum defined level power = SX126X_MAX_POWER; - limitPower(); - int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO); // \todo Display actual typename of the adapter, not just `SX126x` LOG_INFO("SX126x init result %d", res); diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 23a023d3f..2b17543fc 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -62,11 +62,11 @@ template bool SX128xInterface::init() RadioLibInterface::init(); + limitPower(); + if (power > SX128X_MAX_POWER) // This chip has lower power limits than some power = SX128X_MAX_POWER; - limitPower(); - preambleLength = 12; // 12 is the default for this chip, 32 does not RX at all int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength); diff --git a/variants/xiao_ble/variant.h b/variants/xiao_ble/variant.h index d00f8be89..b46aa96ae 100644 --- a/variants/xiao_ble/variant.h +++ b/variants/xiao_ble/variant.h @@ -145,12 +145,12 @@ static const uint8_t SCK = PIN_SPI_SCK; #ifdef EBYTE_E22_900M30S // 10dB PA gain and 30dB rated output; based on measurements from // https://github.com/S5NC/EBYTE_ESP32-S3/blob/main/E22-900M30S%20power%20output%20testing.txt -#define REGULATORY_GAIN_LORA 7 +#define TX_GAIN_LORA 7 #define SX126X_MAX_POWER 22 #endif #ifdef EBYTE_E22_900M33S // 25dB PA gain and 33dB rated output; based on TX Power Curve from E22-900M33S_UserManual_EN_v1.0.pdf -#define REGULATORY_GAIN_LORA 25 +#define TX_GAIN_LORA 25 #define SX126X_MAX_POWER 8 #endif #endif From d3b16c1e474519b3e51ad8fdc0d04e9ccb848ebd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 25 May 2025 06:29:00 -0500 Subject: [PATCH 06/41] Upgrade trunk (#6843) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 79bdf4778..bcb75d550 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -10,14 +10,14 @@ lint: enabled: - renovate@40.0.6 - prettier@3.5.3 - - trufflehog@3.88.29 + - trufflehog@3.88.32 - yamllint@1.37.1 - bandit@1.8.3 - trivy@0.62.1 - taplo@0.9.3 - - ruff@0.11.9 + - ruff@0.11.10 - isort@6.0.1 - - markdownlint@0.44.0 + - markdownlint@0.45.0 - oxipng@9.1.5 - svgo@3.3.2 - actionlint@1.7.7 From c47bdd11f9b17d1e81ee2377d1ee361e80ea869a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 25 May 2025 06:56:21 -0500 Subject: [PATCH 07/41] [create-pull-request] automated change (#6885) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/telemetry.pb.h | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/protobufs b/protobufs index 0b32ce24f..91484534a 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 0b32ce24f029f69635026aec9428b5c8176e2ce1 +Subproject commit 91484534a58cb4da8ab68ac046f1e76fd1936bf7 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index 4071c611e..4fa673df8 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -277,6 +277,10 @@ typedef struct _meshtastic_LocalStats { /* Number of times we canceled a packet to be relayed, because someone else did it before us. This will always be zero for ROUTERs/REPEATERs. If this number is high, some other node(s) is/are relaying faster than you. */ uint32_t num_tx_relay_canceled; + /* Number of bytes used in the heap */ + uint32_t heap_total_bytes; + /* Number of bytes free in the heap */ + uint32_t heap_free_bytes; } meshtastic_LocalStats; /* Health telemetry metrics */ @@ -374,7 +378,7 @@ extern "C" { #define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_PowerMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_AirQualityMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} -#define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_HealthMetrics_init_default {false, 0, false, 0, false, 0} #define meshtastic_HostMetrics_init_default {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} @@ -383,7 +387,7 @@ extern "C" { #define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_AirQualityMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} -#define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_HealthMetrics_init_zero {false, 0, false, 0, false, 0} #define meshtastic_HostMetrics_init_zero {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} @@ -447,6 +451,8 @@ extern "C" { #define meshtastic_LocalStats_num_rx_dupe_tag 9 #define meshtastic_LocalStats_num_tx_relay_tag 10 #define meshtastic_LocalStats_num_tx_relay_canceled_tag 11 +#define meshtastic_LocalStats_heap_total_bytes_tag 12 +#define meshtastic_LocalStats_heap_free_bytes_tag 13 #define meshtastic_HealthMetrics_heart_bpm_tag 1 #define meshtastic_HealthMetrics_spO2_tag 2 #define meshtastic_HealthMetrics_temperature_tag 3 @@ -544,7 +550,9 @@ X(a, STATIC, SINGULAR, UINT32, num_online_nodes, 7) \ X(a, STATIC, SINGULAR, UINT32, num_total_nodes, 8) \ X(a, STATIC, SINGULAR, UINT32, num_rx_dupe, 9) \ X(a, STATIC, SINGULAR, UINT32, num_tx_relay, 10) \ -X(a, STATIC, SINGULAR, UINT32, num_tx_relay_canceled, 11) +X(a, STATIC, SINGULAR, UINT32, num_tx_relay_canceled, 11) \ +X(a, STATIC, SINGULAR, UINT32, heap_total_bytes, 12) \ +X(a, STATIC, SINGULAR, UINT32, heap_free_bytes, 13) #define meshtastic_LocalStats_CALLBACK NULL #define meshtastic_LocalStats_DEFAULT NULL @@ -621,7 +629,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define meshtastic_EnvironmentMetrics_size 113 #define meshtastic_HealthMetrics_size 11 #define meshtastic_HostMetrics_size 264 -#define meshtastic_LocalStats_size 60 +#define meshtastic_LocalStats_size 72 #define meshtastic_Nau7802Config_size 16 #define meshtastic_PowerMetrics_size 30 #define meshtastic_Telemetry_size 272 From 5fbdf4b6dc5f2b01f380cddd74ba17e156ba7bd3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 25 May 2025 07:12:03 -0500 Subject: [PATCH 08/41] chore(deps): update meshtastic/device-ui digest to e63b219 (#6883) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index c1012c810..fc6c06162 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/2fba9def30b52bbfd13cc5b76f61f257428325e7.zip + https://github.com/meshtastic/device-ui/archive/e63b219e78e9655be10745b4037cefd2c608d258.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 2e72850d99a9d2546d69fe529b3025aed6aec12f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 25 May 2025 07:24:28 -0500 Subject: [PATCH 09/41] Fix is_unmessagable plumbing (#6886) --- src/mesh/TypeConversions.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesh/TypeConversions.cpp b/src/mesh/TypeConversions.cpp index c47a67e68..17cd92851 100644 --- a/src/mesh/TypeConversions.cpp +++ b/src/mesh/TypeConversions.cpp @@ -87,6 +87,8 @@ meshtastic_UserLite TypeConversions::ConvertToUserLite(meshtastic_User user) memcpy(lite.macaddr, user.macaddr, sizeof(lite.macaddr)); memcpy(lite.public_key.bytes, user.public_key.bytes, sizeof(lite.public_key.bytes)); lite.public_key.size = user.public_key.size; + lite.has_is_unmessagable = user.has_is_unmessagable; + lite.is_unmessagable = user.is_unmessagable; return lite; } @@ -103,6 +105,8 @@ meshtastic_User TypeConversions::ConvertToUser(uint32_t nodeNum, meshtastic_User memcpy(user.macaddr, lite.macaddr, sizeof(user.macaddr)); memcpy(user.public_key.bytes, lite.public_key.bytes, sizeof(user.public_key.bytes)); user.public_key.size = lite.public_key.size; + user.has_is_unmessagable = lite.has_is_unmessagable; + user.is_unmessagable = lite.is_unmessagable; return user; } \ No newline at end of file From 7d95b487efb4da5194e4e3ac66905ab18ffff894 Mon Sep 17 00:00:00 2001 From: Michael Cullen Date: Sun, 25 May 2025 14:29:02 +0200 Subject: [PATCH 10/41] Add PCT2075 Temperature Sensor (#6829) This is an I2C temperature sensor. It is intended to be a drop-in compatible sensor for the LM75, however it is more accurate. Co-authored-by: Ben Meadors --- platformio.ini | 2 ++ src/configuration.h | 1 + src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 1 + src/main.cpp | 1 + .../Telemetry/EnvironmentTelemetry.cpp | 13 +++++++ .../Telemetry/Sensor/PCT2075Sensor.cpp | 35 +++++++++++++++++++ src/modules/Telemetry/Sensor/PCT2075Sensor.h | 24 +++++++++++++ 8 files changed, 78 insertions(+) create mode 100644 src/modules/Telemetry/Sensor/PCT2075Sensor.cpp create mode 100644 src/modules/Telemetry/Sensor/PCT2075Sensor.h diff --git a/platformio.ini b/platformio.ini index fc6c06162..d7504e6c5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -161,6 +161,8 @@ lib_deps = sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2 # renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2 + # renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/Adafruit PCT2075 + adafruit/Adafruit PCT2075@1.0.5 ; (not included in native / portduino) [environmental_extra] diff --git a/src/configuration.h b/src/configuration.h index 5f6930646..0c23e677d 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -153,6 +153,7 @@ along with this program. If not, see . #define CGRADSENS_ADDR 0x66 #define LTR390UV_ADDR 0x53 #define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 // same adress as TCA8418 +#define PCT2075_ADDR 0x37 // ----------------------------------------------------------------------------- // ACCELEROMETER diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index c363db1b5..72184db69 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -71,6 +71,7 @@ class ScanI2C DPS310, LTR390UV, TCA8418KB, + PCT2075, } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 9781cbf56..e2ba78a92 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -434,6 +434,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048", (uint8_t)addr.address); SCAN_SIMPLE_CASE(DFROBOT_RAIN_ADDR, DFROBOT_RAIN, "DFRobot Rain Gauge", (uint8_t)addr.address); SCAN_SIMPLE_CASE(LTR390UV_ADDR, LTR390UV, "LTR390UV", (uint8_t)addr.address); + SCAN_SIMPLE_CASE(PCT2075_ADDR, PCT2075, "PCT2075", (uint8_t)addr.address); #ifdef HAS_TPS65233 SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address); #endif diff --git a/src/main.cpp b/src/main.cpp index 1e46d9db1..7a11ca2e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -732,6 +732,7 @@ void setup() scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DFROBOT_RAIN, meshtastic_TelemetrySensorType_DFROBOT_RAIN); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::LTR390UV, meshtastic_TelemetrySensorType_LTR390UV); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DPS310, meshtastic_TelemetrySensorType_DPS310); + scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::PCT2075, meshtastic_TelemetrySensorType_PCT2075); i2cScanner.reset(); #endif diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 56f9d7433..51f076552 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -157,6 +157,13 @@ BMP3XXSensor bmp3xxSensor; NullSensor bmp3xxSensor; #endif +#if __has_include() +#include "Sensor/PCT2075Sensor.h" +PCT2075Sensor pct2075Sensor; +#else +NullSensor pct2075Sensor; +#endif + RCWL9620Sensor rcwl9620Sensor; CGRadSensSensor cgRadSens; #endif @@ -264,6 +271,8 @@ int32_t EnvironmentTelemetryModule::runOnce() result = max17048Sensor.runOnce(); if (cgRadSens.hasSensor()) result = cgRadSens.runOnce(); + if (pct2075Sensor.hasSensor()) + result = pct2075Sensor.runOnce(); // this only works on the wismesh hub with the solar option. This is not an I2C sensor, so we don't need the // sensormap here. #ifdef HAS_RAKPROT @@ -595,6 +604,10 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m valid = valid && cgRadSens.getMetrics(m); hasSensor = true; } + if (pct2075Sensor.hasSensor()) { + valid = valid && pct2075Sensor.getMetrics(m); + hasSensor = true; + } #ifdef HAS_RAKPROT valid = valid && rak9154Sensor.getMetrics(m); hasSensor = true; diff --git a/src/modules/Telemetry/Sensor/PCT2075Sensor.cpp b/src/modules/Telemetry/Sensor/PCT2075Sensor.cpp new file mode 100644 index 000000000..d2b50d983 --- /dev/null +++ b/src/modules/Telemetry/Sensor/PCT2075Sensor.cpp @@ -0,0 +1,35 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "PCT2075Sensor.h" +#include "TelemetrySensor.h" +#include + +PCT2075Sensor::PCT2075Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_PCT2075, "PCT2075") {} + +int32_t PCT2075Sensor::runOnce() +{ + LOG_INFO("Init sensor: %s", sensorName); + if (!hasSensor()) { + return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; + } + + status = pct2075.begin(nodeTelemetrySensorsMap[sensorType].first, nodeTelemetrySensorsMap[sensorType].second); + + return initI2CSensor(); +} + +void PCT2075Sensor::setup() {} + +bool PCT2075Sensor::getMetrics(meshtastic_Telemetry *measurement) +{ + measurement->variant.environment_metrics.has_temperature = true; + + measurement->variant.environment_metrics.temperature = pct2075.getTemperature(); + + return true; +} + +#endif diff --git a/src/modules/Telemetry/Sensor/PCT2075Sensor.h b/src/modules/Telemetry/Sensor/PCT2075Sensor.h new file mode 100644 index 000000000..842c973d0 --- /dev/null +++ b/src/modules/Telemetry/Sensor/PCT2075Sensor.h @@ -0,0 +1,24 @@ +#pragma once +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "TelemetrySensor.h" +#include + +class PCT2075Sensor : public TelemetrySensor +{ + private: + Adafruit_PCT2075 pct2075; + + protected: + virtual void setup() override; + + public: + PCT2075Sensor(); + virtual int32_t runOnce() override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; +}; + +#endif From 75a49d348622ff537c99a0673f8a9b400448eb9d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 25 May 2025 11:08:56 -0500 Subject: [PATCH 11/41] Add heap metrics to Local stats (#6887) --- src/modules/Telemetry/DeviceTelemetry.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/Telemetry/DeviceTelemetry.cpp b/src/modules/Telemetry/DeviceTelemetry.cpp index 251608641..43c2dd84c 100644 --- a/src/modules/Telemetry/DeviceTelemetry.cpp +++ b/src/modules/Telemetry/DeviceTelemetry.cpp @@ -9,6 +9,7 @@ #include "Router.h" #include "configuration.h" #include "main.h" +#include "memGet.h" #include #include #include @@ -133,6 +134,9 @@ meshtastic_Telemetry DeviceTelemetryModule::getLocalStatsTelemetry() telemetry.variant.local_stats.num_packets_rx_bad = SimRadio::instance->rxBad; telemetry.variant.local_stats.num_tx_relay = SimRadio::instance->txRelay; } +#else + telemetry.variant.local_stats.heap_total_bytes = memGet.getHeapSize(); + telemetry.variant.local_stats.heap_free_bytes = memGet.getFreeHeap(); #endif if (router) { telemetry.variant.local_stats.num_rx_dupe = router->rxDupe; From f223b8a55d1b6a04d2203d43a32bbb880b428af3 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Mon, 26 May 2025 06:12:52 +1200 Subject: [PATCH 12/41] Add missing parsing of UTF-8 chars (#6889) --- .../Applets/System/Notification/NotificationApplet.cpp | 4 ++-- .../InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp | 6 +++--- src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp index f9439fab8..ae0836d19 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp @@ -213,7 +213,7 @@ std::string InkHUD::NotificationApplet::getNotificationText(uint16_t widthAvaila // Sender id if (node && node->has_user) - text += node->user.short_name; + text += parseShortName(node); else text += hexifyNodeNum(message->sender); @@ -227,7 +227,7 @@ std::string InkHUD::NotificationApplet::getNotificationText(uint16_t widthAvaila // Sender id if (node && node->has_user) - text += node->user.short_name; + text += parseShortName(node); else text += hexifyNodeNum(message->sender); diff --git a/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp index 968775302..17d724aee 100644 --- a/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp @@ -67,13 +67,13 @@ void InkHUD::AllMessageApplet::onRender() } // Sender's id - // - shortname, if available, or + // - short name and long name, if available, or // - node id meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(message->sender); if (sender && sender->has_user) { - header += sender->user.short_name; + header += parseShortName(sender); // May be last-four of node if unprintable (emoji, etc) header += " ("; - header += sender->user.long_name; + header += parse(sender->user.long_name); header += ")"; } else header += hexifyNodeNum(message->sender); diff --git a/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp index 3c69495ed..dbf5c08fb 100644 --- a/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp @@ -63,13 +63,13 @@ void InkHUD::DMApplet::onRender() } // Sender's id - // - shortname, if available, or + // - shortname and long name, if available, or // - node id meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(latestMessage->dm.sender); if (sender && sender->has_user) { - header += sender->user.short_name; + header += parseShortName(sender); // May be last-four of node if unprintable (emoji, etc) header += " ("; - header += sender->user.long_name; + header += parse(sender->user.long_name); header += ")"; } else header += hexifyNodeNum(latestMessage->dm.sender); From 106dd087104d67bc77a3f7c075b8baae996ee95d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 25 May 2025 16:53:02 -0500 Subject: [PATCH 13/41] automated bumps (#6890) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- bin/org.meshtastic.meshtasticd.metainfo.xml | 3 +++ debian/changelog | 7 +++++-- version.properties | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/org.meshtastic.meshtasticd.metainfo.xml b/bin/org.meshtastic.meshtasticd.metainfo.xml index 1a7ad284d..30f684fef 100644 --- a/bin/org.meshtastic.meshtasticd.metainfo.xml +++ b/bin/org.meshtastic.meshtasticd.metainfo.xml @@ -87,6 +87,9 @@ + + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.10 + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.9 diff --git a/debian/changelog b/debian/changelog index ae27bc3e9..87e3aea9b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -meshtasticd (2.6.9.0) UNRELEASED; urgency=medium +meshtasticd (2.6.10.0) UNRELEASED; urgency=medium [ Austin Lane ] * Initial packaging @@ -13,4 +13,7 @@ meshtasticd (2.6.9.0) UNRELEASED; urgency=medium [ ] * GitHub Actions Automatic version bump - -- Thu, 15 May 2025 11:13:30 +0000 + [ ] + * GitHub Actions Automatic version bump + + -- Sun, 25 May 2025 20:46:49 +0000 diff --git a/version.properties b/version.properties index b0e960697..71de951f1 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 9 +build = 10 From baefda213a0dcb28196ecad4c92170ca6eef773e Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 26 May 2025 07:31:10 -0400 Subject: [PATCH 14/41] Linux: Adjust udev rules for gpio (#6891) --- bin/99-meshtasticd-udev.rules | 5 ++++- debian/meshtasticd.postinst | 7 ++++--- debian/meshtasticd.udev | 5 ++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/99-meshtasticd-udev.rules b/bin/99-meshtasticd-udev.rules index 69a468d7a..1151efafd 100644 --- a/bin/99-meshtasticd-udev.rules +++ b/bin/99-meshtasticd-udev.rules @@ -1,4 +1,7 @@ -# Set spidev ownership to 'spi' group. +# Set spidev ownership to 'spi' group SUBSYSTEM=="spidev", KERNEL=="spidev*", GROUP="spi", MODE="0660" # Allow access to USB CH341 devices SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666" +# Set gpio ownership to 'gpio' group +SUBSYSTEM=="*gpiomem*", GROUP="gpio", MODE="0660" +SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660" diff --git a/debian/meshtasticd.postinst b/debian/meshtasticd.postinst index 324865718..fe0dbc332 100755 --- a/debian/meshtasticd.postinst +++ b/debian/meshtasticd.postinst @@ -20,16 +20,17 @@ set -e case "$1" in configure|reconfigure) - # create spi group (for udev rules) - # this group already exists on Raspberry Pi OS + # create spi, gpio groups (for udev rules) + # these groups already exist on Raspberry Pi OS getent group spi >/dev/null 2>/dev/null || addgroup --system spi + getent group gpio >/dev/null 2>/dev/null || addgroup --system gpio # create a meshtasticd group and user getent passwd meshtasticd >/dev/null 2>/dev/null || adduser --system --home /var/lib/meshtasticd --no-create-home meshtasticd getent group meshtasticd >/dev/null 2>/dev/null || addgroup --system meshtasticd adduser meshtasticd meshtasticd >/dev/null 2>/dev/null adduser meshtasticd spi >/dev/null 2>/dev/null + adduser meshtasticd gpio >/dev/null 2>/dev/null # add meshtasticd user to appropriate groups (if they exist) - getent group gpio >/dev/null 2>/dev/null && adduser meshtasticd gpio >/dev/null 2>/dev/null getent group plugdev >/dev/null 2>/dev/null && adduser meshtasticd plugdev >/dev/null 2>/dev/null getent group dialout >/dev/null 2>/dev/null && adduser meshtasticd dialout >/dev/null 2>/dev/null getent group i2c >/dev/null 2>/dev/null && adduser meshtasticd i2c >/dev/null 2>/dev/null diff --git a/debian/meshtasticd.udev b/debian/meshtasticd.udev index 69a468d7a..1151efafd 100644 --- a/debian/meshtasticd.udev +++ b/debian/meshtasticd.udev @@ -1,4 +1,7 @@ -# Set spidev ownership to 'spi' group. +# Set spidev ownership to 'spi' group SUBSYSTEM=="spidev", KERNEL=="spidev*", GROUP="spi", MODE="0660" # Allow access to USB CH341 devices SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666" +# Set gpio ownership to 'gpio' group +SUBSYSTEM=="*gpiomem*", GROUP="gpio", MODE="0660" +SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660" From 138dc89442cce81dc902fd057e2132be372206e7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 06:19:35 -0500 Subject: [PATCH 15/41] Upgrade trunk (#6898) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index bcb75d550..91bdf11cb 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -10,12 +10,12 @@ lint: enabled: - renovate@40.0.6 - prettier@3.5.3 - - trufflehog@3.88.32 + - trufflehog@3.88.34 - yamllint@1.37.1 - bandit@1.8.3 - trivy@0.62.1 - taplo@0.9.3 - - ruff@0.11.10 + - ruff@0.11.11 - isort@6.0.1 - markdownlint@0.45.0 - oxipng@9.1.5 From 158c88ddef9382acd2cbf4089f18aecb79745f5b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 15:41:35 -0500 Subject: [PATCH 16/41] [create-pull-request] automated change (#6905) Co-authored-by: jp-bennett <5630967+jp-bennett@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/admin.pb.cpp | 5 + src/mesh/generated/meshtastic/admin.pb.h | 53 +++++++ src/mesh/generated/meshtastic/config.pb.h | 14 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 2 +- src/mesh/generated/meshtastic/localonly.pb.h | 2 +- src/mesh/generated/meshtastic/mesh.pb.cpp | 12 ++ src/mesh/generated/meshtastic/mesh.pb.h | 129 +++++++++++++++++- src/mesh/generated/meshtastic/portnums.pb.h | 2 + 9 files changed, 209 insertions(+), 12 deletions(-) diff --git a/protobufs b/protobufs index 91484534a..022ea79ba 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 91484534a58cb4da8ab68ac046f1e76fd1936bf7 +Subproject commit 022ea79bad79b70d0bee286cd9184916ab47c1b1 diff --git a/src/mesh/generated/meshtastic/admin.pb.cpp b/src/mesh/generated/meshtastic/admin.pb.cpp index 9bf40870f..a9c82f7c0 100644 --- a/src/mesh/generated/meshtastic/admin.pb.cpp +++ b/src/mesh/generated/meshtastic/admin.pb.cpp @@ -18,6 +18,11 @@ PB_BIND(meshtastic_NodeRemoteHardwarePinsResponse, meshtastic_NodeRemoteHardware PB_BIND(meshtastic_SharedContact, meshtastic_SharedContact, AUTO) +PB_BIND(meshtastic_KeyVerificationAdmin, meshtastic_KeyVerificationAdmin, AUTO) + + + + diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index 0a46e6275..2a5fd78b0 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -77,6 +77,19 @@ typedef enum _meshtastic_AdminMessage_BackupLocation { meshtastic_AdminMessage_BackupLocation_SD = 1 } meshtastic_AdminMessage_BackupLocation; +/* Three stages of this request. */ +typedef enum _meshtastic_KeyVerificationAdmin_MessageType { + /* This is the first stage, where a client initiates */ + meshtastic_KeyVerificationAdmin_MessageType_INITIATE_VERIFICATION = 0, + /* After the nonce has been returned over the mesh, the client prompts for the security number + And uses this message to provide it to the node. */ + meshtastic_KeyVerificationAdmin_MessageType_PROVIDE_SECURITY_NUMBER = 1, + /* Once the user has compared the verification message, this message notifies the node. */ + meshtastic_KeyVerificationAdmin_MessageType_DO_VERIFY = 2, + /* This is the cancel path, can be taken at any point */ + meshtastic_KeyVerificationAdmin_MessageType_DO_NOT_VERIFY = 3 +} meshtastic_KeyVerificationAdmin_MessageType; + /* Struct definitions */ /* Parameters for setting up Meshtastic for ameteur radio usage */ typedef struct _meshtastic_HamParameters { @@ -107,6 +120,18 @@ typedef struct _meshtastic_SharedContact { meshtastic_User user; } meshtastic_SharedContact; +/* This message is used by a client to initiate or complete a key verification */ +typedef struct _meshtastic_KeyVerificationAdmin { + meshtastic_KeyVerificationAdmin_MessageType message_type; + /* The nodenum we're requesting */ + uint32_t remote_nodenum; + /* The nonce is used to track the connection */ + uint64_t nonce; + /* The 4 digit code generated by the remote node, and communicated outside the mesh */ + bool has_security_number; + uint32_t security_number; +} meshtastic_KeyVerificationAdmin; + typedef PB_BYTES_ARRAY_T(8) meshtastic_AdminMessage_session_passkey_t; /* This message is handled by the Admin module and is responsible for all settings/channel read/write operations. This message is used to do settings operations to both remote AND local nodes. @@ -212,6 +237,8 @@ typedef struct _meshtastic_AdminMessage { bool commit_edit_settings; /* Add a contact (User) to the nodedb */ meshtastic_SharedContact add_contact; + /* Initiate or respond to a key verification request */ + meshtastic_KeyVerificationAdmin key_verification; /* Tell the node to factory reset config everything; all device state and configuration will be returned to factory defaults and BLE bonds will be cleared. */ int32_t factory_reset_device; /* Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot) @@ -253,6 +280,10 @@ extern "C" { #define _meshtastic_AdminMessage_BackupLocation_MAX meshtastic_AdminMessage_BackupLocation_SD #define _meshtastic_AdminMessage_BackupLocation_ARRAYSIZE ((meshtastic_AdminMessage_BackupLocation)(meshtastic_AdminMessage_BackupLocation_SD+1)) +#define _meshtastic_KeyVerificationAdmin_MessageType_MIN meshtastic_KeyVerificationAdmin_MessageType_INITIATE_VERIFICATION +#define _meshtastic_KeyVerificationAdmin_MessageType_MAX meshtastic_KeyVerificationAdmin_MessageType_DO_NOT_VERIFY +#define _meshtastic_KeyVerificationAdmin_MessageType_ARRAYSIZE ((meshtastic_KeyVerificationAdmin_MessageType)(meshtastic_KeyVerificationAdmin_MessageType_DO_NOT_VERIFY+1)) + #define meshtastic_AdminMessage_payload_variant_get_config_request_ENUMTYPE meshtastic_AdminMessage_ConfigType #define meshtastic_AdminMessage_payload_variant_get_module_config_request_ENUMTYPE meshtastic_AdminMessage_ModuleConfigType #define meshtastic_AdminMessage_payload_variant_backup_preferences_ENUMTYPE meshtastic_AdminMessage_BackupLocation @@ -262,16 +293,20 @@ extern "C" { +#define meshtastic_KeyVerificationAdmin_message_type_ENUMTYPE meshtastic_KeyVerificationAdmin_MessageType + /* Initializer values for message structs */ #define meshtastic_AdminMessage_init_default {0, {0}, {0, {0}}} #define meshtastic_HamParameters_init_default {"", 0, 0, ""} #define meshtastic_NodeRemoteHardwarePinsResponse_init_default {0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}} #define meshtastic_SharedContact_init_default {0, false, meshtastic_User_init_default} +#define meshtastic_KeyVerificationAdmin_init_default {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0} #define meshtastic_AdminMessage_init_zero {0, {0}, {0, {0}}} #define meshtastic_HamParameters_init_zero {"", 0, 0, ""} #define meshtastic_NodeRemoteHardwarePinsResponse_init_zero {0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}} #define meshtastic_SharedContact_init_zero {0, false, meshtastic_User_init_zero} +#define meshtastic_KeyVerificationAdmin_init_zero {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_HamParameters_call_sign_tag 1 @@ -281,6 +316,10 @@ extern "C" { #define meshtastic_NodeRemoteHardwarePinsResponse_node_remote_hardware_pins_tag 1 #define meshtastic_SharedContact_node_num_tag 1 #define meshtastic_SharedContact_user_tag 2 +#define meshtastic_KeyVerificationAdmin_message_type_tag 1 +#define meshtastic_KeyVerificationAdmin_remote_nodenum_tag 2 +#define meshtastic_KeyVerificationAdmin_nonce_tag 3 +#define meshtastic_KeyVerificationAdmin_security_number_tag 4 #define meshtastic_AdminMessage_get_channel_request_tag 1 #define meshtastic_AdminMessage_get_channel_response_tag 2 #define meshtastic_AdminMessage_get_owner_request_tag 3 @@ -326,6 +365,7 @@ extern "C" { #define meshtastic_AdminMessage_begin_edit_settings_tag 64 #define meshtastic_AdminMessage_commit_edit_settings_tag 65 #define meshtastic_AdminMessage_add_contact_tag 66 +#define meshtastic_AdminMessage_key_verification_tag 67 #define meshtastic_AdminMessage_factory_reset_device_tag 94 #define meshtastic_AdminMessage_reboot_ota_seconds_tag 95 #define meshtastic_AdminMessage_exit_simulator_tag 96 @@ -382,6 +422,7 @@ X(a, STATIC, ONEOF, UINT32, (payload_variant,remove_ignored_node,remove_i X(a, STATIC, ONEOF, BOOL, (payload_variant,begin_edit_settings,begin_edit_settings), 64) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,commit_edit_settings,commit_edit_settings), 65) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,add_contact,add_contact), 66) \ +X(a, STATIC, ONEOF, MESSAGE, (payload_variant,key_verification,key_verification), 67) \ X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset_device,factory_reset_device), 94) \ X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_ota_seconds,reboot_ota_seconds), 95) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,exit_simulator,exit_simulator), 96) \ @@ -408,6 +449,7 @@ X(a, STATIC, SINGULAR, BYTES, session_passkey, 101) #define meshtastic_AdminMessage_payload_variant_get_ui_config_response_MSGTYPE meshtastic_DeviceUIConfig #define meshtastic_AdminMessage_payload_variant_store_ui_config_MSGTYPE meshtastic_DeviceUIConfig #define meshtastic_AdminMessage_payload_variant_add_contact_MSGTYPE meshtastic_SharedContact +#define meshtastic_AdminMessage_payload_variant_key_verification_MSGTYPE meshtastic_KeyVerificationAdmin #define meshtastic_HamParameters_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, call_sign, 1) \ @@ -430,21 +472,32 @@ X(a, STATIC, OPTIONAL, MESSAGE, user, 2) #define meshtastic_SharedContact_DEFAULT NULL #define meshtastic_SharedContact_user_MSGTYPE meshtastic_User +#define meshtastic_KeyVerificationAdmin_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UENUM, message_type, 1) \ +X(a, STATIC, SINGULAR, UINT32, remote_nodenum, 2) \ +X(a, STATIC, SINGULAR, UINT64, nonce, 3) \ +X(a, STATIC, OPTIONAL, UINT32, security_number, 4) +#define meshtastic_KeyVerificationAdmin_CALLBACK NULL +#define meshtastic_KeyVerificationAdmin_DEFAULT NULL + extern const pb_msgdesc_t meshtastic_AdminMessage_msg; extern const pb_msgdesc_t meshtastic_HamParameters_msg; extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePinsResponse_msg; extern const pb_msgdesc_t meshtastic_SharedContact_msg; +extern const pb_msgdesc_t meshtastic_KeyVerificationAdmin_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg #define meshtastic_HamParameters_fields &meshtastic_HamParameters_msg #define meshtastic_NodeRemoteHardwarePinsResponse_fields &meshtastic_NodeRemoteHardwarePinsResponse_msg #define meshtastic_SharedContact_fields &meshtastic_SharedContact_msg +#define meshtastic_KeyVerificationAdmin_fields &meshtastic_KeyVerificationAdmin_msg /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_ADMIN_PB_H_MAX_SIZE meshtastic_AdminMessage_size #define meshtastic_AdminMessage_size 511 #define meshtastic_HamParameters_size 31 +#define meshtastic_KeyVerificationAdmin_size 25 #define meshtastic_NodeRemoteHardwarePinsResponse_size 496 #define meshtastic_SharedContact_size 123 diff --git a/src/mesh/generated/meshtastic/config.pb.h b/src/mesh/generated/meshtastic/config.pb.h index edcd7b41c..9d7a96dc8 100644 --- a/src/mesh/generated/meshtastic/config.pb.h +++ b/src/mesh/generated/meshtastic/config.pb.h @@ -441,6 +441,8 @@ typedef struct _meshtastic_Config_NetworkConfig { char rsyslog_server[33]; /* Flags for enabling/disabling network protocols */ uint32_t enabled_protocols; + /* Enable/Disable ipv6 support */ + bool ipv6_enabled; } meshtastic_Config_NetworkConfig; /* Display Config */ @@ -693,7 +695,7 @@ extern "C" { #define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0} #define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} #define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0} +#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0, 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0} #define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0} @@ -704,7 +706,7 @@ extern "C" { #define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0} #define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} #define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0} +#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0, 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0} #define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0} @@ -759,6 +761,7 @@ extern "C" { #define meshtastic_Config_NetworkConfig_ipv4_config_tag 8 #define meshtastic_Config_NetworkConfig_rsyslog_server_tag 9 #define meshtastic_Config_NetworkConfig_enabled_protocols_tag 10 +#define meshtastic_Config_NetworkConfig_ipv6_enabled_tag 11 #define meshtastic_Config_DisplayConfig_screen_on_secs_tag 1 #define meshtastic_Config_DisplayConfig_gps_format_tag 2 #define meshtastic_Config_DisplayConfig_auto_screen_carousel_secs_tag 3 @@ -889,7 +892,8 @@ X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \ X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \ X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8) \ X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9) \ -X(a, STATIC, SINGULAR, UINT32, enabled_protocols, 10) +X(a, STATIC, SINGULAR, UINT32, enabled_protocols, 10) \ +X(a, STATIC, SINGULAR, BOOL, ipv6_enabled, 11) #define meshtastic_Config_NetworkConfig_CALLBACK NULL #define meshtastic_Config_NetworkConfig_DEFAULT NULL #define meshtastic_Config_NetworkConfig_ipv4_config_MSGTYPE meshtastic_Config_NetworkConfig_IpV4Config @@ -995,12 +999,12 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg; #define meshtastic_Config_DisplayConfig_size 32 #define meshtastic_Config_LoRaConfig_size 85 #define meshtastic_Config_NetworkConfig_IpV4Config_size 20 -#define meshtastic_Config_NetworkConfig_size 202 +#define meshtastic_Config_NetworkConfig_size 204 #define meshtastic_Config_PositionConfig_size 62 #define meshtastic_Config_PowerConfig_size 52 #define meshtastic_Config_SecurityConfig_size 178 #define meshtastic_Config_SessionkeyConfig_size 0 -#define meshtastic_Config_size 205 +#define meshtastic_Config_size 207 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 2436098da..37f99d8b5 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -360,7 +360,7 @@ extern const pb_msgdesc_t meshtastic_BackupPreferences_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_NodeDatabase_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size -#define meshtastic_BackupPreferences_size 2267 +#define meshtastic_BackupPreferences_size 2269 #define meshtastic_ChannelFile_size 718 #define meshtastic_DeviceState_size 1722 #define meshtastic_NodeInfoLite_size 196 diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index 53d8d7d80..bb2eefc04 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -187,7 +187,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size -#define meshtastic_LocalConfig_size 743 +#define meshtastic_LocalConfig_size 745 #define meshtastic_LocalModuleConfig_size 669 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/mesh.pb.cpp b/src/mesh/generated/meshtastic/mesh.pb.cpp index 6c5c7a4be..11875fadd 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.cpp +++ b/src/mesh/generated/meshtastic/mesh.pb.cpp @@ -21,6 +21,9 @@ PB_BIND(meshtastic_Routing, meshtastic_Routing, AUTO) PB_BIND(meshtastic_Data, meshtastic_Data, 2) +PB_BIND(meshtastic_KeyVerification, meshtastic_KeyVerification, AUTO) + + PB_BIND(meshtastic_Waypoint, meshtastic_Waypoint, AUTO) @@ -48,6 +51,15 @@ PB_BIND(meshtastic_FromRadio, meshtastic_FromRadio, 2) PB_BIND(meshtastic_ClientNotification, meshtastic_ClientNotification, 2) +PB_BIND(meshtastic_KeyVerificationNumberInform, meshtastic_KeyVerificationNumberInform, AUTO) + + +PB_BIND(meshtastic_KeyVerificationNumberRequest, meshtastic_KeyVerificationNumberRequest, AUTO) + + +PB_BIND(meshtastic_KeyVerificationFinal, meshtastic_KeyVerificationFinal, AUTO) + + PB_BIND(meshtastic_FileInfo, meshtastic_FileInfo, AUTO) diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index d6816eeef..c1ec607d6 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -247,6 +247,17 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_NOMADSTAR_METEOR_PRO = 96, /* Elecrow CrowPanel Advance models, ESP32-S3 and TFT with SX1262 radio plugin */ meshtastic_HardwareModel_CROWPANEL = 97, + /* * + Lilygo LINK32 board with sensors */ + meshtastic_HardwareModel_LINK_32 = 98, + /* * + Seeed Tracker L1 */ + meshtastic_HardwareModel_SEEED_TRACKER_L1 = 99, + /* * + Seeed Tracker L1 EINK driver */ + meshtastic_HardwareModel_SEEED_TRACKER_L1_EINK = 100, + /* Reserved ID for future and past use */ + meshtastic_HardwareModel_QWANTZ_TINY_ARMS = 101, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ @@ -680,6 +691,19 @@ typedef struct _meshtastic_Data { uint8_t bitfield; } meshtastic_Data; +typedef PB_BYTES_ARRAY_T(32) meshtastic_KeyVerification_hash1_t; +typedef PB_BYTES_ARRAY_T(32) meshtastic_KeyVerification_hash2_t; +/* The actual over-the-mesh message doing KeyVerification */ +typedef struct _meshtastic_KeyVerification { + /* random value Selected by the requesting node */ + uint64_t nonce; + /* The final authoritative hash, only to be sent by NodeA at the end of the handshake */ + meshtastic_KeyVerification_hash1_t hash1; + /* The intermediary hash (actually derived from hash1), + sent from NodeB to NodeA in response to the initial message. */ + meshtastic_KeyVerification_hash2_t hash2; +} meshtastic_KeyVerification; + /* Waypoint message, used to share arbitrary locations across the mesh */ typedef struct _meshtastic_Waypoint { /* Id of the waypoint */ @@ -907,6 +931,24 @@ typedef struct _meshtastic_QueueStatus { uint32_t mesh_packet_id; } meshtastic_QueueStatus; +typedef struct _meshtastic_KeyVerificationNumberInform { + uint64_t nonce; + char remote_longname[40]; + uint32_t security_number; +} meshtastic_KeyVerificationNumberInform; + +typedef struct _meshtastic_KeyVerificationNumberRequest { + uint64_t nonce; + char remote_longname[40]; +} meshtastic_KeyVerificationNumberRequest; + +typedef struct _meshtastic_KeyVerificationFinal { + uint64_t nonce; + char remote_longname[40]; + bool isSender; + char verification_characters[10]; +} meshtastic_KeyVerificationFinal; + /* A notification message from the device to the client To be used for important messages that should to be displayed to the user in the form of push notifications or validation messages when saving @@ -921,6 +963,12 @@ typedef struct _meshtastic_ClientNotification { meshtastic_LogRecord_Level level; /* The message body of the notification */ char message[400]; + pb_size_t which_payload_variant; + union { + meshtastic_KeyVerificationNumberInform key_verification_number_inform; + meshtastic_KeyVerificationNumberRequest key_verification_number_request; + meshtastic_KeyVerificationFinal key_verification_final; + } payload_variant; } meshtastic_ClientNotification; /* Individual File info for the device */ @@ -1183,6 +1231,7 @@ extern "C" { + #define meshtastic_MeshPacket_priority_ENUMTYPE meshtastic_MeshPacket_Priority #define meshtastic_MeshPacket_delayed_ENUMTYPE meshtastic_MeshPacket_Delayed @@ -1196,6 +1245,9 @@ extern "C" { + + + #define meshtastic_Compressed_portnum_ENUMTYPE meshtastic_PortNum @@ -1215,6 +1267,7 @@ extern "C" { #define meshtastic_RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}} #define meshtastic_Routing_init_default {0, {meshtastic_RouteDiscovery_init_default}} #define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0} +#define meshtastic_KeyVerification_init_default {0, {0, {0}}, {0, {0}}} #define meshtastic_Waypoint_init_default {0, false, 0, false, 0, 0, 0, "", "", 0} #define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0} #define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0} @@ -1223,7 +1276,10 @@ extern "C" { #define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN} #define meshtastic_QueueStatus_init_default {0, 0, 0, 0} #define meshtastic_FromRadio_init_default {0, 0, {meshtastic_MeshPacket_init_default}} -#define meshtastic_ClientNotification_init_default {false, 0, 0, _meshtastic_LogRecord_Level_MIN, ""} +#define meshtastic_ClientNotification_init_default {false, 0, 0, _meshtastic_LogRecord_Level_MIN, "", 0, {meshtastic_KeyVerificationNumberInform_init_default}} +#define meshtastic_KeyVerificationNumberInform_init_default {0, "", 0} +#define meshtastic_KeyVerificationNumberRequest_init_default {0, ""} +#define meshtastic_KeyVerificationFinal_init_default {0, "", 0, ""} #define meshtastic_FileInfo_init_default {"", 0} #define meshtastic_ToRadio_init_default {0, {meshtastic_MeshPacket_init_default}} #define meshtastic_Compressed_init_default {_meshtastic_PortNum_MIN, {0, {0}}} @@ -1240,6 +1296,7 @@ extern "C" { #define meshtastic_RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}} #define meshtastic_Routing_init_zero {0, {meshtastic_RouteDiscovery_init_zero}} #define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0} +#define meshtastic_KeyVerification_init_zero {0, {0, {0}}, {0, {0}}} #define meshtastic_Waypoint_init_zero {0, false, 0, false, 0, 0, 0, "", "", 0} #define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0} #define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0} @@ -1248,7 +1305,10 @@ extern "C" { #define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN} #define meshtastic_QueueStatus_init_zero {0, 0, 0, 0} #define meshtastic_FromRadio_init_zero {0, 0, {meshtastic_MeshPacket_init_zero}} -#define meshtastic_ClientNotification_init_zero {false, 0, 0, _meshtastic_LogRecord_Level_MIN, ""} +#define meshtastic_ClientNotification_init_zero {false, 0, 0, _meshtastic_LogRecord_Level_MIN, "", 0, {meshtastic_KeyVerificationNumberInform_init_zero}} +#define meshtastic_KeyVerificationNumberInform_init_zero {0, "", 0} +#define meshtastic_KeyVerificationNumberRequest_init_zero {0, ""} +#define meshtastic_KeyVerificationFinal_init_zero {0, "", 0, ""} #define meshtastic_FileInfo_init_zero {"", 0} #define meshtastic_ToRadio_init_zero {0, {meshtastic_MeshPacket_init_zero}} #define meshtastic_Compressed_init_zero {_meshtastic_PortNum_MIN, {0, {0}}} @@ -1310,6 +1370,9 @@ extern "C" { #define meshtastic_Data_reply_id_tag 7 #define meshtastic_Data_emoji_tag 8 #define meshtastic_Data_bitfield_tag 9 +#define meshtastic_KeyVerification_nonce_tag 1 +#define meshtastic_KeyVerification_hash1_tag 2 +#define meshtastic_KeyVerification_hash2_tag 3 #define meshtastic_Waypoint_id_tag 1 #define meshtastic_Waypoint_latitude_i_tag 2 #define meshtastic_Waypoint_longitude_i_tag 3 @@ -1367,10 +1430,22 @@ extern "C" { #define meshtastic_QueueStatus_free_tag 2 #define meshtastic_QueueStatus_maxlen_tag 3 #define meshtastic_QueueStatus_mesh_packet_id_tag 4 +#define meshtastic_KeyVerificationNumberInform_nonce_tag 1 +#define meshtastic_KeyVerificationNumberInform_remote_longname_tag 2 +#define meshtastic_KeyVerificationNumberInform_security_number_tag 3 +#define meshtastic_KeyVerificationNumberRequest_nonce_tag 1 +#define meshtastic_KeyVerificationNumberRequest_remote_longname_tag 2 +#define meshtastic_KeyVerificationFinal_nonce_tag 1 +#define meshtastic_KeyVerificationFinal_remote_longname_tag 2 +#define meshtastic_KeyVerificationFinal_isSender_tag 3 +#define meshtastic_KeyVerificationFinal_verification_characters_tag 4 #define meshtastic_ClientNotification_reply_id_tag 1 #define meshtastic_ClientNotification_time_tag 2 #define meshtastic_ClientNotification_level_tag 3 #define meshtastic_ClientNotification_message_tag 4 +#define meshtastic_ClientNotification_key_verification_number_inform_tag 11 +#define meshtastic_ClientNotification_key_verification_number_request_tag 12 +#define meshtastic_ClientNotification_key_verification_final_tag 13 #define meshtastic_FileInfo_file_name_tag 1 #define meshtastic_FileInfo_size_bytes_tag 2 #define meshtastic_Compressed_portnum_tag 1 @@ -1501,6 +1576,13 @@ X(a, STATIC, OPTIONAL, UINT32, bitfield, 9) #define meshtastic_Data_CALLBACK NULL #define meshtastic_Data_DEFAULT NULL +#define meshtastic_KeyVerification_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT64, nonce, 1) \ +X(a, STATIC, SINGULAR, BYTES, hash1, 2) \ +X(a, STATIC, SINGULAR, BYTES, hash2, 3) +#define meshtastic_KeyVerification_CALLBACK NULL +#define meshtastic_KeyVerification_DEFAULT NULL + #define meshtastic_Waypoint_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, id, 1) \ X(a, STATIC, OPTIONAL, SFIXED32, latitude_i, 2) \ @@ -1629,9 +1711,36 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,deviceuiConfig,deviceuiConfi X(a, STATIC, OPTIONAL, UINT32, reply_id, 1) \ X(a, STATIC, SINGULAR, FIXED32, time, 2) \ X(a, STATIC, SINGULAR, UENUM, level, 3) \ -X(a, STATIC, SINGULAR, STRING, message, 4) +X(a, STATIC, SINGULAR, STRING, message, 4) \ +X(a, STATIC, ONEOF, MESSAGE, (payload_variant,key_verification_number_inform,payload_variant.key_verification_number_inform), 11) \ +X(a, STATIC, ONEOF, MESSAGE, (payload_variant,key_verification_number_request,payload_variant.key_verification_number_request), 12) \ +X(a, STATIC, ONEOF, MESSAGE, (payload_variant,key_verification_final,payload_variant.key_verification_final), 13) #define meshtastic_ClientNotification_CALLBACK NULL #define meshtastic_ClientNotification_DEFAULT NULL +#define meshtastic_ClientNotification_payload_variant_key_verification_number_inform_MSGTYPE meshtastic_KeyVerificationNumberInform +#define meshtastic_ClientNotification_payload_variant_key_verification_number_request_MSGTYPE meshtastic_KeyVerificationNumberRequest +#define meshtastic_ClientNotification_payload_variant_key_verification_final_MSGTYPE meshtastic_KeyVerificationFinal + +#define meshtastic_KeyVerificationNumberInform_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT64, nonce, 1) \ +X(a, STATIC, SINGULAR, STRING, remote_longname, 2) \ +X(a, STATIC, SINGULAR, UINT32, security_number, 3) +#define meshtastic_KeyVerificationNumberInform_CALLBACK NULL +#define meshtastic_KeyVerificationNumberInform_DEFAULT NULL + +#define meshtastic_KeyVerificationNumberRequest_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT64, nonce, 1) \ +X(a, STATIC, SINGULAR, STRING, remote_longname, 2) +#define meshtastic_KeyVerificationNumberRequest_CALLBACK NULL +#define meshtastic_KeyVerificationNumberRequest_DEFAULT NULL + +#define meshtastic_KeyVerificationFinal_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT64, nonce, 1) \ +X(a, STATIC, SINGULAR, STRING, remote_longname, 2) \ +X(a, STATIC, SINGULAR, BOOL, isSender, 3) \ +X(a, STATIC, SINGULAR, STRING, verification_characters, 4) +#define meshtastic_KeyVerificationFinal_CALLBACK NULL +#define meshtastic_KeyVerificationFinal_DEFAULT NULL #define meshtastic_FileInfo_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, file_name, 1) \ @@ -1731,6 +1840,7 @@ extern const pb_msgdesc_t meshtastic_User_msg; extern const pb_msgdesc_t meshtastic_RouteDiscovery_msg; extern const pb_msgdesc_t meshtastic_Routing_msg; extern const pb_msgdesc_t meshtastic_Data_msg; +extern const pb_msgdesc_t meshtastic_KeyVerification_msg; extern const pb_msgdesc_t meshtastic_Waypoint_msg; extern const pb_msgdesc_t meshtastic_MqttClientProxyMessage_msg; extern const pb_msgdesc_t meshtastic_MeshPacket_msg; @@ -1740,6 +1850,9 @@ extern const pb_msgdesc_t meshtastic_LogRecord_msg; extern const pb_msgdesc_t meshtastic_QueueStatus_msg; extern const pb_msgdesc_t meshtastic_FromRadio_msg; extern const pb_msgdesc_t meshtastic_ClientNotification_msg; +extern const pb_msgdesc_t meshtastic_KeyVerificationNumberInform_msg; +extern const pb_msgdesc_t meshtastic_KeyVerificationNumberRequest_msg; +extern const pb_msgdesc_t meshtastic_KeyVerificationFinal_msg; extern const pb_msgdesc_t meshtastic_FileInfo_msg; extern const pb_msgdesc_t meshtastic_ToRadio_msg; extern const pb_msgdesc_t meshtastic_Compressed_msg; @@ -1758,6 +1871,7 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg; #define meshtastic_RouteDiscovery_fields &meshtastic_RouteDiscovery_msg #define meshtastic_Routing_fields &meshtastic_Routing_msg #define meshtastic_Data_fields &meshtastic_Data_msg +#define meshtastic_KeyVerification_fields &meshtastic_KeyVerification_msg #define meshtastic_Waypoint_fields &meshtastic_Waypoint_msg #define meshtastic_MqttClientProxyMessage_fields &meshtastic_MqttClientProxyMessage_msg #define meshtastic_MeshPacket_fields &meshtastic_MeshPacket_msg @@ -1767,6 +1881,9 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg; #define meshtastic_QueueStatus_fields &meshtastic_QueueStatus_msg #define meshtastic_FromRadio_fields &meshtastic_FromRadio_msg #define meshtastic_ClientNotification_fields &meshtastic_ClientNotification_msg +#define meshtastic_KeyVerificationNumberInform_fields &meshtastic_KeyVerificationNumberInform_msg +#define meshtastic_KeyVerificationNumberRequest_fields &meshtastic_KeyVerificationNumberRequest_msg +#define meshtastic_KeyVerificationFinal_fields &meshtastic_KeyVerificationFinal_msg #define meshtastic_FileInfo_fields &meshtastic_FileInfo_msg #define meshtastic_ToRadio_fields &meshtastic_ToRadio_msg #define meshtastic_Compressed_fields &meshtastic_Compressed_msg @@ -1784,13 +1901,17 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg; /* meshtastic_ChunkedPayloadResponse_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_MESH_PB_H_MAX_SIZE meshtastic_FromRadio_size #define meshtastic_ChunkedPayload_size 245 -#define meshtastic_ClientNotification_size 415 +#define meshtastic_ClientNotification_size 482 #define meshtastic_Compressed_size 239 #define meshtastic_Data_size 269 #define meshtastic_DeviceMetadata_size 54 #define meshtastic_FileInfo_size 236 #define meshtastic_FromRadio_size 510 #define meshtastic_Heartbeat_size 0 +#define meshtastic_KeyVerificationFinal_size 65 +#define meshtastic_KeyVerificationNumberInform_size 58 +#define meshtastic_KeyVerificationNumberRequest_size 52 +#define meshtastic_KeyVerification_size 79 #define meshtastic_LogRecord_size 426 #define meshtastic_MeshPacket_size 378 #define meshtastic_MqttClientProxyMessage_size 501 diff --git a/src/mesh/generated/meshtastic/portnums.pb.h b/src/mesh/generated/meshtastic/portnums.pb.h index 4e7c43e58..5bd27ef7d 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.h +++ b/src/mesh/generated/meshtastic/portnums.pb.h @@ -74,6 +74,8 @@ typedef enum _meshtastic_PortNum { meshtastic_PortNum_DETECTION_SENSOR_APP = 10, /* Same as Text Message but used for critical alerts. */ meshtastic_PortNum_ALERT_APP = 11, + /* Module/port for handling key verification requests. */ + meshtastic_PortNum_KEY_VERIFICATION_APP = 12, /* Provides a 'ping' service that replies to any packet it receives. Also serves as a small example module. ENCODING: ASCII Plaintext */ From 8908805894b73ea70b9de46000e34f0378ec556d Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Wed, 28 May 2025 01:10:14 +0200 Subject: [PATCH 17/41] Don't cancel sending ReTx for relayer if we're ROUTER(_LATE)/REPEATER (#6904) Co-authored-by: Ben Meadors --- src/mesh/NextHopRouter.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mesh/NextHopRouter.cpp b/src/mesh/NextHopRouter.cpp index f21974a2e..860250f75 100644 --- a/src/mesh/NextHopRouter.cpp +++ b/src/mesh/NextHopRouter.cpp @@ -165,10 +165,15 @@ bool NextHopRouter::stopRetransmission(GlobalPacketId key) /* Only when we already transmitted a packet via LoRa, we will cancel the packet in the Tx queue to avoid canceling a transmission if it was ACKed super fast via MQTT */ if (old->numRetransmissions < NUM_RELIABLE_RETX - 1) { - // remove the 'original' (identified by originator and packet->id) from the txqueue and free it - cancelSending(getFrom(p), p->id); - // now free the pooled copy for retransmission too - packetPool.release(p); + // We only cancel it if we are the original sender or if we're not a router(_late)/repeater + if (isFromUs(p) || (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER && + config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER && + config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE)) { + // remove the 'original' (identified by originator and packet->id) from the txqueue and free it + cancelSending(getFrom(p), p->id); + // now free the pooled copy for retransmission too + packetPool.release(p); + } } auto numErased = pending.erase(key); assert(numErased == 1); From 96c18d990880b82fb9d391a558e50696a0c9001d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 28 May 2025 01:11:32 +0200 Subject: [PATCH 18/41] Add LINK32 (Lilygo) Board with Light+Environment sensors (#6899) * Add LINK32 (Lilygo) Board with Light+Environment sensors TODO: replace PRIVATE_HW with actual HWID * Add LINK32 (Lilygo) Board with Light+Environment sensors TODO: replace PRIVATE_HW with actual HWID * Update to real HWID and trunk fmt --- .trunk/trunk.yaml | 7 +++-- src/platform/esp32/architecture.h | 2 ++ variants/link32_s3_v1/pins_arduino.h | 19 +++++++++++++ variants/link32_s3_v1/platformio.ini | 11 ++++++++ variants/link32_s3_v1/variant.h | 42 ++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 variants/link32_s3_v1/pins_arduino.h create mode 100644 variants/link32_s3_v1/platformio.ini create mode 100644 variants/link32_s3_v1/variant.h diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 91bdf11cb..162fdfd2d 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -4,11 +4,12 @@ cli: plugins: sources: - id: trunk - ref: v1.6.8 + ref: v1.7.0 uri: https://github.com/trunk-io/plugins lint: enabled: - - renovate@40.0.6 + - checkov@3.2.435 + - renovate@40.32.7 - prettier@3.5.3 - trufflehog@3.88.34 - yamllint@1.37.1 @@ -37,7 +38,7 @@ runtimes: enabled: - python@3.10.8 - go@1.21.0 - - node@18.20.5 + - node@22.16.0 actions: disabled: - trunk-announce diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 68d06c6d7..3763bce1e 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -184,6 +184,8 @@ #define HW_VENDOR meshtastic_HardwareModel_HELTEC_SENSOR_HUB #elif defined(ELECROW_PANEL) #define HW_VENDOR meshtastic_HardwareModel_CROWPANEL +#elif defined(LINK_32) +#define HW_VENDOR meshtastic_HardwareModel_LINK_32 #endif // ----------------------------------------------------------------------------- diff --git a/variants/link32_s3_v1/pins_arduino.h b/variants/link32_s3_v1/pins_arduino.h new file mode 100644 index 000000000..010e5bf2e --- /dev/null +++ b/variants/link32_s3_v1/pins_arduino.h @@ -0,0 +1,19 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SDA = 47; +static const uint8_t SCL = 48; + +// Default SPI will be mapped to Radio +static const uint8_t SS = 21; +static const uint8_t MOSI = 34; +static const uint8_t MISO = 33; +static const uint8_t SCK = 16; + +#endif /* Pins_Arduino_h */ diff --git a/variants/link32_s3_v1/platformio.ini b/variants/link32_s3_v1/platformio.ini new file mode 100644 index 000000000..5a614a7af --- /dev/null +++ b/variants/link32_s3_v1/platformio.ini @@ -0,0 +1,11 @@ +[env:link32-s3-v1] +extends = esp32s3_base +board = esp32-s3-devkitc-1 +build_flags = + ${esp32_base.build_flags} -D LINK_32 -I variants/link32_s3_v1 + -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -DARDUINO_USB_CDC_ON_BOOT + -DARDUINO_USB_MODE=1 + -DRADIOLIB_EXCLUDE_SX128X=1 + -DRADIOLIB_EXCLUDE_SX127X=1 + -DRADIOLIB_EXCLUDE_LR11X0=1 diff --git a/variants/link32_s3_v1/variant.h b/variants/link32_s3_v1/variant.h new file mode 100644 index 000000000..1f8a7435a --- /dev/null +++ b/variants/link32_s3_v1/variant.h @@ -0,0 +1,42 @@ +#define BATTERY_PIN 15 +#define ADC_CHANNEL ADC2_GPIO15_CHANNEL // ADC channel for battery voltage measurement +#define BATTERY_SENSE_SAMPLES 30 +#define BAT_MEASURE_ADC_UNIT 2 // Use ADC2 for battery measurement + +#define USE_SSD1306 + +#define BUTTON_PIN 0 // Button pin for this board +#define BUTTON_PIN_ALT 36 + +#define HAS_NEOPIXEL // If defined, we will use the neopixel library +#define NEOPIXEL_DATA 35 // Neopixel pin for this board +#define NEOPIXEL_COUNT 1 // Number of neopixels on this board +#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use + +#define ADC_MULTIPLIER 2 + +#define I2C_SDA 47 // I2C pins for this board +#define I2C_SCL 48 + +#define USE_SX1262 + +#define LORA_SCK 16 +#define LORA_MISO 33 +#define LORA_MOSI 34 +#define LORA_CS 21 +#define LORA_RESET 18 + +#define LORA_DIO0 12 // a No connect on the SX1262 module +#define LORA_DIO1 13 +#define LORA_DIO2 14 // Not really used + +#define LORA_TCXO_GPIO 17 + +#define TCXO_OPTIONAL + +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 From da69d8879045bde87dd1600510fea9726498a4c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 06:20:51 -0500 Subject: [PATCH 19/41] [create-pull-request] automated change (#6909) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/protobufs b/protobufs index 022ea79ba..24c7a3d28 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 022ea79bad79b70d0bee286cd9184916ab47c1b1 +Subproject commit 24c7a3d287a4bd269ce191827e5dabd8ce8f57a7 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index c1ec607d6..5fc1cc4f5 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -252,10 +252,10 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_LINK_32 = 98, /* * Seeed Tracker L1 */ - meshtastic_HardwareModel_SEEED_TRACKER_L1 = 99, + meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1 = 99, /* * Seeed Tracker L1 EINK driver */ - meshtastic_HardwareModel_SEEED_TRACKER_L1_EINK = 100, + meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1_EINK = 100, /* Reserved ID for future and past use */ meshtastic_HardwareModel_QWANTZ_TINY_ARMS = 101, /* ------------------------------------------------------------------------------------------------------------------------------------------ From 42a80d8aeda556df7f30ec67a612273e48241502 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 28 May 2025 11:30:59 -0500 Subject: [PATCH 20/41] Coerce user.id to always be derive from the nodenum (#6906) * Coerce user.id to always be derive from the nodenum * Additionally null it out on send * Revert "Additionally null it out on send" This reverts commit 22a2d687237d9f49024bfb8641043cc8e99b32f0. --- src/modules/NodeInfoModule.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/NodeInfoModule.cpp b/src/modules/NodeInfoModule.cpp index 5142f2db0..e072fcb0f 100644 --- a/src/modules/NodeInfoModule.cpp +++ b/src/modules/NodeInfoModule.cpp @@ -14,6 +14,9 @@ bool NodeInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes { auto p = *pptr; + // Coerce user.id to be derived from the node number + snprintf(p.id, sizeof(p.id), "!%08x", getFrom(&mp)); + bool hasChanged = nodeDB->updateUser(getFrom(&mp), p, mp.channel); bool wasBroadcast = isBroadcast(mp.to); From 5195815df017e67ce6ee599367f2cd4ce52b5bed Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Thu, 29 May 2025 23:21:09 +1200 Subject: [PATCH 21/41] Parse own short name in LogoApplet (#6913) --- src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp index 89bdb0bc7..fa85deab3 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp @@ -111,9 +111,10 @@ void InkHUD::LogoApplet::onShutdown() // Prepare for the powered-off screen now // We can change these values because the initial "shutting down" screen has already rendered at this point + meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum()); textLeft = ""; textRight = ""; - textTitle = owner.short_name; + textTitle = parseShortName(ourNode); fontTitle = fontLarge; // This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete From e31cd0bc773901df844192d3edcdd42ce57f262e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 06:27:36 -0500 Subject: [PATCH 22/41] chore(deps): update meshtastic/device-ui digest to 3dfcc97 (#6912) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index d7504e6c5..e5d36d862 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/e63b219e78e9655be10745b4037cefd2c608d258.zip + https://github.com/meshtastic/device-ui/archive/3dfcc973cdfec8b34719510952e160bbfb57d9df.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From c0c2ec195f53b3f2e51dc71df73957631af83a09 Mon Sep 17 00:00:00 2001 From: dylanli Date: Thu, 29 May 2025 19:33:22 +0800 Subject: [PATCH 23/41] add support for seeed wio tracker L1 (#6907) * add support for seeed wio tracker l1 * add support in nrf52 arch * fix ADC problem and comments incorrect * fix gps wakeup pin * fix gps pin --- boards/seeed_wio_tracker_L1.json | 54 ++++++ src/configuration.h | 6 +- src/platform/nrf52/architecture.h | 2 + variants/seeed_wio_tracker_L1/platformio.ini | 13 ++ variants/seeed_wio_tracker_L1/variant.cpp | 97 ++++++++++ variants/seeed_wio_tracker_L1/variant.h | 185 +++++++++++++++++++ 6 files changed, 356 insertions(+), 1 deletion(-) create mode 100644 boards/seeed_wio_tracker_L1.json create mode 100644 variants/seeed_wio_tracker_L1/platformio.ini create mode 100644 variants/seeed_wio_tracker_L1/variant.cpp create mode 100644 variants/seeed_wio_tracker_L1/variant.h diff --git a/boards/seeed_wio_tracker_L1.json b/boards/seeed_wio_tracker_L1.json new file mode 100644 index 000000000..7c7bc62fa --- /dev/null +++ b/boards/seeed_wio_tracker_L1.json @@ -0,0 +1,54 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v7.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [["0x2886", "0x1668"]], + "usb_product": "TRACKER L1", + "mcu": "nrf52840", + "variant": "seeed_wio_tracker_L1", + "bsp": { + "name": "adafruit" + }, + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "7.3.0", + "sd_fwid": "0x0123" + }, + "bootloader": { + "settings_addr": "0xFF000" + } + }, + "connectivity": ["bluetooth"], + "debug": { + "jlink_device": "nRF52840_xxAA", + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52840-mdk-rs" + }, + "frameworks": ["arduino"], + "name": "seeed_wio_tracker_L1", + "upload": { + "maximum_ram_size": 248832, + "maximum_size": 815104, + "speed": 115200, + "protocol": "nrfutil", + "protocols": [ + "jlink", + "nrfjprog", + "nrfutil", + "stlink", + "cmsis-dap", + "blackmagic" + ], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "https://www.seeedstudio.com/Wio-Tracker-L1-p-6477.html", + "vendor": "Seeed Studio" +} diff --git a/src/configuration.h b/src/configuration.h index 0c23e677d..32d99295e 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -99,8 +99,12 @@ along with this program. If not, see . // ----------------------------------------------------------------------------- // OLED & Input // ----------------------------------------------------------------------------- - +#if defined(SEEED_WIO_TRACKER_L1) +#define SSD1306_ADDRESS 0x3D +#define USE_SH1106 +#else #define SSD1306_ADDRESS 0x3C +#endif #define ST7567_ADDRESS 0x3F // The SH1106 controller is almost, but not quite, the same as SSD1306 diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 9d1d48f1c..eea3aee45 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -85,6 +85,8 @@ #define HW_VENDOR meshtastic_HardwareModel_SEEED_SOLAR_NODE #elif defined(HELTEC_MESH_POCKET) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_POCKET +#elif defined(SEEED_WIO_TRACKER_L1) +#define HW_VENDOR meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1 #else #define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN #endif diff --git a/variants/seeed_wio_tracker_L1/platformio.ini b/variants/seeed_wio_tracker_L1/platformio.ini new file mode 100644 index 000000000..3c4653d7e --- /dev/null +++ b/variants/seeed_wio_tracker_L1/platformio.ini @@ -0,0 +1,13 @@ +[env:seeed_wio_tracker_L1] +board = seeed_wio_tracker_L1 +extends = nrf52840_base +;board_level = extra +build_flags = ${nrf52840_base.build_flags} + -I $PROJECT_DIR/variants/seeed_wio_tracker_L1 + -D SEEED_WIO_TRACKER_L1 + -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 +board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_wio_tracker_L1> +lib_deps = + ${nrf52840_base.lib_deps} +debug_tool = jlink diff --git a/variants/seeed_wio_tracker_L1/variant.cpp b/variants/seeed_wio_tracker_L1/variant.cpp new file mode 100644 index 000000000..3ff5688bb --- /dev/null +++ b/variants/seeed_wio_tracker_L1/variant.cpp @@ -0,0 +1,97 @@ +/* + * variant.cpp - Digital pin mapping for TRACKER L1 + * + * This file defines the pin mapping array that maps logical digital pins (D0-D17) + * to physical GPIO ports/pins on the Nordic nRF52 series microcontroller. + * + * Board: [Seeed Studio WIO TRACKER L1] + * Hardware Features: + * - LoRa module (CS/SCK/MISO/MOSI control pins) + * - GNSS module (TX/RX/Reset/Wakeup) + * - User LEDs (D11-D12) + * - User button (D13) + * - Grove/NFC interface (D14-D15) + * - Battery voltage monitoring (D16) + * + * Created [20250521] + * By [Dylan] + */ + +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +/** + * @brief Digital pin to GPIO port/pin mapping table + * + * Format: Logical Pin (Dx) -> nRF Port.Pin (Px.xx) + * + */ + +extern "C" { +const uint32_t g_ADigitalPinMap[] = { + // D0 .. D10 - Peripheral control pins + 41, // D0 P1.09 GNSS_WAKEUP + 7, // D1 P0.07 LORA_DIO1 + 39, // D2 P1,07 LORA_RESET + 42, // D3 P1.10 LORA_BUSY + 46, // D4 P1.14 (A4/SDA) LORA_CS + 40, // D5 P1.08 (A5/SCL) LORA_SW + 27, // D6 P0.27 (UART_TX) GNSS_TX + 26, // D7 P0.26 (UART_RX) GNSS_RX + 30, // D8 P0.30 (SPI_SCK) LORA_SCK + 3, // D9 P0.3 (SPI_MISO) LORA_MISO + 28, // D10 P0.28 (SPI_MOSI) LORA_MOSI + + // D11-D12 - LED outputs + 33, // D11 P1.1 User LED + // Buzzzer + 32, // D12 P1.0 Buzzer + + // D13 - User input + 8, // D13 P0.08 User Button + + // D14-D15 - Grove interface + 6, // D14 P0.06 OLED SDA + 5, // D15 P0.05 OLED SCL + + // D16 - Battery voltage ADC input + 31, // D16 P0.31 VBAT_ADC + // GROVE + 0, // D17 P0.00 GROVESDA + 1, // D18 P0.01 GROVESCL + + // FLASH + 21, // D19 P0.21 (QSPI_SCK) + 25, // D20 P0.25 (QSPI_CSN) + 20, // D21 P0.20 (QSPI_SIO_0 DI) + 24, // D22 P0.24 (QSPI_SIO_1 DO) + 22, // D23 P0.22 (QSPI_SIO_2 WP) + 23, // D24 P0.23 (QSPI_SIO_3 HOLD) + + + 36, // D25 TB_UP + 12, // D26 TB_DOWN + 11, // D27 TB_LEFT + 35, // D28 TB_RIGHT + 37, // D29 TB_PRESS + 4, // D30 BAT_CTL +}; +} + +void initVariant() +{ + pinMode(PIN_QSPI_CS, OUTPUT); + digitalWrite(PIN_QSPI_CS, HIGH); + // This setup is crucial for ensuring low power consumption and proper initialization of the hardware components. + // VBAT_ENABLE + pinMode(BAT_READ, OUTPUT); + digitalWrite(BAT_READ, HIGH); + + pinMode(PIN_LED1, OUTPUT); + digitalWrite(PIN_LED1, LOW); + pinMode(PIN_LED2, OUTPUT); + digitalWrite(PIN_LED2, LOW); + pinMode(PIN_LED2, OUTPUT); +} \ No newline at end of file diff --git a/variants/seeed_wio_tracker_L1/variant.h b/variants/seeed_wio_tracker_L1/variant.h new file mode 100644 index 000000000..23c788480 --- /dev/null +++ b/variants/seeed_wio_tracker_L1/variant.h @@ -0,0 +1,185 @@ +#ifndef _SEEED_TRACKER_L1_H_ +#define _SEEED_TRACKER_L1_H_ +#include "WVariant.h" +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Clock Configuration +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +#define VARIANT_MCK (64000000ul) // Master clock frequency +#define USE_LFXO // 32.768kHz crystal for LFCLK + +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Pin Capacity Definitions +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +#define PINS_COUNT (33u) // Total GPIO pins +#define NUM_DIGITAL_PINS (33u) // Digital I/O pins +#define NUM_ANALOG_INPUTS (8u) // Analog inputs (A0-A5 + VBAT + AREF) +#define NUM_ANALOG_OUTPUTS (0u) + +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// LED Configuration +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// LEDs +// LEDs +#define PIN_LED1 (11) // LED P1.15 +#define PIN_LED2 (12) // + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_GREEN PIN_LED1 +#define LED_BLUE PIN_LED2 +// #define LED_PIN PIN_LED2 +#define LED_STATE_ON 1 // State when LED is litted +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Button Configuration +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +#define BUTTON_PIN D13 // This is the Program Button +// #define BUTTON_NEED_PULLUP 1 +#define BUTTON_ACTIVE_LOW true +#define BUTTON_ACTIVE_PULLUP false + +#define BUTTON_PIN_TOUCH 13 // Touch button +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Digital Pin Mapping (D0-D10) +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +#define D0 0 // P1.06 GNSS_WAKEUP/IO0 +#define D1 1 // P0.07 LORA_DIO1 +#define D2 2 // P1.07 LORA_RESET +#define D3 3 // P1.10 LORA_BUSY +#define D4 4 // P1.14 LORA_CS +#define D5 5 // P1.08 LORA_SW +#define D6 6 // P0.27 GNSS_TX +#define D7 7 // P0.26 GNSS_RX +#define D8 8 // P0.30 SPI_SCK +#define D9 9 // P0.03 SPI_MISO +#define D10 10 // P0.28 SPI_MOSI +#define D12 12 // P1.00 Buzzer +#define D13 13 // P0.08 User Button +#define D14 14 // P0.05 OLED SCL +#define D15 15 // P0.06 OLED SDA +#define D16 16 // P0.31 VBAT_ADC +#define D17 17 // P0.00 GROVE SDA +#define D18 18 // P0.01 GROVE_SCL +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Analog Pin Definitions +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +#define PIN_A0 0 // P0.02 Analog Input 0 +#define PIN_A1 1 // P0.03 Analog Input 1 +#define PIN_A2 2 // P0.28 Analog Input 2 +#define PIN_A3 3 // P0.29 Analog Input 3 +#define PIN_A4 4 // P0.04 Analog Input 4 +#define PIN_A5 5 // P0.05 Analog Input 5 +#define PIN_VBAT D16 // P0.31 Battery voltage sense +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Communication Interfaces +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// I2C Configuration +#define HAS_WIRE 1 +#define PIN_WIRE_SDA D14 // P0.09 +#define PIN_WIRE_SCL D15 // P0.10 +#define WIRE_INTERFACES_COUNT 1 +#define I2C_NO_RESCAN + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + +#define HAS_SCREEN 1 +#define USE_SSD1306 1 + +// SPI Configuration (SX1262) + +#define SPI_INTERFACES_COUNT 1 +#define PIN_SPI_MISO 9 // P0.03 (D9) +#define PIN_SPI_MOSI 10 // P0.28 (D10) +#define PIN_SPI_SCK 8 // P0.30 (D8) + +// SX1262 LoRa Module Pins +#define USE_SX1262 +#define SX126X_CS D4 // Chip select +#define SX126X_DIO1 D1 // Digital IO 1 (Interrupt) +#define SX126X_BUSY D3 // Busy status +#define SX126X_RESET D2 // Reset control +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // TCXO supply voltage +#define SX126X_RXEN D5 // RX enable control +#define SX126X_TXEN RADIOLIB_NC +#define SX126X_DIO2_AS_RF_SWITCH // This Line is really necessary for SX1262 to work with RF switch or will loss TX power +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Power Management +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +#define BAT_READ \ + 30 // D30 = P0.04 Reads battery voltage from divider on signal board. +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define ADC_MULTIPLIER 2.0 +#define BATTERY_PIN PIN_VBAT // PIN_A7 +#define AREF_VOLTAGE 3.6 +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// GPS L76KB +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +#define GPS_L76K +#ifdef GPS_L76K +#define PIN_GPS_RX D6 // P0.26 +#define PIN_GPS_TX D7 +#define HAS_GPS 1 +#define GPS_BAUDRATE 9600 +#define GPS_THREAD_INTERVAL 50 +#define PIN_SERIAL1_RX PIN_GPS_TX +#define PIN_SERIAL1_TX PIN_GPS_RX + +#define GPS_RX_PIN PIN_GPS_TX +#define GPS_TX_PIN PIN_GPS_RX +#define PIN_GPS_STANDBY D0 + +// #define GPS_DEBUG +// #define GPS_EN D18 // P1.05 +#endif + +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// On-board QSPI Flash +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// On-board QSPI Flash +#define PIN_QSPI_SCK (21) +#define PIN_QSPI_CS (22) +#define PIN_QSPI_IO0 (23) +#define PIN_QSPI_IO1 (24) +#define PIN_QSPI_IO2 (25) +#define PIN_QSPI_IO3 (26) + +#define EXTERNAL_FLASH_DEVICES P25Q16H +#define EXTERNAL_FLASH_USE_QSPI + +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Buzzer +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Buzzer + +#define PIN_BUZZER D12 // P1.00, pwm output + +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// joystick +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +#define CANNED_MESSAGE_MODULE_ENABLE 1 + +// trackball +#define HAS_TRACKBALL 1 +#define TB_UP 25 +#define TB_DOWN 26 +#define TB_LEFT 27 +#define TB_RIGHT 28 +#define TB_PRESS 29 +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// Compatibility Definitions +// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +#ifdef __cplusplus +extern "C" { +#endif +// Serial port placeholders + +#define PIN_SERIAL2_RX (-1) +#define PIN_SERIAL2_TX (-1) +#ifdef __cplusplus +} +#endif + +#endif // _SEEED_SOLAR_NODE_H_ \ No newline at end of file From 7849a3d29119be7abef060bc99d7048997f13d03 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 29 May 2025 06:35:18 -0500 Subject: [PATCH 24/41] Trunk --- variants/seeed_wio_tracker_L1/variant.cpp | 3 +-- variants/seeed_wio_tracker_L1/variant.h | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/variants/seeed_wio_tracker_L1/variant.cpp b/variants/seeed_wio_tracker_L1/variant.cpp index 3ff5688bb..6c34d63e6 100644 --- a/variants/seeed_wio_tracker_L1/variant.cpp +++ b/variants/seeed_wio_tracker_L1/variant.cpp @@ -70,13 +70,12 @@ const uint32_t g_ADigitalPinMap[] = { 22, // D23 P0.22 (QSPI_SIO_2 WP) 23, // D24 P0.23 (QSPI_SIO_3 HOLD) - 36, // D25 TB_UP 12, // D26 TB_DOWN 11, // D27 TB_LEFT 35, // D28 TB_RIGHT 37, // D29 TB_PRESS - 4, // D30 BAT_CTL + 4, // D30 BAT_CTL }; } diff --git a/variants/seeed_wio_tracker_L1/variant.h b/variants/seeed_wio_tracker_L1/variant.h index 23c788480..b257fd9b6 100644 --- a/variants/seeed_wio_tracker_L1/variant.h +++ b/variants/seeed_wio_tracker_L1/variant.h @@ -107,10 +107,9 @@ static const uint8_t SCL = PIN_WIRE_SCL; // Power Management // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -#define BAT_READ \ - 30 // D30 = P0.04 Reads battery voltage from divider on signal board. +#define BAT_READ 30 // D30 = P0.04 Reads battery voltage from divider on signal board. #define BATTERY_SENSE_RESOLUTION_BITS 12 -#define ADC_MULTIPLIER 2.0 +#define ADC_MULTIPLIER 2.0 #define BATTERY_PIN PIN_VBAT // PIN_A7 #define AREF_VOLTAGE 3.6 // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ From f972b62d89420abdac781113747b2c40ac873b41 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 09:06:52 -0500 Subject: [PATCH 25/41] Upgrade trunk to 1.24.0 (#6915) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 162fdfd2d..3a02034a6 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.22.15 + version: 1.24.0 plugins: sources: - id: trunk @@ -9,7 +9,7 @@ plugins: lint: enabled: - checkov@3.2.435 - - renovate@40.32.7 + - renovate@40.33.8 - prettier@3.5.3 - trufflehog@3.88.34 - yamllint@1.37.1 From cb9429e83e06b29679b5c85272b62615ce583bed Mon Sep 17 00:00:00 2001 From: dmarman Date: Thu, 29 May 2025 16:09:33 +0200 Subject: [PATCH 26/41] Added full support for LTR390UV readings of UV and Lux (#6872) * Added full support for LTR390UV readings of UV and Lux * Trunk formatting * Added full support for LTR390UV readings of UV and Lux * Trunk formatting * fix library check and unnecessary bit resolution change * fixed log info messages and removed unused dependency * Hopefully fixes git mess * fix variable scope and getMetrics returns * set metrics flags bavk to false in case something wrong happens while reading LTR390UV mode --------- Co-authored-by: Domingo Co-authored-by: Ben Meadors --- platformio.ini | 4 +- .../Telemetry/EnvironmentTelemetry.cpp | 18 +++++ .../Telemetry/Sensor/LTR390UVSensor.cpp | 73 +++++++++++++++++++ src/modules/Telemetry/Sensor/LTR390UVSensor.h | 25 +++++++ 4 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 src/modules/Telemetry/Sensor/LTR390UVSensor.cpp create mode 100644 src/modules/Telemetry/Sensor/LTR390UVSensor.h diff --git a/platformio.ini b/platformio.ini index e5d36d862..125dfb573 100644 --- a/platformio.ini +++ b/platformio.ini @@ -161,6 +161,8 @@ lib_deps = sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2 # renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2 + # renovate: datasource=custom.pio depName=Adafruit LTR390 Library packageName=adafruit/library/Adafruit LTR390 Library + adafruit/Adafruit LTR390 Library@1.1.2 # renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/Adafruit PCT2075 adafruit/Adafruit PCT2075@1.0.5 @@ -190,4 +192,4 @@ lib_deps = # renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library boschsensortec/BME68x Sensor Library@1.3.40408 # renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master - https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip + https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip \ No newline at end of file diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 51f076552..6d29fecb2 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -52,6 +52,13 @@ BMP280Sensor bmp280Sensor; NullSensor bme280Sensor; #endif +#if __has_include() +#include "Sensor/LTR390UVSensor.h" +LTR390UVSensor ltr390uvSensor; +#else +NullSensor ltr390uvSensor; +#endif + #if __has_include() #include "Sensor/BME680Sensor.h" BME680Sensor bme680Sensor; @@ -231,6 +238,8 @@ int32_t EnvironmentTelemetryModule::runOnce() #endif if (bme280Sensor.hasSensor()) result = bme280Sensor.runOnce(); + if (ltr390uvSensor.hasSensor()) + result = ltr390uvSensor.runOnce(); if (bmp3xxSensor.hasSensor()) result = bmp3xxSensor.runOnce(); if (bme680Sensor.hasSensor()) @@ -524,6 +533,10 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m valid = valid && bme280Sensor.getMetrics(m); hasSensor = true; } + if (ltr390uvSensor.hasSensor()) { + valid = valid && ltr390uvSensor.getMetrics(m); + hasSensor = true; + } if (bmp3xxSensor.hasSensor()) { valid = valid && bmp3xxSensor.getMetrics(m); hasSensor = true; @@ -752,6 +765,11 @@ AdminMessageHandleResult EnvironmentTelemetryModule::handleAdminMessageForModule if (result != AdminMessageHandleResult::NOT_HANDLED) return result; } + if (ltr390uvSensor.hasSensor()) { + result = ltr390uvSensor.handleAdminMessage(mp, request, response); + if (result != AdminMessageHandleResult::NOT_HANDLED) + return result; + } if (bmp3xxSensor.hasSensor()) { result = bmp3xxSensor.handleAdminMessage(mp, request, response); if (result != AdminMessageHandleResult::NOT_HANDLED) diff --git a/src/modules/Telemetry/Sensor/LTR390UVSensor.cpp b/src/modules/Telemetry/Sensor/LTR390UVSensor.cpp new file mode 100644 index 000000000..fb84700c4 --- /dev/null +++ b/src/modules/Telemetry/Sensor/LTR390UVSensor.cpp @@ -0,0 +1,73 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "LTR390UVSensor.h" +#include "TelemetrySensor.h" +#include + +LTR390UVSensor::LTR390UVSensor() : TelemetrySensor(meshtastic_TelemetrySensorType_LTR390UV, "LTR390UV") {} + +int32_t LTR390UVSensor::runOnce() +{ + LOG_INFO("Init sensor: %s", sensorName); + if (!hasSensor()) { + return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; + } + + status = ltr390uv.begin(nodeTelemetrySensorsMap[sensorType].second); + ltr390uv.setMode(LTR390_MODE_UVS); + ltr390uv.setGain(LTR390_GAIN_18); // Datasheet default + ltr390uv.setResolution(LTR390_RESOLUTION_20BIT); // Datasheet default + + return initI2CSensor(); +} + +void LTR390UVSensor::setup() {} + +bool LTR390UVSensor::getMetrics(meshtastic_Telemetry *measurement) +{ + LOG_DEBUG("LTR390UV getMetrics"); + + // Because the sensor does not measure Lux and UV at the same time, we need to read them in two passes. + if (ltr390uv.newDataAvailable()) { + measurement->variant.environment_metrics.has_lux = true; + measurement->variant.environment_metrics.has_uv_lux = true; + + if (ltr390uv.getMode() == LTR390_MODE_ALS) { + lastLuxReading = 0.6 * ltr390uv.readALS() / (1 * 4); // Datasheet page 23 for gain x1 and 20bit resolution + LOG_DEBUG("LTR390UV Lux reading: %f", lastLuxReading); + + measurement->variant.environment_metrics.lux = lastLuxReading; + measurement->variant.environment_metrics.uv_lux = lastUVReading; + + ltr390uv.setGain( + LTR390_GAIN_18); // Recommended for UVI - x18. Do not change, 2300 UV Sensitivity only specified for x18 gain + ltr390uv.setMode(LTR390_MODE_UVS); + + return true; + + } else if (ltr390uv.getMode() == LTR390_MODE_UVS) { + lastUVReading = ltr390uv.readUVS() / + 2300.f; // Datasheet page 23 and page 6, only characterisation for gain x18 and 20bit resolution + LOG_DEBUG("LTR390UV UV reading: %f", lastUVReading); + + measurement->variant.environment_metrics.lux = lastLuxReading; + measurement->variant.environment_metrics.uv_lux = lastUVReading; + + ltr390uv.setGain( + LTR390_GAIN_1); // x1 gain will already max out the sensor at direct sunlight, so no need to increase it + ltr390uv.setMode(LTR390_MODE_ALS); + + return true; + } + } + + // In case we fail to read the sensor mode, set the has_lux and has_uv_lux back to false + measurement->variant.environment_metrics.has_lux = false; + measurement->variant.environment_metrics.has_uv_lux = false; + + return false; +} +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/LTR390UVSensor.h b/src/modules/Telemetry/Sensor/LTR390UVSensor.h new file mode 100644 index 000000000..40206bce8 --- /dev/null +++ b/src/modules/Telemetry/Sensor/LTR390UVSensor.h @@ -0,0 +1,25 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "TelemetrySensor.h" +#include + +class LTR390UVSensor : public TelemetrySensor +{ + private: + Adafruit_LTR390 ltr390uv = Adafruit_LTR390(); + float lastLuxReading = 0; + float lastUVReading = 0; + + protected: + virtual void setup() override; + + public: + LTR390UVSensor(); + virtual int32_t runOnce() override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; +}; + +#endif \ No newline at end of file From ba535433543f40b0e15280c7beb9e0afabe56142 Mon Sep 17 00:00:00 2001 From: Quency-D <55523105+Quency-D@users.noreply.github.com> Date: Thu, 29 May 2025 22:10:25 +0800 Subject: [PATCH 27/41] Add a new screen for heltec_wireless_paper. (#6894) Co-authored-by: Ben Meadors --- src/graphics/EInkDisplay2.cpp | 64 +++- src/graphics/EInkDisplay2.h | 6 +- src/graphics/EInkMultiWrapper.h | 327 ++++++++++++++++++ src/graphics/niche/Drivers/EInk/E0213A367.cpp | 126 +++++++ src/graphics/niche/Drivers/EInk/E0213A367.h | 44 +++ .../heltec_wireless_paper/nicheGraphics.h | 57 ++- variants/heltec_wireless_paper/platformio.ini | 6 +- 7 files changed, 624 insertions(+), 6 deletions(-) create mode 100644 src/graphics/EInkMultiWrapper.h create mode 100644 src/graphics/niche/Drivers/EInk/E0213A367.cpp create mode 100644 src/graphics/niche/Drivers/EInk/E0213A367.h diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 5a2749482..b518299f7 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -174,7 +174,7 @@ bool EInkDisplay::connect() } } -#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \ +#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \ defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \ defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER) { @@ -228,6 +228,68 @@ bool EInkDisplay::connect() auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *spi1); adafruitDisplay = new GxEPD2_BW(*lowLevel); + // Init GxEPD2 + adafruitDisplay->init(); + adafruitDisplay->setRotation(3); + } +#elif defined(HELTEC_WIRELESS_PAPER) + { + uint8_t model; + pinMode(PIN_EINK_SCLK, OUTPUT); + pinMode(PIN_EINK_DC, OUTPUT); + pinMode(PIN_EINK_CS, OUTPUT); + pinMode(PIN_EINK_RES, OUTPUT); + + //rest e-ink + digitalWrite(PIN_EINK_RES, LOW); + delay(20); + digitalWrite(PIN_EINK_RES, HIGH); + delay(20); + + digitalWrite(PIN_EINK_DC, LOW); + digitalWrite(PIN_EINK_CS, LOW); + + // write cmd + uint8_t cmd = 0x2F; + pinMode(PIN_EINK_MOSI, OUTPUT); + digitalWrite(PIN_EINK_SCLK, LOW); + for (int i = 0; i < 8; i++) + { + digitalWrite(PIN_EINK_MOSI, (cmd & 0x80) ? HIGH : LOW); + cmd <<= 1; + digitalWrite(PIN_EINK_SCLK, HIGH); + delayMicroseconds(1); + digitalWrite(PIN_EINK_SCLK, LOW); + delayMicroseconds(1); + } + delay(10); + + digitalWrite(PIN_EINK_DC, HIGH); + pinMode(PIN_EINK_MOSI, INPUT_PULLUP); + + // read chip ID + uint8_t chipId = 0; + for (int8_t b = 7; b >= 0; b--) + { + digitalWrite(PIN_EINK_SCLK, LOW); + delayMicroseconds(1); + digitalWrite(PIN_EINK_SCLK, HIGH); + delayMicroseconds(1); + if (digitalRead(PIN_EINK_MOSI)) chipId |= (1 << b); + } + digitalWrite(PIN_EINK_CS, HIGH); + LOG_INFO("eink chipId: %02X", chipId); + model = ((chipId&0x03) !=0x01) ? 1 : 2; + + // Start HSPI + hspi = new SPIClass(HSPI); + hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); // SCLK, MISO, MOSI, SS + // VExt already enabled in setup() + // RTC GPIO hold disabled in setup() + + // Create GxEPD2 objects + adafruitDisplay = new EInkMultiWrapper(model, PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *hspi); + // Init GxEPD2 adafruitDisplay->init(); adafruitDisplay->setRotation(3); diff --git a/src/graphics/EInkDisplay2.h b/src/graphics/EInkDisplay2.h index 93be197b0..965a3307a 100644 --- a/src/graphics/EInkDisplay2.h +++ b/src/graphics/EInkDisplay2.h @@ -4,6 +4,7 @@ #include "GxEPD2_BW.h" #include +#include "EinkMultiWrapper.h" /** * An adapter class that allows using the GxEPD2 library as if it was an OLEDDisplay implementation. @@ -64,8 +65,11 @@ class EInkDisplay : public OLEDDisplay virtual bool connect() override; // AdafruitGFX display object - instantiated in connect(), variant specific +#if defined(HELTEC_WIRELESS_PAPER) + EInkMultiWrapper *adafruitDisplay; +#else GxEPD2_BW *adafruitDisplay = NULL; - +#endif // If display uses HSPI #if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \ defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \ diff --git a/src/graphics/EInkMultiWrapper.h b/src/graphics/EInkMultiWrapper.h new file mode 100644 index 000000000..3ac0b194d --- /dev/null +++ b/src/graphics/EInkMultiWrapper.h @@ -0,0 +1,327 @@ +// Wrapper class for GxEPD2_BW + +// Generic signature at build time, allowing display model to be detected at run-time +// Workaround for issue of GxEPD2_BW objects not having a shared base class +// Only exposes methods which we are actually using +#ifndef _EINKMULTIWRAPPER_H_ +#define _EINKMULTIWRAPPER_H_ + +#include "GxEPD2_BW.h" +#include "GxEPD2_EPD.h" + +template +class EInkMultiWrapper +{ +public: + void drawPixel(int16_t x, int16_t y, uint16_t color) + { + if (model == 1) + model1->drawPixel(x, y, color); + else + model2->drawPixel(x, y, color); + } + void init(uint32_t serial_diag_bitrate = 0) // = 0 : disabled + { + if (model == 1) + model1->init(serial_diag_bitrate); + else + model2->init(serial_diag_bitrate); + } + + void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false) + { + if (model == 1) + model1->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode); + else + model2->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode); + } + void fillScreen(uint16_t color) // 0x0 black, >0x0 white, to buffer + { + if (model == 1) + model1->fillScreen(color); + else + model2->fillScreen(color); + } + void display(bool partial_update_mode = false) + { + if (model == 1) + model1->display(partial_update_mode); + else + model2->display(partial_update_mode); + } + void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) + { + if (model == 1) + model1->displayWindow(x, y, w, h); + else + model2->displayWindow(x, y, w, h); + } + + void setFullWindow() + { + if (model == 1) + model1->setFullWindow(); + else + model2->setFullWindow(); + } + + void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) + { + if (model == 1) + model1->setPartialWindow(x, y, w, h); + else + model2->setPartialWindow(x, y, w, h); + } + + void firstPage() + { + if (model == 1) + model1->firstPage(); + else + model2->firstPage(); + } + void endAsyncFull() + { + if (model == 1) + model1->endAsyncFull(); + else + model2->endAsyncFull(); + } + + bool nextPage() + { + if (model == 1) + return model1->nextPage(); + else + return model2->nextPage(); + } + void drawPaged(void (*drawCallback)(const void*), const void* pv) + { + if (model == 1) + model1->drawPaged(drawCallback, pv); + else + model2->drawPaged(drawCallback, pv); + } + + void drawInvertedBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color) + { + if (model == 1) + model1->drawInvertedBitmap(x, y, bitmap, w, h, color); + else + model2->drawInvertedBitmap(x, y, bitmap, w, h, color); + } + + void clearScreen(uint8_t value = 0xFF) // init controller memory and screen (default white) + { + if (model == 1) + model1->clearScreen(value); + else + model2->clearScreen(value); + } + void writeScreenBuffer(uint8_t value = 0xFF) // init controller memory (default white) + { + if (model == 1) + model1->writeScreenBuffer(value); + else + model2->writeScreenBuffer(value); + } + // write to controller memory, without screen refresh; x and w should be multiple of 8 + void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) + { + if (model == 1) + model1->writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm); + else + model2->writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm); + } + void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, + int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) + { + if (model == 1) + model1->writeImagePart(x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); + else + model2->writeImagePart(x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); + } + void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) + { + if (model == 1) + model1->writeImage(black, color, x, y, w, h, invert, mirror_y, pgm); + else + model2->writeImage(black, color, x, y, w, h, invert, mirror_y, pgm); + } + void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) + { + if (model == 1) + model1->writeImage(black, color, x, y, w, h); + else + model2->writeImage(black, color, x, y, w, h); + } + void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, + int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) + { + if (model == 1) + model1->writeImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h, invert, mirror_y, pgm); + else + model2->writeImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h, invert, mirror_y, pgm); + } + + void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, + int16_t x, int16_t y, int16_t w, int16_t h) + { + if (model == 1) + model1->writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); + else + model2->writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); + } + // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 + void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) + { + if (model == 1) + model1->writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); + else + model2->writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); + } + // write to controller memory, with screen refresh; x and w should be multiple of 8 + void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) + { + if (model == 1) + model1->drawImage(bitmap, x, y, w, h, invert, mirror_y, pgm); + else + model2->drawImage(bitmap, x, y, w, h, invert, mirror_y, pgm); + } + void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, + int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) + { + if (model == 1) + model1->drawImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); + else + model2->drawImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); + } + void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) + { + if (model == 1) + model1->drawImage(black, color, x, y, w, h, invert, mirror_y, pgm); + else + model2->drawImage(black, color, x, y, w, h, invert, mirror_y, pgm); + } + void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) + { + if (model == 1) + model1->drawImage(black, color, x, y, w, h); + else + model2->drawImage(black, color, x, y, w, h); + } + void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, + int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) + { + if (model == 1) + model1->drawImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); + else + model2->drawImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); + } + void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, + int16_t x, int16_t y, int16_t w, int16_t h) + { + if (model == 1) + model1->drawImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); + else + model2->drawImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); + } + // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 + void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) + { + if (model == 1) + model1->drawNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); + else + model2->drawNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); + } + void refresh(bool partial_update_mode = false) // screen refresh from controller memory to full screen + { + if (model == 1) + model1->refresh(partial_update_mode); + else + model2->refresh(partial_update_mode); + } + void refresh(int16_t x, int16_t y, int16_t w, int16_t h) // screen refresh from controller memory, partial screen + { + if (model == 1) + model1->refresh(x, y, w, h); + else + model2->refresh(x, y, w, h); + } + // turns off generation of panel driving voltages, avoids screen fading over time + void powerOff() + { + if (model == 1) + model1->powerOff(); + else + model2->powerOff(); + } + // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) + void hibernate() + { + if (model == 1) + model1->hibernate(); + else + model2->hibernate(); + } + + void setRotation(uint8_t x) + { + if (model == 1) + model1->setRotation(x); + else + model2->setRotation(x); + } + + int16_t width() + { + if (model == 1) + return model1->width(); + else + return model2->width(); + } + + int16_t height() + { + if (model == 1) + return model1->height(); + else + return model2->height(); + } + + + // Exposes methods of the GxEPD2_EPD object which is usually available as GxEPD2_BW::epd + class Epd2Wrapper + { + public: + bool isBusy() { return m_epd2->isBusy(); } + GxEPD2_EPD *m_epd2; + } epd2; + + // Constructor + // Select driver by passing whichModel as 1 or 2 + EInkMultiWrapper(uint8_t whichModel, int16_t cs, int16_t dc, int16_t rst, int16_t busy, SPIClass &spi) + { + assert(whichModel == 1 || whichModel == 2); + model = whichModel; + // LOG_DEBUG("GxEPD2_BW_MultiWrapper using driver %d", model); + + if (model == 1) + { + model1 = new GxEPD2_BW(DISPLAY_MODEL_1(cs, dc, rst, busy, spi)); + epd2.m_epd2 = &(model1->epd2); + } + else if (model == 2) + { + model2 = new GxEPD2_BW(DISPLAY_MODEL_2(cs, dc, rst, busy, spi)); + epd2.m_epd2 = &(model2->epd2); + } + } + +private: + uint8_t model; + GxEPD2_BW *model1; + GxEPD2_BW *model2; +}; + +#endif \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/E0213A367.cpp b/src/graphics/niche/Drivers/EInk/E0213A367.cpp new file mode 100644 index 000000000..4f2a50ba7 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/E0213A367.cpp @@ -0,0 +1,126 @@ +#include "./E0213A367.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +using namespace NicheGraphics::Drivers; + +// Map the display controller IC's output to the connected panel +void E0213A367::configScanning() +{ + // "Driver output control" + sendCommand(0x01); + sendData(0xF9); + sendData(0x00); + // Values set here might be redundant: F9, 00 seems to be default +} + +// Specify which information is used to control the sequence of voltages applied to move the pixels +// - For this display, configUpdateSequence() specifies that a suitable LUT will be loaded from +// the controller IC's OTP memory, when the update procedure begins. +void E0213A367::configWaveform() +{ + sendCommand(0x37); // Waveform ID register + sendData(0x40); // ByteA + sendData(0x80); // ByteB DM[7:0] + sendData(0x03); // ByteC DM[[15:8] + sendData(0x0E); // ByteD DM[[23:16] + + switch (updateType) { + case FAST: + sendCommand(0x3C); // Border waveform: + sendData(0x81); + break; + case FULL: + sendCommand(0x3C); // Border waveform: + sendData(0x01); + default: + // From OTP memory + break; + } +} + +void E0213A367::configUpdateSequence() +{ + switch (updateType) { + case FAST: + sendCommand(0x22); + sendData(0xFF); + break; + case FULL: + default: + sendCommand(0x22); // Set "update sequence" + sendData(0xF7); + break; + } +} + +// Once the refresh operation has been started, +// begin periodically polling the display to check for completion, using the normal Meshtastic threading code +// Only used when refresh is "async" +void E0213A367::detachFromUpdate() +{ + switch (updateType) { + case FAST: + return beginPolling(50, 500); // At least 500ms for fast refresh + case FULL: + default: + return beginPolling(100, 2000); // At least 2 seconds for full refresh + } +} +void E0213A367::configFullscreen() +{ + // Placing this code in a separate method because it's probably pretty consistent between displays + // Should make it tidier to override SSD16XX::configure + + // Define the boundaries of the "fullscreen" region, for the controller IC + static const uint16_t sx = bufferOffsetX; // Notice the offset + static const uint16_t sy = 0; + static const uint16_t ex = bufferRowSize + bufferOffsetX - 1; // End is "max index", not "count". Minus 1 handles this + static const uint16_t ey = height; + + // Split into bytes + static const uint8_t sy1 = sy & 0xFF; + static const uint8_t ey1 = ey & 0xFF; + + // Data entry mode - Left to Right, Top to Bottom + sendCommand(0x11); + sendData(0x03); + + // Select controller IC memory region to display a fullscreen image + sendCommand(0x44); // Memory X start - end + sendData(sx); + sendData(ex); + sendCommand(0x45); // Memory Y start - end + sendData(sy1); + sendData(ey1); + + // Place the cursor at the start of this memory region, ready to send image data x=0 y=0 + sendCommand(0x4E); // Memory cursor X + sendData(sx); + sendCommand(0x4F); // Memory cursor y + sendData(sy1); +} +void E0213A367::finalizeUpdate() +{ + // Put a copy of the image into the "old memory". + // Used with differential refreshes (e.g. FAST update), to determine which px need to move, and which can remain in place + // We need to keep the "old memory" up to date, because don't know whether next refresh will be FULL or FAST etc. + if (updateType != FULL) { + writeNewImage(); // Only required by some controller variants. Todo: Override just for GDEY0154D678? + writeOldImage(); + sendCommand(0x7F); // Terminate image write without update + wait(); + } + + //After waking up from sleep mode, the local refresh is abnormal, which may be due to the loss of data in RAM. + // if ((pin_rst != 0xFF) && (updateType ==FULL)) + // deepSleep(); +} + +void E0213A367::deepSleep() +{ + sendCommand(0x10); // Enter deep sleep + sendData(0x03); // Will not retain image RAM +} + +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/E0213A367.h b/src/graphics/niche/Drivers/EInk/E0213A367.h new file mode 100644 index 000000000..c00d73378 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/E0213A367.h @@ -0,0 +1,44 @@ +/* + +E-Ink display driver + - SSD1682 + - Manufacturer: WISEVAST + - Size: 2.13 inch + - Resolution: 122px x 255px + - Flex connector marking: HINK-E0213A162-FPC-A0 (Hidden, printed on back-side) + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "configuration.h" + +#include "./SSD16XX.h" + +namespace NicheGraphics::Drivers +{ +class E0213A367 : public SSD16XX +{ + // Display properties + private: + static constexpr uint32_t width = 122; + static constexpr uint32_t height = 250; + static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); + + public: + E0213A367() : SSD16XX(width, height, supported, 0) {} + + protected: + virtual void configScanning() override; + virtual void configWaveform() override; + virtual void configUpdateSequence() override; + virtual void detachFromUpdate() override; + virtual void configFullscreen() override; + virtual void deepSleep() override; + virtual void finalizeUpdate() override; +}; + +} // namespace NicheGraphics::Drivers +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/variants/heltec_wireless_paper/nicheGraphics.h b/variants/heltec_wireless_paper/nicheGraphics.h index c8994b7f1..e42a4df85 100644 --- a/variants/heltec_wireless_paper/nicheGraphics.h +++ b/variants/heltec_wireless_paper/nicheGraphics.h @@ -19,12 +19,58 @@ // Shared NicheGraphics components // -------------------------------- #include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h" +#include "graphics/niche/Drivers/EInk/E0213A367.h" #include "graphics/niche/Inputs/TwoButton.h" void setupNicheGraphics() { using namespace NicheGraphics; + pinMode(PIN_EINK_SCLK, OUTPUT); + pinMode(PIN_EINK_DC, OUTPUT); + pinMode(PIN_EINK_CS, OUTPUT); + pinMode(PIN_EINK_RES, OUTPUT); + + //rest e-ink + digitalWrite(PIN_EINK_RES, LOW); + delay(20); + digitalWrite(PIN_EINK_RES, HIGH); + delay(20); + + digitalWrite(PIN_EINK_DC, LOW); + digitalWrite(PIN_EINK_CS, LOW); + + // write cmd + uint8_t cmd = 0x2F; + pinMode(PIN_EINK_MOSI, OUTPUT); + digitalWrite(PIN_EINK_SCLK, LOW); + for (int i = 0; i < 8; i++) + { + digitalWrite(PIN_EINK_MOSI, (cmd & 0x80) ? HIGH : LOW); + cmd <<= 1; + digitalWrite(PIN_EINK_SCLK, HIGH); + delayMicroseconds(1); + digitalWrite(PIN_EINK_SCLK, LOW); + delayMicroseconds(1); + } + delay(10); + + digitalWrite(PIN_EINK_DC, HIGH); + pinMode(PIN_EINK_MOSI, INPUT_PULLUP); + + // read chip ID + uint8_t chipId = 0; + for (int8_t b = 7; b >= 0; b--) + { + digitalWrite(PIN_EINK_SCLK, LOW); + delayMicroseconds(1); + digitalWrite(PIN_EINK_SCLK, HIGH); + delayMicroseconds(1); + if (digitalRead(PIN_EINK_MOSI)) chipId |= (1 << b); + } + digitalWrite(PIN_EINK_CS, HIGH); + LOG_INFO("eink chipId: %02X", chipId); + // SPI // ----------------------------- @@ -34,8 +80,15 @@ void setupNicheGraphics() // E-Ink Driver // ----------------------------- - - Drivers::EInk *driver = new Drivers::LCMEN213EFC1; + Drivers::EInk *driver; + if((chipId &0x03) !=0x01) + { + driver = new Drivers::LCMEN213EFC1; + } + else + { + driver = new Drivers::E0213A367; + } driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES); // InkHUD diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index 51430ebff..762b793cc 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -8,6 +8,8 @@ build_flags = -I variants/heltec_wireless_paper -D HELTEC_WIRELESS_PAPER -D EINK_DISPLAY_MODEL=GxEPD2_213_FC1 + -D EINK_DISPLAY_MODEL1=GxEPD2_213_FC1 + -D EINK_DISPLAY_MODEL2=GxEPD2_213_E0213A367 -D EINK_WIDTH=250 -D EINK_HEIGHT=122 -D USE_EINK @@ -17,9 +19,9 @@ build_flags = -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip + https://github.com/Quency-D/GxEPD2/archive/0513405847b281d9dea400488714643ef84507ec.zip lewisxhe/PCF8563_Library@^1.0.1 -upload_speed = 115200 +upload_speed = 921600 [env:heltec-wireless-paper-inkhud] extends = esp32s3_base, inkhud From 7a7166d57555f42156eb15a8923667e63fdb6a95 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 29 May 2025 10:17:20 -0500 Subject: [PATCH 28/41] Revert "Add a new screen for heltec_wireless_paper. (#6894)" (#6918) This reverts commit ba535433543f40b0e15280c7beb9e0afabe56142. --- src/graphics/EInkDisplay2.cpp | 64 +--- src/graphics/EInkDisplay2.h | 6 +- src/graphics/EInkMultiWrapper.h | 327 ------------------ src/graphics/niche/Drivers/EInk/E0213A367.cpp | 126 ------- src/graphics/niche/Drivers/EInk/E0213A367.h | 44 --- .../heltec_wireless_paper/nicheGraphics.h | 57 +-- variants/heltec_wireless_paper/platformio.ini | 6 +- 7 files changed, 6 insertions(+), 624 deletions(-) delete mode 100644 src/graphics/EInkMultiWrapper.h delete mode 100644 src/graphics/niche/Drivers/EInk/E0213A367.cpp delete mode 100644 src/graphics/niche/Drivers/EInk/E0213A367.h diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index b518299f7..5a2749482 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -174,7 +174,7 @@ bool EInkDisplay::connect() } } -#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \ +#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \ defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \ defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER) { @@ -228,68 +228,6 @@ bool EInkDisplay::connect() auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *spi1); adafruitDisplay = new GxEPD2_BW(*lowLevel); - // Init GxEPD2 - adafruitDisplay->init(); - adafruitDisplay->setRotation(3); - } -#elif defined(HELTEC_WIRELESS_PAPER) - { - uint8_t model; - pinMode(PIN_EINK_SCLK, OUTPUT); - pinMode(PIN_EINK_DC, OUTPUT); - pinMode(PIN_EINK_CS, OUTPUT); - pinMode(PIN_EINK_RES, OUTPUT); - - //rest e-ink - digitalWrite(PIN_EINK_RES, LOW); - delay(20); - digitalWrite(PIN_EINK_RES, HIGH); - delay(20); - - digitalWrite(PIN_EINK_DC, LOW); - digitalWrite(PIN_EINK_CS, LOW); - - // write cmd - uint8_t cmd = 0x2F; - pinMode(PIN_EINK_MOSI, OUTPUT); - digitalWrite(PIN_EINK_SCLK, LOW); - for (int i = 0; i < 8; i++) - { - digitalWrite(PIN_EINK_MOSI, (cmd & 0x80) ? HIGH : LOW); - cmd <<= 1; - digitalWrite(PIN_EINK_SCLK, HIGH); - delayMicroseconds(1); - digitalWrite(PIN_EINK_SCLK, LOW); - delayMicroseconds(1); - } - delay(10); - - digitalWrite(PIN_EINK_DC, HIGH); - pinMode(PIN_EINK_MOSI, INPUT_PULLUP); - - // read chip ID - uint8_t chipId = 0; - for (int8_t b = 7; b >= 0; b--) - { - digitalWrite(PIN_EINK_SCLK, LOW); - delayMicroseconds(1); - digitalWrite(PIN_EINK_SCLK, HIGH); - delayMicroseconds(1); - if (digitalRead(PIN_EINK_MOSI)) chipId |= (1 << b); - } - digitalWrite(PIN_EINK_CS, HIGH); - LOG_INFO("eink chipId: %02X", chipId); - model = ((chipId&0x03) !=0x01) ? 1 : 2; - - // Start HSPI - hspi = new SPIClass(HSPI); - hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); // SCLK, MISO, MOSI, SS - // VExt already enabled in setup() - // RTC GPIO hold disabled in setup() - - // Create GxEPD2 objects - adafruitDisplay = new EInkMultiWrapper(model, PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *hspi); - // Init GxEPD2 adafruitDisplay->init(); adafruitDisplay->setRotation(3); diff --git a/src/graphics/EInkDisplay2.h b/src/graphics/EInkDisplay2.h index 965a3307a..93be197b0 100644 --- a/src/graphics/EInkDisplay2.h +++ b/src/graphics/EInkDisplay2.h @@ -4,7 +4,6 @@ #include "GxEPD2_BW.h" #include -#include "EinkMultiWrapper.h" /** * An adapter class that allows using the GxEPD2 library as if it was an OLEDDisplay implementation. @@ -65,11 +64,8 @@ class EInkDisplay : public OLEDDisplay virtual bool connect() override; // AdafruitGFX display object - instantiated in connect(), variant specific -#if defined(HELTEC_WIRELESS_PAPER) - EInkMultiWrapper *adafruitDisplay; -#else GxEPD2_BW *adafruitDisplay = NULL; -#endif + // If display uses HSPI #if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \ defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \ diff --git a/src/graphics/EInkMultiWrapper.h b/src/graphics/EInkMultiWrapper.h deleted file mode 100644 index 3ac0b194d..000000000 --- a/src/graphics/EInkMultiWrapper.h +++ /dev/null @@ -1,327 +0,0 @@ -// Wrapper class for GxEPD2_BW - -// Generic signature at build time, allowing display model to be detected at run-time -// Workaround for issue of GxEPD2_BW objects not having a shared base class -// Only exposes methods which we are actually using -#ifndef _EINKMULTIWRAPPER_H_ -#define _EINKMULTIWRAPPER_H_ - -#include "GxEPD2_BW.h" -#include "GxEPD2_EPD.h" - -template -class EInkMultiWrapper -{ -public: - void drawPixel(int16_t x, int16_t y, uint16_t color) - { - if (model == 1) - model1->drawPixel(x, y, color); - else - model2->drawPixel(x, y, color); - } - void init(uint32_t serial_diag_bitrate = 0) // = 0 : disabled - { - if (model == 1) - model1->init(serial_diag_bitrate); - else - model2->init(serial_diag_bitrate); - } - - void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false) - { - if (model == 1) - model1->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode); - else - model2->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode); - } - void fillScreen(uint16_t color) // 0x0 black, >0x0 white, to buffer - { - if (model == 1) - model1->fillScreen(color); - else - model2->fillScreen(color); - } - void display(bool partial_update_mode = false) - { - if (model == 1) - model1->display(partial_update_mode); - else - model2->display(partial_update_mode); - } - void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) - { - if (model == 1) - model1->displayWindow(x, y, w, h); - else - model2->displayWindow(x, y, w, h); - } - - void setFullWindow() - { - if (model == 1) - model1->setFullWindow(); - else - model2->setFullWindow(); - } - - void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) - { - if (model == 1) - model1->setPartialWindow(x, y, w, h); - else - model2->setPartialWindow(x, y, w, h); - } - - void firstPage() - { - if (model == 1) - model1->firstPage(); - else - model2->firstPage(); - } - void endAsyncFull() - { - if (model == 1) - model1->endAsyncFull(); - else - model2->endAsyncFull(); - } - - bool nextPage() - { - if (model == 1) - return model1->nextPage(); - else - return model2->nextPage(); - } - void drawPaged(void (*drawCallback)(const void*), const void* pv) - { - if (model == 1) - model1->drawPaged(drawCallback, pv); - else - model2->drawPaged(drawCallback, pv); - } - - void drawInvertedBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color) - { - if (model == 1) - model1->drawInvertedBitmap(x, y, bitmap, w, h, color); - else - model2->drawInvertedBitmap(x, y, bitmap, w, h, color); - } - - void clearScreen(uint8_t value = 0xFF) // init controller memory and screen (default white) - { - if (model == 1) - model1->clearScreen(value); - else - model2->clearScreen(value); - } - void writeScreenBuffer(uint8_t value = 0xFF) // init controller memory (default white) - { - if (model == 1) - model1->writeScreenBuffer(value); - else - model2->writeScreenBuffer(value); - } - // write to controller memory, without screen refresh; x and w should be multiple of 8 - void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) - { - if (model == 1) - model1->writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm); - else - model2->writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm); - } - void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, - int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) - { - if (model == 1) - model1->writeImagePart(x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); - else - model2->writeImagePart(x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); - } - void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) - { - if (model == 1) - model1->writeImage(black, color, x, y, w, h, invert, mirror_y, pgm); - else - model2->writeImage(black, color, x, y, w, h, invert, mirror_y, pgm); - } - void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) - { - if (model == 1) - model1->writeImage(black, color, x, y, w, h); - else - model2->writeImage(black, color, x, y, w, h); - } - void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, - int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) - { - if (model == 1) - model1->writeImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h, invert, mirror_y, pgm); - else - model2->writeImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h, invert, mirror_y, pgm); - } - - void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, - int16_t x, int16_t y, int16_t w, int16_t h) - { - if (model == 1) - model1->writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); - else - model2->writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); - } - // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 - void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) - { - if (model == 1) - model1->writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); - else - model2->writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); - } - // write to controller memory, with screen refresh; x and w should be multiple of 8 - void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) - { - if (model == 1) - model1->drawImage(bitmap, x, y, w, h, invert, mirror_y, pgm); - else - model2->drawImage(bitmap, x, y, w, h, invert, mirror_y, pgm); - } - void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, - int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) - { - if (model == 1) - model1->drawImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); - else - model2->drawImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); - } - void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) - { - if (model == 1) - model1->drawImage(black, color, x, y, w, h, invert, mirror_y, pgm); - else - model2->drawImage(black, color, x, y, w, h, invert, mirror_y, pgm); - } - void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) - { - if (model == 1) - model1->drawImage(black, color, x, y, w, h); - else - model2->drawImage(black, color, x, y, w, h); - } - void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, - int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) - { - if (model == 1) - model1->drawImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); - else - model2->drawImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm); - } - void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, - int16_t x, int16_t y, int16_t w, int16_t h) - { - if (model == 1) - model1->drawImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); - else - model2->drawImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h); - } - // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 - void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) - { - if (model == 1) - model1->drawNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); - else - model2->drawNative(data1, data2, x, y, w, h, invert, mirror_y, pgm); - } - void refresh(bool partial_update_mode = false) // screen refresh from controller memory to full screen - { - if (model == 1) - model1->refresh(partial_update_mode); - else - model2->refresh(partial_update_mode); - } - void refresh(int16_t x, int16_t y, int16_t w, int16_t h) // screen refresh from controller memory, partial screen - { - if (model == 1) - model1->refresh(x, y, w, h); - else - model2->refresh(x, y, w, h); - } - // turns off generation of panel driving voltages, avoids screen fading over time - void powerOff() - { - if (model == 1) - model1->powerOff(); - else - model2->powerOff(); - } - // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) - void hibernate() - { - if (model == 1) - model1->hibernate(); - else - model2->hibernate(); - } - - void setRotation(uint8_t x) - { - if (model == 1) - model1->setRotation(x); - else - model2->setRotation(x); - } - - int16_t width() - { - if (model == 1) - return model1->width(); - else - return model2->width(); - } - - int16_t height() - { - if (model == 1) - return model1->height(); - else - return model2->height(); - } - - - // Exposes methods of the GxEPD2_EPD object which is usually available as GxEPD2_BW::epd - class Epd2Wrapper - { - public: - bool isBusy() { return m_epd2->isBusy(); } - GxEPD2_EPD *m_epd2; - } epd2; - - // Constructor - // Select driver by passing whichModel as 1 or 2 - EInkMultiWrapper(uint8_t whichModel, int16_t cs, int16_t dc, int16_t rst, int16_t busy, SPIClass &spi) - { - assert(whichModel == 1 || whichModel == 2); - model = whichModel; - // LOG_DEBUG("GxEPD2_BW_MultiWrapper using driver %d", model); - - if (model == 1) - { - model1 = new GxEPD2_BW(DISPLAY_MODEL_1(cs, dc, rst, busy, spi)); - epd2.m_epd2 = &(model1->epd2); - } - else if (model == 2) - { - model2 = new GxEPD2_BW(DISPLAY_MODEL_2(cs, dc, rst, busy, spi)); - epd2.m_epd2 = &(model2->epd2); - } - } - -private: - uint8_t model; - GxEPD2_BW *model1; - GxEPD2_BW *model2; -}; - -#endif \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/E0213A367.cpp b/src/graphics/niche/Drivers/EInk/E0213A367.cpp deleted file mode 100644 index 4f2a50ba7..000000000 --- a/src/graphics/niche/Drivers/EInk/E0213A367.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "./E0213A367.h" - -#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS - -using namespace NicheGraphics::Drivers; - -// Map the display controller IC's output to the connected panel -void E0213A367::configScanning() -{ - // "Driver output control" - sendCommand(0x01); - sendData(0xF9); - sendData(0x00); - // Values set here might be redundant: F9, 00 seems to be default -} - -// Specify which information is used to control the sequence of voltages applied to move the pixels -// - For this display, configUpdateSequence() specifies that a suitable LUT will be loaded from -// the controller IC's OTP memory, when the update procedure begins. -void E0213A367::configWaveform() -{ - sendCommand(0x37); // Waveform ID register - sendData(0x40); // ByteA - sendData(0x80); // ByteB DM[7:0] - sendData(0x03); // ByteC DM[[15:8] - sendData(0x0E); // ByteD DM[[23:16] - - switch (updateType) { - case FAST: - sendCommand(0x3C); // Border waveform: - sendData(0x81); - break; - case FULL: - sendCommand(0x3C); // Border waveform: - sendData(0x01); - default: - // From OTP memory - break; - } -} - -void E0213A367::configUpdateSequence() -{ - switch (updateType) { - case FAST: - sendCommand(0x22); - sendData(0xFF); - break; - case FULL: - default: - sendCommand(0x22); // Set "update sequence" - sendData(0xF7); - break; - } -} - -// Once the refresh operation has been started, -// begin periodically polling the display to check for completion, using the normal Meshtastic threading code -// Only used when refresh is "async" -void E0213A367::detachFromUpdate() -{ - switch (updateType) { - case FAST: - return beginPolling(50, 500); // At least 500ms for fast refresh - case FULL: - default: - return beginPolling(100, 2000); // At least 2 seconds for full refresh - } -} -void E0213A367::configFullscreen() -{ - // Placing this code in a separate method because it's probably pretty consistent between displays - // Should make it tidier to override SSD16XX::configure - - // Define the boundaries of the "fullscreen" region, for the controller IC - static const uint16_t sx = bufferOffsetX; // Notice the offset - static const uint16_t sy = 0; - static const uint16_t ex = bufferRowSize + bufferOffsetX - 1; // End is "max index", not "count". Minus 1 handles this - static const uint16_t ey = height; - - // Split into bytes - static const uint8_t sy1 = sy & 0xFF; - static const uint8_t ey1 = ey & 0xFF; - - // Data entry mode - Left to Right, Top to Bottom - sendCommand(0x11); - sendData(0x03); - - // Select controller IC memory region to display a fullscreen image - sendCommand(0x44); // Memory X start - end - sendData(sx); - sendData(ex); - sendCommand(0x45); // Memory Y start - end - sendData(sy1); - sendData(ey1); - - // Place the cursor at the start of this memory region, ready to send image data x=0 y=0 - sendCommand(0x4E); // Memory cursor X - sendData(sx); - sendCommand(0x4F); // Memory cursor y - sendData(sy1); -} -void E0213A367::finalizeUpdate() -{ - // Put a copy of the image into the "old memory". - // Used with differential refreshes (e.g. FAST update), to determine which px need to move, and which can remain in place - // We need to keep the "old memory" up to date, because don't know whether next refresh will be FULL or FAST etc. - if (updateType != FULL) { - writeNewImage(); // Only required by some controller variants. Todo: Override just for GDEY0154D678? - writeOldImage(); - sendCommand(0x7F); // Terminate image write without update - wait(); - } - - //After waking up from sleep mode, the local refresh is abnormal, which may be due to the loss of data in RAM. - // if ((pin_rst != 0xFF) && (updateType ==FULL)) - // deepSleep(); -} - -void E0213A367::deepSleep() -{ - sendCommand(0x10); // Enter deep sleep - sendData(0x03); // Will not retain image RAM -} - -#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/E0213A367.h b/src/graphics/niche/Drivers/EInk/E0213A367.h deleted file mode 100644 index c00d73378..000000000 --- a/src/graphics/niche/Drivers/EInk/E0213A367.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - -E-Ink display driver - - SSD1682 - - Manufacturer: WISEVAST - - Size: 2.13 inch - - Resolution: 122px x 255px - - Flex connector marking: HINK-E0213A162-FPC-A0 (Hidden, printed on back-side) - -*/ - -#pragma once - -#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS - -#include "configuration.h" - -#include "./SSD16XX.h" - -namespace NicheGraphics::Drivers -{ -class E0213A367 : public SSD16XX -{ - // Display properties - private: - static constexpr uint32_t width = 122; - static constexpr uint32_t height = 250; - static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); - - public: - E0213A367() : SSD16XX(width, height, supported, 0) {} - - protected: - virtual void configScanning() override; - virtual void configWaveform() override; - virtual void configUpdateSequence() override; - virtual void detachFromUpdate() override; - virtual void configFullscreen() override; - virtual void deepSleep() override; - virtual void finalizeUpdate() override; -}; - -} // namespace NicheGraphics::Drivers -#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/variants/heltec_wireless_paper/nicheGraphics.h b/variants/heltec_wireless_paper/nicheGraphics.h index e42a4df85..c8994b7f1 100644 --- a/variants/heltec_wireless_paper/nicheGraphics.h +++ b/variants/heltec_wireless_paper/nicheGraphics.h @@ -19,58 +19,12 @@ // Shared NicheGraphics components // -------------------------------- #include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h" -#include "graphics/niche/Drivers/EInk/E0213A367.h" #include "graphics/niche/Inputs/TwoButton.h" void setupNicheGraphics() { using namespace NicheGraphics; - pinMode(PIN_EINK_SCLK, OUTPUT); - pinMode(PIN_EINK_DC, OUTPUT); - pinMode(PIN_EINK_CS, OUTPUT); - pinMode(PIN_EINK_RES, OUTPUT); - - //rest e-ink - digitalWrite(PIN_EINK_RES, LOW); - delay(20); - digitalWrite(PIN_EINK_RES, HIGH); - delay(20); - - digitalWrite(PIN_EINK_DC, LOW); - digitalWrite(PIN_EINK_CS, LOW); - - // write cmd - uint8_t cmd = 0x2F; - pinMode(PIN_EINK_MOSI, OUTPUT); - digitalWrite(PIN_EINK_SCLK, LOW); - for (int i = 0; i < 8; i++) - { - digitalWrite(PIN_EINK_MOSI, (cmd & 0x80) ? HIGH : LOW); - cmd <<= 1; - digitalWrite(PIN_EINK_SCLK, HIGH); - delayMicroseconds(1); - digitalWrite(PIN_EINK_SCLK, LOW); - delayMicroseconds(1); - } - delay(10); - - digitalWrite(PIN_EINK_DC, HIGH); - pinMode(PIN_EINK_MOSI, INPUT_PULLUP); - - // read chip ID - uint8_t chipId = 0; - for (int8_t b = 7; b >= 0; b--) - { - digitalWrite(PIN_EINK_SCLK, LOW); - delayMicroseconds(1); - digitalWrite(PIN_EINK_SCLK, HIGH); - delayMicroseconds(1); - if (digitalRead(PIN_EINK_MOSI)) chipId |= (1 << b); - } - digitalWrite(PIN_EINK_CS, HIGH); - LOG_INFO("eink chipId: %02X", chipId); - // SPI // ----------------------------- @@ -80,15 +34,8 @@ void setupNicheGraphics() // E-Ink Driver // ----------------------------- - Drivers::EInk *driver; - if((chipId &0x03) !=0x01) - { - driver = new Drivers::LCMEN213EFC1; - } - else - { - driver = new Drivers::E0213A367; - } + + Drivers::EInk *driver = new Drivers::LCMEN213EFC1; driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES); // InkHUD diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index 762b793cc..51430ebff 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -8,8 +8,6 @@ build_flags = -I variants/heltec_wireless_paper -D HELTEC_WIRELESS_PAPER -D EINK_DISPLAY_MODEL=GxEPD2_213_FC1 - -D EINK_DISPLAY_MODEL1=GxEPD2_213_FC1 - -D EINK_DISPLAY_MODEL2=GxEPD2_213_E0213A367 -D EINK_WIDTH=250 -D EINK_HEIGHT=122 -D USE_EINK @@ -19,9 +17,9 @@ build_flags = -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" lib_deps = ${esp32s3_base.lib_deps} - https://github.com/Quency-D/GxEPD2/archive/0513405847b281d9dea400488714643ef84507ec.zip + https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip lewisxhe/PCF8563_Library@^1.0.1 -upload_speed = 921600 +upload_speed = 115200 [env:heltec-wireless-paper-inkhud] extends = esp32s3_base, inkhud From b6cb0b148cdf2ed01f1a1dfd4f17ddb4e1838ece Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 29 May 2025 17:33:10 -0400 Subject: [PATCH 29/41] Fix renovate for Adafruit PCT2075 (#6919) --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 125dfb573..ac74a352a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -163,7 +163,7 @@ lib_deps = sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2 # renovate: datasource=custom.pio depName=Adafruit LTR390 Library packageName=adafruit/library/Adafruit LTR390 Library adafruit/Adafruit LTR390 Library@1.1.2 - # renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/Adafruit PCT2075 + # renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/library/Adafruit PCT2075 adafruit/Adafruit PCT2075@1.0.5 ; (not included in native / portduino) From f9d4fdbb52440ee35fb597c2dc7695b6d1cada75 Mon Sep 17 00:00:00 2001 From: ArgoNavi <63644530+ArgoNavi@users.noreply.github.com> Date: Fri, 30 May 2025 07:00:20 -0400 Subject: [PATCH 30/41] Update TSL2591Sensor.cpp (#6921) Lower gain and timing to avoid saturation in bright light --- src/modules/Telemetry/Sensor/TSL2591Sensor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/Telemetry/Sensor/TSL2591Sensor.cpp b/src/modules/Telemetry/Sensor/TSL2591Sensor.cpp index beec3c70b..04443ebec 100644 --- a/src/modules/Telemetry/Sensor/TSL2591Sensor.cpp +++ b/src/modules/Telemetry/Sensor/TSL2591Sensor.cpp @@ -23,8 +23,8 @@ int32_t TSL2591Sensor::runOnce() void TSL2591Sensor::setup() { - tsl.setGain(TSL2591_GAIN_MED); // 25x gain - tsl.setTiming(TSL2591_INTEGRATIONTIME_300MS); + tsl.setGain(TSL2591_GAIN_LOW); // 1x gain + tsl.setTiming(TSL2591_INTEGRATIONTIME_100MS); } bool TSL2591Sensor::getMetrics(meshtastic_Telemetry *measurement) @@ -41,4 +41,4 @@ bool TSL2591Sensor::getMetrics(meshtastic_Telemetry *measurement) return true; } -#endif \ No newline at end of file +#endif From 9799f10e6363703bf64490044dbac813f0ddf2ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 08:38:13 -0500 Subject: [PATCH 31/41] Upgrade trunk (#6922) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 3a02034a6..f45bba826 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,7 +9,7 @@ plugins: lint: enabled: - checkov@3.2.435 - - renovate@40.33.8 + - renovate@40.34.4 - prettier@3.5.3 - trufflehog@3.88.34 - yamllint@1.37.1 From 284b8bcff283b05d320c81c4dcc64a6fe6e47104 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 31 May 2025 06:15:37 -0500 Subject: [PATCH 32/41] chore(deps): update meshtastic/device-ui digest to 37e2fb8 (#6925) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index ac74a352a..40517eea0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/3dfcc973cdfec8b34719510952e160bbfb57d9df.zip + https://github.com/meshtastic/device-ui/archive/37e2fb84a8d1b7d8cc1e2ed00d34cfb1f284bd59.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 5cd74f4b53a70ce18303ccdee75260be2e689ea7 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 1 Jun 2025 21:03:38 -0500 Subject: [PATCH 33/41] Don't give LOG_INFO a null --- src/modules/Telemetry/HostMetrics.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/Telemetry/HostMetrics.cpp b/src/modules/Telemetry/HostMetrics.cpp index dc4315efa..9a9d8fecc 100644 --- a/src/modules/Telemetry/HostMetrics.cpp +++ b/src/modules/Telemetry/HostMetrics.cpp @@ -34,7 +34,8 @@ bool HostMetricsModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, sender, t->variant.host_metrics.uptime_seconds, t->variant.host_metrics.diskfree1_bytes, t->variant.host_metrics.freemem_bytes, static_cast(t->variant.host_metrics.load1) / 100, static_cast(t->variant.host_metrics.load5) / 100, - static_cast(t->variant.host_metrics.load15) / 100, t->variant.host_metrics.user_string); + static_cast(t->variant.host_metrics.load15) / 100, + t->variant.host_metrics.has_user_string ? t->variant.host_metrics.user_string : ""); #endif } return false; // Let others look at this message also if they want @@ -124,7 +125,8 @@ bool HostMetricsModule::sendMetrics() telemetry.variant.host_metrics.uptime_seconds, telemetry.variant.host_metrics.diskfree1_bytes, telemetry.variant.host_metrics.freemem_bytes, static_cast(telemetry.variant.host_metrics.load1) / 100, static_cast(telemetry.variant.host_metrics.load5) / 100, - static_cast(telemetry.variant.host_metrics.load15) / 100, telemetry.variant.host_metrics.user_string); + static_cast(telemetry.variant.host_metrics.load15) / 100, + telemetry.variant.host_metrics.has_user_string ? telemetry.variant.host_metrics.user_string : ""); meshtastic_MeshPacket *p = allocDataProtobuf(telemetry); p->to = NODENUM_BROADCAST; From d833a9ea61fcad0999944ff8879204fb8611e123 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 06:16:01 -0500 Subject: [PATCH 34/41] chore(deps): update meshtastic/device-ui digest to 04e3a07 (#6942) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 40517eea0..095cf3b9d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/37e2fb84a8d1b7d8cc1e2ed00d34cfb1f284bd59.zip + https://github.com/meshtastic/device-ui/archive/04e3a075dc848f49e1344c5404ccce03a1876017.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From be0c7d73a34c73b68ee1277bb17f17af970493bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 06:16:24 -0500 Subject: [PATCH 35/41] Upgrade trunk (#6941) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> Co-authored-by: Ben Meadors --- .trunk/trunk.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index f45bba826..fd827e229 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,14 +9,14 @@ plugins: lint: enabled: - checkov@3.2.435 - - renovate@40.34.4 + - renovate@40.36.2 - prettier@3.5.3 - - trufflehog@3.88.34 + - trufflehog@3.88.35 - yamllint@1.37.1 - bandit@1.8.3 - - trivy@0.62.1 + - trivy@0.63.0 - taplo@0.9.3 - - ruff@0.11.11 + - ruff@0.11.12 - isort@6.0.1 - markdownlint@0.45.0 - oxipng@9.1.5 From 9ce44556ceaabaf1c6cd689d6390651dcc29d3de Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 06:29:41 -0500 Subject: [PATCH 36/41] chore(deps): update meshtastic/device-ui digest to 649e095 (#6943) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 095cf3b9d..ecde59de2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/04e3a075dc848f49e1344c5404ccce03a1876017.zip + https://github.com/meshtastic/device-ui/archive/649e0953508ee4aabf1171519ee2eb69fb125647.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 4d81280ac25a006fb66e2e954577e607de5b7e51 Mon Sep 17 00:00:00 2001 From: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Date: Tue, 3 Jun 2025 03:35:26 +0200 Subject: [PATCH 37/41] Add --1200bps-reset param to device-install/update scripts (#6752) * add change-mode support * add change-mode support * tab to space * fix if check * change param name to 1200bps-reset * update help section * missed one in help seciton --------- Co-authored-by: Ben Meadors --- bin/device-install.bat | 21 +++++++++++++++++++-- bin/device-install.sh | 12 +++++++++++- bin/device-update.bat | 21 +++++++++++++++++++-- bin/device-update.sh | 16 +++++++++++++--- 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/bin/device-install.bat b/bin/device-install.bat index 3ffca0b63..816d2fbba 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -12,6 +12,7 @@ SET "BIGDB16=0" SET "ESPTOOL_BAUD=115200" SET "ESPTOOL_CMD=" 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" @@ -24,7 +25,7 @@ GOTO getopts :help ECHO Flash image file to device, but first erasing and writing system information. ECHO. -ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] (--web) +ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] (--web) [--1200bps-reset] ECHO. ECHO Options: ECHO -f filename The firmware .bin file to flash. Custom to your device type and region. (required) @@ -35,13 +36,16 @@ ECHO -P python Specify alternate python interpreter to use to invoke ECHO If supplied the script will use python. ECHO If not supplied the script will try to find esptool in Path. ECHO --web Enable WebUI. (default: false) +ECHO --1200bps-reset Attempt to place the device in correct mode. (1200bps Reset) +ECHO Some hardware requires this twice. ECHO. +ECHO Example: %SCRIPT_NAME% -p COM17 --1200bps-reset ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4.bin -p COM11 ECHO Example: %SCRIPT_NAME% -f firmware-unphone-2.6.0.0b106d4.bin -p COM11 --web GOTO eof :version -ECHO %SCRIPT_NAME% [Version 2.6.1] +ECHO %SCRIPT_NAME% [Version 2.6.2] ECHO Meshtastic GOTO eof @@ -58,10 +62,13 @@ IF "%~1"=="-p" SET "ESPTOOL_PORT=%~2" & SHIFT IF /I "%~1"=="--port" SET "ESPTOOL_PORT=%~2" & SHIFT IF "%~1"=="-P" SET "PYTHON=%~2" & SHIFT IF /I "%~1"=="--web" SET "WEB_APP=1" +IF /I "%~1"=="--1200bps-reset" SET "BPS_RESET=1" SHIFT GOTO getopts :endopts +IF %BPS_RESET% EQU 1 GOTO skip-filename + CALL :LOG_MESSAGE DEBUG "Checking FILENAME parameter..." IF "__!FILENAME!__"=="____" ( CALL :LOG_MESSAGE DEBUG "Missing -f filename input." @@ -95,6 +102,9 @@ IF NOT "!FILENAME:update=!"=="!FILENAME!" ( CALL :LOG_MESSAGE DEBUG "We are NOT working with a *update* file. !FILENAME!" ) +:skip-filename +SET "ESPTOOL_BAUD=1200" + CALL :LOG_MESSAGE DEBUG "Determine the correct esptool command to use..." IF NOT "__%PYTHON%__"=="____" ( SET "ESPTOOL_CMD=!PYTHON! -m esptool" @@ -133,6 +143,12 @@ IF "__!ESPTOOL_PORT!__" == "____" ( ) CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!." +IF %BPS_RESET% EQU 1 ( + @REM Attempt to change mode via 1200bps Reset. + CALL :RUN_ESPTOOL !ESPTOOL_BAUD! --after no_reset read_flash_status + GOTO eof +) + @REM Check if FILENAME contains "-tft-" and set target partitionScheme accordingly. @REM https://github.com/meshtastic/web-flasher/blob/main/types/resources.ts#L3 IF NOT "!FILENAME:-tft-=!"=="!FILENAME!" ( @@ -254,6 +270,7 @@ EXIT /B %ERRORLEVEL% IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4" CALL :RESET_ERROR !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4 +IF %BPS_RESET% EQU 1 GOTO :eof IF %ERRORLEVEL% NEQ 0 ( CALL :LOG_MESSAGE ERROR "Error running command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4" EXIT /B %ERRORLEVEL% diff --git a/bin/device-install.sh b/bin/device-install.sh index 7fa5ffdbb..76765bb5f 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -2,6 +2,7 @@ PYTHON=${PYTHON:-$(which python3 python | head -n 1)} WEB_APP=false +BPS_RESET=false TFT_BUILD=false MCU="" @@ -72,7 +73,7 @@ set -e # Usage info show_help() { cat </dev/null 2>&1; then @@ -17,14 +18,15 @@ fi # Usage info show_help() { cat << EOF -Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME|FILENAME] -Flash image file to device, leave existing system intact." +Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME|FILENAME] [--change-mode] +Flash image file to device, leave existing system intact. -h Display this help and exit -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerous). -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON") -f FILENAME The *update.bin file to flash. Custom to your device type. - + --change-mode Attempt to place the device in correct mode. Some hardware requires this twice. (1200bps Reset) + EOF } @@ -41,6 +43,9 @@ while getopts ":hp:P:f:" opt; do ;; f) FILENAME=${OPTARG} ;; + --change-mode) + CHANGE_MODE=true + ;; *) echo "Invalid flag." show_help >&2 @@ -50,6 +55,11 @@ while getopts ":hp:P:f:" opt; do done shift "$((OPTIND-1))" +if [[ $CHANGE_MODE == true ]]; then + $ESPTOOL_CMD --baud 1200 --after no_reset read_flash_status + exit 0 +fi + [ -z "$FILENAME" -a -n "$1" ] && { FILENAME=$1 shift From a5716cf25c6ad17a1473306fac5656669c351ad5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 07:08:46 -0500 Subject: [PATCH 38/41] automated bumps (#6944) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- bin/org.meshtastic.meshtasticd.metainfo.xml | 3 +++ debian/changelog | 7 +++++-- version.properties | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/org.meshtastic.meshtasticd.metainfo.xml b/bin/org.meshtastic.meshtasticd.metainfo.xml index 30f684fef..40f86fb0b 100644 --- a/bin/org.meshtastic.meshtasticd.metainfo.xml +++ b/bin/org.meshtastic.meshtasticd.metainfo.xml @@ -87,6 +87,9 @@ + + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.11 + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.10 diff --git a/debian/changelog b/debian/changelog index 87e3aea9b..4b67eecd4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -meshtasticd (2.6.10.0) UNRELEASED; urgency=medium +meshtasticd (2.6.11.0) UNRELEASED; urgency=medium [ Austin Lane ] * Initial packaging @@ -16,4 +16,7 @@ meshtasticd (2.6.10.0) UNRELEASED; urgency=medium [ ] * GitHub Actions Automatic version bump - -- Sun, 25 May 2025 20:46:49 +0000 + [ ] + * GitHub Actions Automatic version bump + + -- Mon, 02 Jun 2025 20:00:55 +0000 diff --git a/version.properties b/version.properties index 71de951f1..e13094769 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 10 +build = 11 From 55b2bbf93756fc7bbbfdbc7cbf29f88e6b637f22 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Wed, 4 Jun 2025 12:16:37 -0500 Subject: [PATCH 39/41] Generate keys when Lora Region is set (#6951) * Generate keys when Lora Region changes * Nest the ifs * Even more entropy * Namespacing --- src/mesh/CryptoEngine.cpp | 13 +++++++++++++ src/mesh/NodeDB.cpp | 2 +- src/modules/AdminModule.cpp | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/mesh/CryptoEngine.cpp b/src/mesh/CryptoEngine.cpp index d32b73855..82d0a9f57 100644 --- a/src/mesh/CryptoEngine.cpp +++ b/src/mesh/CryptoEngine.cpp @@ -3,12 +3,17 @@ #include "architecture.h" #if !(MESHTASTIC_EXCLUDE_PKI) +#include "NodeDB.h" #include "aes-ccm.h" #include "meshUtils.h" #include #include +#include #include #if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN) +#if !defined(ARCH_STM32WL) +#define CryptRNG RNG +#endif /** * Create a public/private key pair with Curve25519. @@ -18,6 +23,14 @@ */ void CryptoEngine::generateKeyPair(uint8_t *pubKey, uint8_t *privKey) { + // Mix in any randomness we can, to make key generation stronger. + CryptRNG.begin(optstr(APP_VERSION)); + if (myNodeInfo.device_id.size == 16) { + CryptRNG.stir(myNodeInfo.device_id.bytes, myNodeInfo.device_id.size); + } + auto noise = random(); + CryptRNG.stir((uint8_t *)&noise, sizeof(noise)); + LOG_DEBUG("Generate Curve25519 keypair"); Curve25519::dh1(public_key, private_key); memcpy(pubKey, public_key, sizeof(public_key)); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 28af7d308..0a79f94a8 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -261,7 +261,7 @@ NodeDB::NodeDB() #if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN || MESHTASTIC_EXCLUDE_PKI) - if (!owner.is_licensed) { + if (!owner.is_licensed && config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) { bool keygenSuccess = false; if (config.security.private_key.size == 32) { if (crypto->regeneratePublicKey(config.security.public_key.bytes, config.security.private_key.bytes)) { diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 3ff4fa74d..4005222dc 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -661,6 +661,24 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) config.lora = c.payload_variant.lora; // If we're setting region for the first time, init the region if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) { + if (!owner.is_licensed) { + bool keygenSuccess = false; + if (config.security.private_key.size == 32) { + if (crypto->regeneratePublicKey(config.security.public_key.bytes, config.security.private_key.bytes)) { + keygenSuccess = true; + } + } else { + LOG_INFO("Generate new PKI keys"); + crypto->generateKeyPair(config.security.public_key.bytes, config.security.private_key.bytes); + keygenSuccess = true; + } + if (keygenSuccess) { + config.security.public_key.size = 32; + config.security.private_key.size = 32; + owner.public_key.size = 32; + memcpy(owner.public_key.bytes, config.security.public_key.bytes, 32); + } + } config.lora.tx_enabled = true; initRegion(); if (myRegion->dutyCycle < 100) { From 76f72074632e0709c5f4f88c372c09129403e3f6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:15:51 -0500 Subject: [PATCH 40/41] chore(deps): update meshtastic/web to v2.6.4 (#6950) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- bin/web.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/web.version b/bin/web.version index a4db534a2..e46a05b19 100644 --- a/bin/web.version +++ b/bin/web.version @@ -1 +1 @@ -2.5.3 \ No newline at end of file +2.6.4 \ No newline at end of file From 070deb290f56735da581fb3d2225cde63d611f8d Mon Sep 17 00:00:00 2001 From: Andrew Yong Date: Thu, 5 Jun 2025 19:45:43 +0800 Subject: [PATCH 41/41] seeed_xiao_nrf52840_kit improvements (#6930) * feat: seeed_xiao_nrf52840_kit improvements - LEDs: - Change RGB LED to be active low as it is common anode - Remove re-definition of LED_PIN - Use red LED to indicate flash writes - Use blue LED as user LED (External Notification module) - GPIO: Re-word unused BUTTON_PIN comment - Wire: Set I2C pins to match XIAO nRF52840 Sense's LSM6DS3TR IMU - Battery: - Use charge LED to detect charging state - Move voltage divider boilerplate out of src/main.cpp and into initVariant() - Fix dependencies for above in related XIAO BLE DIY variants Build tested variants: - seeed_xiao_nrf52840_kit - xiao_ble - seeed-xiao-nrf52840-wio-sx1262 Flashed to and tested on hardware: - seeed_xiao_nrf52840_kit Signed-off-by: Andrew Yong * chore(seeed_xiao_nrf52840_kit): Re-order generic GPIO definitions Signed-off-by: Andrew Yong * chore: Use ADC_CTRL for XIAO nRF52840 Signed-off-by: Andrew Yong --------- Signed-off-by: Andrew Yong --- src/main.cpp | 13 --- .../variant.cpp | 9 +- .../seeed-xiao-nrf52840-wio-sx1262/variant.h | 3 +- variants/seeed_xiao_nrf52840_kit/variant.cpp | 28 ++--- variants/seeed_xiao_nrf52840_kit/variant.h | 101 +++++++++--------- variants/xiao_ble/variant.cpp | 9 +- variants/xiao_ble/variant.h | 5 +- 7 files changed, 88 insertions(+), 80 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7a11ca2e0..2d49b2fbe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -482,19 +482,6 @@ void setup() fsInit(); -#if defined(_SEEED_XIAO_NRF52840_SENSE_H_) - - pinMode(CHARGE_LED, INPUT); // sets to detect if charge LED is on or off to see if USB is plugged in - - pinMode(HICHG, OUTPUT); - digitalWrite(HICHG, LOW); // 100 mA charging current if set to LOW and 50mA (actually about 20mA) if set to HIGH - - pinMode(BAT_READ, OUTPUT); - digitalWrite(BAT_READ, LOW); // This is pin P0_14 = 14 and by pullling low to GND it provices path to read on pin 32 (P0,31) - // PIN_VBAT the voltage from divider on XIAO board - -#endif - #if !MESHTASTIC_EXCLUDE_I2C #if defined(I2C_SDA1) && defined(ARCH_RP2040) Wire1.setSDA(I2C_SDA1); diff --git a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp index 2c6c3e539..300f69d0b 100644 --- a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp +++ b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp @@ -52,4 +52,11 @@ const uint32_t g_ADigitalPinMap[] = { // VBAT 31, // D32 is P0.10 (VBAT) -}; \ No newline at end of file +}; + +void initVariant() +{ + // Set BQ25101 ISET to 100mA instead of 50mA + pinMode(HICHG, OUTPUT); + digitalWrite(HICHG, LOW); +} diff --git a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h index 7a76727f2..277377d71 100644 --- a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h +++ b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h @@ -164,7 +164,8 @@ static const uint8_t SCK = PIN_SPI_SCK; // ------- // P0_14 = 14 Reads battery voltage from divider on signal board. // PIN_VBAT is reading voltage divider on XIAO and is program pin 32 / or P0.31 -#define BAT_READ 14 +#define ADC_CTRL VBAT_ENABLE +#define ADC_CTRL_ENABLED LOW #define BATTERY_SENSE_RESOLUTION_BITS 10 #define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED #define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge diff --git a/variants/seeed_xiao_nrf52840_kit/variant.cpp b/variants/seeed_xiao_nrf52840_kit/variant.cpp index 22072312a..70cadf5db 100644 --- a/variants/seeed_xiao_nrf52840_kit/variant.cpp +++ b/variants/seeed_xiao_nrf52840_kit/variant.cpp @@ -34,9 +34,9 @@ const uint32_t g_ADigitalPinMap[] = { 11, // D18 is P0.11 (6D_INT1) // MIC - 42, // 17,//42, // D19 is P1.10 (MIC_PWR) - 32, // 26,//32, // D20 is P1.00 (PDM_CLK) - 16, // 25,//16, // D21 is P0.16 (PDM_DATA) + 42, // D19 is P1.10 (MIC_PWR) + 32, // D20 is P1.00 (PDM_CLK) + 16, // D21 is P0.16 (PDM_DATA) // BQ25100 13, // D22 is P0.13 (HICHG) @@ -80,13 +80,17 @@ const uint32_t g_ADigitalPinMap[] = { void initVariant() { - // LED1 & LED2 - pinMode(21, OUTPUT); - digitalWrite(21, LOW); - // LED1 & LED2 - pinMode(22, OUTPUT); - digitalWrite(22, LOW); + // Set BQ25101 ISET to 100mA instead of 50mA + pinMode(HICHG, OUTPUT); + digitalWrite(HICHG, LOW); - pinMode(PIN_WIRE_SDA, INPUT_PULLUP); - pinMode(PIN_WIRE_SCL, INPUT_PULLUP); -} \ No newline at end of file + // LEDs + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); + + pinMode(PIN_LED3, OUTPUT); + ledOff(PIN_LED3); +} diff --git a/variants/seeed_xiao_nrf52840_kit/variant.h b/variants/seeed_xiao_nrf52840_kit/variant.h index 869c3d405..e6ef74e2e 100644 --- a/variants/seeed_xiao_nrf52840_kit/variant.h +++ b/variants/seeed_xiao_nrf52840_kit/variant.h @@ -19,31 +19,12 @@ extern "C" { #define PINS_COUNT (33) #define NUM_DIGITAL_PINS (33) -#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_INPUTS (8) #define NUM_ANALOG_OUTPUTS (0) -// LEDs - -#define LED_RED 11 -#define LED_BLUE 12 -#define LED_GREEN 13 - -#define PIN_LED1 LED_GREEN -#define PIN_LED2 LED_BLUE -#define PIN_LED3 LED_RED - -#define PIN_LED PIN_LED1 -#define LED_PWR (PINS_COUNT) - -#define LED_BUILTIN PIN_LED - -#define LED_STATE_ON 1 // State when LED is lit - /* - * Buttons + * Digital Pins */ - -// Digital PINs #define D0 (0ul) #define D1 (1ul) #define D2 (2ul) @@ -56,15 +37,6 @@ extern "C" { #define D9 (9ul) #define D10 (10ul) -/*Due to the lack of pins,and have to make sure gps standby work well we have temporarily removed the button. -There are some technical solutions that can solve this problem, -and we are currently exploring and researching them*/ - -// #define BUTTON_PIN D0 // This is the Program Button -// // #define BUTTON_NEED_PULLUP 1 -// #define BUTTON_ACTIVE_LOW true -// #define BUTTON_ACTIVE_PULLUP false - /* * Analog pins */ @@ -85,6 +57,38 @@ static const uint8_t A4 = PIN_A4; static const uint8_t A5 = PIN_A5; #define ADC_RESOLUTION 12 +/* + * LEDs + */ +#define LED_STATE_ON (0) // RGB LED is common anode +#define LED_RED (11) +#define LED_GREEN (13) +#define LED_BLUE (12) + +#define PIN_LED1 LED_GREEN // PIN_LED1 is used in src/platform/nrf52/architecture.h to define LED_PIN +#define PIN_LED2 LED_BLUE +#define PIN_LED3 LED_RED + +#define LED_BUILTIN LED_RED // LED_BUILTIN is used by framework-arduinoadafruitnrf52 to indicate flash writes + +#define LED_PWR LED_RED +#define USER_LED LED_BLUE + +/* + * Buttons + */ + +/* + * D0 is shared with PIN_GPS_STANDBY on the L76K GNSS Module. + * There are some technical solutions that can solve this problem, and we are + * currently exploring and researching them. + */ + +// #define BUTTON_PIN D0 + +/* + * Serial Interfaces + */ #define PIN_SERIAL2_RX (-1) #define PIN_SERIAL2_TX (-1) @@ -102,11 +106,9 @@ static const uint8_t MOSI = PIN_SPI_MOSI; static const uint8_t MISO = PIN_SPI_MISO; static const uint8_t SCK = PIN_SPI_SCK; -// supported modules list #define USE_SX1262 -// common pinouts for SX126X modules - +// Pinout for SX126X #define SX126X_CS D4 #define SX126X_DIO1 D1 #define SX126X_BUSY D3 @@ -121,16 +123,19 @@ static const uint8_t SCK = PIN_SPI_SCK; /* * Wire Interfaces */ - #define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much #define WIRE_INTERFACES_COUNT 1 // 2 -#define PIN_WIRE_SDA (24) // change to use the correct pins if needed -#define PIN_WIRE_SCL (25) // change to use the correct pins if needed +// LSM6DS3TR on XIAO nRF52840 Series +#define PIN_WIRE_SDA (17) +#define PIN_WIRE_SCL (16) static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; +/* + * GPS + */ // GPS L76KB #define GPS_L76K #ifdef GPS_L76K @@ -144,20 +149,18 @@ static const uint8_t SCL = PIN_WIRE_SCL; #define PIN_GPS_STANDBY D0 #endif -// Battery +/* + * Battery + */ +#define BATTERY_PIN PIN_VBAT // P0.31: VBAT voltage divider +#define ADC_MULTIPLIER (3) // ... R17=1M, R18=510k +#define ADC_CTRL VBAT_ENABLE // P0.14: VBAT voltage divider +#define ADC_CTRL_ENABLED LOW // ... sink +#define EXT_CHRG_DETECT (23) // P0.17: Charge LED +#define EXT_CHRG_DETECT_VALUE LOW // ... BQ25101 ~CHG indicates charging +#define HICHG (22) // P0.13: BQ25101 ISET 100mA instead of 50mA -#define BAT_READ \ - 14 // P0_14 = 14 Reads battery voltage from divider on signal board. (PIN_VBAT is reading voltage divider on XIAO and is - // program pin 32 / or P0.31) -#define BATTERY_SENSE_RESOLUTION_BITS 10 -#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED -#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge - -// The battery sense is hooked to pin A0 (5) -#define BATTERY_PIN PIN_VBAT // PIN_A0 - -// ratio of voltage divider = 3.0 (R17=1M, R18=510k) -#define ADC_MULTIPLIER 3 // 3.0 + a bit for being optimistic +#define BATTERY_SENSE_RESOLUTION_BITS (10) #ifdef __cplusplus } diff --git a/variants/xiao_ble/variant.cpp b/variants/xiao_ble/variant.cpp index 2c6c3e539..300f69d0b 100644 --- a/variants/xiao_ble/variant.cpp +++ b/variants/xiao_ble/variant.cpp @@ -52,4 +52,11 @@ const uint32_t g_ADigitalPinMap[] = { // VBAT 31, // D32 is P0.10 (VBAT) -}; \ No newline at end of file +}; + +void initVariant() +{ + // Set BQ25101 ISET to 100mA instead of 50mA + pinMode(HICHG, OUTPUT); + digitalWrite(HICHG, LOW); +} diff --git a/variants/xiao_ble/variant.h b/variants/xiao_ble/variant.h index b46aa96ae..e511c6869 100644 --- a/variants/xiao_ble/variant.h +++ b/variants/xiao_ble/variant.h @@ -189,9 +189,8 @@ static const uint8_t SCL = PIN_WIRE_SCL; // Battery -#define BAT_READ \ - 14 // P0_14 = 14 Reads battery voltage from divider on signal board. (PIN_VBAT is reading voltage divider on XIAO and is - // program pin 32 / or P0.31) +#define ADC_CTRL VBAT_ENABLE // P0.14: VBAT voltage divider +#define ADC_CTRL_ENABLED LOW // ... sink #define BATTERY_SENSE_RESOLUTION_BITS 10 #define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED #define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge