From 221eeeb628796ebd9af272c142d0d928efe19a1e Mon Sep 17 00:00:00 2001 From: mrmx Date: Mon, 13 Mar 2023 12:14:53 +0100 Subject: [PATCH 1/4] 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); } From c59d07efb882eee361e98cbff32fe7b821be55e6 Mon Sep 17 00:00:00 2001 From: mrmx Date: Sat, 1 Apr 2023 14:14:26 +0200 Subject: [PATCH 2/4] fix: Board id collission with heltec --- Config.h | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Config.h b/Config.h index 56764e0..326c6c8 100644 --- a/Config.h +++ b/Config.h @@ -35,7 +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_LORA32_V1_0 0x39 #define BOARD_HELTEC32_V2 0x38 #define BOARD_RNODE_NG_20 0x40 #define BOARD_RNODE_NG_21 0x41 diff --git a/Makefile b/Makefile index 961e448..199e948 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ 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\"" + 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=\0x39"" 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\"" @@ -177,7 +177,7 @@ release-tbeam: 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\"" + 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=0x39\"" 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 From b12fc82a80f6d9dc40a4a2615cbfba586c8bc85f Mon Sep 17 00:00:00 2001 From: mrmx Date: Sat, 1 Apr 2023 18:27:21 +0200 Subject: [PATCH 3/4] fix: OLED initialization and make typo --- Config.h | 4 ++-- Display.h | 9 ++++++++- Makefile | 2 +- README.md | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Config.h b/Config.h index 326c6c8..48e35e4 100644 --- a/Config.h +++ b/Config.h @@ -160,7 +160,7 @@ #define HAS_CONSOLE true #elif BOARD_MODEL == BOARD_LORA32_V1_0 const int pin_cs = 18; - const int pin_reset = 12; + const int pin_reset = 14; const int pin_dio = 26; #if defined(EXTERNAL_LEDS) const int pin_led_rx = 25; @@ -171,7 +171,7 @@ #endif #define HAS_DISPLAY true #define HAS_BLUETOOTH true - #define HAS_CONSOLE true + #define HAS_CONSOLE false #elif BOARD_MODEL == BOARD_LORA32_V2_0 const int pin_cs = 18; const int pin_reset = 12; diff --git a/Display.h b/Display.h index 9dfaa03..c58c005 100644 --- a/Display.h +++ b/Display.h @@ -95,7 +95,11 @@ bool display_init() { #elif BOARD_MODEL == BOARD_HELTEC32_V2 Wire.begin(SDA_OLED, SCL_OLED); #endif - + + #if BOARD_MODEL == BOARD_LORA32_V1_0 + Wire.begin(SDA_OLED, SCL_OLED); + #endif + if(!display.begin(SSD1306_SWITCHCAPVCC, DISP_ADDR)) { return false; } else { @@ -106,6 +110,9 @@ bool display_init() { #elif BOARD_MODEL == BOARD_RNODE_NG_21 disp_mode = DISP_MODE_PORTRAIT; display.setRotation(3); + #elif BOARD_MODEL == BOARD_LORA32_V1_0 + disp_mode = DISP_MODE_PORTRAIT; + display.setRotation(3); #elif BOARD_MODEL == BOARD_LORA32_V2_0 disp_mode = DISP_MODE_PORTRAIT; display.setRotation(3); diff --git a/Makefile b/Makefile index 199e948..17bebe8 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ 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=\0x39"" + 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=0x39\"" 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\"" diff --git a/README.md b/README.md index 80f2453..23aebb0 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ The RNode Firmware supports all transceiver modules based on **Semtech SX1276** Support for **SX1262**, **SX1268** and **SX1280** is being implemented. Please support the project with donations if you want this faster! ## Getting Started Fast -You can download and flash the firmware to all the supported boards using the [RNode Config Utility](https://github.com/markqvist/rnodeconfigutil). All firmware releases are now handled and installed directly through the `rnodeconf` utility, which is inclueded in the `rns` package. It can be installed via `pip`: +You can download and flash the firmware to all the supported boards using the [RNode Config Utility](https://github.com/markqvist/rnodeconfigutil). All firmware releases are now handled and installed directly through the `rnodeconf` utility, which is included in the `rns` package. It can be installed via `pip`: ``` # Install rnodeconf via rns package From 5beecad62ebeca803f2d6954a44a74f12aa3c0c6 Mon Sep 17 00:00:00 2001 From: mrmx Date: Sat, 1 Apr 2023 18:30:58 +0200 Subject: [PATCH 4/4] chore: re-enable console flag --- Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config.h b/Config.h index 48e35e4..c005ca0 100644 --- a/Config.h +++ b/Config.h @@ -171,7 +171,7 @@ #endif #define HAS_DISPLAY true #define HAS_BLUETOOTH true - #define HAS_CONSOLE false + #define HAS_CONSOLE true #elif BOARD_MODEL == BOARD_LORA32_V2_0 const int pin_cs = 18; const int pin_reset = 12;