aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKing Kévin <kingkevin@cuvoodoo.info>2014-08-04 10:47:32 -0700
committerKing Kévin <kingkevin@cuvoodoo.info>2014-08-04 10:47:32 -0700
commitbcf548583fa82acaac4f9829399cba47f21a5cf4 (patch)
tree2f30baeac91426690b9164c54483de1e6d0d64e2
parent5162c296077b2a1fe3b56607b403521322532be0 (diff)
add safety: ensure button is pressed before erasing
-rw-r--r--pic/MDR/MDR.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pic/MDR/MDR.c b/pic/MDR/MDR.c
index 0b648e4..259ef08 100644
--- a/pic/MDR/MDR.c
+++ b/pic/MDR/MDR.c
@@ -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;
}