Browse Source

Merge 3ca64b3fc2 into 03b6ef4b0d

pull/2854/merge
Nicole Faerber 20 hours ago
committed by GitHub
parent
commit
0e4d34d417
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 15
      variants/lilygo_tlora_v1/LilyGoTLoraBoard.h
  2. 200
      variants/lilygo_tlora_v1/platformio.ini
  3. 34
      variants/lilygo_tlora_v1/target.cpp
  4. 26
      variants/lilygo_tlora_v1/target.h

15
variants/lilygo_tlora_v1/LilyGoTLoraBoard.h

@ -0,0 +1,15 @@
#pragma once
#include <Arduino.h>
#include <helpers/ESP32Board.h>
// LILYGO T-LoRa V1 board with SX1276
class LilyGoTLoraBoard : public ESP32Board {
public:
const char* getManufacturerName() const override {
return "LILYGO T-LoRa V1";
}
// LILYGO T-LoRa V1 has no battery monitoring ADC
};

200
variants/lilygo_tlora_v1/platformio.ini

@ -0,0 +1,200 @@
[LilyGo_TLora_V1]
extends = esp32_base
board = ttgo-lora32-v1 ; LILYGO T-LoRa V1 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}
${sensor_base.build_flags}
-UENV_INCLUDE_GPS
-I variants/lilygo_tlora_v1
-Os -ffunction-sections -fdata-sections ; Optimize for size
-D LILYGO_TLORA ; LILYGO T-LoRa V1 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_BOARD_SDA=4
-D PIN_BOARD_SCL=15
# -D PIN_VBAT_READ=35 ; Battery voltage reading (analog pin)
-D PIN_USER_BTN=0
-D ARDUINO_LOOP_STACK_SIZE=16384
-D DISPLAY_CLASS=SSD1306Display
-D PIN_OLED_RESET=16
-D RADIO_CLASS=CustomSX1276
-D WRAPPER_CLASS=CustomSX1276Wrapper
-D SX127X_CURRENT_LIMIT=120
-D LORA_TX_POWER=20
build_src_filter = ${esp32_base.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<../variants/lilygo_tlora_v2_1>
+<helpers/sensors>
lib_deps =
${esp32_base.lib_deps}
${sensor_base.lib_deps}
; === LILYGO T-LoRa V2.1-1.6 with SX1276 environments ===
[env:LilyGo_TLora_V1_repeater]
extends = LilyGo_TLora_V1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<../examples/simple_repeater>
build_flags =
${LilyGo_TLora_V1.build_flags}
-D ADVERT_NAME='"TLora-V1 Repeater"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D CORE_DEBUG_LEVEL=3
lib_deps =
${LilyGo_TLora_V1.lib_deps}
${esp32_ota.lib_deps}
[env:LilyGo_TLora_V1_terminal_chat]
extends = LilyGo_TLora_V1
build_flags =
${LilyGo_TLora_V1.build_flags}
-D MAX_CONTACTS=160
-D MAX_GROUP_CHANNELS=8
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<../examples/simple_secure_chat/main.cpp>
lib_deps =
${LilyGo_TLora_V1.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_TLora_V1_companion_radio_usb]
extends = LilyGo_TLora_V1
build_flags =
${LilyGo_TLora_V1.build_flags}
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=160
-D MAX_GROUP_CHANNELS=8
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${LilyGo_TLora_V1.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_TLora_V1_companion_radio_ble]
extends = LilyGo_TLora_V1
build_flags =
${LilyGo_TLora_V1.build_flags}
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=160
-D MAX_GROUP_CHANNELS=8
-D BLE_PIN_CODE=123456
-D OFFLINE_QUEUE_SIZE=128
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${LilyGo_TLora_V1.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_TLora_V1_room_server]
extends = LilyGo_TLora_V1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_room_server>
build_flags =
${LilyGo_TLora_V1.build_flags}
-D ADVERT_NAME='"TLora-V1 Room"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D ROOM_PASSWORD='"hello"'
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps =
${LilyGo_TLora_V1.lib_deps}
${esp32_ota.lib_deps}
[env:LilyGo_TLora_V1_companion_radio_wifi]
extends = LilyGo_TLora_V1
build_flags =
${LilyGo_TLora_V1.build_flags}
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=160
-D MAX_GROUP_CHANNELS=8
-D WIFI_SSID='"ssid"'
-D WIFI_PWD='"password"'
-D WIFI_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=128
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${LilyGo_TLora_V1.lib_deps}
densaugeo/base64 @ ~1.4.0
;
; Repeater Bridges
;
[env:LilyGo_TLora_V1_repeater_bridge_rs232]
extends = LilyGo_TLora_V1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<helpers/bridges/RS232Bridge.cpp>
+<../examples/simple_repeater>
build_flags =
${LilyGo_TLora_V1.build_flags}
-D ADVERT_NAME='"RS232 Bridge"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D WITH_RS232_BRIDGE=Serial2
-D WITH_RS232_BRIDGE_RX=34
-D WITH_RS232_BRIDGE_TX=25
; -D BRIDGE_DEBUG=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D CORE_DEBUG_LEVEL=3
lib_deps =
${LilyGo_TLora_V1.lib_deps}
${esp32_ota.lib_deps}
[env:LilyGo_TLora_V1_repeater_bridge_espnow]
extends = LilyGo_TLora_V1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<helpers/bridges/ESPNowBridge.cpp>
+<../examples/simple_repeater>
build_flags =
${LilyGo_TLora_V1.build_flags}
-D ADVERT_NAME='"ESPNow Bridge"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D WITH_ESPNOW_BRIDGE=1
; -D BRIDGE_DEBUG=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D CORE_DEBUG_LEVEL=3
lib_deps =
${LilyGo_TLora_V1.lib_deps}
${esp32_ota.lib_deps}
[env:LilyGo_TLora_V1_kiss_modem]
extends = LilyGo_TLora_V1
build_src_filter = ${LilyGo_TLora_V1.build_src_filter}
+<../examples/kiss_modem/>

34
variants/lilygo_tlora_v1/target.cpp

@ -0,0 +1,34 @@
#include <Arduino.h>
#include "target.h"
LilyGoTLoraBoard board;
static SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
WRAPPER_CLASS radio_driver(radio, board);
ESP32RTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);
EnvironmentSensorManager sensors;
#ifdef DISPLAY_CLASS
DISPLAY_CLASS display;
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
#endif
bool radio_init() {
fallback_clock.begin();
rtc_clock.begin(Wire);
#if defined(P_LORA_SCLK)
return radio.std_init(&spi);
#else
return radio.std_init();
#endif
}
mesh::LocalIdentity radio_new_identity() {
RadioNoiseListener rng(radio);
return mesh::LocalIdentity(&rng); // create new random identity
}

26
variants/lilygo_tlora_v1/target.h

@ -0,0 +1,26 @@
#pragma once
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include <LilyGoTLoraBoard.h>
#include <helpers/radiolib/CustomSX1276Wrapper.h>
#include <helpers/AutoDiscoverRTCClock.h>
#include <helpers/sensors/EnvironmentSensorManager.h>
#ifdef DISPLAY_CLASS
#include <helpers/ui/SSD1306Display.h>
#include <helpers/ui/MomentaryButton.h>
#endif
extern LilyGoTLoraBoard board;
extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock;
extern EnvironmentSensorManager sensors;
#ifdef DISPLAY_CLASS
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
#endif
bool radio_init();
mesh::LocalIdentity radio_new_identity();
Loading…
Cancel
Save