From 4b48f41c380797f1b4a8636395eb889ebaac611c Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 8 Dec 2024 13:49:07 +0100 Subject: [PATCH] Added display read command --- Framing.h | 1 + RNode_Firmware.ino | 6 +++--- Utilities.h | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Framing.h b/Framing.h index efa4b31..c124ffb7 100644 --- a/Framing.h +++ b/Framing.h @@ -52,6 +52,7 @@ #define CMD_FB_READ 0x42 #define CMD_FB_WRITE 0x43 #define CMD_FB_READL 0x44 + #define CMD_DISP_READ 0x66 #define CMD_DISP_INT 0x45 #define CMD_DISP_ADDR 0x63 #define CMD_DISP_BLNK 0x64 diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index 57a7f2f..d1e9237 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -973,9 +973,9 @@ void serialCallback(uint8_t sbyte) { } #endif } else if (command == CMD_FB_READ) { - if (sbyte != 0x00) { - kiss_indicate_fb(); - } + if (sbyte != 0x00) { kiss_indicate_fb(); } + } else if (command == CMD_DISP_READ) { + if (sbyte != 0x00) { kiss_indicate_disp(); } } else if (command == CMD_DEV_HASH) { #if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52 if (sbyte != 0x00) { diff --git a/Utilities.h b/Utilities.h index d532220..a2b1d6c 100644 --- a/Utilities.h +++ b/Utilities.h @@ -977,6 +977,20 @@ void kiss_indicate_fb() { serial_write(FEND); } +void kiss_indicate_disp() { + serial_write(FEND); + serial_write(CMD_DISP_READ); + #if HAS_DISPLAY + uint8_t *da = disp_area.getBuffer(); + uint8_t *sa = stat_area.getBuffer(); + for (int i = 0; i < 512; i++) { escaped_serial_write(da[i]); } + for (int i = 0; i < 512; i++) { escaped_serial_write(sa[i]); } + #else + serial_write(0xFF); + #endif + serial_write(FEND); +} + void kiss_indicate_ready() { serial_write(FEND); serial_write(CMD_READY);