cce151e4bf3d — David Douard 4 years ago
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
1 files changed, 8 insertions(+), 2 deletions(-)

M src/main.cpp
M src/main.cpp +8 -2
@@ 255,6 255,8 @@ void reset(void)
   // 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 @@ void mainloop()
 
 	  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);
 	  }