add safety: ensure button is pressed before erasing
This commit is contained in:
parent
5162c29607
commit
bcf548583f
|
@ -362,10 +362,12 @@ static void interrupt(void) __interrupt 0
|
|||
} else {
|
||||
led_on();
|
||||
}
|
||||
/* pressed for 5s, clear memory */
|
||||
/* button pressed for 5s, clear memory */
|
||||
if (hold==20) {
|
||||
led_on();
|
||||
clear_memory();
|
||||
if (!(PORTB&SWITCH1)) { /* ensure the button is pressed */
|
||||
clear_memory();
|
||||
}
|
||||
led_off();
|
||||
TMR4ON = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue