From 5780b50a48ab25650fd1507c0ffdce4c880e5b5d Mon Sep 17 00:00:00 2001 From: recrof Date: Mon, 5 May 2025 08:30:12 +0200 Subject: [PATCH 1/3] echo, m1: correct display scalling; all nrf52 boards jsons: added debug.openocd_target --- boards/heltec_t114.json | 3 ++- boards/promicro_nrf52840.json | 5 +++-- boards/t-echo.json | 3 ++- boards/thinknode_m1.json | 3 ++- boards/tracker-t1000-e.json | 3 ++- src/helpers/CustomLR1121.h | 17 +++++++++++++++++ src/helpers/CustomLR1121Wrapper.h | 30 ++++++++++++++++++++++++++++++ src/helpers/ui/GxEPDDisplay.cpp | 4 ++-- src/helpers/ui/GxEPDDisplay.h | 8 ++++---- 9 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 src/helpers/CustomLR1121.h create mode 100644 src/helpers/CustomLR1121Wrapper.h diff --git a/boards/heltec_t114.json b/boards/heltec_t114.json index 6df7266d..86f72e73 100644 --- a/boards/heltec_t114.json +++ b/boards/heltec_t114.json @@ -34,7 +34,8 @@ ], "debug": { "jlink_device": "nRF52840_xxAA", - "svd_path": "nrf52840.svd" + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52.cfg" }, "frameworks": [ "arduino" diff --git a/boards/promicro_nrf52840.json b/boards/promicro_nrf52840.json index 346f0f26..a428ffde 100644 --- a/boards/promicro_nrf52840.json +++ b/boards/promicro_nrf52840.json @@ -8,7 +8,7 @@ "extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA", "f_cpu": "64000000L", "hwids": [ - [ + [ "0x239A", "0x00B3" ], @@ -51,7 +51,8 @@ ], "debug": { "jlink_device": "nRF52840_xxAA", - "svd_path": "nrf52840.svd" + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52.cfg" }, "frameworks": [ "arduino", diff --git a/boards/t-echo.json b/boards/t-echo.json index 5c2703a3..8deea1bc 100644 --- a/boards/t-echo.json +++ b/boards/t-echo.json @@ -37,7 +37,8 @@ "onboard_tools": [ "jlink" ], - "svd_path": "nrf52840.svd" + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52.cfg" }, "frameworks": [ "arduino" diff --git a/boards/thinknode_m1.json b/boards/thinknode_m1.json index 0f313063..9f486285 100644 --- a/boards/thinknode_m1.json +++ b/boards/thinknode_m1.json @@ -45,7 +45,8 @@ "onboard_tools": [ "jlink" ], - "svd_path": "nrf52840.svd" + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52.cfg" }, "frameworks": [ "arduino" diff --git a/boards/tracker-t1000-e.json b/boards/tracker-t1000-e.json index 2be716e2..fc740ac5 100644 --- a/boards/tracker-t1000-e.json +++ b/boards/tracker-t1000-e.json @@ -32,7 +32,8 @@ "connectivity": ["bluetooth"], "debug": { "jlink_device": "nRF52840_xxAA", - "svd_path": "nrf52840.svd" + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52.cfg" }, "frameworks": ["arduino"], "name": "Seeed T1000-E", diff --git a/src/helpers/CustomLR1121.h b/src/helpers/CustomLR1121.h new file mode 100644 index 00000000..fa8aa871 --- /dev/null +++ b/src/helpers/CustomLR1121.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +#define LR1121_IRQ_HAS_PREAMBLE 0b0000000100 // 4 4 valid LoRa header received +#define LR1121_IRQ_HEADER_VALID 0b0000010000 // 4 4 valid LoRa header received + +class CustomLR1121 : public LR1121 { + public: + CustomLR1121(Module *mod) : LR1121(mod) { } + + bool isReceiving() { + uint16_t irq = getIrqStatus(); + bool hasPreamble = ((irq & LR1121_IRQ_HEADER_VALID) && (irq & LR1121_IRQ_HAS_PREAMBLE)); + return hasPreamble; + } +}; \ No newline at end of file diff --git a/src/helpers/CustomLR1121Wrapper.h b/src/helpers/CustomLR1121Wrapper.h new file mode 100644 index 00000000..359aecd4 --- /dev/null +++ b/src/helpers/CustomLR1121Wrapper.h @@ -0,0 +1,30 @@ +#pragma once + +#include "CustomLR1121.h" +#include "RadioLibWrappers.h" + +class CustomLR1121Wrapper : public RadioLibWrapper { +public: + CustomLR1121Wrapper(CustomLR1121& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { } + bool isReceiving() override { + if (((CustomLR1121 *)_radio)->isReceiving()) return true; + + idle(); // put lr1121 into standby + // do some basic CAD (blocks for ~12780 micros (on SF 10)!) + bool activity = (((CustomLR1121 *)_radio)->scanChannel() == RADIOLIB_LORA_DETECTED); + if (activity) { + startRecv(); + } else { + idle(); + } + return activity; + } + + void onSendFinished() override { + RadioLibWrapper::onSendFinished(); + _radio->setPreambleLength(8); // overcomes weird issues with small and big pkts + } + + float getLastRSSI() const override { return ((CustomLR1121 *)_radio)->getRSSI(); } + float getLastSNR() const override { return ((CustomLR1121 *)_radio)->getSNR(); } +}; diff --git a/src/helpers/ui/GxEPDDisplay.cpp b/src/helpers/ui/GxEPDDisplay.cpp index 57a96074..7faaf2c3 100644 --- a/src/helpers/ui/GxEPDDisplay.cpp +++ b/src/helpers/ui/GxEPDDisplay.cpp @@ -7,10 +7,10 @@ #ifdef TECHO_ZOOM #define SCALE_X (1.5625f * 1.5f) // 200 / 128 (with 1.5 scale) - #define SCALE_Y (2.9687f * 1.5f) // 190 / 64 (with 1.5 scale) + #define SCALE_Y (1.5625f * 1.5f) // 200 / 128 (with 1.5 scale) #else #define SCALE_X 1.5625f // 200 / 128 - #define SCALE_Y 2.9687f // 190 / 64 + #define SCALE_Y 1.5625f // 200 / 128 #endif bool GxEPDDisplay::begin() { diff --git a/src/helpers/ui/GxEPDDisplay.h b/src/helpers/ui/GxEPDDisplay.h index 88aecaae..01c900ac 100644 --- a/src/helpers/ui/GxEPDDisplay.h +++ b/src/helpers/ui/GxEPDDisplay.h @@ -14,11 +14,11 @@ #define GxEPD2_DISPLAY_CLASS GxEPD2_BW #define GxEPD2_DRIVER_CLASS GxEPD2_150_BN // DEPG0150BN 200x200, SSD1681, (FPC8101), TTGO T5 V2.4.1 -#include // 1.54" b/w +#include // 1.54" b/w #include "DisplayDriver.h" -//GxEPD2_BW display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)); // DEPG0150BN 200x200, SSD1681, TTGO T5 V2.4.1 +//GxEPD2_BW display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)); // DEPG0150BN 200x200, SSD1681, TTGO T5 V2.4.1 class GxEPDDisplay : public DisplayDriver { @@ -29,12 +29,12 @@ class GxEPDDisplay : public DisplayDriver { public: // there is a margin in y... - GxEPDDisplay() : DisplayDriver(128, 64), display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)) { + GxEPDDisplay() : DisplayDriver(128, 128), display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)) { } bool begin(); - bool isOn() override {return _isOn;}; + bool isOn() override {return _isOn;}; void turnOn() override; void turnOff() override; void clear() override; From 310e6c64d41a0555c3eb4f9d3509f112650f4924 Mon Sep 17 00:00:00 2001 From: Rastislav Vysoky Date: Mon, 5 May 2025 08:34:24 +0200 Subject: [PATCH 2/3] Delete src/helpers/CustomLR1121.h --- src/helpers/CustomLR1121.h | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 src/helpers/CustomLR1121.h diff --git a/src/helpers/CustomLR1121.h b/src/helpers/CustomLR1121.h deleted file mode 100644 index fa8aa871..00000000 --- a/src/helpers/CustomLR1121.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -#define LR1121_IRQ_HAS_PREAMBLE 0b0000000100 // 4 4 valid LoRa header received -#define LR1121_IRQ_HEADER_VALID 0b0000010000 // 4 4 valid LoRa header received - -class CustomLR1121 : public LR1121 { - public: - CustomLR1121(Module *mod) : LR1121(mod) { } - - bool isReceiving() { - uint16_t irq = getIrqStatus(); - bool hasPreamble = ((irq & LR1121_IRQ_HEADER_VALID) && (irq & LR1121_IRQ_HAS_PREAMBLE)); - return hasPreamble; - } -}; \ No newline at end of file From 81863a599553e2c75b5efe3711ca2a9c246612e7 Mon Sep 17 00:00:00 2001 From: Rastislav Vysoky Date: Mon, 5 May 2025 08:34:41 +0200 Subject: [PATCH 3/3] Delete src/helpers/CustomLR1121Wrapper.h --- src/helpers/CustomLR1121Wrapper.h | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 src/helpers/CustomLR1121Wrapper.h diff --git a/src/helpers/CustomLR1121Wrapper.h b/src/helpers/CustomLR1121Wrapper.h deleted file mode 100644 index 359aecd4..00000000 --- a/src/helpers/CustomLR1121Wrapper.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "CustomLR1121.h" -#include "RadioLibWrappers.h" - -class CustomLR1121Wrapper : public RadioLibWrapper { -public: - CustomLR1121Wrapper(CustomLR1121& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { } - bool isReceiving() override { - if (((CustomLR1121 *)_radio)->isReceiving()) return true; - - idle(); // put lr1121 into standby - // do some basic CAD (blocks for ~12780 micros (on SF 10)!) - bool activity = (((CustomLR1121 *)_radio)->scanChannel() == RADIOLIB_LORA_DETECTED); - if (activity) { - startRecv(); - } else { - idle(); - } - return activity; - } - - void onSendFinished() override { - RadioLibWrapper::onSendFinished(); - _radio->setPreambleLength(8); // overcomes weird issues with small and big pkts - } - - float getLastRSSI() const override { return ((CustomLR1121 *)_radio)->getRSSI(); } - float getLastSNR() const override { return ((CustomLR1121 *)_radio)->getSNR(); } -};