Minor cleanup, shabbat mode fixes.

This commit is contained in:
Travis Goodspeed 2018-08-18 14:04:37 -04:00
parent f61b849469
commit c2275fb03b
4 changed files with 21 additions and 14 deletions

View File

@ -111,8 +111,10 @@ void app_next(){
}
//Initialize the new application.
if(applet->init)
if(applet->init){
lcd_zero();
applet->init();
}
return;
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;