Added support for Heltec LoRa 32 v2

This commit is contained in:
Mark Qvist 2022-06-16 19:12:28 +02:00
parent 4cca140c5b
commit 1d44082962
4 changed files with 89 additions and 4 deletions

View File

@ -20,6 +20,7 @@
#define BOARD_GENERIC_ESP32 0x35
#define BOARD_LORA32_V2_0 0x36
#define BOARD_LORA32_V2_1 0x37
#define BOARD_HELTEC32_V2 0x38
#define BOARD_RNODE_NG_20 0x40
#define BOARD_RNODE_NG_21 0x41
@ -129,6 +130,17 @@
const int pin_led_rx = 25;
const int pin_led_tx = 25;
#endif
#elif BOARD_MODEL == BOARD_HELTEC32_V2
const int pin_cs = 18;
const int pin_reset = 23;
const int pin_dio = 26;
#if defined(EXTERNAL_LEDS)
const int pin_led_rx = 36;
const int pin_led_tx = 37;
#else
const int pin_led_rx = 25;
const int pin_led_tx = 25;
#endif
#elif BOARD_MODEL == BOARD_RNODE_NG_20
const int pin_cs = 18;
const int pin_reset = 12;

View File

@ -30,9 +30,18 @@ firmware-lora32_v20_extled:
firmware-lora32_v21_extled:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DEXTERNAL_LEDS=true\""
firmware-heltec32_v2:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\""
firmware-heltec32_v2_extled:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
firmware-rnode_ng_20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
firmware-rnode_ng_21:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x41\""
firmware-featheresp32:
arduino-cli compile --fqbn esp32:esp32:featheresp32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
@ -56,6 +65,9 @@ upload-lora32_v20:
upload-lora32_v21:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32
upload-heltec32_v2:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:heltec_wifi_lora_32_V2
upload-rnode_ng_20:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
@ -67,7 +79,7 @@ upload-mega2560:
release-all: release-rnode release-tbeam release-lora32_v20 release-lora32_v21 release-lora32_v20_extled release-lora32_v21_extled release-featheresp32 release-genericesp32
release-all: release-rnode 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:
arduino-cli compile --fqbn unsignedio:avr:rnode -e
@ -119,6 +131,44 @@ release-lora32_v21_extled:
zip --junk-paths ./Release/rnode_firmware_latest_lora32v21_extled.zip ./Release/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-heltec32_v2:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\""
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_heltec32v2.boot_app0
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bin build/rnode_firmware_latest_heltec32v2.bin
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_heltec32v2.bootloader
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_heltec32v2.partitions
zip --junk-paths ./Release/rnode_firmware_latest_heltec32v2.zip ./Release/esptool/esptool.py build/rnode_firmware_latest_heltec32v2.boot_app0 build/rnode_firmware_latest_heltec32v2.bin build/rnode_firmware_latest_heltec32v2.bootloader build/rnode_firmware_latest_heltec32v2.partitions
rm -r build
release-heltec32_v2_extled:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_heltec32v2.boot_app0
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bin build/rnode_firmware_latest_heltec32v2.bin
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_heltec32v2.bootloader
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_heltec32v2.partitions
zip --junk-paths ./Release/rnode_firmware_latest_heltec32v2.zip ./Release/esptool/esptool.py build/rnode_firmware_latest_heltec32v2.boot_app0 build/rnode_firmware_latest_heltec32v2.bin build/rnode_firmware_latest_heltec32v2.bootloader build/rnode_firmware_latest_heltec32v2.partitions
rm -r build
release-rnode_ng_20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_ng20.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_latest_ng20.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_ng20.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_ng20.partitions
zip --junk-paths ./Release/rnode_firmware_latest_ng20.zip ./Release/esptool/esptool.py build/rnode_firmware_latest_ng20.boot_app0 build/rnode_firmware_latest_ng20.bin build/rnode_firmware_latest_ng20.bootloader build/rnode_firmware_latest_ng20.partitions
rm -r build
release-rnode_ng_21:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x41\""
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_ng21.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_latest_ng21.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_ng21.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_ng21.partitions
zip --junk-paths ./Release/rnode_firmware_latest_ng21.zip ./Release/esptool/esptool.py build/rnode_firmware_latest_ng21.boot_app0 build/rnode_firmware_latest_ng21.bin build/rnode_firmware_latest_ng21.bootloader build/rnode_firmware_latest_ng21.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

7
ROM.h
View File

@ -8,12 +8,19 @@
#define PRODUCT_TBEAM 0xE0
#define PRODUCT_T32_20 0xB0
#define PRODUCT_T32_21 0xB1
#define PRODUCT_H32_V2 0xC0
#define MODEL_A4 0xA4
#define MODEL_A9 0xA9
#define MODEL_A3 0xA3
#define MODEL_A8 0xA8
#define MODEL_A2 0xA2
#define MODEL_A7 0xA7
#define MODEL_B3 0xB3
#define MODEL_B8 0xB8
#define MODEL_B4 0xB4
#define MODEL_B9 0xB9
#define MODEL_C4 0xC4
#define MODEL_C9 0xC9
#define MODEL_E4 0xE4
#define MODEL_E9 0xE9
#define MODEL_FF 0xFF

View File

@ -73,6 +73,18 @@ uint8_t boot_vector = 0x00;
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
#endif
#elif BOARD_MODEL == BOARD_HELTEC32_V2
#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_1
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
@ -765,7 +777,7 @@ bool eeprom_product_valid() {
#if PLATFORM == PLATFORM_AVR
if (rval == PRODUCT_RNODE || rval == PRODUCT_HMBRW) {
#elif PLATFORM == PLATFORM_ESP32
if (rval == PRODUCT_RNODE || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21) {
if (rval == PRODUCT_RNODE || rval == BOARD_RNODE_NG_20 || rval == BOARD_RNODE_NG_21 || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21 || rval == PRODUCT_H32_V2) {
#else
if (false) {
#endif
@ -779,6 +791,10 @@ bool eeprom_model_valid() {
model = EEPROM.read(eeprom_addr(ADDR_MODEL));
#if BOARD_MODEL == BOARD_RNODE
if (model == MODEL_A4 || model == MODEL_A9 || model == MODEL_FF) {
#elif BOARD_MODEL == BOARD_RNODE_NG_20
if (model == MODEL_A3 || model == MODEL_A8) {
#elif BOARD_MODEL == BOARD_RNODE_NG_21
if (model == MODEL_A2 || model == MODEL_A7) {
#elif BOARD_MODEL == BOARD_HMBRW
if (model == MODEL_FF) {
#elif BOARD_MODEL == BOARD_TBEAM
@ -787,8 +803,8 @@ bool eeprom_model_valid() {
if (model == MODEL_B3 || model == MODEL_B8) {
#elif BOARD_MODEL == BOARD_LORA32_V2_1
if (model == MODEL_B4 || model == MODEL_B9) {
#elif BOARD_MODEL == BOARD_RNODE_NG_20
if (model == MODEL_B3 || model == MODEL_B8) {
#elif BOARD_MODEL == BOARD_HELTEC32_V2
if (model == MODEL_C4 || model == MODEL_C9) {
#elif BOARD_MODEL == BOARD_HUZZAH32
if (model == MODEL_FF) {
#elif BOARD_MODEL == BOARD_GENERIC_ESP32