Malcolm,
I missed this part in your conversion last time.It should be testing the Stop time instead of the Current time.Code:; if the Start and Stop times are the same, then Always OFF if (lightsetHR[fn]=timeH) AND _ (lightsetMN[fn]=timeM) then AlwaysOFF
Here's the updated code.
I've run it in the simulator and it works perfectly.Code:CheckTimes: TimeCmpFlags = 0 ; clear flags first ; if the Start and Stop times are the same, then Always OFF if (lightsetHR[fn]=lightoffHR[fn]) AND _ (lightsetMN[fn]=lightoffMN[fn]) then AlwaysOFF ; is it past the Start time? if (timeH>lightsetHR[fn]) OR _ (timeH=lightsetHR[fn] AND timeM >= lightsetMN[fn])then PastStart=1 ; is it past the Stop time? if (timeH>lightoffHR[fn]) OR _ (timeH=lightoffHR[fn] AND timeM >= lightoffMN[fn])then PastStop=1 ; does the period end the following day? if (lightoffHR[fn]< lightsetHR[fn]) OR _ (lightoffHR[fn]=lightsetHR[fn] AND lightoffMN[fn] < lightsetMN[fn]) then NextDay=1 if !NextDay then ; same day, use AND if PastStart AND !PastStop then ProgON = 1 else ; next day, use OR IF PastStart OR !PastStop then ProgON = 1 endif AlwaysOFF: return
![]()




Bookmarks