MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
RJPotts
Posts: 13
Supporter
Hi,

I'm new to Mobiflight, so much so in fact that I first downloaded it yesterday!

I've been trying out an Arduino Mega (clone) and some cheap rotary encoders, as a bit of an experiment, before deciding what I'm going to create for real.

I got encoders working for autopilot heading and altitude, both seem to work ok. I decided to use the button on the heading encoder to set the autopilot heading mode / state.

I tried setting up the button with just the on-press condition, with a value of 'IF($=1,0,1)' but I couldn't get it to work. Eventually I set an output for the offset (named 'AP Hdg Out') and confirmed that it's 1 or 0. I tried setting up the button to be 1 on press and 0 on release and that would work (but who would want to have to keep their finger on the button!). I setup two inputs (i.e. one for on & one for off), with an AP Hdg Out = 1 condition for the off and an AP Hdg Out = 0 for the on.

It works but I wondered, should the first method (using just the on press and value 'IF($=1,0,1)') work or is it necessary to use two inputs alongside an output?

Best regards
Richard
2021-03-27 15:59
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 4647
Supporter
Hi

Your on the right way.... And if your testing with Press and Relase work we can be sure the master Logic also work.

Your Issue is the SYNTAX......
In Mobiflight ( and the used NCALC Expression Plugin) there is a difference between capital or non capital chars.....

IF($=1,0,1) will NOT work..... but if($=1,0,1) work fine

Check the Manual..... https://github.com/ncalc/ncalc/wiki/Functions


So for example "Round" work..... "round" or "ROUND" will not.
"If" or "IF"or "iF" will not work..... "if" will do !
Good Luck !
2021-03-27 22:22
Avatar
RJPotts
Posts: 13
Supporter
Many thanks indeed for such a quick reply.

I feel a bit daft for not having thought of the case!

Best regards
Richard
2021-03-27 22:29
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 4647
Supporter
;) Keep Cool

Believe in me..... We all do this misstake.

I remember to one of my first requests here 4 years ago..... Same Problem..... "round" and "Round" :P
Good Luck !
2021-03-28 01:12
icon