From d2dab8c65ec1d2e048685256df0319b44072eee3 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 30 Oct 2022 18:58:12 +0100 Subject: [PATCH] Updated build configs --- Config.h | 38 ++++++++++++++++++++++---------------- RNode_Firmware.ino | 15 ++++++++------- Utilities.h | 4 ++-- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/Config.h b/Config.h index c18a769..e7aaae7 100644 --- a/Config.h +++ b/Config.h @@ -27,6 +27,21 @@ #define MODE_HOST 0x11 #define MODE_TNC 0x12 + #define CABLE_STATE_DISCONNECTED 0x00 + #define CABLE_STATE_CONNECTED 0x01 + uint8_t cable_state = CABLE_STATE_DISCONNECTED; + + #define BT_STATE_NA 0xff + #define BT_STATE_OFF 0x00 + #define BT_STATE_ON 0x01 + #define BT_STATE_PAIRING 0x02 + #define BT_STATE_CONNECTED 0x03 + uint8_t bt_state = BT_STATE_NA; + uint32_t bt_ssp_pin = 0; + bool bt_ready = false; + bool bt_enabled = false; + bool bt_allow_pairing = false; + #if defined(__AVR_ATmega1284P__) #define PLATFORM PLATFORM_AVR #define MCU_VARIANT MCU_1284P @@ -36,21 +51,6 @@ #elif defined(ESP32) #define PLATFORM PLATFORM_ESP32 #define MCU_VARIANT MCU_ESP32 - - #define CABLE_STATE_DISCONNECTED 0x00 - #define CABLE_STATE_CONNECTED 0x01 - uint8_t cable_state = CABLE_STATE_DISCONNECTED; - - #define BT_STATE_NA 0xff - #define BT_STATE_OFF 0x00 - #define BT_STATE_ON 0x01 - #define BT_STATE_PAIRING 0x02 - #define BT_STATE_CONNECTED 0x03 - uint8_t bt_state = BT_STATE_NA; - uint32_t bt_ssp_pin = 0; - bool bt_ready = false; - bool bt_enabled = false; - bool bt_allow_pairing = false; #else #error "The firmware cannot be compiled for the selected MCU variant" #endif @@ -60,7 +60,7 @@ #define HEADER_L 1 #define MIN_L 1 - #define CMD_L 4 + #define CMD_L 10 // MCU dependent configuration parameters @@ -115,19 +115,23 @@ const int pin_dio = 39; const int pin_led_rx = 14; const int pin_led_tx = 32; + #define HAS_BLUETOOTH true #elif BOARD_MODEL == BOARD_TBEAM 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 = 4; + #define HAS_DISPLAY true #define HAS_PMU true + #define HAS_BLUETOOTH true #elif BOARD_MODEL == BOARD_HUZZAH32 const int pin_cs = 4; const int pin_reset = 36; const int pin_dio = 39; const int pin_led_rx = 14; const int pin_led_tx = 32; + #define HAS_BLUETOOTH true #elif BOARD_MODEL == BOARD_LORA32_V2_0 const int pin_cs = 18; const int pin_reset = 12; @@ -166,6 +170,8 @@ const int pin_led_rx = 25; const int pin_led_tx = 25; #endif + #define HAS_DISPLAY true + #define HAS_BLUETOOTH true #elif BOARD_MODEL == BOARD_RNODE_NG_20 const int pin_cs = 18; const int pin_reset = 12; diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index 38cd347..555ea86 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -660,13 +660,14 @@ void serialCallback(uint8_t sbyte) { } cbuf[frame_len++] = sbyte; } - - if (frame_len == 9) { - uint8_t line = cbuf[0]; - if (line > 63) line = 63; - int fb_o = line*8; - memcpy(fb+fb_o, cbuf+1, 8); - } + #if HAS_DISPLAY + if (frame_len == 9) { + uint8_t line = cbuf[0]; + if (line > 63) line = 63; + int fb_o = line*8; + memcpy(fb+fb_o, cbuf+1, 8); + } + #endif } else if (command == CMD_FB_READ) { if (sbyte != 0x00) { kiss_indicate_fb(); diff --git a/Utilities.h b/Utilities.h index 200afdf..d5ed1e7 100644 --- a/Utilities.h +++ b/Utilities.h @@ -603,7 +603,7 @@ void kiss_indicate_fbstate() { serial_write(0x00); } #else - serial_write(0xFF) + serial_write(0xFF); #endif serial_write(FEND); } @@ -619,7 +619,7 @@ void kiss_indicate_fb() { serial_write(byte); } #else - serial_write(0xFF) + serial_write(0xFF); #endif serial_write(FEND); }