Compare commits

..

12 Commits

Author SHA1 Message Date
ripplebiz
a3d46a3e8a Merge pull request #62 from awolden/awolden/t3lora
Add LILYGO T-LoRa V2.1-1.6 firmware
2025-03-06 16:33:27 +11:00
Alex Wolden
0fc85b8c59 Revert identity change 2025-03-05 19:38:08 -08:00
Scott Powell
45a88dca3d * .yml files, permissions: write 2025-03-05 19:48:52 +11:00
Scott Powell
7832548714 * now suppressing 'cp' errors 2025-03-05 19:20:28 +11:00
Scott Powell
78ee88c9ed * companion, HeltecV3: now picks random BLE pin for every session (from boot), unless a (non-zero) one stored in _prefs
* companion, WSL3: uses static BLE pin, per build BLE_PIN_CODE define
2025-03-05 19:14:34 +11:00
Alex Wolden
86389579eb Merge remote-tracking branch 'origin/dev' into awolden/t3lora 2025-03-04 23:23:03 -08:00
Alex Wolden
d36da0ed8e Refactor naming 2025-03-04 22:00:48 -08:00
Alex Wolden
ed320ac1f5 add libsodium 2025-03-04 20:04:19 -08:00
Alex Wolden
21ba6116a3 fix memory 2025-03-04 12:13:45 -08:00
Alex Wolden
1f25575b94 readded 1262 radio 2025-03-04 09:03:36 -08:00
Alex Wolden
b777264eb7 Remove duplicate entries from platformio.ini
- Remove unnecessary T3S3 configurations
- Keep only the LilyGo T3 with SX1276 configurations
- Clean up the platformio.ini file to remove duplication
2025-03-04 00:16:35 -08:00
Alex Wolden
e1022791e8 Add support for LilyGo T3 with SX1276 module
- Add custom partition table for fitting larger firmware
- Create LilyGoT3S3Board.h for board-specific functionality
- Update all example files to support the T3 board with SX1276
- Configure build environment for optimizing firmware size
- Set up the right pin configuration for SX1276 on LilyGo T3
2025-03-04 00:07:36 -08:00
11 changed files with 201 additions and 16 deletions

View File

@@ -1,5 +1,8 @@
name: Build Companion Firmwares
permissions:
contents: write
on:
workflow_dispatch:
push:

View File

@@ -1,5 +1,8 @@
name: Build Repeater Firmwares
permissions:
contents: write
on:
workflow_dispatch:
push:

View File

@@ -1,5 +1,8 @@
name: Build Room Server Firmwares
permissions:
contents: write
on:
workflow_dispatch:
push:

View File

@@ -67,12 +67,12 @@ build_firmware() {
# e.g: RAK_4631_Repeater-v1.0.0-SHA.uf2
# copy .bin for esp32 boards
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null
cp .pio/build/$1/firmware-merged.bin out/${FIRMWARE_FILENAME}-merged.bin 2>/dev/null
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null || true
cp .pio/build/$1/firmware-merged.bin out/${FIRMWARE_FILENAME}-merged.bin 2>/dev/null || true
# copy .zip and .uf2 of nrf52 boards
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null
cp .pio/build/$1/firmware.zip out/${FIRMWARE_FILENAME}.zip 2>/dev/null
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null || true
cp .pio/build/$1/firmware.zip out/${FIRMWARE_FILENAME}.zip 2>/dev/null || true
}

View File

