From 221eeeb628796ebd9af272c142d0d928efe19a1e Mon Sep 17 00:00:00 2001 From: mrmx Date: Mon, 13 Mar 2023 12:14:53 +0100 Subject: [PATCH] Initial commit --- Config.h | 15 +++++++++++++++ Display.h | 4 ++-- Makefile | 33 ++++++++++++++++++++++++++++++++- README.md | 1 + Utilities.h | 12 ++++++++++++ 5 files changed, 62 insertions(+), 3 deletions(-) diff --git a/Config.h b/Config.h index 1ecc155..56764e0 100644 --- a/Config.h +++ b/Config.h @@ -35,6 +35,7 @@ #define BOARD_GENERIC_ESP32 0x35 #define BOARD_LORA32_V2_0 0x36 #define BOARD_LORA32_V2_1 0x37 + #define BOARD_LORA32_V1_0 0x38 #define BOARD_HELTEC32_V2 0x38 #define BOARD_RNODE_NG_20 0x40 #define BOARD_RNODE_NG_21 0x41 @@ -156,6 +157,20 @@ const int pin_led_rx = 14; const int pin_led_tx = 32; #define HAS_BLUETOOTH true + #define HAS_CONSOLE true + #elif BOARD_MODEL == BOARD_LORA32_V1_0 + const int pin_cs = 18; + const int pin_reset = 12; + const int pin_dio = 26; + #if defined(EXTERNAL_LEDS) + const int pin_led_rx = 25; + const int pin_led_tx = 2; + #else + const int pin_led_rx = 2; + const int pin_led_tx = 2; + #endif + #define HAS_DISPLAY true + #define HAS_BLUETOOTH true #define HAS_CONSOLE true #elif BOARD_MODEL == BOARD_LORA32_V2_0 const int pin_cs = 18; diff --git a/Display.h b/Display.h index 392d08d..9dfaa03 100644 --- a/Display.h +++ b/Display.h @@ -26,7 +26,7 @@ #define DISP_RST 13 #define DISP_ADDR 0x3D // #define DISP_ADDR 0x3C -#elif BOARD_MODEL == BOARD_HELTEC32_V2 +#elif BOARD_MODEL == BOARD_HELTEC32_V2 || BOARD_MODEL == BOARD_LORA32_V1_0 #define DISP_RST 16 #define DISP_ADDR 0x3C #define SCL_OLED 15 @@ -87,7 +87,7 @@ void set_contrast(Adafruit_SSD1306 *display, uint8_t contrast) { bool display_init() { #if HAS_DISPLAY - #if BOARD_MODEL == BOARD_RNODE_NG_20 || BOARD_MODEL == BOARD_LORA32_V2_0 + #if BOARD_MODEL == BOARD_RNODE_NG_20 || BOARD_MODEL == BOARD_LORA32_V2_0 || BOARD_LORA32_V1_0 int pin_display_en = 16; digitalWrite(pin_display_en, LOW); delay(50); diff --git a/Makefile b/Makefile index 929a2f4..961e448 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,12 @@ firmware-mega2560: firmware-tbeam: arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\"" +firmware-lora32_v10: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\"" + +firmware-lora32_v10_extled: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\"" + firmware-lora32_v20: arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\" \"-DEXTERNAL_LEDS=true\"" @@ -99,6 +105,13 @@ upload-tbeam: @sleep 3 python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB1 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin +upload-lora32_v10: + arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32 + @sleep 1 + rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin) + @sleep 3 + python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin + upload-lora32_v20: arduino-cli upload -p /dev/ttyUSB1 --fqbn esp32:esp32:ttgo-lora32 @sleep 1 @@ -144,7 +157,7 @@ upload-featheresp32: release: release-all -release-all: console-site spiffs-image release-rnode release-mega2560 release-tbeam release-lora32_v20 release-lora32_v21 release-lora32_v20_extled release-lora32_v21_extled release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-hashes +release-all: console-site spiffs-image release-rnode release-mega2560 release-tbeam release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-hashes release-hashes: python ./release_hashes.py > ./Release/release.json @@ -163,6 +176,15 @@ release-tbeam: zip --junk-paths ./Release/rnode_firmware_tbeam.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tbeam.boot_app0 build/rnode_firmware_tbeam.bin build/rnode_firmware_tbeam.bootloader build/rnode_firmware_tbeam.partitions rm -r build +release-lora32_v10: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.?/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0 + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_lora32v10.bin + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_lora32v10.bootloader + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_lora32v10.partitions + zip --junk-paths ./Release/rnode_firmware_lora32v10.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v10.boot_app0 build/rnode_firmware_lora32v10.bin build/rnode_firmware_lora32v10.bootloader build/rnode_firmware_lora32v10.partitions + rm -r build + release-lora32_v20: arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\"" cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.?/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0 @@ -181,6 +203,15 @@ release-lora32_v21: zip --junk-paths ./Release/rnode_firmware_lora32v21.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v21.boot_app0 build/rnode_firmware_lora32v21.bin build/rnode_firmware_lora32v21.bootloader build/rnode_firmware_lora32v21.partitions rm -r build +release-lora32_v10_extled: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.?/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0 + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_lora32v10.bin + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_lora32v10.bootloader + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_lora32v10.partitions + zip --junk-paths ./Release/rnode_firmware_lora32v10.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v10.boot_app0 build/rnode_firmware_lora32v10.bin build/rnode_firmware_lora32v10.bootloader build/rnode_firmware_lora32v10.partitions + rm -r build + release-lora32_v20_extled: arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\" \"-DEXTERNAL_LEDS=true\"" cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.?/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0 diff --git a/README.md b/README.md index 8f99b24..80f2453 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ The RNode Firmware supports the following boards: - Handheld v2.x RNodes from [unsigned.io](https://unsigned.io/shop/product/handheld-rnode) - Original v1.x RNodes from [unsigned.io](https://unsigned.io/shop/product/rnode) - LilyGO T-Beam v1.1 devices +- LilyGO LoRa32 v1.0 devices - LilyGO LoRa32 v2.0 devices - LilyGO LoRa32 v2.1 devices - Heltec LoRa32 v2 devices diff --git a/Utilities.h b/Utilities.h index 56b870d..be9af7d 100644 --- a/Utilities.h +++ b/Utilities.h @@ -123,6 +123,18 @@ uint8_t boot_vector = 0x00; void led_rx_off() { digitalWrite(pin_led_rx, LOW); } void led_tx_on() { digitalWrite(pin_led_tx, LOW); } void led_tx_off() { digitalWrite(pin_led_tx, HIGH); } + #elif BOARD_MODEL == BOARD_LORA32_V1_0 + #if defined(EXTERNAL_LEDS) + void led_rx_on() { digitalWrite(pin_led_rx, HIGH); } + void led_rx_off() { digitalWrite(pin_led_rx, LOW); } + void led_tx_on() { digitalWrite(pin_led_tx, HIGH); } + void led_tx_off() { digitalWrite(pin_led_tx, LOW); } + #else + void led_rx_on() { digitalWrite(pin_led_rx, HIGH); } + void led_rx_off() { digitalWrite(pin_led_rx, LOW); } + void led_tx_on() { digitalWrite(pin_led_tx, HIGH); } + void led_tx_off() { digitalWrite(pin_led_tx, LOW); } + #endif #elif BOARD_MODEL == BOARD_LORA32_V2_0 #if defined(EXTERNAL_LEDS) void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }