From 309a3d5396a4d421f5a74c17b80aa1605e74a714 Mon Sep 17 00:00:00 2001 From: code8buster Date: Sun, 30 Oct 2022 22:27:16 -0400 Subject: [PATCH 01/28] Rearranging deck chairs, 900M22S working, 30S not --- variants/diy/dr-dev/variant.h | 51 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/variants/diy/dr-dev/variant.h b/variants/diy/dr-dev/variant.h index 6356cad14..e670c5a91 100644 --- a/variants/diy/dr-dev/variant.h +++ b/variants/diy/dr-dev/variant.h @@ -1,47 +1,54 @@ // For OLED LCD -#define I2C_SDA 21 -#define I2C_SCL 22 +#define HAS_WIRE 0 +#define HAS_SCREEN 0 +#define I2C_SDA 4 +#define I2C_SCL 5 // GPS #undef GPS_RX_PIN #define GPS_RX_PIN NOT_A_PIN -#undef WANT_GPS +#define HAS_GPS 0 -#define BUTTON_PIN 2 // The middle button GPIO on the T-Beam +#define BUTTON_PIN 13 // The middle button GPIO on the T-Beam #define BUTTON_NEED_PULLUP #define EXT_NOTIFY_OUT 12 // Overridden default pin to use for Ext Notify Module (#975). -#define LORA_DIO0 -1 // a No connect on the SX1262/SX1268 module -#define LORA_RESET -1 // RST for SX1276, and for SX1262/SX1268 -#define LORA_DIO1 27 // IRQ for SX1262/SX1268 (IO26 FOR 22S) -#define LORA_DIO2 NOT_A_PIN // BUSY for SX1262/SX1268 -#define LORA_DIO3 // Not connected on PCB, but internally on the SX1262/SX1268, if DIO3 is high the TXCO is enabled +#define LORA_DIO0 NOT_A_PIN // a No connect on the SX1262/SX1268 module +#define LORA_RESET NOT_A_PIN // RST for SX1276, and for SX1262/SX1268 +#define LORA_DIO3 NOT_A_PIN // Not connected on PCB, but internally on the SX1262/SX1268, if DIO3 is high the TXCO is enabled // In transmitting, set TXEN as high communication level,RXEN pin is low level; // In receiving, set RXEN as high communication level, TXEN is lowlevel; // Before powering off, set TXEN、RXEN as low level. -#define LORA_RXEN 17 // Input - RF switch RX control, connecting external MCU IO, valid in high level -#define LORA_TXEN -1 // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level -/* --PINS FOR THE 900M22S + #undef RF95_SCK #define RF95_SCK 18 #undef RF95_MISO #define RF95_MISO 19 #undef RF95_MOSI #define RF95_MOSI 23 + +// --PINS FOR THE 900M22S + +#define LORA_DIO1 26 // IRQ for SX1262/SX1268 +#define LORA_DIO2 22 // BUSY for SX1262/SX1268 +#define LORA_TXEN NOT_A_PIN // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level +#define LORA_RXEN 17 // Input - RF switch RX control, connecting external MCU IO, valid in high level #undef RF95_NSS #define RF95_NSS 16 -*/ +#define SX126X_BUSY 22 + // PINS FOR THE 900M30S -#undef RF95_SCK -#define RF95_SCK 18 -#undef RF95_MISO -#define RF95_MISO 19 -#undef RF95_MOSI -#define RF95_MOSI 23 +/* +#define LORA_DIO1 27 // IRQ for SX1262/SX1268 +#define LORA_RXEN 21 // Input - RF switch RX control, connecting external MCU IO, valid in high level +#define LORA_DIO2 35 // BUSY for SX1262/SX1268 +#define LORA_TXEN NOT_A_PIN // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level #undef RF95_NSS #define RF95_NSS 33 +#define SX126X_BUSY 35 +*/ // RX/TX for RFM95/SX127x #define RF95_RXEN LORA_RXEN @@ -51,7 +58,6 @@ // common pinouts for SX126X modules #define SX126X_CS 33 #define SX126X_DIO1 LORA_DIO1 -#define SX126X_BUSY 35 #define SX126X_RESET LORA_RESET #define SX126X_RXEN LORA_RXEN #define SX126X_TXEN LORA_TXEN @@ -61,9 +67,4 @@ #define USE_SX1262 #define USE_SX1268 #define USE_LLCC68 - -#ifdef EBYTE_E22 -// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch -// (which is the default for the sx1262interface code) #define SX126X_E22 -#endif From 8fa71afb72689255cc0f3cade37f0303efb30824 Mon Sep 17 00:00:00 2001 From: code8buster Date: Sun, 30 Oct 2022 22:30:33 -0400 Subject: [PATCH 02/28] We do have wire, just not where it's expected --- variants/diy/dr-dev/variant.h | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/diy/dr-dev/variant.h b/variants/diy/dr-dev/variant.h index e670c5a91..b756536af 100644 --- a/variants/diy/dr-dev/variant.h +++ b/variants/diy/dr-dev/variant.h @@ -1,5 +1,4 @@ // For OLED LCD -#define HAS_WIRE 0 #define HAS_SCREEN 0 #define I2C_SDA 4 #define I2C_SCL 5 From 3d8e6aead291e80b6bb8add8645a7041a5496cf2 Mon Sep 17 00:00:00 2001 From: code8buster Date: Mon, 31 Oct 2022 21:39:11 -0400 Subject: [PATCH 03/28] Put more of the module specific pins in their blocks --- variants/diy/dr-dev/variant.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/variants/diy/dr-dev/variant.h b/variants/diy/dr-dev/variant.h index b756536af..7d0625907 100644 --- a/variants/diy/dr-dev/variant.h +++ b/variants/diy/dr-dev/variant.h @@ -1,4 +1,4 @@ -// For OLED LCD +// Initialize i2c bus on sd_dat and esp_led pins, respectively. We need a bus to not hang on boot #define HAS_SCREEN 0 #define I2C_SDA 4 #define I2C_SCL 5 @@ -27,7 +27,7 @@ #undef RF95_MOSI #define RF95_MOSI 23 -// --PINS FOR THE 900M22S +// PINS FOR THE 900M22S #define LORA_DIO1 26 // IRQ for SX1262/SX1268 #define LORA_DIO2 22 // BUSY for SX1262/SX1268 @@ -36,17 +36,19 @@ #undef RF95_NSS #define RF95_NSS 16 #define SX126X_BUSY 22 +#define SX126X_CS 16 // PINS FOR THE 900M30S /* #define LORA_DIO1 27 // IRQ for SX1262/SX1268 -#define LORA_RXEN 21 // Input - RF switch RX control, connecting external MCU IO, valid in high level #define LORA_DIO2 35 // BUSY for SX1262/SX1268 #define LORA_TXEN NOT_A_PIN // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level +#define LORA_RXEN 21 // Input - RF switch RX control, connecting external MCU IO, valid in high level #undef RF95_NSS #define RF95_NSS 33 #define SX126X_BUSY 35 +#define SX126X_CS 33 */ // RX/TX for RFM95/SX127x @@ -55,15 +57,15 @@ // #define RF95_TCXO // common pinouts for SX126X modules -#define SX126X_CS 33 + #define SX126X_DIO1 LORA_DIO1 #define SX126X_RESET LORA_RESET #define SX126X_RXEN LORA_RXEN #define SX126X_TXEN LORA_TXEN // supported modules list -#define USE_RF95 // RFM95/SX127x +//#define USE_RF95 // RFM95/SX127x #define USE_SX1262 -#define USE_SX1268 -#define USE_LLCC68 +//#define USE_SX1268 +//#define USE_LLCC68 #define SX126X_E22 From 32ad8aaa4e84f2b2968accacc6e07927bb08e3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 2 Nov 2022 10:17:59 +0100 Subject: [PATCH 04/28] tryfix compile with NO_SCREEN --- src/graphics/Screen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index cee00f174..23828b3ee 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -10,7 +10,7 @@ namespace graphics class Screen { public: - Screen(char){} + explicit Screen(char){} void onPress() {} void setup() {} void setOn(bool) {} From 85b541bfd93c4397201070efb3a3053a41d132d4 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Wed, 2 Nov 2022 12:58:14 +0100 Subject: [PATCH 05/28] Portduino only: don't continue to try rebooting (#1887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thomas Göttgens --- src/shutdown.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shutdown.h b/src/shutdown.h index 678a1401c..3927825fb 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -13,7 +13,8 @@ void powerCommandsCheck() #elif defined(ARCH_NRF52) NVIC_SystemReset(); #else - DEBUG_MSG("FIXME implement reboot for this platform"); + rebootAtMsec = -1; + DEBUG_MSG("FIXME implement reboot for this platform. Skipping for now.\n"); #endif } From 12df55c3d472fb363d299db2b7d5248363ac3944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 2 Nov 2022 13:12:15 +0100 Subject: [PATCH 06/28] Support for TLORA 2.1-1.8 --- src/main.cpp | 10 +++--- src/mesh/InterfacesTemplates.cpp | 2 +- ...X1281Interface.cpp => SX1280Interface.cpp} | 4 +-- .../{SX1281Interface.h => SX1280Interface.h} | 6 ++-- src/mesh/SX128xInterface.h | 2 +- src/platform/esp32/architecture.h | 2 ++ variants/tlora_v2_1_18/platformio.ini | 7 ++++ variants/tlora_v2_1_18/variant.h | 33 +++++++++++++++++++ 8 files changed, 54 insertions(+), 12 deletions(-) rename src/mesh/{SX1281Interface.cpp => SX1280Interface.cpp} (72%) rename src/mesh/{SX1281Interface.h => SX1280Interface.h} (52%) create mode 100644 variants/tlora_v2_1_18/platformio.ini create mode 100644 variants/tlora_v2_1_18/variant.h diff --git a/src/main.cpp b/src/main.cpp index 20bbcd085..8836b6460 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,7 +51,7 @@ #include "RF95Interface.h" #include "SX1262Interface.h" #include "SX1268Interface.h" -#include "SX1281Interface.h" +#include "SX1280Interface.h" #if !HAS_RADIO && defined(ARCH_PORTDUINO) #include "platform/portduino/SimRadio.h" #endif @@ -372,15 +372,15 @@ void setup() } #endif -#if defined(USE_SX1281) && !defined(ARCH_PORTDUINO) +#if defined(USE_SX1280) && !defined(ARCH_PORTDUINO) if (!rIf) { - rIf = new SX1281Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI); + rIf = new SX1280Interface(SX128X_CS, SX128X_DIO1, SX128X_RESET, SX128X_BUSY, SPI); if (!rIf->init()) { - DEBUG_MSG("Warning: Failed to find SX1281 radio\n"); + DEBUG_MSG("Warning: Failed to find SX1280 radio\n"); delete rIf; rIf = NULL; } else { - DEBUG_MSG("SX1281 Radio init succeeded, using SX1281 radio\n"); + DEBUG_MSG("SX1280 Radio init succeeded, using SX1280 radio\n"); rIf_wide_lora = true; } } diff --git a/src/mesh/InterfacesTemplates.cpp b/src/mesh/InterfacesTemplates.cpp index 6707813db..ccef2df23 100644 --- a/src/mesh/InterfacesTemplates.cpp +++ b/src/mesh/InterfacesTemplates.cpp @@ -9,5 +9,5 @@ template class SX126xInterface; template class SX126xInterface; #if !defined(ARCH_PORTDUINO) -template class SX128xInterface; +template class SX128xInterface; #endif \ No newline at end of file diff --git a/src/mesh/SX1281Interface.cpp b/src/mesh/SX1280Interface.cpp similarity index 72% rename from src/mesh/SX1281Interface.cpp rename to src/mesh/SX1280Interface.cpp index 50805cfe0..37aad1d40 100644 --- a/src/mesh/SX1281Interface.cpp +++ b/src/mesh/SX1280Interface.cpp @@ -1,10 +1,10 @@ #include "configuration.h" -#include "SX1281Interface.h" +#include "SX1280Interface.h" #include "error.h" #if !defined(ARCH_PORTDUINO) -SX1281Interface::SX1281Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, +SX1280Interface::SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi) : SX128xInterface(cs, irq, rst, busy, spi) { diff --git a/src/mesh/SX1281Interface.h b/src/mesh/SX1280Interface.h similarity index 52% rename from src/mesh/SX1281Interface.h rename to src/mesh/SX1280Interface.h index 3bd65309a..1c2e24900 100644 --- a/src/mesh/SX1281Interface.h +++ b/src/mesh/SX1280Interface.h @@ -3,15 +3,15 @@ #include "SX128xInterface.h" /** - * Our adapter for SX1281 radios + * Our adapter for SX1280 radios */ #if !defined(ARCH_PORTDUINO) -class SX1281Interface : public SX128xInterface +class SX1280Interface : public SX128xInterface { public: - SX1281Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); + SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); }; #endif \ No newline at end of file diff --git a/src/mesh/SX128xInterface.h b/src/mesh/SX128xInterface.h index d01dfc510..f712b8bc4 100644 --- a/src/mesh/SX128xInterface.h +++ b/src/mesh/SX128xInterface.h @@ -6,7 +6,7 @@ /** * \brief Adapter for SX128x radio family. Implements common logic for child classes. - * \tparam T RadioLib module type for SX128x: SX1281. + * \tparam T RadioLib module type for SX128x: SX1280. */ template class SX128xInterface : public RadioLibInterface diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 18253abe5..00d221691 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -70,6 +70,8 @@ #define HW_VENDOR HardwareModel_TLORA_V1_1P3 #elif defined(TLORA_V2_1_16) #define HW_VENDOR HardwareModel_TLORA_V2_1_1P6 +#elif defined(TLORA_V2_1_18) + #define HW_VENDOR HardwareModel_TLORA_V2_1_1P8 #elif defined(GENIEBLOCKS) #define HW_VENDOR HardwareModel_GENIEBLOCKS #elif defined(PRIVATE_HW) diff --git a/variants/tlora_v2_1_18/platformio.ini b/variants/tlora_v2_1_18/platformio.ini new file mode 100644 index 000000000..2cb1c3d2f --- /dev/null +++ b/variants/tlora_v2_1_18/platformio.ini @@ -0,0 +1,7 @@ +[env:tlora-v2-1-1.8] +extends = esp32_base +board = ttgo-lora32-v21 +lib_deps = + ${esp32_base.lib_deps} +build_flags = + ${esp32_base.build_flags} -D TLORA_V2_1_18 -I variants/tlora_v2_1_18 \ No newline at end of file diff --git a/variants/tlora_v2_1_18/variant.h b/variants/tlora_v2_1_18/variant.h new file mode 100644 index 000000000..cd693a3d2 --- /dev/null +++ b/variants/tlora_v2_1_18/variant.h @@ -0,0 +1,33 @@ +#undef GPS_RX_PIN +#undef GPS_TX_PIN +#define GPS_RX_PIN 15 // per @der_bear on the forum, 36 is incorrect for this board type and 15 is a better pick +#define GPS_TX_PIN 13 + +#define EXT_NOTIFY_OUT 2 // Default pin to use for Ext Notify Module. + +#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage +// ratio of voltage divider = 2.0 (R42=100k, R43=100k) +#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage. + +#define I2C_SDA 21 // I2C pins for this board +#define I2C_SCL 22 + +// #define RESET_OLED 16 // If defined, this pin will be used to reset the display controller. Crashes on newer ESP-IDF and not needed per schematic + +#define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost +#define LED_PIN 25 // If defined we will blink this LED +#define BUTTON_PIN 12 // If defined, this will be used for user button presses, + +#define BUTTON_NEED_PULLUP + +#define USE_SX1280 +#define LORA_DIO0 26 // a No connect on the SX1262 module +#define LORA_RESET 23 + +#define SX128X_CS 18 // FIXME - we really should define LORA_CS instead +#define SX128X_DIO1 33 +#define SX128X_BUSY 32 +#define SX128X_RESET LORA_RESET +#define SX128X_E22 // Not really an E22 but TTGO seems to be trying to clone that +// Internally the TTGO module hooks the SX1280-DIO2 in to control the TX/RX switch (which is the default for the sx1280interface +// code) From b2969b2faf8f07df2f3856b6e3f0572a05c9bbfa Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Wed, 2 Nov 2022 13:18:15 +0100 Subject: [PATCH 07/28] Don't allow arbitrary channel name for admin (#1886) Co-authored-by: Ben Meadors --- src/mesh/MeshModule.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mesh/MeshModule.cpp b/src/mesh/MeshModule.cpp index 7b204ae49..ca1fb5b50 100644 --- a/src/mesh/MeshModule.cpp +++ b/src/mesh/MeshModule.cpp @@ -109,10 +109,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src) /// Also: if a packet comes in on the local PC interface, we don't check for bound channels, because it is TRUSTED and it needs to /// to be able to fetch the initial admin packets without yet knowing any channels. - bool rxChannelOk = !pi.boundChannel || (mp.from == 0) || - !ch || - strlen(ch->settings.name) > 0 || - (strcasecmp(ch->settings.name, pi.boundChannel) == 0); + bool rxChannelOk = !pi.boundChannel || (mp.from == 0) || (strcasecmp(ch->settings.name, pi.boundChannel) == 0); if (!rxChannelOk) { // no one should have already replied! From 39c1637030da260eeefe30eba3f32f53d987af36 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 2 Nov 2022 07:48:14 -0500 Subject: [PATCH 08/28] Experimental DIY nrf52840 feather support (#1884) * Experimental DIY nrf52840 feather support * Fix target * sx1262 wiring * Remove lib --- .github/workflows/main_matrix.yml | 2 ++ src/platform/nrf52/architecture.h | 2 +- variants/feather_diy/platformio.ini | 11 ++++++++++ variants/feather_diy/variant.h | 33 +++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 variants/feather_diy/platformio.ini create mode 100644 variants/feather_diy/variant.h diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 06a229312..66bf7539c 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -42,6 +42,7 @@ jobs: - board: m5stack-core - board: m5stack-coreink - board: tbeam-s3-core + - board: feather_diy # - board: pico runs-on: ubuntu-latest @@ -181,6 +182,7 @@ jobs: - board: rak4631_eink - board: t-echo - board: pca10059_diy_eink + - board: feather_diy runs-on: ubuntu-latest steps: diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 47d95c92d..986a864c9 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -45,7 +45,7 @@ #define HW_VENDOR HardwareModel_T_ECHO #elif defined(NORDIC_PCA10059) #define HW_VENDOR HardwareModel_NRF52840_PCA10059 -#elif defined(PRIVATE_HW) +#elif defined(PRIVATE_HW) || defined(FEATHER_DIY) #define HW_VENDOR HardwareModel_PRIVATE_HW #else #define HW_VENDOR HardwareModel_NRF52_UNKNOWN diff --git a/variants/feather_diy/platformio.ini b/variants/feather_diy/platformio.ini new file mode 100644 index 000000000..446011cb9 --- /dev/null +++ b/variants/feather_diy/platformio.ini @@ -0,0 +1,11 @@ +; The very slick RAK wireless RAK 4631 / 4630 board - Unified firmware for 5005/19003, with or without OLED RAK 1921 +[env:feather_diy] +extends = nrf52840_base +board = adafruit_feather_nrf52840 +build_flags = ${nrf52840_base.build_flags} -Ivariants/feather_diy -D feather_diy +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/feather_diy> +lib_deps = + ${nrf52840_base.lib_deps} +debug_tool = jlink +; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) +;upload_protocol = jlink \ No newline at end of file diff --git a/variants/feather_diy/variant.h b/variants/feather_diy/variant.h new file mode 100644 index 000000000..8327e6050 --- /dev/null +++ b/variants/feather_diy/variant.h @@ -0,0 +1,33 @@ +// For OLED LCD +#define I2C_SDA 22 +#define I2C_SCL 23 + +#define BUTTON_PIN 7 + +#define LORA_DIO0 -1 // a No connect on the SX1262/SX1268 module +#define LORA_RESET 13 // RST for SX1276, and for SX1262/SX1268 +#define LORA_DIO1 11 // IRQ for SX1262/SX1268 +#define LORA_DIO2 12 // BUSY for SX1262/SX1268 +#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262/SX1268, if DIO3 is high the TXCO is enabled + +#define RF95_SCK SCK +#define RF95_MISO MI +#define RF95_MOSI MO +#define RF95_NSS D2 + +// supported modules list +#define USE_SX1262 + +// common pinouts for SX126X modules +#define SX126X_CS RF95_NSS // NSS for SX126X +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_RXEN 10 +#define SX126X_TXEN 9 + +#ifdef EBYTE_E22 +// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch +// (which is the default for the sx1262interface code) +#define SX126X_E22 +#endif From 5715ddc3613fc52d048f1028a4e3c48a338b9d1c Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Wed, 2 Nov 2022 20:32:18 +0100 Subject: [PATCH 09/28] Don't consider Response as ACK for FloodingRouter (#1885) Co-authored-by: Ben Meadors --- src/mesh/FloodingRouter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index b6519abdb..818bacf45 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -29,8 +29,8 @@ bool FloodingRouter::shouldFilterReceived(MeshPacket *p) void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c) { - PacketId ackId = ((c && c->error_reason == Routing_Error_NONE) || !c) ? p->decoded.request_id : 0; - if (ackId && p->to != getNodeNum()) { + bool isAck = ((c && c->error_reason == Routing_Error_NONE)); // consider only ROUTING_APP message without error as ACK + if (isAck && p->to != getNodeNum()) { // do not flood direct message that is ACKed DEBUG_MSG("Receiving an ACK not for me, but don't need to rebroadcast this direct message anymore.\n"); Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM From 593301146e6beaaf41a2885c396b564e7f3ea7dc Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 2 Nov 2022 15:57:47 -0500 Subject: [PATCH 10/28] Fix feather diy (#1892) * Fix variant * Fix feather diy target --- variants/feather_diy/platformio.ini | 2 +- variants/feather_diy/variant.cpp | 24 ++++++++ variants/feather_diy/variant.h | 94 +++++++++++++++++++++++++++-- 3 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 variants/feather_diy/variant.cpp diff --git a/variants/feather_diy/platformio.ini b/variants/feather_diy/platformio.ini index 446011cb9..84c582ab0 100644 --- a/variants/feather_diy/platformio.ini +++ b/variants/feather_diy/platformio.ini @@ -2,7 +2,7 @@ [env:feather_diy] extends = nrf52840_base board = adafruit_feather_nrf52840 -build_flags = ${nrf52840_base.build_flags} -Ivariants/feather_diy -D feather_diy +build_flags = ${nrf52840_base.build_flags} -Ivariants/feather_diy -Dfeather_diy build_src_filter = ${nrf52_base.build_src_filter} +<../variants/feather_diy> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/feather_diy/variant.cpp b/variants/feather_diy/variant.cpp new file mode 100644 index 000000000..7311c9019 --- /dev/null +++ b/variants/feather_diy/variant.cpp @@ -0,0 +1,24 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" diff --git a/variants/feather_diy/variant.h b/variants/feather_diy/variant.h index 8327e6050..703d32202 100644 --- a/variants/feather_diy/variant.h +++ b/variants/feather_diy/variant.h @@ -1,9 +1,80 @@ -// For OLED LCD -#define I2C_SDA 22 -#define I2C_SCL 23 +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_FEATHER_DIY_ +#define _VARIANT_FEATHER_DIY_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (6) +#define NUM_ANALOG_OUTPUTS (0) + +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA 22 +#define PIN_WIRE_SCL 23 + +#define PIN_LED1 3 +#define PIN_LED2 4 + +#define LED_BUILTIN PIN_LED1 + +#define LED_GREEN PIN_LED2 // Actually red +#define LED_BLUE PIN_LED1 + +#define LED_STATE_ON 1 // State when LED is litted #define BUTTON_PIN 7 +/* + * Serial interfaces + */ +#define PIN_SERIAL1_RX 1 +#define PIN_SERIAL1_TX 0 + +#define PIN_SERIAL2_RX (-1) +#define PIN_SERIAL2_TX (-1) + +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO 24 +#define PIN_SPI_MOSI 25 +#define PIN_SPI_SCK 26 + +#define SS 2 + #define LORA_DIO0 -1 // a No connect on the SX1262/SX1268 module #define LORA_RESET 13 // RST for SX1276, and for SX1262/SX1268 #define LORA_DIO1 11 // IRQ for SX1262/SX1268 @@ -13,7 +84,12 @@ #define RF95_SCK SCK #define RF95_MISO MI #define RF95_MOSI MO -#define RF95_NSS D2 +#define RF95_NSS SS + +// enables 3.3V periphery like GPS or IO Module +#define PIN_3V3_EN (34) + +#undef USE_EINK // supported modules list #define USE_SX1262 @@ -31,3 +107,13 @@ // (which is the default for the sx1262interface code) #define SX126X_E22 #endif + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif From 25a3a09d5f6ecd60d491b61ac42f6ede41b39931 Mon Sep 17 00:00:00 2001 From: Mykhailo Lesyk Date: Mon, 31 Oct 2022 16:13:21 -0700 Subject: [PATCH 11/28] [modules][external notifications] allow select channel to listen to --- src/modules/ExternalNotificationModule.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 56a0db941..4951d635e 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -116,9 +116,6 @@ ExternalNotificationModule::ExternalNotificationModule() : SinglePortModule("ExternalNotificationModule", PortNum_TEXT_MESSAGE_APP), concurrency::OSThread( "ExternalNotificationModule") { - // restrict to the admin channel for rx - boundChannel = Channels::gpioChannel; - /* Uncomment the preferences below if you want to use the module without having to configure it from the PythonAPI or WebUI. @@ -131,6 +128,11 @@ ExternalNotificationModule::ExternalNotificationModule() // moduleConfig.external_notification.alert_bell = 1; // moduleConfig.external_notification.output_ms = 1000; // moduleConfig.external_notification.output = 13; + + if (moduleConfig.external_notification.alert_message) { + // restrict to the gpio channel for rx + boundChannel = Channels::gpioChannel; + } if (moduleConfig.external_notification.enabled) { From a3eced53bbd61ad9e2da90767e1bd8835f53c988 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 3 Nov 2022 14:28:49 -0500 Subject: [PATCH 12/28] Fix feather diy pin mapping (#1894) Thanks to @markbirss --- variants/feather_diy/variant.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/variants/feather_diy/variant.h b/variants/feather_diy/variant.h index 703d32202..92128add2 100644 --- a/variants/feather_diy/variant.h +++ b/variants/feather_diy/variant.h @@ -43,11 +43,11 @@ extern "C" { #define WIRE_INTERFACES_COUNT 1 -#define PIN_WIRE_SDA 22 -#define PIN_WIRE_SCL 23 +#define PIN_WIRE_SDA (0 + 12) //P0.12 22 +#define PIN_WIRE_SCL (0 + 11) //P0.12 23 -#define PIN_LED1 3 -#define PIN_LED2 4 +#define PIN_LED1 (32 + 15) //P1.15 3 +#define PIN_LED2 (32 + 10) //P1.10 4 #define LED_BUILTIN PIN_LED1 @@ -56,29 +56,29 @@ extern "C" { #define LED_STATE_ON 1 // State when LED is litted -#define BUTTON_PIN 7 +#define BUTTON_PIN (32 + 2) //P1.02 7 /* * Serial interfaces */ -#define PIN_SERIAL1_RX 1 -#define PIN_SERIAL1_TX 0 +#define PIN_SERIAL1_RX (0 + 24) //P0.24 1 +#define PIN_SERIAL1_TX (0 + 25) //P0.25 0 #define PIN_SERIAL2_RX (-1) #define PIN_SERIAL2_TX (-1) #define SPI_INTERFACES_COUNT 1 -#define PIN_SPI_MISO 24 -#define PIN_SPI_MOSI 25 -#define PIN_SPI_SCK 26 +#define PIN_SPI_MISO (0 + 15) //P0.15 24 +#define PIN_SPI_MOSI (0 + 13) //P0.13 25 +#define PIN_SPI_SCK (0 + 14) //P0.14 26 #define SS 2 #define LORA_DIO0 -1 // a No connect on the SX1262/SX1268 module -#define LORA_RESET 13 // RST for SX1276, and for SX1262/SX1268 -#define LORA_DIO1 11 // IRQ for SX1262/SX1268 -#define LORA_DIO2 12 // BUSY for SX1262/SX1268 +#define LORA_RESET (32 + 9) //P1.09 13 // RST for SX1276, and for SX1262/SX1268 +#define LORA_DIO1 (0 + 6) //P0.06 11 // IRQ for SX1262/SX1268 +#define LORA_DIO2 (0 + 8) //P0.08 12 // BUSY for SX1262/SX1268 #define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262/SX1268, if DIO3 is high the TXCO is enabled #define RF95_SCK SCK @@ -87,7 +87,7 @@ extern "C" { #define RF95_NSS SS // enables 3.3V periphery like GPS or IO Module -#define PIN_3V3_EN (34) +#define PIN_3V3_EN (-1) #undef USE_EINK @@ -99,8 +99,8 @@ extern "C" { #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET -#define SX126X_RXEN 10 -#define SX126X_TXEN 9 +#define SX126X_RXEN (0 + 27) //P0.27 10 +#define SX126X_TXEN (0 + 26) //P0.26 9 #ifdef EBYTE_E22 // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch From f1afbf2c0fb0fcc3682aa5d84c4f5136cea86d68 Mon Sep 17 00:00:00 2001 From: caveman99 Date: Thu, 3 Nov 2022 21:35:06 +0000 Subject: [PATCH 13/28] [create-pull-request] automated change --- protobufs | 2 +- src/mesh/generated/config.pb.c | 1 + src/mesh/generated/config.pb.h | 21 +++++++++++++++++---- src/mesh/generated/localonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 2 ++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/protobufs b/protobufs index ed9f2499d..a0fe9ec86 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit ed9f2499d692925461facd64c6af2d2a7672245a +Subproject commit a0fe9ec8614cd27af7691869ccbd20c39e48a086 diff --git a/src/mesh/generated/config.pb.c b/src/mesh/generated/config.pb.c index c5bc69552..2b75b7558 100644 --- a/src/mesh/generated/config.pb.c +++ b/src/mesh/generated/config.pb.c @@ -43,3 +43,4 @@ PB_BIND(Config_BluetoothConfig, Config_BluetoothConfig, AUTO) + diff --git a/src/mesh/generated/config.pb.h b/src/mesh/generated/config.pb.h index 6a8e56ad0..263b1e916 100644 --- a/src/mesh/generated/config.pb.h +++ b/src/mesh/generated/config.pb.h @@ -56,6 +56,12 @@ typedef enum _Config_DisplayConfig_DisplayUnits { Config_DisplayConfig_DisplayUnits_IMPERIAL = 1 } Config_DisplayConfig_DisplayUnits; +typedef enum _Config_DisplayConfig_OledType { + Config_DisplayConfig_OledType_OLED_AUTO = 0, + Config_DisplayConfig_OledType_OLED_SSD1306 = 1, + Config_DisplayConfig_OledType_OLED_SH1106 = 2 +} Config_DisplayConfig_OledType; + typedef enum _Config_LoRaConfig_RegionCode { Config_LoRaConfig_RegionCode_UNSET = 0, Config_LoRaConfig_RegionCode_US = 1, @@ -109,6 +115,7 @@ typedef struct _Config_DisplayConfig { bool compass_north_top; bool flip_screen; Config_DisplayConfig_DisplayUnits units; + Config_DisplayConfig_OledType oled; } Config_DisplayConfig; typedef struct _Config_LoRaConfig { @@ -205,6 +212,10 @@ typedef struct _Config { #define _Config_DisplayConfig_DisplayUnits_MAX Config_DisplayConfig_DisplayUnits_IMPERIAL #define _Config_DisplayConfig_DisplayUnits_ARRAYSIZE ((Config_DisplayConfig_DisplayUnits)(Config_DisplayConfig_DisplayUnits_IMPERIAL+1)) +#define _Config_DisplayConfig_OledType_MIN Config_DisplayConfig_OledType_OLED_AUTO +#define _Config_DisplayConfig_OledType_MAX Config_DisplayConfig_OledType_OLED_SH1106 +#define _Config_DisplayConfig_OledType_ARRAYSIZE ((Config_DisplayConfig_OledType)(Config_DisplayConfig_OledType_OLED_SH1106+1)) + #define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_UNSET #define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_LORA_24 #define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_LORA_24+1)) @@ -229,7 +240,7 @@ extern "C" { #define Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0} #define Config_NetworkConfig_init_default {0, "", "", "", 0, _Config_NetworkConfig_EthMode_MIN, false, Config_NetworkConfig_IpV4Config_init_default} #define Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} -#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN} +#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN} #define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, {0, 0, 0}} #define Config_BluetoothConfig_init_default {0, _Config_BluetoothConfig_PairingMode_MIN, 0} #define Config_init_zero {0, {Config_DeviceConfig_init_zero}} @@ -238,7 +249,7 @@ extern "C" { #define Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0} #define Config_NetworkConfig_init_zero {0, "", "", "", 0, _Config_NetworkConfig_EthMode_MIN, false, Config_NetworkConfig_IpV4Config_init_zero} #define Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} -#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN} +#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN} #define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, {0, 0, 0}} #define Config_BluetoothConfig_init_zero {0, _Config_BluetoothConfig_PairingMode_MIN, 0} @@ -255,6 +266,7 @@ extern "C" { #define Config_DisplayConfig_compass_north_top_tag 4 #define Config_DisplayConfig_flip_screen_tag 5 #define Config_DisplayConfig_units_tag 6 +#define Config_DisplayConfig_oled_tag 7 #define Config_LoRaConfig_use_preset_tag 1 #define Config_LoRaConfig_modem_preset_tag 2 #define Config_LoRaConfig_bandwidth_tag 3 @@ -376,7 +388,8 @@ X(a, STATIC, SINGULAR, UENUM, gps_format, 2) \ X(a, STATIC, SINGULAR, UINT32, auto_screen_carousel_secs, 3) \ X(a, STATIC, SINGULAR, BOOL, compass_north_top, 4) \ X(a, STATIC, SINGULAR, BOOL, flip_screen, 5) \ -X(a, STATIC, SINGULAR, UENUM, units, 6) +X(a, STATIC, SINGULAR, UENUM, units, 6) \ +X(a, STATIC, SINGULAR, UENUM, oled, 7) #define Config_DisplayConfig_CALLBACK NULL #define Config_DisplayConfig_DEFAULT NULL @@ -427,7 +440,7 @@ extern const pb_msgdesc_t Config_BluetoothConfig_msg; /* Maximum encoded size of messages (where known) */ #define Config_BluetoothConfig_size 10 #define Config_DeviceConfig_size 6 -#define Config_DisplayConfig_size 20 +#define Config_DisplayConfig_size 22 #define Config_LoRaConfig_size 68 #define Config_NetworkConfig_IpV4Config_size 20 #define Config_NetworkConfig_size 161 diff --git a/src/mesh/generated/localonly.pb.h b/src/mesh/generated/localonly.pb.h index b691ee408..8e4199d48 100644 --- a/src/mesh/generated/localonly.pb.h +++ b/src/mesh/generated/localonly.pb.h @@ -144,7 +144,7 @@ extern const pb_msgdesc_t LocalModuleConfig_msg; #define LocalModuleConfig_fields &LocalModuleConfig_msg /* Maximum encoded size of messages (where known) */ -#define LocalConfig_size 359 +#define LocalConfig_size 361 #define LocalModuleConfig_size 270 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 3f2a8839c..812099166 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -52,6 +52,8 @@ typedef enum _HardwareModel { HardwareModel_RAK11200 = 13, /* B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano */ HardwareModel_NANO_G1 = 14, + /* TODO: REPLACE */ + HardwareModel_TLORA_V2_1_1P8 = 15, /* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */ HardwareModel_STATION_G1 = 25, /* Less common/prototype boards listed here (needs one more byte over the air) */ From acfa186d44bc9761ad4103d5b4dc8752d621c275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 3 Nov 2022 22:44:22 +0100 Subject: [PATCH 14/28] Override Screen Autodtect --- src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 8836b6460..d7abdb2a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -293,6 +293,10 @@ void setup() * Boards with an PMU need to be powered on to correctly scan to the device address, such as t-beam-s3-core */ scanI2Cdevice(); + + // fixed screen override? + if (config.display.oled != Config_DisplayConfig_OledType_OLED_AUTO) + screen_model = config.display.oled; // Init our SPI controller (must be before screen and lora) initSPI(); From 04a478a5ad596831b2727b4923c185e1205e39d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 3 Nov 2022 22:50:54 +0100 Subject: [PATCH 15/28] Maybe fix crash of this board. --- variants/tlora_v2/variant.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/variants/tlora_v2/variant.h b/variants/tlora_v2/variant.h index 1bff09fb0..af91e0eea 100644 --- a/variants/tlora_v2/variant.h +++ b/variants/tlora_v2/variant.h @@ -1,7 +1,5 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN -#define GPS_RX_PIN 36 -#define GPS_TX_PIN 13 // per @eugene #define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage From 8b84ac8a6c579469e61b7dadca42e35e984a0c30 Mon Sep 17 00:00:00 2001 From: he-leon Date: Fri, 4 Nov 2022 16:48:49 +0100 Subject: [PATCH 16/28] Fixes reset loop with new espressif32 platform on tlora-v2 Sending a pulse to the OLED_RESET Pin 16 results in a reset loop using recent version of the espressif32 platform. --- variants/tlora_v2/variant.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/variants/tlora_v2/variant.h b/variants/tlora_v2/variant.h index 1bff09fb0..0c854e37a 100644 --- a/variants/tlora_v2/variant.h +++ b/variants/tlora_v2/variant.h @@ -8,8 +8,6 @@ #define I2C_SDA 21 // I2C pins for this board #define I2C_SCL 22 -#define RESET_OLED 16 // If defined, this pin will be used to reset the display controller - #define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost #define LED_PIN 25 // If defined we will blink this LED #define BUTTON_PIN \ @@ -21,4 +19,4 @@ #define LORA_DIO0 26 // a No connect on the SX1262 module #define LORA_RESET 14 #define LORA_DIO1 35 // Not really used -#define LORA_DIO2 34 // Not really used \ No newline at end of file +#define LORA_DIO2 34 // Not really used From b2e540b114f594ea960daf9ce346710287d5aee6 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 4 Nov 2022 13:43:16 -0500 Subject: [PATCH 17/28] Experiment with self hosted action runner --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 66bf7539c..640b88e51 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -105,7 +105,7 @@ jobs: - board: m5stack-coreink - board: tbeam-s3-core - runs-on: ubuntu-latest + runs-on: [self-hosted, ubuntu-latest] steps: - name: Checkout code uses: actions/checkout@v3 From 4ccb4393c56f7eea1ee5fee48e0ff4a687e62922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 4 Nov 2022 19:44:45 +0100 Subject: [PATCH 18/28] Fix MQTT on ETH --- src/main.cpp | 2 +- src/mesh/Router.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d7abdb2a9..e0f0783d3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ #include "nimble/NimbleBluetooth.h" #endif -#if HAS_WIFI || defined(ARCH_PORTDUINO) +#if HAS_WIFI #include "mesh/wifi/WiFiServerAPI.h" #include "mqtt/MQTT.h" #endif diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 815571b9b..e0746bdd9 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -11,7 +11,7 @@ extern "C" { #include "mesh/compression/unishox2.h" } -#if HAS_WIFI +#if HAS_WIFI || HAS_ETHERNET #include "mqtt/MQTT.h" #endif @@ -209,7 +209,7 @@ ErrorCode Router::send(MeshPacket *p) if (p->which_payload_variant == MeshPacket_decoded_tag) { ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it -#if HAS_WIFI +#if HAS_WIFI || HAS_ETHERNET // check if we should send decrypted packets to mqtt // truth table: @@ -240,7 +240,7 @@ ErrorCode Router::send(MeshPacket *p) return encodeResult; // FIXME - this isn't a valid ErrorCode } -#if HAS_WIFI +#if HAS_WIFI || HAS_ETHERNET // the packet is now encrypted. // check if we should send encrypted packets to mqtt if (mqtt && shouldActuallyEncrypt) From 7c692444e5107ff17e7e8a8b9f43ccf8b27b7ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 4 Nov 2022 19:48:28 +0100 Subject: [PATCH 19/28] revert the tryfix --- variants/tlora_v2/variant.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/tlora_v2/variant.h b/variants/tlora_v2/variant.h index 6a09839d6..0c854e37a 100644 --- a/variants/tlora_v2/variant.h +++ b/variants/tlora_v2/variant.h @@ -1,5 +1,7 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN +#define GPS_RX_PIN 36 +#define GPS_TX_PIN 13 // per @eugene #define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage From a49355133c5c3171d424eb63593e94978bedf11e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 4 Nov 2022 14:23:22 -0500 Subject: [PATCH 20/28] Cheating --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 640b88e51..66bf7539c 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -105,7 +105,7 @@ jobs: - board: m5stack-coreink - board: tbeam-s3-core - runs-on: [self-hosted, ubuntu-latest] + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 From a547a791ba11b59e02570ea859cbdcd4c6b5c0f5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 06:42:53 -0500 Subject: [PATCH 21/28] Cleanup artifacts older than 1 month --- .github/workflows/cleanup_artifacts.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/cleanup_artifacts.yml diff --git a/.github/workflows/cleanup_artifacts.yml b/.github/workflows/cleanup_artifacts.yml new file mode 100644 index 000000000..183d1dc7e --- /dev/null +++ b/.github/workflows/cleanup_artifacts.yml @@ -0,0 +1,17 @@ +name: Remove old artifacts + +on: + schedule: + # Every day at 1am + - cron: '0 1 * * *' + +jobs: + remove-old-artifacts: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Remove old artifacts + uses: c-hive/gha-remove-artifacts@v1 + with: + age: '1 month' From 4c931967c7d08f26dca891382e2177fb6432cc44 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 06:44:08 -0500 Subject: [PATCH 22/28] Update cleanup_artifacts.yml --- .github/workflows/cleanup_artifacts.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cleanup_artifacts.yml b/.github/workflows/cleanup_artifacts.yml index 183d1dc7e..7fef005f1 100644 --- a/.github/workflows/cleanup_artifacts.yml +++ b/.github/workflows/cleanup_artifacts.yml @@ -4,6 +4,8 @@ on: schedule: # Every day at 1am - cron: '0 1 * * *' + + workflow_dispatch: jobs: remove-old-artifacts: From 764b48e04a3d6917821ea15fa4b3176e47dbccb8 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 06:47:00 -0500 Subject: [PATCH 23/28] Update cleanup_artifacts.yml --- .github/workflows/cleanup_artifacts.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cleanup_artifacts.yml b/.github/workflows/cleanup_artifacts.yml index 7fef005f1..d95304ccf 100644 --- a/.github/workflows/cleanup_artifacts.yml +++ b/.github/workflows/cleanup_artifacts.yml @@ -16,4 +16,5 @@ jobs: - name: Remove old artifacts uses: c-hive/gha-remove-artifacts@v1 with: - age: '1 month' + age: '1 month' + skip-tags: true From 3dc6ed5672348b9dd0a8c092f536fdbeb509080f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 06:57:47 -0500 Subject: [PATCH 24/28] Update cleanup_artifacts.yml --- .github/workflows/cleanup_artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup_artifacts.yml b/.github/workflows/cleanup_artifacts.yml index d95304ccf..df55e4273 100644 --- a/.github/workflows/cleanup_artifacts.yml +++ b/.github/workflows/cleanup_artifacts.yml @@ -16,5 +16,5 @@ jobs: - name: Remove old artifacts uses: c-hive/gha-remove-artifacts@v1 with: - age: '1 month' + age: '2 month' skip-tags: true From 01381057c5dc16758953b4748422b293619883b6 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 08:06:28 -0500 Subject: [PATCH 25/28] Delete cleanup_artifacts.yml --- .github/workflows/cleanup_artifacts.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/cleanup_artifacts.yml diff --git a/.github/workflows/cleanup_artifacts.yml b/.github/workflows/cleanup_artifacts.yml deleted file mode 100644 index df55e4273..000000000 --- a/.github/workflows/cleanup_artifacts.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Remove old artifacts - -on: - schedule: - # Every day at 1am - - cron: '0 1 * * *' - - workflow_dispatch: - -jobs: - remove-old-artifacts: - runs-on: ubuntu-latest - timeout-minutes: 10 - - steps: - - name: Remove old artifacts - uses: c-hive/gha-remove-artifacts@v1 - with: - age: '2 month' - skip-tags: true From ed26ab801c8e6edbca8bb6fbc04561f77572e28b Mon Sep 17 00:00:00 2001 From: Lars Weber Date: Sat, 5 Nov 2022 14:37:00 +0100 Subject: [PATCH 26/28] fix: use RF95_IRQ for wakeup source in doLightSleep (#1899) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thomas Göttgens Co-authored-by: Ben Meadors --- src/sleep.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sleep.cpp b/src/sleep.cpp index 055cf770d..390ab7f65 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -263,8 +263,8 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r #ifdef BUTTON_PIN gpio_wakeup_enable((gpio_num_t)BUTTON_PIN, GPIO_INTR_LOW_LEVEL); // when user presses, this button goes low #endif -#ifdef RF95_IRQ_GPIO - gpio_wakeup_enable((gpio_num_t)RF95_IRQ_GPIO, GPIO_INTR_HIGH_LEVEL); // RF95 interrupt, active high +#ifdef RF95_IRQ + gpio_wakeup_enable((gpio_num_t)RF95_IRQ, GPIO_INTR_HIGH_LEVEL); // RF95 interrupt, active high #endif #ifdef PMU_IRQ // wake due to PMU can happen repeatedly if there is no battery installed or the battery fills From cda7a6073440148000d6da5f94f4dfb0b980b1da Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 08:43:44 -0500 Subject: [PATCH 27/28] Update protos --- protobufs | 2 +- src/mesh/generated/mesh.pb.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/protobufs b/protobufs index a0fe9ec86..6b46e42a6 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit a0fe9ec8614cd27af7691869ccbd20c39e48a086 +Subproject commit 6b46e42a656dd3aab74c373e79b70e699eeac834 diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 812099166..c1c2bdd7b 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -501,7 +501,7 @@ typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; typedef struct _MeshPacket { /* The sending node number. Note: Our crypto implementation uses this field as well. - See [crypto](/docs/developers/firmware/encryption) for details. + See [crypto](/docs/about/overview/encryption) for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */ uint32_t from; /* The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only @@ -529,7 +529,7 @@ typedef struct _MeshPacket { needs to be unique for a few minutes (long enough to last for the length of any ACK or the completion of a mesh broadcast flood). Note: Our crypto implementation uses this id as well. - See [crypto](/docs/developers/firmware/encryption) for details. + See [crypto](/docs/about/overview/encryption) for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */ uint32_t id; From c6f060a24fed4c9ff0e3eed81110b8bb07c85bc3 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 09:21:51 -0500 Subject: [PATCH 28/28] Add develop to CI --- .github/workflows/main_matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 66bf7539c..4736de06e 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -2,14 +2,14 @@ name: CI on: # # Triggers the workflow on push but only for the master branch push: - branches: [master] + branches: [master, develop] paths-ignore: - "**.md" - "version.properties" # Note: This is different from "pull_request". Need to specify ref when doing checkouts. pull_request_target: - branches: [master] + branches: [master, develop] paths-ignore: - "**.md" #- "**.yml"