diff --git a/variants/lilygo_tlora_v1/LilyGoTLoraBoard.h b/variants/lilygo_tlora_v1/LilyGoTLoraBoard.h new file mode 100644 index 0000000000..2d8515be2b --- /dev/null +++ b/variants/lilygo_tlora_v1/LilyGoTLoraBoard.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +// 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 + +}; \ No newline at end of file diff --git a/variants/lilygo_tlora_v1/platformio.ini b/variants/lilygo_tlora_v1/platformio.ini new file mode 100644 index 0000000000..1e42474fdf --- /dev/null +++ b/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} + + + +<../variants/lilygo_tlora_v2_1> + + +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} + + + +<../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} + + + + + +<../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} + + + +<../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} + + + + + +<../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} + + + +<../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} + + + +<../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/> diff --git a/variants/lilygo_tlora_v1/target.cpp b/variants/lilygo_tlora_v1/target.cpp new file mode 100644 index 0000000000..8c12016150 --- /dev/null +++ b/variants/lilygo_tlora_v1/target.cpp @@ -0,0 +1,34 @@ +#include +#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 +} \ No newline at end of file diff --git a/variants/lilygo_tlora_v1/target.h b/variants/lilygo_tlora_v1/target.h new file mode 100644 index 0000000000..fa954b329b --- /dev/null +++ b/variants/lilygo_tlora_v1/target.h @@ -0,0 +1,26 @@ +#pragma once + +#define RADIOLIB_STATIC_ONLY 1 +#include +#include +#include +#include +#include +#include +#ifdef DISPLAY_CLASS + #include + #include +#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(); \ No newline at end of file