From 18780131d8b77ba7c645c245d0f223a3cf84ee23 Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Wed, 16 Oct 2024 21:24:18 +0100 Subject: [PATCH] Fix openCom XL compilation --- Display.h | 10 +++++----- Power.h | 4 ++-- RNode_Firmware_CE.ino | 2 +- Radio.cpp | 4 ++-- Utilities.h | 6 ++++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Display.h b/Display.h index 4bfaf56..ba27ea4 100644 --- a/Display.h +++ b/Display.h @@ -94,7 +94,7 @@ void busyCallback(const void* p) { #define SCL_OLED 17 #define SDA_OLED 18 #endif -#elif BOARD_MODEL == BOARD_RAK4631 +#elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL #if DISPLAY == OLED // RAK1921/SSD1306 #define DISP_RST -1 @@ -135,7 +135,7 @@ void busyCallback(const void* p) { #include "Graphics.h" -#if BOARD_MODEL == BOARD_RAK4631 +#if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL #if DISPLAY == EINK_BW GxEPD2_BW display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy)); float disp_target_fps = 0.2; @@ -316,7 +316,7 @@ bool display_init() { // waiting for the display to update, it will poll the serial buffer to // check for any commands from the host. display.epd2.setBusyCallback(busyCallback); - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL #if DISPLAY == OLED #elif DISPLAY == EINK_BW || DISPLAY == EINK_3C pinMode(pin_disp_en, INPUT_PULLUP); @@ -386,7 +386,7 @@ bool display_init() { #elif BOARD_MODEL == BOARD_HELTEC32_V2 disp_mode = DISP_MODE_PORTRAIT; display.setRotation(1); - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL #if DISPLAY == OLED #elif DISPLAY == EINK_BW || DISPLAY == EINK_3C disp_mode = DISP_MODE_PORTRAIT; @@ -397,7 +397,7 @@ bool display_init() { #elif BOARD_MODEL == BOARD_HELTEC32_V3 disp_mode = DISP_MODE_PORTRAIT; display.setRotation(1); - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL disp_mode = DISP_MODE_LANDSCAPE; display.setRotation(0); #elif BOARD_MODEL == BOARD_TDECK diff --git a/Power.h b/Power.h index 0aec818..80d6e11 100644 --- a/Power.h +++ b/Power.h @@ -62,7 +62,7 @@ bool bat_voltage_dropping = false; float bat_delay_v = 0; float bat_state_change_v = 0; -#elif BOARD_MODEL == BOARD_RAK4631 +#elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL #include "nrfx_power.h" #define BAT_C_SAMPLES 7 #define BAT_D_SAMPLES 2 @@ -291,7 +291,7 @@ void measure_battery() { battery_ready = false; } - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL battery_installed = true; battery_indeterminate = false; diff --git a/RNode_Firmware_CE.ino b/RNode_Firmware_CE.ino index 4b39cd6..143bff9 100644 --- a/RNode_Firmware_CE.ino +++ b/RNode_Firmware_CE.ino @@ -19,7 +19,7 @@ #if MCU_VARIANT == MCU_NRF52 #define INTERFACE_SPI - #if BOARD_MODEL == BOARD_RAK4631 + #if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL // Required because on RAK4631, non-default SPI pins must be initialised when class is declared. SPIClass interface_spi[1] = { // SX1262 diff --git a/Radio.cpp b/Radio.cpp index 852263c..f1d7b04 100644 --- a/Radio.cpp +++ b/Radio.cpp @@ -740,7 +740,7 @@ void sx126x::sleep() void sx126x::enableTCXO() { if (_tcxo) { - #if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_HELTEC32_V3 + #if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL || 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}; @@ -2240,7 +2240,7 @@ void sx128x::disableTCXO() { void sx128x::setTxPower(int level, int outputPin) { uint8_t tx_buf[2]; - #if BOARD_VARIANT == MODEL_13 + #if BOARD_VARIANT == MODEL_13 || BOARD_VARIANT == MODEL_21 // RAK4631 with WisBlock SX1280 module (LIBSYS002) if (level > 27) { level = 27; diff --git a/Utilities.h b/Utilities.h index d9a34be..8a0eb9d 100644 --- a/Utilities.h +++ b/Utilities.h @@ -236,7 +236,7 @@ uint8_t boot_vector = 0x00; void led_tx_off() { digitalWrite(pin_led_tx, LOW); } #endif #elif MCU_VARIANT == MCU_NRF52 - #if BOARD_MODEL == BOARD_RAK4631 + #if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL 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); } @@ -1427,7 +1427,9 @@ bool eeprom_model_valid() { #elif BOARD_MODEL == BOARD_HELTEC32_V3 if (model == MODEL_C5 || model == MODEL_CA) { #elif BOARD_MODEL == BOARD_RAK4631 - if (model == MODEL_11 || model == MODEL_12 || model == MODEL_13 || model == MODEL_14 || model == MODEL_21) { + if (model == MODEL_11 || model == MODEL_12 || model == MODEL_13 || model == MODEL_14) { + #elif BOARD_MODEL == BOARD_OPENCOM_XL + if (model == MODEL_21) { #elif BOARD_MODEL == BOARD_HUZZAH32 if (model == MODEL_FF) { #elif BOARD_MODEL == BOARD_HMBRW