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 {
|
} else {
|
||||||
led_on();
|
led_on();
|
||||||
}
|
}
|
||||||
/* pressed for 5s, clear memory */
|
/* button pressed for 5s, clear memory */
|
||||||
if (hold==20) {
|
if (hold==20) {
|
||||||
led_on();
|
led_on();
|
||||||
clear_memory();
|
if (!(PORTB&SWITCH1)) { /* ensure the button is pressed */
|
||||||
|
clear_memory();
|
||||||
|
}
|
||||||
led_off();
|
led_off();
|
||||||
TMR4ON = 0;
|
TMR4ON = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue