src/main.cpp

changeset 68
a0f97359f266
parent 65
d9c5eaf85fab
child 69
516acbbce05a
--- a/src/main.cpp	Thu Oct 07 21:05:13 2021 +0200
+++ b/src/main.cpp	Thu Oct 07 21:05:59 2021 +0200
@@ -20,7 +20,7 @@
 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 @@
   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 @@
   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 @@
 	  }
 	  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 @@
 	  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 @@
         }
       }
     }
+	}
     //else
     ThisThread::sleep_for(1ms);
   }

mercurial