From 6fe250aca790c7f15c46adee9597e025cd66499c Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 21 Jan 2022 22:45:26 +0100 Subject: [PATCH] Work on LoRa32 compatibility --- Config.h | 13 +++++++++++++ Makefile | 30 ++++++++++++++++++++++++++++++ Utilities.h | 10 ++++++++++ 3 files changed, 53 insertions(+) diff --git a/Config.h b/Config.h index 9c9ea97..6b24663 100644 --- a/Config.h +++ b/Config.h @@ -98,6 +98,19 @@ const int pin_dio = 39; const int pin_led_rx = 14; const int pin_led_tx = 32; + #elif BOARD_MODEL == BOARD_LORA32_V2_0 + // TODO: Add correct pins here + // const int pin_cs = 18; + // const int pin_reset = 23; + // const int pin_dio = 26; + // const int pin_led_rx = 2; + // const int pin_led_tx = 25; + #elif BOARD_MODEL == BOARD_LORA32_V2_1 + const int pin_cs = 18; + const int pin_reset = 23; + const int pin_dio = 26; + const int pin_led_rx = 2; + const int pin_led_tx = 25; #else #error An unsupported board was selected. Cannot compile RNode firmware. #endif diff --git a/Makefile b/Makefile index d05cfec..08d0811 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,12 @@ firmware: firmware-tbeam: arduino-cli compile --fqbn esp32:esp32:t-beam --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\"" +firmware-lora32_v20: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\"" + +firmware-lora32_v21: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\"" + firmware-featheresp32: arduino-cli compile --fqbn esp32:esp32:featheresp32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\"" @@ -35,6 +41,12 @@ upload: upload-tbeam: arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:t-beam +upload-lora32_v20: + arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32 + +upload-lora32_v21: + arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32 + upload-featheresp32: arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:featheresp32 @@ -57,6 +69,24 @@ release-tbeam: zip --junk-paths ./Precompiled/rnode_firmware_latest_tbeam.zip ./Precompiled/esptool/esptool.py build/rnode_firmware_latest_tbeam.boot_app0 build/rnode_firmware_latest_tbeam.bin build/rnode_firmware_latest_tbeam.bootloader build/rnode_firmware_latest_tbeam.partitions rm -r build +release-lora32_v20: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_lora32v20.boot_app0 + cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bin build/rnode_firmware_latest_lora32v20.bin + cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_lora32v20.bootloader + cp build/esp32.esp32.t-beam/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_lora32v20.partitions + zip --junk-paths ./Precompiled/rnode_firmware_latest_lora32v20.zip ./Precompiled/esptool/esptool.py build/rnode_firmware_latest_lora32v20.boot_app0 build/rnode_firmware_latest_lora32v20.bin build/rnode_firmware_latest_lora32v20.bootloader build/rnode_firmware_latest_lora32v20.partitions + rm -r build + +release-lora32_v21: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_lora32v21.boot_app0 + cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bin build/rnode_firmware_latest_lora32v21.bin + cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_lora32v21.bootloader + cp build/esp32.esp32.t-beam/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_lora32v21.partitions + zip --junk-paths ./Precompiled/rnode_firmware_latest_lora32v21.zip ./Precompiled/esptool/esptool.py build/rnode_firmware_latest_lora32v21.boot_app0 build/rnode_firmware_latest_lora32v21.bin build/rnode_firmware_latest_lora32v21.bootloader build/rnode_firmware_latest_lora32v21.partitions + rm -r build + release-featheresp32: arduino-cli compile --fqbn esp32:esp32:featheresp32 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\"" cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_featheresp32.boot_app0 diff --git a/Utilities.h b/Utilities.h index b5534b7..f722ce7 100644 --- a/Utilities.h +++ b/Utilities.h @@ -41,6 +41,16 @@ 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_V2_0 + // 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, LOW); } + // void led_tx_off() { digitalWrite(pin_led_tx, HIGH); } + #elif BOARD_MODEL == BOARD_LORA32_V2_1 + 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, LOW); } + void led_tx_off() { digitalWrite(pin_led_tx, HIGH); } #elif BOARD_MODEL == BOARD_HUZZAH32 void led_rx_on() { digitalWrite(pin_led_rx, HIGH); } void led_rx_off() { digitalWrite(pin_led_rx, LOW); }