From 869c7a026bf4a8e04a23169fbc498aca44390ba0 Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Mon, 15 Jul 2024 21:22:32 +0100 Subject: [PATCH] Added support to compile freeNode target --- Boards.h | 6 +++--- Display.h | 12 ++++++------ Makefile | 12 ++++++------ Power.h | 6 +++--- Radio.cpp | 2 +- Utilities.h | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Boards.h b/Boards.h index 3d0a80c..137d6be 100644 --- a/Boards.h +++ b/Boards.h @@ -38,7 +38,7 @@ #define BOARD_RNODE_NG_21 0x41 #define BOARD_RNODE_NG_22 0x42 #define BOARD_GENERIC_NRF52 0x50 - #define BOARD_RAK4631 0x51 + #define BOARD_FREENODE 0x52 #define OLED 0x01 #define EINK_BW 0x02 @@ -616,7 +616,7 @@ #endif #elif MCU_VARIANT == MCU_NRF52 - #if BOARD_MODEL == BOARD_RAK4631 + #if BOARD_MODEL == BOARD_FREENODE #define HAS_EEPROM false #define HAS_DISPLAY true #define DISPLAY EINK_BW @@ -663,7 +663,7 @@ }; #define INTERFACE_SPI - // Required because on RAK4631, non-default SPI pins must be initialised when class is declared. + // Required because on FREENODE, non-default SPI pins must be initialised when class is declared. const SPIClass interface_spi[1] = { // SX1262 SPIClass( diff --git a/Display.h b/Display.h index cd1a59e..fb99943 100644 --- a/Display.h +++ b/Display.h @@ -75,7 +75,7 @@ void busyCallback(const void* p) { #define SCL_OLED 17 #define SDA_OLED 18 #endif -#elif BOARD_MODEL == BOARD_RAK4631 +#elif BOARD_MODEL == BOARD_FREENODE #if DISPLAY == OLED // todo: add support for OLED board #elif DISPLAY == EINK_BW @@ -101,14 +101,14 @@ void busyCallback(const void* p) { #include "Graphics.h" -#if BOARD_MODEL != BOARD_RAK4631 -// support for BOARD_RAK4631 OLED not implemented yet +#if BOARD_MODEL != BOARD_FREENODE +// support for BOARD_FREENODE OLED not implemented yet #if DISPLAY == OLED Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST); float disp_target_fps = 7; #endif #endif -#if BOARD_MODEL == BOARD_RAK4631 +#if BOARD_MODEL == BOARD_FREENODE #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; @@ -222,7 +222,7 @@ bool display_init() { delay(50); digitalWrite(pin_display_en, HIGH); Wire.begin(SDA_OLED, SCL_OLED); - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_FREENODE #if DISPLAY == OLED #elif DISPLAY == EINK_BW || DISPLAY == EINK_3C pinMode(pin_disp_en, INPUT_PULLUP); @@ -282,7 +282,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_FREENODE #if DISPLAY == OLED #elif DISPLAY == EINK_BW || DISPLAY == EINK_3C disp_mode = DISP_MODE_PORTRAIT; diff --git a/Makefile b/Makefile index 88b70b4..fae7aa9 100644 --- a/Makefile +++ b/Makefile @@ -113,8 +113,8 @@ firmware-featheresp32: firmware-genericesp32: arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\"" -firmware-rak4631: - arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\"" +firmware-freenode: + arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x52\"" upload: arduino-cli upload -p /dev/ttyUSB0 --fqbn unsignedio:avr:rnode @@ -198,7 +198,7 @@ upload-featheresp32: @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-rak4631: +upload-freenode: arduino-cli upload -p /dev/ttyACM0 --fqbn rakwireless:nrf52:WisCoreRAK4631Board unzip -o build/rakwireless.nrf52.WisCoreRAK4631Board/freeNode_Firmware.ino.zip -d build/rakwireless.nrf52.WisCoreRAK4631Board rnodeconf /dev/ttyACM0 --firmware-hash $$(sha256sum ./build/rakwireless.nrf52.WisCoreRAK4631Board/freeNode_Firmware.ino.bin | grep -o '^\S*') @@ -370,7 +370,7 @@ release-mega2560: cp build/arduino.avr.mega/freeNode_Firmware.ino.hex Release/rnode_firmware_m2560.hex rm -r build -release-rak4631: +release-freenode: arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\"" - cp build/rakwireless.nrf52.WisCoreRAK4631Board/freeNode_Firmware.ino.hex build/rnode_firmware_rak4631.hex - adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_rak4631.hex Release/rnode_firmware_rak4631.zip + cp build/rakwireless.nrf52.WisCoreRAK4631Board/freeNode_Firmware.ino.hex build/freeNode_Firmware.hex + adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/freeNode_Firmware.hex Release/freeNode_Firmware.zip diff --git a/Power.h b/Power.h index 395f629..02aa41d 100644 --- a/Power.h +++ b/Power.h @@ -44,7 +44,7 @@ int bat_charged_samples = 0; bool bat_voltage_dropping = false; float bat_delay_v = 0; -#elif BOARD_MODEL == BOARD_RAK4631 +#elif BOARD_MODEL == BOARD_FREENODE #include "nrfx_power.h" #define BAT_C_SAMPLES 7 #define BAT_D_SAMPLES 2 @@ -214,7 +214,7 @@ void measure_battery() { battery_ready = false; } - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_FREENODE battery_installed = true; battery_indeterminate = false; @@ -421,7 +421,7 @@ bool init_pmu() { PMU->setPowerKeyPressOffTime(XPOWERS_POWEROFF_4S); return true; - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_FREENODE // board doesn't have PMU but we can measure batt voltage // prep ADC for reading battery level diff --git a/Radio.cpp b/Radio.cpp index 33b46a9..c2f17f3 100644 --- a/Radio.cpp +++ b/Radio.cpp @@ -731,7 +731,7 @@ void sx126x::sleep() void sx126x::enableTCXO() { if (_tcxo) { - #if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_HELTEC32_V3 + #if BOARD_MODEL == BOARD_FREENODE || 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}; diff --git a/Utilities.h b/Utilities.h index 58aff10..afe99d4 100644 --- a/Utilities.h +++ b/Utilities.h @@ -205,7 +205,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_FREENODE void led_rx_on() { analogWrite(pin_led_rx, 1); } void led_rx_off() { analogWrite(pin_led_rx, 0); } void led_tx_on() { analogWrite(pin_led_tx, 1); } @@ -1356,7 +1356,7 @@ bool eeprom_model_valid() { if (model == MODEL_C4 || model == MODEL_C9) { #elif BOARD_MODEL == BOARD_HELTEC32_V3 if (model == MODEL_C5 || model == MODEL_CA) { - #elif BOARD_MODEL == BOARD_RAK4631 + #elif BOARD_MODEL == BOARD_FREENODE if (model == MODEL_11 || model == MODEL_12) { #elif BOARD_MODEL == BOARD_FREENODE if (model == MODEL_21) {