No MSG Branch defined again !
Posted: Thu Mar 01, 2018 4:25 am
Hi all !
Maybe I found a bug on Msgbranch command.
this is my code :
Msgreturn works fine ONLY if the ACTION variable is equal to TEM (first IF.. THEN block) or if the ACTION variable doesn't match NONE of the IF..THEN blocks (NOK is returned).
For all other IF.. THEN blocks Msgreturn give "No MSG Branch defined" message, even if the related block is correctly performed.
Maybe the "DELAY" or "DO.. END LOOP" commands affects negatively Msgreturn ?
Thank you.
Maybe I found a bug on Msgbranch command.
this is my code :
Code: Select all
msgbranch [azione]
Button "Esci",[uscita]
wait
[azione]
esito = "NOK"
action=msgget("act")
if action == "TEM" then
temperature=DHT.TEMP()
humidity= DHT.HUM()
sendts("W5RQDTRSNKD113J6","3",str(temperature) & "&field4=" & str(humidity))
esito=temperature&"x"&humidity
end if
if action == "ON1" then
tmr1=0
ora1="0"
minuti1="0"
io(po,D5,1)
Do
sendts("W5RQDTRSNKD113J6","1","1")
delay 5000
action= readts("5L3ICJTZZH1PYZL6","415417","1")
loop until action == "1"
action = "ON1"
esito="OK"
end if
if action == "ON2" then
tmr2=0
ora2="0"
minuti2="0"
io(po,D6,1)
Do
sendts("W5RQDTRSNKD113J6","2","1")
delay 5000
action= readts("5L3ICJTZZH1PYZL6","415417","2")
loop until action == "1"
action = "ON2"
esito="OK"
end if
if action == "OF1" then
tmr1=0
ora1="0"
minuti1="0"
io(po,D5,0)
Do
sendts("W5RQDTRSNKD113J6","1","0")
delay 5000
action= readts("5L3ICJTZZH1PYZL6","415417","1")
loop until action == "0"
action = "OF1"
esito="OK"
end if
if action == "OF2" then
tmr2=0
ora2="0"
minuti2="0"
io(po,D6,0)
Do
sendts("W5RQDTRSNKD113J6","2","0")
delay 5000
action= readts("5L3ICJTZZH1PYZL6","415417","2")
loop until action == "0"
action = "OF2"
esito="OK"
end if
if len(action)=5 then
rele=left(action,1)
if rele=="1" then
minuti1=right(action,2)
ora1=mid(action,2,2)
tmr1=1
io(po,D5,1)
else
minuti2=right(action,2)
ora2=mid(action,2,2)
tmr2=1
io(po,D6,1)
end if
esito=right(action,4)
Do
sendts("W5RQDTRSNKD113J6",rele,esito)
delay 5000
action = readts("5L3ICJTZZH1PYZL6","415417",rele)
loop until action == esito
esito="OK"
Timer 55000, [controra]
end if
msgreturn esito
wait
[uscita]
Timer 0
end
Msgreturn works fine ONLY if the ACTION variable is equal to TEM (first IF.. THEN block) or if the ACTION variable doesn't match NONE of the IF..THEN blocks (NOK is returned).
For all other IF.. THEN blocks Msgreturn give "No MSG Branch defined" message, even if the related block is correctly performed.
Maybe the "DELAY" or "DO.. END LOOP" commands affects negatively Msgreturn ?
Thank you.