@@ 29,7 29,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);
@@ 235,21 235,22 @@ void setup() {
void end_splashscreen(void)
{
- // print is forbidden here because we are in an ISR context here
- //printf("End of splash screen CB\r\n");
splashscreen = false;
- dsp->cls();
- dsp->power_off();
+ // wait for the reset irq from the CPU board
+ must_shutdown = true;
}
+/*
void reset_irq_tmr(void)
{
must_reset = true;
}
+*/
void reset_irq(void)
{
- rst_delay.attach(callback(&reset_irq_tmr), 50ms);
+ must_reset = true;
+ //rst_delay.attach(callback(&reset_irq_tmr), 50ms);
}
void reset(void)
@@ 258,13 259,13 @@ void reset(void)
printf("Reset connection to the main unit\n");
if (DigitalIn(HP_RST).read() == 0) {
byescreen_timer.detach(); // cancel a "poweroff", if any
+ splashscreen_timer.detach(); // same for splashscreen
splashscreen = false; // in case it still on
if (hp == NULL) {
printf("setup HP communication handler\r\n");
hp = new HPSerial(HP_TX, HP_RX);
- }
- else {
+ } else {
printf("Connection already initialized\n");
}
@@ 274,10 275,12 @@ void reset(void)
dsp->power_on();
dsp->cls();
printf("Initiate startup sequence\n");
- if (last_key.keyevent == KEY_PRESSED)
+ if (last_key.keyevent == KEY_PRESSED) {
+ printf(" with key pressed\n");
hp->send_startup_seq(kp_mapping[last_key.row][last_key.col]);
- else
+ } else {
hp->send_startup_seq();
+ }
}
else
{
@@ 310,10 313,13 @@ void mainloop()
while(1) {
if (must_reset) {
must_reset = false;
+ must_shutdown = false; // just in case...
reset();
}
+
if (must_shutdown) {
must_shutdown = false;
+ dsp->cls();
dsp->power_off();
}