@@ -78,7 +78,7 @@ void UITask::renderCurrScreen() {
if (_connected) {
//_display->printf("freq : %03.2f sf %d\n", _prefs.freq, _prefs.sf);
//_display->printf("bw : %03.2f cr %d\n", _prefs.bw, _prefs.cr);
} else {
} else if (_pin_code != 0) {
_display->setTextSize(2);
_display->setCursor(0, 43);
sprintf(tmp, "Pin:%d", _pin_code);

View File

@@ -72,6 +72,10 @@
#include <helpers/ESP32Board.h>
#include <helpers/CustomSX1262Wrapper.h>
static ESP32Board board;
#elif defined(LILYGO_TLORA)
#include <helpers/LilyGoTLoraBoard.h>
#include <helpers/CustomSX1276Wrapper.h>
static LilyGoTLoraBoard board;
#elif defined(RAK_4631)
#include <helpers/nrf52/RAK4631Board.h>
#include <helpers/CustomSX1262Wrapper.h>
@@ -204,6 +208,7 @@ class MyMesh : public BaseChatMesh {
ContactsIterator _iter;
uint32_t _iter_filter_since;
uint32_t _most_recent_lastmod;
uint32_t _active_ble_pin;
bool _iter_started;
uint8_t app_target_ver;
uint8_t cmd_frame[MAX_FRAME_SIZE+1];
@@ -220,11 +225,6 @@ class MyMesh : public BaseChatMesh {
if (!_identity_store->load("_main", self_id)) {
self_id = mesh::LocalIdentity(&trng); // create new random identity
saveMainIdentity(self_id);
#if defined(BLE_PIN_CODE) && defined(DISPLAY_CLASS)
// start with randomly assigned BLE pin
_prefs.ble_pin = trng.nextInt(100000, 999999);
#endif
}
}
@@ -617,9 +617,6 @@ public:
_prefs.bw = LORA_BW;
_prefs.cr = LORA_CR;
_prefs.tx_power_dbm = LORA_TX_POWER;
#ifdef BLE_PIN_CODE
_prefs.ble_pin = BLE_PIN_CODE;
#endif
//_prefs.rx_delay_base = 10.0f; enable once new algo fixed
}
@@ -672,6 +669,20 @@ public:
}
}
#ifdef BLE_PIN_CODE
if (_prefs.ble_pin == 0) {
#ifdef DISPLAY_CLASS
_active_ble_pin = trng.nextInt(100000, 999999); // random pin each session
#else
_active_ble_pin = BLE_PIN_CODE; // otherwise static pin
#endif
} else {
_active_ble_pin = _prefs.ble_pin;
}
#else
_active_ble_pin = 0;
#endif
// init 'blob store' support
_fs->mkdir("/bl");
@@ -686,7 +697,7 @@ public:
}
const char* getNodeName() { return _prefs.node_name; }
uint32_t getBLEPin() { return _prefs.ble_pin; }
uint32_t getBLEPin() { return _active_ble_pin; }
void startInterface(BaseSerialInterface& serial) {
_serial = &serial;
@@ -1184,6 +1195,9 @@ public:
#if defined(NRF52_PLATFORM)
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
#elif defined(LILYGO_TLORA)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
#elif defined(P_LORA_SCLK)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);

View File

@@ -76,6 +76,10 @@
#include <helpers/ESP32Board.h>
#include <helpers/CustomSX1262Wrapper.h>
static ESP32Board board;
#elif defined(LILYGO_TLORA)
#include <helpers/LilyGoTLoraBoard.h>
#include <helpers/CustomSX1276Wrapper.h>
static LilyGoTLoraBoard board;
#elif defined(RAK_4631)
#include <helpers/nrf52/RAK4631Board.h>
#include <helpers/CustomSX1262Wrapper.h>
@@ -607,6 +611,9 @@ public:
#if defined(NRF52_PLATFORM)
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
#elif defined(LILYGO_TLORA)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
#elif defined(P_LORA_SCLK)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);

View File

@@ -80,6 +80,10 @@
#include <helpers/ESP32Board.h>
#include <helpers/CustomSX1262Wrapper.h>
static ESP32Board board;
#elif defined(LILYGO_TLORA)
#include <helpers/LilyGoTLoraBoard.h>
#include <helpers/CustomSX1276Wrapper.h>
static LilyGoTLoraBoard board;
#elif defined(RAK_4631)
#include <helpers/nrf52/RAK4631Board.h>
#include <helpers/CustomSX1262Wrapper.h>
@@ -669,6 +673,9 @@ public:
#if defined(NRF52_PLATFORM)
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
#elif defined(LILYGO_TLORA)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
#elif defined(P_LORA_SCLK)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);

View File

@@ -66,6 +66,10 @@
#include <helpers/ESP32Board.h>
#include <helpers/CustomSX1262Wrapper.h>
static ESP32Board board;
#elif defined(LILYGO_TLORA)
#include <helpers/LilyGoTLoraBoard.h>
#include <helpers/CustomSX1276Wrapper.h>
static LilyGoTLoraBoard board;
#elif defined(RAK_4631)
#include <helpers/nrf52/RAK4631Board.h>
#include <helpers/CustomSX1262Wrapper.h>
@@ -541,6 +545,9 @@ public:
#if defined(NRF52_PLATFORM)
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
#elif defined(LILYGO_TLORA)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
#elif defined(P_LORA_SCLK)
SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);

View File

@@ -185,7 +185,7 @@ build_flags =
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
-D DISPLAY_CLASS=SSD1306Display
-D BLE_PIN_CODE=123456
-D BLE_PIN_CODE=0 ; dynamic, random PIN
-D BLE_DEBUG_LOGGING=1
; -D ENABLE_PRIVATE_KEY_IMPORT=1
; -D ENABLE_PRIVATE_KEY_EXPORT=1
@@ -196,6 +196,23 @@ lib_deps =
${Heltec_lora32_v3.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:Heltec_WSL3_companion_radio_ble]
extends = Heltec_lora32_v3
build_flags =
${Heltec_lora32_v3.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
-D BLE_PIN_CODE=123456
-D BLE_DEBUG_LOGGING=1
; -D ENABLE_PRIVATE_KEY_IMPORT=1
; -D ENABLE_PRIVATE_KEY_EXPORT=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Heltec_lora32_v3.build_src_filter} +<helpers/esp32/*.cpp> +<../examples/companion_radio>
lib_deps =
${Heltec_lora32_v3.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:Heltec_v3_companion_radio_wifi]
extends = Heltec_lora32_v3
build_flags =
@@ -328,6 +345,31 @@ lib_deps =
${Xiao_S3_WIO.lib_deps}
densaugeo/base64 @ ~1.4.0
; =============
[LilyGo_TLora_V2_1_1_6]
extends = esp32_base
board = ttgo-lora32-v1 ; LILYGO T-LoRa V2.1-1.6 ESP32 with SX1276
build_unflags = -Os
build_type = release ; Set build type to release
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
build_flags =
${esp32_base.build_flags}
-Os -ffunction-sections -fdata-sections ; Optimize for size
-D LILYGO_TLORA ; LILYGO T-LoRa V2.1-1.6 ESP32 with SX1276
-D P_LORA_DIO_0=26 ; SX1276 DIO0 interrupt pin
-D P_LORA_DIO_1=33 ; SX1276 DIO1 interrupt pin
-D P_LORA_NSS=18 ; Chip select - SS pin
-D P_LORA_RESET=14 ; Reset pin
-D P_LORA_SCLK=5 ; SPI clock
-D P_LORA_MISO=19 ; SPI MISO
-D P_LORA_MOSI=27 ; SPI MOSI
-D P_LORA_TX_LED=2 ; LED pin for TX indication
-D PIN_VBAT_READ=35 ; Battery voltage reading (analog pin)
-D RADIO_CLASS=CustomSX1276
-D ARDUINO_LOOP_STACK_SIZE=16384
-D WRAPPER_CLASS=CustomSX1276Wrapper
-D LORA_TX_POWER=20
; =============
[LilyGo_T3S3_sx1262]
extends = esp32_base
@@ -350,12 +392,86 @@ build_flags = ${esp32_base.build_flags}
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D LORA_TX_POWER=22
; === LILYGO T-LoRa V2.1-1.6 with SX1276 environments ===
[env:LilyGo_TLora_V2_1_1_6_Repeater]
extends = LilyGo_TLora_V2_1_1_6
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_repeater/main.cpp>
build_flags =
${LilyGo_TLora_V2_1_1_6.build_flags}
-D ADVERT_NAME="\"TLora-V2.1-1.6 Repeater\""
-D ADVERT_LAT=-37.0
-D ADVERT_LON=145.0
-D ADMIN_PASSWORD="\"password\""
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D CORE_DEBUG_LEVEL=3
[env:LilyGo_TLora_V2_1_1_6_terminal_chat]
extends = LilyGo_TLora_V2_1_1_6
build_flags =
${LilyGo_TLora_V2_1_1_6.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_secure_chat/main.cpp>
lib_deps =
${LilyGo_TLora_V2_1_1_6.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_TLora_V2_1_1_6_companion_radio_usb]
extends = LilyGo_TLora_V2_1_1_6
build_flags =
${LilyGo_TLora_V2_1_1_6.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
; -D ENABLE_PRIVATE_KEY_IMPORT=1
; -D ENABLE_PRIVATE_KEY_EXPORT=1
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/companion_radio/main.cpp>
lib_deps =
${LilyGo_TLora_V2_1_1_6.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_TLora_V2_1_1_6_companion_radio_ble]
extends = LilyGo_TLora_V2_1_1_6
build_flags =
${LilyGo_TLora_V2_1_1_6.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
-D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D ENABLE_PRIVATE_KEY_IMPORT=1
; -D ENABLE_PRIVATE_KEY_EXPORT=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<helpers/esp32/*.cpp> +<../examples/companion_radio/main.cpp>
lib_deps =
${LilyGo_TLora_V2_1_1_6.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_TLora_V2_1_1_6_room_server]
extends = LilyGo_TLora_V2_1_1_6
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_room_server/main.cpp>
build_flags =
${LilyGo_TLora_V2_1_1_6.build_flags}
-D ADVERT_NAME="\"TLora-V2.1-1.6 Room\""
-D ADVERT_LAT=-37.0
-D ADVERT_LON=145.0
-D ADMIN_PASSWORD="\"password\""
-D ROOM_PASSWORD="\"hello\""
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; === LilyGo T3S3 with SX1262 environments ===
[env:LilyGo_T3S3_sx1262_Repeater]
extends = LilyGo_T3S3_sx1262
build_src_filter = ${LilyGo_T3S3_sx1262.build_src_filter} +<../examples/simple_repeater/main.cpp>
build_flags =
${LilyGo_T3S3_sx1262.build_flags}
-D ADVERT_NAME="\"T3S3 Repeater\""
-D ADVERT_NAME="\"T3S3-1262 Repeater\""
-D ADVERT_LAT=-37.0
-D ADVERT_LON=145.0
-D ADMIN_PASSWORD="\"password\""
@@ -407,6 +523,7 @@ lib_deps =
${LilyGo_T3S3_sx1262.lib_deps}
densaugeo/base64 @ ~1.4.0
; ----------------- NRF52 ---------------------
[nrf52_base]
extends = arduino_base

View File

@@ -0,0 +1,24 @@
#pragma once
#include <Arduino.h>
#include "ESP32Board.h"
// LILYGO T-LoRa V2.1-1.6 board with SX1276
class LilyGoTLoraBoard : public ESP32Board {
public:
const char* getManufacturerName() const override {
return "LILYGO T-LoRa V2.1-1.6";
}
uint16_t getBattMilliVolts() override {
analogReadResolution(12);
uint32_t raw = 0;
for (int i = 0; i < 8; i++) {
raw += analogReadMilliVolts(PIN_VBAT_READ);
}
raw = raw / 8;
return (2 * raw);
}
};