--- PowerTimer.py.4.1.011 2016-06-03 01:21:07.136405509 +0100 +++ PowerTimer.py 2016-06-03 01:21:07.136405509 +0100 @@ -101,6 +101,18 @@ if self.backoff > 1800: self.backoff = 1800 self.log(10, "backoff: retry in %d minutes" % (int(self.backoff)/60)) +# +# If this is the first backoff of a repeat timer remember the original +# begin/end times, so that we can use *these* when setting up the +# repeat. +# A repeat timer (self.repeat != 0) is one set for a given time on a +# day. +# A timer that repeats every mins has autosleeprepeat="repeated" and +# is a different beast, which doesn't need, and mustn't have, this. +# + if self.repeated and not hasattr(self, "real_begin"): + self.real_begin = self.begin + self.real_end = self.end def activate(self): next_state = self.state + 1 @@ -245,12 +257,6 @@ if NavigationInstance.instance.RecordTimer.isRecording() or abs(NavigationInstance.instance.RecordTimer.getNextRecordingTime() - time()) <= 900 or abs(NavigationInstance.instance.RecordTimer.getNextZapTime() - time()) <= 900: self.do_backoff() # retry -# If this is the first backoff of a repeating timer remember the original -# begin/end times, so that we can use *these* when setting up the repeat. -# - if self.repeated and not hasattr(self, "real_begin"): - self.real_begin = self.begin - self.real_end = self.end self.begin = time() + self.backoff if self.end <= self.begin: self.end = self.begin @@ -416,6 +422,9 @@ if hasattr(w, "real_begin"): w.begin = w.real_begin w.end = w.real_end +# Now remove the temporary holding attributes... + del w.real_begin + del w.real_end w.processRepeated() w.state = PowerTimerEntry.StateWaiting self.addTimerEntry(w)