From 56a51fdafe2b86feb93c5ec2ccaf1837d5d4e8d8 Mon Sep 17 00:00:00 2001 From: Kevin Brosius Date: Thu, 11 Apr 2024 01:38:06 -0400 Subject: [PATCH] Update to add product and model codes for Heltec V3, swap to HELTEC32_V3 name for board ID. Bluetooth still disabled. --- Boards.h | 4 ++-- Display.h | 10 +++++----- Makefile | 2 +- RNode_Firmware.ino | 10 +++++++++- ROM.h | 3 +++ Utilities.h | 8 +++++--- sx126x.cpp | 4 ++-- 7 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Boards.h b/Boards.h index 1f08807..f5be0e9 100644 --- a/Boards.h +++ b/Boards.h @@ -36,7 +36,7 @@ #define BOARD_LORA32_V2_1 0x37 #define BOARD_LORA32_V1_0 0x39 #define BOARD_HELTEC32_V2 0x38 - #define BOARD_HELTEC_LORA32_V3 0x3a + #define BOARD_HELTEC32_V3 0x3A #define BOARD_RNODE_NG_20 0x40 #define BOARD_RNODE_NG_21 0x41 #define BOARD_RNODE_NG_22 0x42 @@ -249,7 +249,7 @@ const int pin_led_tx = 25; #endif - #elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 + #elif BOARD_MODEL == BOARD_HELTEC32_V3 #define IS_ESP32S3 true #define HAS_DISPLAY true //ESP32-S3 no bluetooth classic diff --git a/Display.h b/Display.h index e0b17c6..695fa90 100644 --- a/Display.h +++ b/Display.h @@ -32,7 +32,7 @@ #define DISP_ADDR 0x3C #define SCL_OLED 15 #define SDA_OLED 4 -#elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 +#elif BOARD_MODEL == BOARD_HELTEC32_V3 #define DISP_RST 21 #define DISP_ADDR 0x3C #define SCL_OLED 18 @@ -113,7 +113,7 @@ bool display_init() { Wire.begin(SDA_OLED, SCL_OLED); #elif BOARD_MODEL == BOARD_HELTEC32_V2 Wire.begin(SDA_OLED, SCL_OLED); - #elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 + #elif BOARD_MODEL == BOARD_HELTEC32_V3 // enable vext / pin 36 pinMode(Vext, OUTPUT); digitalWrite(Vext, LOW); @@ -166,12 +166,12 @@ bool display_init() { #elif BOARD_MODEL == BOARD_HELTEC32_V2 disp_mode = DISP_MODE_PORTRAIT; display.setRotation(1); - #elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 + #elif BOARD_MODEL == BOARD_HELTEC32_V3 disp_mode = DISP_MODE_PORTRAIT; // Antenna conx up - display.setRotation(1); + //display.setRotation(1); // USB-C up - //display.setRotation(3); + display.setRotation(3); #else disp_mode = DISP_MODE_PORTRAIT; display.setRotation(3); diff --git a/Makefile b/Makefile index b0576c9..6019a54 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ firmware-heltec32_v2_extled: arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -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-heltec32_v3: - arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3a\"" + arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3A\"" firmware-rnode_ng_20: 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=0x40\"" diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index 54ddb12..acbf3e0 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -1102,7 +1102,15 @@ void validate_status() { if (device_init()) { hw_ready = true; } else { - hw_ready = false; + #if !HAS_BLUETOOTH && !HAS_BLE + // Without bluetooth, bt_ready and device_init_done + // are not set + // and neither is hw_ready (see device_init()) + hw_ready = true; + device_init_done = true; + #else + hw_ready = false; + #endif } #else hw_ready = true; diff --git a/ROM.h b/ROM.h index b186318..a945d97 100644 --- a/ROM.h +++ b/ROM.h @@ -25,6 +25,7 @@ #define PRODUCT_T32_20 0xB0 #define PRODUCT_T32_21 0xB1 #define PRODUCT_H32_V2 0xC0 + #define PRODUCT_H32_V3 0xC1 #define MODEL_A1 0xA1 #define MODEL_A6 0xA6 #define MODEL_A4 0xA4 @@ -41,6 +42,8 @@ #define MODEL_BB 0xBB #define MODEL_C4 0xC4 #define MODEL_C9 0xC9 + #define MODEL_C5 0xC5 + #define MODEL_CA 0xCA #define MODEL_E4 0xE4 #define MODEL_E9 0xE9 #define MODEL_E3 0xE3 diff --git a/Utilities.h b/Utilities.h index 0bb84a7..db60800 100644 --- a/Utilities.h +++ b/Utilities.h @@ -60,7 +60,7 @@ sx128x *LoRa = &sx128x_modem; #include "Device.h" #endif #if MCU_VARIANT == MCU_ESP32 - #if BOARD_MODEL == BOARD_HELTEC_LORA32_V3 + #if BOARD_MODEL == BOARD_HELTEC32_V3 //https://github.com/espressif/esp-idf/issues/8855 #include "hal/wdt_hal.h" #elif BOARD_MODEL != BOARD_RNODE_NG_22 @@ -195,7 +195,7 @@ uint8_t boot_vector = 0x00; void led_tx_on() { digitalWrite(pin_led_tx, HIGH); } void led_tx_off() { digitalWrite(pin_led_tx, LOW); } #endif - #elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 + #elif BOARD_MODEL == BOARD_HELTEC32_V3 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); } @@ -1281,7 +1281,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 == BOARD_RNODE_NG_20 || rval == BOARD_RNODE_NG_21 || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_10 || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21 || rval == PRODUCT_H32_V2) { + if (rval == PRODUCT_RNODE || rval == BOARD_RNODE_NG_20 || rval == BOARD_RNODE_NG_21 || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_10 || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21 || rval == PRODUCT_H32_V2 || rval == PRODUCT_H32_V3) { #elif PLATFORM == PLATFORM_NRF52 if (rval == PRODUCT_HMBRW) { #else @@ -1319,6 +1319,8 @@ bool eeprom_model_valid() { if (model == MODEL_B4 || model == MODEL_B9) { #elif BOARD_MODEL == BOARD_HELTEC32_V2 if (model == MODEL_C4 || model == MODEL_C9) { + #elif BOARD_MODEL == BOARD_HELTEC32_V3 + if (model == MODEL_C5 || model == MODEL_CA) { #elif BOARD_MODEL == BOARD_RAK4630 if (model == MODEL_FF) { #elif BOARD_MODEL == BOARD_HUZZAH32 diff --git a/sx126x.cpp b/sx126x.cpp index fcf7371..a425e00 100644 --- a/sx126x.cpp +++ b/sx126x.cpp @@ -127,7 +127,7 @@ bool sx126x::preInit() { pinMode(_ss, OUTPUT); digitalWrite(_ss, HIGH); - #if BOARD_MODEL == BOARD_RNODE_NG_22 || BOARD_MODEL == BOARD_HELTEC_LORA32_V3 + #if BOARD_MODEL == BOARD_RNODE_NG_22 || BOARD_MODEL == BOARD_HELTEC32_V3 SPI.begin(pin_sclk, pin_miso, pin_mosi, pin_cs); #else SPI.begin(); @@ -717,7 +717,7 @@ void sx126x::sleep() void sx126x::enableTCXO() { #if HAS_TCXO - #if BOARD_MODEL == BOARD_RAK4630 || BOARD_MODEL == BOARD_HELTEC_LORA32_V3 + #if BOARD_MODEL == BOARD_RAK4630 || BOARD_MODEL == BOARD_HELTEC32_V3 uint8_t buf[4] = {MODE_TCXO_3_3V_6X, 0x00, 0x00, 0xFF}; #elif BOARD_MODEL == BOARD_TBEAM uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};