Revert to soft reset on RST irq
1 files changed, 11 insertions(+), 9 deletions(-)

M src/main.cpp
M src/main.cpp +11 -9
@@ 20,7 20,7 @@ volatile bool splashscreen;
 HPSerial *hp;
 Thread tdsp(osPriorityNormal, OS_STACK_SIZE, nullptr, "DSP");
 Ticker dsp_refresh;
-//Timeout rst_delay;
+Timeout rst_delay;
 Timeout splashscreen_timer;
 Timeout byescreen_timer;
 InterruptIn rst(HP_RST);

          
@@ 178,6 178,7 @@ void setup() {
   printf("SETUP DONE\r\n");
 
   if (rst.read() == 0)
+	// in case we reset the FP while the unit is running
     reset();
 }
 

          
@@ 188,18 189,18 @@ void end_splashscreen(void)
   must_shutdown = true;
 }
 
-/*
+
 void reset_irq_tmr(void)
 {
 	must_reset = true;
 }
-*/
+
 
 void reset_irq(void)
 {
-	must_reset = true;
-	//rst_delay.attach(callback(&reset_irq_tmr), 50ms);
-    NVIC_SystemReset();
+	//must_reset = true;
+	rst_delay.attach(callback(&reset_irq_tmr), 600ms);
+    //NVIC_SystemReset();
 }
 
 void reset(void)

          
@@ 220,6 221,7 @@ void reset(void)
 	  }
 	  dsp->power_on();
 	  dsp->cls();
+
 	  printf("Initiate startup sequence\n");
 	  if (last_key.keyevent == KEY_PRESSED) {
 		  printf("  with key pressed\n");

          
@@ 264,13 266,12 @@ void mainloop()
 	  must_shutdown = false;  // just in case...
 	  reset();
 	}
-
-	if (must_shutdown) {
+	else if (must_shutdown) {
 		must_shutdown = false;
 		dsp->cls();
 		dsp->power_off();
 	}
-
+	else {
     if (knob != 0)
     {
       if (hp != NULL)

          
@@ 388,6 389,7 @@ void mainloop()
         }
       }
     }
+	}
     //else
     ThisThread::sleep_for(1ms);
   }