]> git.tnoah.ca Git - lora-radio.git/commitdiff
Added display reconditioning function
authorMark Qvist <mark@unsigned.io>
Tue, 31 Dec 2024 13:13:52 +0000 (14:13 +0100)
committerMark Qvist <mark@unsigned.io>
Tue, 31 Dec 2024 13:13:52 +0000 (14:13 +0100)
Display.h
Framing.h
Makefile
RNode_Firmware.ino

index 903d84e91952bcd1ccaf70dbd0e320675390b263..98e8920e60028bd0cfc2612870ca44c1d16b3b4c 100644 (file)
--- a/Display.h
+++ b/Display.h
@@ -99,6 +99,7 @@ uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT;
 uint8_t display_unblank_intensity = display_intensity;
 bool display_blanked = false;
 bool display_tx = false;
+bool recondition_display = false;
 uint8_t disp_target_fps = 7;
 int disp_update_interval = 1000/disp_target_fps;
 uint32_t last_page_flip = 0;
@@ -707,6 +708,21 @@ void update_disp_area() {
   }
 }
 
+void display_recondition() {
+  for (uint8_t iy = 0; iy < disp_area.height(); iy++) {
+    unsigned char rand_seg [] = {random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF)};
+    stat_area.drawBitmap(0, iy, rand_seg, 64, 1, SSD1306_WHITE, SSD1306_BLACK);
+    disp_area.drawBitmap(0, iy, rand_seg, 64, 1, SSD1306_WHITE, SSD1306_BLACK);
+  }
+
+  display.drawBitmap(p_ad_x, p_ad_y, disp_area.getBuffer(), disp_area.width(), disp_area.height(), SSD1306_WHITE, SSD1306_BLACK);
+  if (disp_mode == DISP_MODE_PORTRAIT) {
+    display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
+  } else if (disp_mode == DISP_MODE_LANDSCAPE) {
+    display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
+  }
+}
+
 void update_display(bool blank = false) {
   if (blank == true) {
     last_disp_update = millis()-disp_update_interval-1;
@@ -754,9 +770,15 @@ void update_display(bool blank = false) {
         display.clearDisplay();
       #endif
 
-      update_stat_area();
-      update_disp_area();
-
+      if (recondition_display) {
+        disp_target_fps = 30;
+        disp_update_interval = 1000/disp_target_fps;
+        display_recondition();
+      } else {
+        update_stat_area();
+        update_disp_area();
+      }
+      
       #if BOARD_MODEL != BOARD_TDECK
         display.display();
       #endif
index 37065b7ae524e3a57128e14c5af8c20448d62efe..d31af63a543895c1072eb150435fb61bbda75739 100644 (file)
--- a/Framing.h
+++ b/Framing.h
@@ -57,6 +57,7 @@
   #define CMD_DISP_ADDR   0x63
   #define CMD_DISP_BLNK   0x64
   #define CMD_DISP_ROT    0x67
+  #define CMD_DISP_RCND   0x68
   #define CMD_NP_INT      0x65
   #define CMD_BT_CTRL     0x46
   #define CMD_BT_PIN      0x62
index 0d0fb51dd829745928b384acfd57463e2c5a8ae3..3a1863403b48f9fb86f83a6dfab6f161667457a4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -181,8 +181,8 @@ upload-heltec32_v3:
        arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:heltec_wifi_lora_32_V3
        @sleep 1
        rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware.ino.bin)
-       @sleep 3
-       python ./Release/esptool/esptool.py --chip esp32-s3 --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
+       #@sleep 3
+       #python ./Release/esptool/esptool.py --chip esp32-s3 --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-tdeck:
        arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3
index 924bf3459ec6e1cd2657d24c48cebe3fd572b56c..f890cdec5e3bc5cb19df8a106b301dadb7f6d0ec 100644 (file)
@@ -1098,7 +1098,6 @@ void serialCallback(uint8_t sbyte) {
             db_conf_save(sbyte);
             display_unblank();
         }
-
       #endif
     } else if (command == CMD_DISP_ROT) {
       #if HAS_DISPLAY
@@ -1113,7 +1112,20 @@ void serialCallback(uint8_t sbyte) {
             drot_conf_save(sbyte);
             display_unblank();
         }
-
+      #endif
+    } else if (command == CMD_DISP_RCND) {
+      #if HAS_DISPLAY
+        if (sbyte == FESC) {
+            ESCAPE = true;
+        } else {
+            if (ESCAPE) {
+                if (sbyte == TFEND) sbyte = FEND;
+                if (sbyte == TFESC) sbyte = FESC;
+                ESCAPE = false;
+            }
+            if (sbyte > 0x00) recondition_display = true;
+            display_unblank();
+        }
       #endif
     } else if (command == CMD_NP_INT) {
       #if HAS_NP