bluegaspode;506394 Wrote:
> Ben - you optimized the sledgehammer too much.
>
> It had a line
> >
Code:
--------------------
> >
> if self.alarmInProgress == 'server' then
>
--------------------
> >
> once ... now this is missing - whenever the server reconnects the
> fallback alarm will fire now :)
>
> Mnyb - I guess you can start the alarm whenever you restart your
> server - Cool !
Actually my fix is different than that. IMO the sledgehammer routine
needs to check self.alarmInProgress to see if the hammer boolean should
be true
Code:
--------------------
=== AlarmSnoozeApplet.lua
==================================================================
--- AlarmSnoozeApplet.lua (revision 38121)
+++ AlarmSnoozeApplet.lua (local)
@@ -38,7 +38,7 @@
jnt:subscribe(self)
self.alarmTone = "applets/AlarmSnooze/alarm.mp3"
- self.alarmInProgress = 'none';
+ self.alarmInProgress = nil
local timeToAlarm
local startTimer = false
@@ -127,7 +127,7 @@
self:getSettings()['alarmNext'] = false
self:storeSettings()
self:_setWakeupTime('none')
- self.alarmInProgress = 'none'
+ self.alarmInProgress = nil
-- might want to qualify whether or not to stop this timer dependent upon
whether it's already running.
-- for now just log the information
if self.RTCAlarmTimer:isRunning() then
@@ -186,7 +186,7 @@
--debug.dump(status)
log:warn('alarm_sledgehammerRearm(', caller,'): ', self.alarmInProgress, '
alarm in progress - audioState is ', status.audioState)
- if status.audioState ~= 1 then
+ if self.alarmInProgress and status.audioState ~= 1 then
hammer = true
end
@@ -279,7 +279,7 @@
log:info('notify_serverDisconnected: ', server, ' is now disconnected')
-- blindly check state here irrespective of which server caused this
notification
- if self.alarmInProgress ~= 'none' and self.alarmInProgress ~= 'rtc'
then
+ if self.alarmInProgress and self.alarmInProgress ~= 'rtc' then
if not self.localPlayer:isConnected() then
log:warn('notify_serverDisconnected: ', server, ' - while server alarm in
progress! state ', self.alarmInProgress, ' triggering fallback alarm!')
self:openAlarmWindow('rtc')
@@ -490,7 +490,7 @@
if self.decodeStatePoller:isRunning() then
self.decodeStatePoller:stop()
end
- self.alarmInProgress = 'none'
+ self.alarmInProgress = nil
self.alarmWindow = nil
end
)
@@ -512,7 +512,7 @@
end
end
- self.alarmInProgress = 'none'
+ self.alarmInProgress = nil
self:_stopTimer()
self.alarmWindow:playSound("WINDOWHIDE")
self:_hideAlarmWindow()
--------------------
So basically, quit using the 'none' string and instead nil out
self.alarmInProgress, and then check for self.alarmInProgress as well as
audioState not equal to 1 for the hammer rearm. Make sense?
FYI, tests look good so far with this patch
#!/ben
--
bklaas
Logitech Developer:
Squeezeplay/SqueezeOS/SqueezeboxController/SqueezeCenter
Community Developer: Nokia770Skin
http://www.last.fm/user/bklaas/
'KHAAAN!' (http://khaaan.com/)...'BUNNIES!'
(http://home.pacbell.net/bettychu/2003allbreedbisris/BIS.html)
------------------------------------------------------------------------
bklaas's Profile: http://forums.slimdevices.com/member.php?userid=58
View this thread: http://forums.slimdevices.com/showthread.php?t=74025
_______________________________________________
beta mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/beta