if-clause not work

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Micha_he
Normal user
Posts: 372
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

if-clause not work

#1 Post by Micha_he » 04 Mar 2020, 22:12

Background: I'll try to execute a rule part, only if the 'absolute' difference between the integer in VAR#1 and the smoothed dummy value (Fuellstand#WertGlatt) is less than 10 or the smoothed value is zero. Here's my if-clause:

Code: Select all

if ([INT#1]-[Fuellstand#WertGlatt])^2^.5<10 or [Fuellstand#WertGlatt]=0
...
endif
I logged the calculation ([INT#1]-[Fuellstand#WertGlatt])^2^.5) and the result is greater then 10, the smoothed value is nearly 90, but the if-tree is executed?! Where is my mistake?

Build is from 10/2019.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: if-clause not work

#2 Post by grovkillen » 04 Mar 2020, 22:15

You cannot have the formula like that. You should try using a VAR (using Let command) for that and then do the if on that [VAR#n].
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Micha_he
Normal user
Posts: 372
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: if-clause not work

#3 Post by Micha_he » 04 Mar 2020, 22:21

You mean, I've to take this way:

Code: Select all

let,2,([INT#1]-[Fuellstand#WertGlatt])^2^.5
if [var#2]<10 or [Fuellstand#WertGlatt]=0
...
endif

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: if-clause not work

#4 Post by grovkillen » 04 Mar 2020, 22:49

Yes
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Micha_he
Normal user
Posts: 372
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: if-clause not work

#5 Post by Micha_he » 04 Mar 2020, 22:53

I'll test it...

Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests