Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Logic problem in my response - but I can't find it
#1
I have a response associated with a CBUS switch in the kitchen which I use to call the kids down to dinner by flashing their bedroom lights on & off 10 times....

When I initially uploaded it & tested it, it worked perfectly, as it has numerous other times, however, I\'ve noticed it very often doesn\'t... I *think* it might be working the first time only after a system reset, and thereafter not working, which obviously made me look for a counter or flag not getting reset in the code and thus failing a conditional test... but I\'ve poured over the code for ages, and I can\'t see what would stop it working... I\'ll paste the full response code below:

******************************************************

If Counter Counter201 = 0 Then ! On FIRST loop only, do some initialisation
    Announce Call Children
    Copy Counter CBUSVictoriLight To Counter205 ! Save current level of Victorias light
    Copy Counter CBUSAdamsLight To Counter206 ! Save current level of Adams light
End If
If Counter Counter201 <= 10 Then ! Loop will repeat 10 times
    Do KidsBedLightON ! Response turns both rooms lights on at 100%
    Do KidsBedLightOFF After 1 Seconds Using FlashKids-timer1 ! Response turns both rooms lights OFF
    If Counter Counter201 = 10 Then ! After 10 loops restore everything to normal & exit
        Set Counter201 = 0 ! Reset counter 201 back to 0
        Copy Counter Counter205 To CBUSVictoriLight ! Restore Victorias light to previous level
        Copy Counter Counter206 To CBUSAdamsLight ! Restore Adams light to previous level
        Exit Response
    End If
    Increment Counter201
    Say Number
    Do FlashKidsBedroom After 2 Seconds Using FlashKids-timer2 ! Response recursively calls itself with a delay
End If

*****************************************************

When it doesn\'t work, it only partially doesn\'t work... it *always* does the announcement \"Call children\" which is conditional on counter201=0 so from that I know that I must be resetting counter 201 to 0 at the end of the response... however, what does NOT happen is the announcement of the number (I have 1... 2... 3... etc. announced on the keypad so I can be aware of the response running), and the lights do not flash...

To be clear, the 2 responses called to turn the lights on & off, definitely don\'t do anything other than a CBUS group on/off command, so they can\'t be having any impact on the conditional logic...

Can anyone figure out why the response always starts, but doesn\'t always get to the main code block?

Cheers

 

Paul G.

 
Reply
#2
I cannot see anything wrong with the response either

can you check \"Show status\"  for the counters that are used especially 201 and then Execute the Response. It would be useful to see how the counter changes

Perhaps the timer should be increased to say 4 seconds to see if that is a factor inhibiting the say number. I think only 1 announcement can be made at a time so if the previous announcement is not completed, the new announcement may not be heard
Reply
#3
I have had problems where the keypad dioes not send full comands when I have uploaded comfiguration files to the comfort panel, sometimes you have to also upload the kepads after files have been loaded upto your comfort panel. it seems like that the keypads becomes slightly disjointed from the comfort panel.

Give it a try if it works
Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)