diff --git a/firmware/apps.c b/firmware/apps.c index b226e95..363584d 100644 --- a/firmware/apps.c +++ b/firmware/apps.c @@ -111,8 +111,10 @@ void app_next(){ } //Initialize the new application. - if(applet->init) + if(applet->init){ + lcd_zero(); applet->init(); + } return; } diff --git a/firmware/apps/shabbat.c b/firmware/apps/shabbat.c index 5ce6b3f..22e040b 100644 --- a/firmware/apps/shabbat.c +++ b/firmware/apps/shabbat.c @@ -107,18 +107,23 @@ void shabbat_init(){ //! Exit the Shabbat application. int shabbat_exit(){ - //Return GPIO to normal, just to be safe. - exit_shabbat(); - //Good to move to the next applet. - return 0; + //After shabbat mode has been exited by pressing the SET button, + //press the MODE button to move to the next applet. + if(sidebutton_mode()){ + //Return GPIO to normal, just to be safe. + exit_shabbat(); + //Good to move to the next applet. + return 0; + }else{ + //False alarms are frequent from the mode being set, so refuse to exit. + return 1; + } } //! Draw the Shabbat screen. void shabbat_draw(){ //Use the SET button to exit Shabbat mode. if(sidebutton_set()){ - //Wait for the button to be released. - while(sidebutton_set()); //Return GPIO to normal, which should show the PANIC message. exit_shabbat(); } diff --git a/firmware/main.c b/firmware/main.c index 7cd2b14..97b04bb 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -165,10 +165,10 @@ void __attribute__ ((interrupt(WDT_VECTOR))) watchdog_timer (void) { too many polling cycles, we forcibly revert to the clock application. */ - + //Politely move to the next app if requested. if(!(latch++)){ - lcd_zero(); + //lcd_zero(); app_next(); } diff --git a/firmware/sidebutton.c b/firmware/sidebutton.c index 91490af..cf438d8 100644 --- a/firmware/sidebutton.c +++ b/firmware/sidebutton.c @@ -32,8 +32,8 @@ void sidebutton_init(){ //! Test the Mode button. int sidebutton_mode(){ - //Side button. - if(!uartactive && !(P1IN&BIT5)) + //Easily accessible side button. + if(!uartactive && !(P1IN&BIT5) && !(P1DIR&BIT5)) return 1; //Emulation. @@ -45,11 +45,11 @@ int sidebutton_mode(){ //! Test the Set button. int sidebutton_set(){ - //Side button. - if(!uartactive && !(P1IN&BIT6)) + //Recessed side button. + if(!uartactive && !(P1IN&BIT6) && !(P1DIR&BIT6)) return 1; - //Emulation, disaabled by default. + //Emulation, disabled by default. #ifdef EMULATESET if(key_scan()==0xC1) return 1;