Rules problem...

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Rules problem...

#1 Post by Shardan » 15 Mar 2019, 01:44

Hi all,
testing with some rules, tested with Mega version mega-20190311
With running into problems i tried an old MegaV2, same result.

Code: Select all

on System#Boot do
   gpio,2,0
   timerset,1,10    //Set Timer 1
enddo

on rules#timer=1 do    //if Timer1 expires
   taskvalueset 5,1,1   //set dummy#var1 to 1
   timerset,2,10   //Set Timer2
enddo

on rules#timer=2 do   //If Timer2 expires
   taskvalueset 5,1,0   //set dummy#var1 to 0  
   timerset,1,10   //Set Timer1
enddo

on dummy#var1 do    //If dummy#var1 changes
   gpio,2,[dummy#var1]  //Set GPIO2 to dummy#var1
enddo
It seems that only the "om System#Boot do" is executed.

The dummy#var1 is set to the last taskvalueset command, GPIO2 is set to that value.
Swapping taskvalueset 5,1,1 and taskvalueset 5,1,0 shows it always remains on the last taskvalueset value.
The timer1/Timer2 sequence should toggle it but does not. I don't see any timer events in the log.

Second problem
The GPIO2 is set to that value only once.
If i manually send a taskvalueset, the "on dummy#var1 do" is not recognized.
By the log the event from dummy#var 1 is generated.
It seems to me that even the "On dummy#var1" is not executed.

What is going wrong? Maybe I'm partially blind again ;)
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Rules problem...

#2 Post by Shardan » 15 Mar 2019, 02:04

Hello again,

Some more info

The timer-part seems to be a problem with setting the timer value.
With rebooting and external (serial) logger i see the following:

Code: Select all

EVENT: System#Boot
ACT  : timerSet,1,10
ACT  : enddo
ACT  : on Rules#Timer=1 do
ACT  : taskvalueset 5,1,0
ACT  : timerSet,2,10
ACT  : enddo
ACT  : on Rules#Timer=2 do
ACT  : taskvalueset 5,1,1
ACT  : timerSet,1,10
ACT  : enddo
These steps are not executed after 10 seconds but at once.
Seems the "timerSet,1,10" is not correct.

The event on changing "dummy#var1" is generated if I change the value manually:

Code: Select all

EVENT: dummy#var1=0.00 
but the "gpio,2,[dummy#var1] is not executed.
Regards
Shardan

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Rules problem...

#3 Post by ThomasB » 15 Mar 2019, 03:55

enddo is incorrect syntax. Correct usage is endon.

Revised rules with syntax corrections:

Code: Select all

on System#Boot do
   gpio,2,0
   timerset,1,10       //Set Timer 1
endon

on rules#timer=1 do    //if Timer1 expires
   taskvalueset 5,1,1  //set dummy#var1 to 1
   timerset,2,10       //Set Timer2
endon

on rules#timer=2 do    //If Timer2 expires
   taskvalueset 5,1,0  //set dummy#var1 to 0  
   timerset,1,10       //Set Timer1
endon

on dummy#var1 do        //If dummy#var1 changes
   gpio,2,[dummy#var1]  //Set GPIO2 to dummy#var1
endon

- Thomas

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Rules problem...

#4 Post by Shardan » 15 Mar 2019, 17:02

Grrrr... 6 weeks away and everything is forgotten..

Many thanks, i knew i was blind....
Regards
Shardan

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Rules problem...

#5 Post by budman1758 » 16 Mar 2019, 17:36

Grrrr... 6 weeks away and everything is forgotten..
They say the first thing that goes is memory....... Can't remember what the second thing was....... :lol: :lol:
"The glass is twice as big as it needs to be".

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Rules problem...

#6 Post by Shardan » 16 Mar 2019, 20:30

definitely right, from my own experience......

:D
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests