diff options
-rw-r--r-- | arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde b/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde index 090f14e..1b5fd89 100644 --- a/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde +++ b/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde @@ -44,7 +44,7 @@ int st = 0; // alarm status (minutes from alarm - TIN) char alarms[NALARMS][5]; // alarm settings char cmin; // current minute -int a = -1; // current alarm +signed char a = -1; // current alarm char dbg = 0; // print debug informations bool ringing = false; // sound the alarm bool pressed = false; // stop button status @@ -88,10 +88,12 @@ void setup () { cmin = RTC.readData(0x0a); // This only works if the arduino had no power for a // "short" time. This is by design. :D - RTC.readClock(); - st = st + (RTC.getMinutes() - cmin) % 60; - cmin = RTC.getMinutes(); - save_status(); + if ( a >= 0 ) { + RTC.readClock(); + st = st + (RTC.getMinutes() - cmin) % 60; + cmin = RTC.getMinutes(); + save_status(); + } for ( int i = 0; i < NALARMS ; i ++ ) { for ( int j = 0; j < 5 ; j ++ ) { alarms[i][j] = RTC.readData(0x0b + i*5 + j); |