From d0e81b915155fff05f86825e526ed0d7e57715b7 Mon Sep 17 00:00:00 2001 From: Nicholas Baddorf <42445164+nbaddorf@users.noreply.github.com> Date: Tue, 23 Apr 2024 08:09:26 -0400 Subject: [PATCH 1/6] Fixed node and channel selection for t-deck (#3695) This enables the node and channel selection to be accessed by pressing the tab shortcut and then swiping between nodes or pressing tab again to change channels. (To access the tab function look at my other pull request https://github.com/meshtastic/firmware/pull/3668) Co-authored-by: Ben Meadors --- src/modules/CannedMessageModule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index cbd6fee72..c80ccc5e7 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -161,10 +161,10 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) if (!event->kbchar) { if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) { this->payload = 0xb4; - this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE; + // this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE; } else if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) { this->payload = 0xb7; - this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE; + // this->destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NODE; } } else { // pass the pressed key From 7acaec8ef5148749df167acc9e4ea1d07862a50f Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Tue, 23 Apr 2024 20:11:22 +0800 Subject: [PATCH 2/6] Add power limit for TW region (#3701) The TW region had now power limit set, so defaulted to 16dBm. The relevant regulation is section 5.8.1 of the Low-power Radio-frequency Devices Technical Regulations, which notes the limits of 0.5W (27dBM) indoor or coastal, 1.0W (30dBM) outdoor. This patch updates the power limit to 27dbM, using the the lower limit specified in the regulations to be conservative. Regulation references: https://www.ncc.gov.tw/english/files/23070/102_5190_230703_1_doc_C.PDF (latest English version) https://gazette.nat.gov.tw/egFront/e_detail.do?metaid=147283 (latest Chinese version, February 2024) --- src/mesh/RadioInterface.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 4fa0bef7a..f5eb35cbe 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -76,9 +76,12 @@ const RegionInfo regions[] = { RDEF(KR, 920.0f, 923.0f, 100, 0, 0, true, false, false), /* - ??? + Taiwan, 920-925Mhz, limited to 0.5W indoor or coastal, 1.0W outdoor. + 5.8.1 in the Low-power Radio-frequency Devices Technical Regulations + https://www.ncc.gov.tw/english/files/23070/102_5190_230703_1_doc_C.PDF + https://gazette.nat.gov.tw/egFront/e_detail.do?metaid=147283 */ - RDEF(TW, 920.0f, 925.0f, 100, 0, 0, true, false, false), + RDEF(TW, 920.0f, 925.0f, 100, 0, 27, true, false, false), /* https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf @@ -586,4 +589,4 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) sendingPacket = p; return p->encrypted.size + sizeof(PacketHeader); -} \ No newline at end of file +} From 4599534616166a412db6c6a5f46f35d856356a59 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Wed, 24 Apr 2024 05:00:48 +1200 Subject: [PATCH 3/6] Terminate an async-full-refresh when caught by determineMode() instead of onNotify() (#3706) --- src/graphics/EInkDynamicDisplay.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/graphics/EInkDynamicDisplay.cpp b/src/graphics/EInkDynamicDisplay.cpp index b396446fa..5b97b8d48 100644 --- a/src/graphics/EInkDynamicDisplay.cpp +++ b/src/graphics/EInkDynamicDisplay.cpp @@ -534,6 +534,10 @@ void EInkDynamicDisplay::checkBusyAsyncRefresh() return; } + + // Async refresh appears to have stopped, but wasn't caught by onNotify() + else + pollAsyncRefresh(); // Check (and terminate) the async refresh manually } // Hold control while an async refresh runs From 27f0e42d2fe2bcf33fbd1ab5b686f495d07ab423 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:32:33 -0500 Subject: [PATCH 4/6] [create-pull-request] automated change (#3708) Co-authored-by: thebentern --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index eade2c6be..86640f20d 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit eade2c6befb65a9c46c5d28ae1e8e24c37a1a3d0 +Subproject commit 86640f20db7b9b5be42949d18e8d96ad10d47a68 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 67b2edd15..68d9b4707 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -148,6 +148,9 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_TD_LORAC = 60, /* CDEBYTE EoRa-S3 board using their own MM modules, clone of LILYGO T3S3 */ meshtastic_HardwareModel_CDEBYTE_EORA_S3 = 61, + /* TWC_MESH_V4 + Adafruit NRF52840 feather express with SX1262, SSD1306 OLED and NEO6M GPS */ + meshtastic_HardwareModel_TWC_MESH_V4 = 62, /* ------------------------------------------------------------------------------------------------------------------------------------------ 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. ------------------------------------------------------------------------------------------------------------------------------------------ */ From 9c9d126f6b2aac4dda2f82193f26bc7959ade2e2 Mon Sep 17 00:00:00 2001 From: SCWhite Date: Wed, 24 Apr 2024 03:09:28 +0800 Subject: [PATCH 5/6] [BOARD] Add new variant: TWC_Mesh (#3705) * add new variant: TWC_mesh_v4 * fix trunk format * fix format under wsl * change board to TWC_mesh_v4 * change platformio & variant.h properly --------- Co-authored-by: Ben Meadors --- src/platform/nrf52/architecture.h | 4 +- variants/TWC_mesh_v4/platformio.ini | 10 +++ variants/TWC_mesh_v4/variant.cpp | 38 ++++++++ variants/TWC_mesh_v4/variant.h | 133 ++++++++++++++++++++++++++++ 4 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 variants/TWC_mesh_v4/platformio.ini create mode 100644 variants/TWC_mesh_v4/variant.cpp create mode 100644 variants/TWC_mesh_v4/variant.h diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 35cd4fd84..3be3e7e55 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -52,6 +52,8 @@ #define HW_VENDOR meshtastic_HardwareModel_CANARYONE #elif defined(NORDIC_PCA10059) #define HW_VENDOR meshtastic_HardwareModel_NRF52840_PCA10059 +#elif defined(TWC_MESH_V4) +#define HW_VENDOR meshtastic_HardwareModel_TWC_MESH_V4 #elif defined(PRIVATE_HW) || defined(FEATHER_DIY) #define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #else @@ -110,4 +112,4 @@ #if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA) // No serial ports on this board - ONLY use segger in memory console #define USE_SEGGER -#endif +#endif \ No newline at end of file diff --git a/variants/TWC_mesh_v4/platformio.ini b/variants/TWC_mesh_v4/platformio.ini new file mode 100644 index 000000000..9cf25c685 --- /dev/null +++ b/variants/TWC_mesh_v4/platformio.ini @@ -0,0 +1,10 @@ +[env:TWC_mesh_v4] +extends = nrf52840_base +board = TWC_mesh_v4 +board_level = extra +build_flags = ${nrf52840_base.build_flags} -I variants/TWC_mesh_v4 -D TWC_mesh_v4 -L".pio\libdeps\TWC_mesh_v4\BSEC2 Software Library\src\cortex-m4\fpv4-sp-d16-hard" +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/TWC_mesh_v4> +lib_deps = + ${nrf52840_base.lib_deps} + zinggjm/GxEPD2@^1.4.9 +debug_tool = jlink \ No newline at end of file diff --git a/variants/TWC_mesh_v4/variant.cpp b/variants/TWC_mesh_v4/variant.cpp new file mode 100644 index 000000000..b3712346d --- /dev/null +++ b/variants/TWC_mesh_v4/variant.cpp @@ -0,0 +1,38 @@ +/* + 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" + +const uint32_t g_ADigitalPinMap[] = { + // P0 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); +} \ No newline at end of file diff --git a/variants/TWC_mesh_v4/variant.h b/variants/TWC_mesh_v4/variant.h new file mode 100644 index 000000000..6a6f541e6 --- /dev/null +++ b/variants/TWC_mesh_v4/variant.h @@ -0,0 +1,133 @@ +#ifndef _VARIANT_TWC_MESH_V4_ +#define _VARIANT_TWC_MESH_V4_ + +#define PCA10059 + +/** 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) + +// LEDs +#define PIN_LED1 (32 + 10) // Blue LED P1.10 +#define PIN_LED2 (32 + 15) // Built in Green P1.15 + +// RGB NeoPixel LED2 +// #define PIN_LED1 (0 + 8) Red +// #define PIN_LED1 (32 + 9) Green +// #define PIN_LED1 (0 + 12) Blue + +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 + +#define LED_GREEN PIN_LED1 +#define LED_BLUE PIN_LED2 + +#define LED_STATE_ON 0 // State when LED is litted + +/* + * Buttons + */ +#define PIN_BUTTON1 (32 + 2) // BTN_DN P1.02 Built in button + +/* + * Analog pins + */ +#define PIN_A0 (0 + 29) // using VDIV (A6 / P0.29) + +static const uint8_t A0 = PIN_A0; +#define ADC_RESOLUTION 14 + +// Other pins +#define PIN_AREF (-1) // AREF Not yet used + +static const uint8_t AREF = PIN_AREF; + +/* + * Serial interfaces + */ +#define PIN_SERIAL1_RX (0 + 24) +#define PIN_SERIAL1_TX (0 + 25) + +// Connected to Jlink CDC +#define PIN_SERIAL2_RX (-1) +#define PIN_SERIAL2_TX (-1) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (0 + 15) // MISO P0.15 +#define PIN_SPI_MOSI (0 + 13) // MOSI P0.13 +#define PIN_SPI_SCK (0 + 14) // SCK P0.14 + +static const uint8_t SS = (0 + 6); // LORA_CS P0.6 +static const uint8_t MOSI = PIN_SPI_MOSI; +static const uint8_t MISO = PIN_SPI_MISO; +static const uint8_t SCK = PIN_SPI_SCK; + +////#define USE_EINK +#define USE_SSD1306 + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (0 + 12) // SDA P0.12 +#define PIN_WIRE_SCL (0 + 11) // SCL P0.11 + +// NiceRF 868 LoRa module +#define USE_SX1262 +#define USE_LLCC68 + +#define SX126X_CS (0 + 6) // LORA_CS P0.06 +#define SX126X_DIO1 (0 + 7) // DIO1 P0.07 +#define SX126X_BUSY (0 + 26) // LORA_BUSY P0.26 +#define SX126X_RESET (0 + 27) // LORA_RESET P0.27 +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + +#define PIN_GPS_EN (-1) +#define PIN_GPS_PPS (-1) // Pulse per second input from the GPS + +#define GPS_RX_PIN PIN_SERIAL1_RX +#define GPS_TX_PIN PIN_SERIAL1_TX + +// Battery +// The battery sense is hooked to pin A6 (0.29) +#define BATTERY_PIN PIN_A0 +// and has 12 bit resolution +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER (2.0F) + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif \ No newline at end of file From 57d296e0db8757a4318f225094fdd21ef48f0198 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Tue, 23 Apr 2024 14:18:51 -0500 Subject: [PATCH 6/6] Add better support for the Adafruit PiTFT 2.8 for Native (#3704) * Add better support for the Adafruit PiTFT 2.8 for Native * native: Make touch i2c address configurable * Bump portduino to pick up I2C features --------- Co-authored-by: Ben Meadors --- arch/portduino/portduino.ini | 2 +- bin/config-dist.yaml | 12 ++++++++---- src/graphics/TFTDisplay.cpp | 7 ++++++- src/platform/portduino/PortduinoGlue.cpp | 3 ++- src/platform/portduino/PortduinoGlue.h | 1 + 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 53f06c9f3..452c34337 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#6fb39b6f94ece9c042141edb4afb91aca94dcaab +platform = https://github.com/meshtastic/platform-native.git#659e49346aa33008b150dfb206b1817ddabc7132 framework = arduino build_src_filter = diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index f729f1ac7..f02c2a2c2 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -96,17 +96,21 @@ Display: # Panel: ILI9341 # CS: 8 # DC: 25 -# Backlight: 2 -# Width: 320 -# Height: 240 +# Width: 240 +# Height: 320 +# Rotate: true Touchscreen: ### Note, at least for now, the touchscreen must have a CS pin defined, even if you let Linux manage the CS switching. -# Module: STMPE610 +# Module: STMPE610 # Option 1 for Adafruit PiTFT 2.8 # CS: 7 # IRQ: 24 +# Module: FT5x06 # Option 2 for Adafruit PiTFT 2.8 +# IRQ: 24 +# I2CAddr: 0x38 + # Module: XPT2046 # Waveshare 2.8inch # CS: 7 # IRQ: 17 diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 12e549424..3c28a9e42 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -383,6 +383,8 @@ class LGFX : public lgfx::LGFX_Device _touch_instance = new lgfx::Touch_XPT2046; } else if (settingsMap[touchscreenModule] == stmpe610) { _touch_instance = new lgfx::Touch_STMPE610; + } else if (settingsMap[touchscreenModule] == ft5x06) { + _touch_instance = new lgfx::Touch_FT5x06; } auto touch_cfg = _touch_instance->config(); @@ -394,6 +396,9 @@ class LGFX : public lgfx::LGFX_Device touch_cfg.pin_int = settingsMap[touchscreenIRQ]; touch_cfg.bus_shared = true; touch_cfg.offset_rotation = 1; + if (settingsMap[touchscreenI2CAddr] != -1) { + touch_cfg.i2c_addr = settingsMap[touchscreenI2CAddr]; + } _touch_instance->config(touch_cfg); _panel_instance->setTouch(_touch_instance); @@ -711,4 +716,4 @@ bool TFTDisplay::connect() return true; } -#endif +#endif \ No newline at end of file diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index a04c9c12c..a8c473887 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -221,6 +221,7 @@ void portduinoSetup() settingsMap[touchscreenIRQ] = yamlConfig["Touchscreen"]["IRQ"].as(-1); settingsMap[touchscreenBusFrequency] = yamlConfig["Touchscreen"]["BusFrequency"].as(1000000); settingsMap[touchscreenRotate] = yamlConfig["Touchscreen"]["Rotate"].as(-1); + settingsMap[touchscreenI2CAddr] = yamlConfig["Touchscreen"]["I2CAddr"].as(-1); if (yamlConfig["Touchscreen"]["spidev"]) { settingsStrings[touchscreenspidev] = "/dev/" + yamlConfig["Touchscreen"]["spidev"].as(""); } @@ -332,4 +333,4 @@ int initGPIOPin(int pinNum, std::string gpioChipName) std::cout << "Warning, cannot claim pin " << gpio_name << (p ? p.__cxa_exception_type()->name() : "null") << std::endl; return ERRNO_DISABLED; } -} +} \ No newline at end of file diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index ed2954eef..4d2bcc262 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -21,6 +21,7 @@ enum configNames { touchscreenModule, touchscreenCS, touchscreenIRQ, + touchscreenI2CAddr, touchscreenBusFrequency, touchscreenRotate, touchscreenspidev,