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
smartell
Posts: 2
Well, I've finally been successful, and I feel as though our school's C172 simulator will work out, but I am learning as we go.

My current dilemma comes from trying to string 7-segments together. I can handle the physical constraints, but I am having a hard time with the Transform syntax.
I need to get just the last three digits of the frequency. I already know that FSX only spits out the trailing 4 (because all frequencies start with 1). What I can't quite get is how to get the transform to spit out the ones digit and the tenths and hundredths in a quick enough manner - I'm thinking I may be able to mask this faster.

Here's the Transform I've gotten to work, and it does - it just makes the display unable to keep up with the encoder, and so the display continues to update to the right frequency 10-20 seconds after the knob has been stopped.
if($>=3000,$-3000,if($>=2000,$-2000,$-1000))

Is this just something we'll have to live with?
[Last edited by smartell, 2020-09-11 17:26]
2020-09-11 16:55
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
This is working but to difficult. But i think your Problem with the "20 seconds!!!!!" delay is different. Whatever the formula is to long and difficult..... this will slow down Mobiflight just by 1-2 milliseconds .... So you will not see or feel this delay.
So for that we need to think about different problems.


About the Formula itself..... The Key is Modulo %

A Modulo Function means.... It divide the current value through a number aslong as possible. If no another divide is possible ( Number smaller as the divide factor) it result in the remain value.
For Example 1250%100 result in 50 .... It divide 12 times 100 from 1250 ..... then 50 remain and can not be divide again..... So its the result !

In your situation for frequency you read the Offset..... And you say $%1000 . Whatever it is 1xxx or 2xxx or 3xxx the result is always xxx in that case.

NOTE: If you use P3Dv4 or higher there are more usefull Offsets for this .....
Those still include the leading 1 and also the 6th diggit !
iconQuote:

05C4 4 Active COM1 frequency in Hz (32 bit int) Ok-SimC Ok-SimC
05C8 4 Active COM2 frequency in Hz (32 bit int) Ok-SimC Ok-SimC
05CC 4 Standby active COM1 frequency in Hz (32 bit int): Ok-SimC Ok-SimC
05D0 4 Standby COM2 frequency in Hz (32 bit int) Ok-SimC Ok-SimC




And LAST NOTE: Maybe rethink your logic and system. Whatever it work. It´s more tidy and logical to use ONE Display for ONE Config. I know some users build there Cockpits by glue the premae 8 Blocks together. But this is not a perfect solution.
I would think for a future project about Single Displays. You can glue them togethter, too if you like. But here every Block you use e.g. for Com1 is finaly controlled by ONE Max7219 each.
Good Luck !
2020-09-12 00:38
Avatar
smartell
Posts: 2
Yes, I was hoping to use modulo like in my old C programs but was unsure if it existed - I did finally dig up the ncalc documentation.

I completely agree with one 5-digit per frequency display, and I may wind up with that. For a proof of concept though, it worked today.

I finally wound up (as I couldn’t find the % in my documentation search) using Truncate:
$-(Truncate($-1000)*1000) will give me last three digits, and using 100 will give me two, and it is very fast. Thank you for helping me think through this process! Even as a science teacher, it’s good to still be learning.

And as I can still string all eight COM and NAV freq displays as one output device, it’ll take up only three pins whether there are six or eight actual displays. :)
2020-09-12 04:49
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi again.

Documentation is verry poor. But you can find it here i think..... https://github.com/ncalc/ncalc/wiki/Operators

About the string/chain. Your right. Thats the solution most people goes.
For me it´s different. I like a "clean" system. In the Chain all Devices got the same name ( the name of the chain) and you must choose the Sub-number.

For me it looks more logical to have 1 Display per Function..... 1 Max Chip per Display ..... 1 Max Device ( No Chain) per Devicename..... 3 Individual Pins per MaxChip.
So in Software and also in the Wirework ALL is clean and logical. Sure i need more Megas.... Got hundrets of additional wires.... But it got also advantages.
Choose your favorite way..... Both are correct basicly !

By the way.... Check informations about the MaxTubes with removeable Diggits !! like this .... https://www.amazon.de/8-Digit-Display-MAX7219-Digital-Control/dp/B00P9277BE

Helimech (Karl) build a nice system here. He uses like you a chain of Maxtubes.... But he also wire individual 4/5/6 Display Blocks on it. So he got a central "Max Bay" in the back of the Panels where all MaxChips are set and connected together..... and from here each Display got its own e.g. 12 wire line and end in the Display on the front panel.
Watch his videos on Youtube if you like.... https://www.youtube.com/watch?v=oPKrnKUcAxc
Good Luck !
2020-09-12 14:07
icon