Small fixes in main draft

Mon, 23 Nov 2020 21:55:40 +0100

author
David Douard <david.douard@sdf3.org>
date
Mon, 23 Nov 2020 21:55:40 +0100
changeset 57
cce151e4bf3d
parent 56
c296edace64a
child 58
c1dfd75f2842

Small fixes in main

- toggle the shift indicator when the key is pressed while already on
- attempt to fix the restart-while-shuting-down bug

src/main.cpp file | annotate | diff | comparison | revisions
--- a/src/main.cpp	Tue Nov 17 20:21:11 2020 +0100
+++ b/src/main.cpp	Mon Nov 23 21:55:40 2020 +0100
@@ -255,6 +255,8 @@
   // this should be called as a result of the HP_RST pin going LO
   printf("Reset connection to the main unit\n");
   if (DigitalIn(HP_RST).read() == 0) {
+	  byescreen_timer.detach(); // cancel a "poweroff", if any
+
     if (hp == NULL) {
       printf("setup HP communication handler\r\n");
       hp = new HPSerial(HP_TX, HP_RX);
@@ -335,8 +337,12 @@
 
 	  if ((keycode == KC_SHIFT) && (key.keyevent == KEY_PRESSED))
 	  {
-		  shift = true;
-		  dsp->set_flag_status(0x0E, true);
+		  // toggle the shift indicator
+		  if (shift)
+			  shift = false;
+		  else
+			  shift = false;
+		  dsp->set_flag_status(0x0E, shift);
 		  dsp->draw_flag(0x0E);
 	  }
 

mercurial