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! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
Karl_Yoghurt
Posts: 6
Hi
I connect 4002 to MobiFlight for display ALT and Speed param.
But i cant fin procedure of rounding
For example:
Current speed 353, i want see 350 - last digit should be round
what i will do?
Thanks
2020-09-10 20:36
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi
If this is a example.... Then its a bad example ;)
I hope you not like to do this.... Make no sense to round a Speed to fully 10 knots up and down!

It´s also a special situation cause you try to round a Full number, but the rounding logic in code is build to round decimal numbers . In your example it is needed to divide the Full number at first to get a decimal that we could round. Finaly you multiply the result again to get the old format back.
like 353 / 10 = 35,3 ------ 35,3 rounded is 35 --------- 35*10=350

So hopefully this was just a "bad" example, I will now explane the normal rounding we use if the value is decimal.


SYNTAX: Round(Value,Number of decimals) e.g. Round($,2) This will round the current Config Value ($) to a number with 2 decimals .
For example $= 123,5251 Here Round($,2) result in 123,53 ...... If you use Round($,1) it result in 123,5 ....... Finaly Round($,0) result in 124 ( No decimals)

NOTE: Its important to use "Round" a big "R" and a small "ound" ........... "round" or "ROUND" will occure in a Error. Also get sure you use a decimal.... not a point !



At Last to awnser the initial example question ( whatever senseless) To get 350 from 353 you use Round($/10,0)*10
Good Luck !
2020-09-11 11:18
Avatar
Karl_Yoghurt
Posts: 6
thanks for example , it was vary helpful
were i can look on full MobiFlight SYNTAX?
[Last edited by Karl_Yoghurt, 2020-09-13 09:11]
2020-09-13 08:44
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi again.

Badly the Syntax is a external Library..... The Documentation is verry poor.
https://github.com/ncalc/ncalc/wiki

If you got basic knwoledge aboit c# or other rudimentary programming languages then most is self explaned.
Good Luck !
2020-09-13 23:46
icon