Proper storing the initial timer time.

This commit is contained in:
Pecusx
2017-03-08 22:30:35 +01:00
committed by GitHub
parent e6acd1ddcc
commit 907b931e85
+5 -3
View File
@@ -353,7 +353,7 @@ class Radio:
now = int(time.time()) # (Pecus) now = int(time.time()) # (Pecus)
self.timeTimer = now - self.timerValue * 60 # (Pecus) self.timeTimer = now - self.timerValue * 60 # (Pecus)
self.fireTimer() # (Pecus) self.fireTimer() # (Pecus)
time.sleep(0.5) time.sleep(0.5) # Zapobiega przewinieciu sie calego tytulu pandory na LCD przed wylaczeniem... dlaczego???
self.setInterrupt() # (Pecus) self.setInterrupt() # (Pecus)
time.sleep(0.5) # Zapobiega przewinieciu sie calego tytulu pandory na LCD przed wylaczeniem... dlaczego??? time.sleep(0.5) # Zapobiega przewinieciu sie calego tytulu pandory na LCD przed wylaczeniem... dlaczego???
self.setInterrupt() # (Pecus) self.setInterrupt() # (Pecus)
@@ -1157,7 +1157,7 @@ class Radio:
if now > self.timeTimer + self.timerValue * 60: if now > self.timeTimer + self.timerValue * 60:
fireTimer = True fireTimer = True
# Store fired value # Store fired value
self.storeTimer(self.timerValue) # self.storeTimer(self.timerValue)
self.timerOff() self.timerOff()
return fireTimer return fireTimer
@@ -1532,7 +1532,6 @@ class Radio:
# If a reload has been issued return to TIME display # If a reload has been issued return to TIME display
if self.getReload(): if self.getReload():
display_mode = self.MODE_TIME display_mode = self.MODE_TIME
elif self.search_index+1 != self.current_id: # zmiana kanalu radiowego lub utworu przez menu elif self.search_index+1 != self.current_id: # zmiana kanalu radiowego lub utworu przez menu
self.current_id = self.search_index+1 self.current_id = self.search_index+1
self.play(self.current_id) self.play(self.current_id)
@@ -1549,6 +1548,9 @@ class Radio:
if self.optionChanged(): if self.optionChanged():
display_mode = self.MODE_TIME display_mode = self.MODE_TIME
self.optionChangedFalse() self.optionChangedFalse()
# If new time of Timer is set - Save it
if self.timerValue != self.getStoredTimer():
self.storeTimer(self.timerValue)
self.setDisplayMode(display_mode) self.setDisplayMode(display_mode)
return return