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
torbentheisen
Posts: 6
Hi all!

Just looking for a steer in the right direction.

I'm putting together various components for a Pilatus PC12 sim and I've been working on a voltage indicator at the moment.

When I turn the battery switch off to power down the aircraft the Voltage indicator should turn off too, so I've used the 'Compare' command to write the display as 'Space,space,space' (its a 3 digit readout of voltage, maximum 25.0 and minimum 16.0) to simulate the indicator being turned off which works just about perfectly, when I turn the battery master off, the indicator turns off and when I turn the battery master on the indicator turns on.

The issue that I'm having is that when I turn the battery master off, the indicator turns off too but the decimal point of the second digit remains illuminated, is there a way to write this as a 'space' too in order to turn the display off completely?

As it stands I'm using a max7219 to control the 7 segment displays and I'm fairly confident in getting it to work and display what I need it to I just can't get it to accurately simulate a power-down.

Thanks for your help!
2018-03-06 17:53
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi
Welcome to Mobiflight.

Your requested system is possible.... Whatever it´s a bit more difficult.

I think you do it at the moment with a compare of the Offset value itself ( And NOT by the Battery Switch offset like normaly) .... You say for example "If Value of Voltage is below xxx then use Space Space Space instead of original value " right ??

In that Case the Decimal Point stay on cause the decimal point have no indication to the value or to space signs... Its like "hardcoded".... If you use it ( with checkmark in display tab) then its ON all the time.

To solve this you need to work with a Double Config and Precondition....
Then you got Display Config A that show Value of Voltage Offset.... And there the Decimal Point is active ! ( Like you do at the moment only without the compare)
In a second Config B ( That is control the SAME Display Diggits as Device) you define a output of Space Space Space all the time 8 by Compare) . Here NO Decimalpoint is used.
Finaly you need a 3.rd config that is used as Indicator for precondition ( Maby the 2 Configs itself or a other config like Battery switch status)
Now you say in Config A " Only work if Indicator Config say Battery is ON" and in Config B " Only work if Battery is OFF)

Result: Config A show value with decimal Point.... Config B show Blank without Decimal Point ! the Indicator set what Config is active at the moment !
Good Luck !
2018-03-06 21:10
Avatar
torbentheisen
Posts: 6
Hello! Thanks for the fast reply!

So I've tried what you suggested but I still cant get it to work, I understand the idea though and I'm sure I'm just making a simple mistake.




I have 3 configs

MBV_on
FSUIPC offset of 2870, Transformed by *10 to allow for a decimal place
No Compare
Display to display 1, boxes 6,7,8 ticked and the decimal point for 7
No precondition

MBV_off
FSUIPC offset of 2870, Transformed by *10 for the decimal again
Compare If current value is <17 set it to ''space'' ''space'' ''space'' else set it to (nothing, do I need to set something in here?
Display to display 1, boxes 6,7,8 ticked and no decimal
No precondition

MBV_output
FSUIPC offset of 2870, Transformed by *10 for the decimal
No Compare
Display to display1, boxes 6,7,8 ticked and no decimal (do I need one?)
Config item Precondition types
Precondition 1 MBV_on>=17
Precondition 2 MBV_off<17



I'm getting the correct voltage indication output, but the decimal point continues to flicker and when the battery goes flat or the master is turned off the numbers turn to zeros and all three (and the decimal) continue to flash.

I'm also getting a 'Precondition is not satisfied' warning on the MBV_output config.

Any suggestions of what I've missed?

Thanks again!
2018-03-07 15:49
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
:) Yes you did a mistake.... and the reported problems like flickering Decimapoint and flickering Numbers in case of Battery Off are exactly the result of your current wrong settings !

Do it so.....

MBV_on
FSUIPC offset of 2870, Transformed by *10 to allow for a decimal place
No Compare
Display to display 1, boxes 6,7,8 ticked and the decimal point for 7
Precondition: Only work if Indicator Config ( In this example "MBV_Readout") is >= 17


MBV_off
FSUIPC offset of 2870, Transformed by *10 for the decimal again
Compare If current value is <17 set it to ''space'' ''space'' ''space'' else set it to (nothing, do I need to set something in here?
Display to display 1, boxes 6,7,8 ticked and no decimal
Precontiton: Only work if Indicater Config ( the same like in the MBV_on Config) is <17

NOTE: Here you normaly not need to work with Offset 2870 or with Tansform.
You can use here Offset 0000 Size 1 Byte and you say in Compare If Value = 1 THEN "Space Space Space" ELSE " Space Space Space". Important here is... If this Config is active it must show ALWAYS Space Space Space .... So it is not importan for us that this config show the MBV Value cause we compare it ALWAYS to "Space"


MBV_Readout
FSUIPC offset of 2870, Transformed by *10 for the decimal
No Compare
NO DISPLAY selected.... this Config is only for indication and need no device!
NO Precondition is needed here.


Note: We define the Value of "MBV_Readout" in the other two preconditions to say what config is active at the moment..... In this example we say Config A work if indicator is >=17
and Config B work if Indicator is <17 .
Here we have "17" cause you use in Indicator Config the transform "$*10"
You can do this in lots of other ways, too....
1. If you not use this Transform you must say Only work if Value is >=1.7 or Only work if Valie is <1.7 ( cause now you not multiply it with *10)
2. Or you can say in indicator config a compare like If Value >=1.7 THEN "1" ELSE "0"
Now this Config is 1 if Display should be ON and 0 if Display should be OFF....
In that case the Preconditions in the A and B Config will be Only work if MBV Readout = 1 for Config A ...... And Only work if MBV Readout = 0 for Config B

Summary: The Precondition MUST be set in the Config you like to Controll..... the Target Config you use in this Precondition is the "Readout" Config.
And awlays get shure a Display is controlled AT ALL TIME by a Config.... So if you disable a Config get shure a other config is active now.
Good Luck !
2018-03-07 17:31
Avatar
torbentheisen
Posts: 6
Ah right I've got it now! so its all working now thank you so much!

The only thing that I'd like to add to it now is this:

In the real aircraft, once the battery voltage drops below 17, the displays turn off completely, at the moment if I turn the master battery off, then everything powers down correctly however if I left the engine running and loaded up the battery but turned the generators off the voltage is coming down to 16.9V and then it is staying illuminated whilst in the Sim the aircraft's electrical system powers down.

Is there a way to turn the display off too once the voltage drops below 17V?
Would I use another precondition?

Thanks! slowly getting used to it all!
2018-03-07 18:41
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Sorry i not understand your question finaly....

You say in your config that Display should get Blank if Value of Offset 2870 is below 17 and it should be work if value is above 17 or exactly 17.
Your config did exactly that.

Maby i see the problem.... Please Confirm ... What is the Mobiflight OUTPUT Value of your MBV Readout Config ??
Note: the Precondition always work with the OUTPUT Value of your Indicator Config... NOT with the Raw FSUIPC Value.
So Indicater is the value after a optional Transform, Compare, Interpolation and so on.

I Don´t know the Offset 2870 ... Are i´m right that this Offset show a RAW Value like 17,3xxxxxx if Voltage is for exampe 17,3 v ???
You say.... "FSUIPC offset of 2870, Transformed by *10 to allow for a decimal place"
So do i understand correct you multiply for example 17,3 with 10 to get 173 to show it on your Display ????

If YES then the preconditions / or / the transform in the Readout Config is wrong....

You say "Only work if MBV_Readout is <17 ...... But you already multiply this value in the Readout Config.... So 17v means the Offset is after transform 170 and not 17,0
So your Precondition must be Only work if Readout Config <170

In Your case you say Only work if Voltage is below 17 but 17 ( with Multuiply means 1,7 v in real )
So your Display would get blank if power is below 1,7 Volt like with a full "0 Volt" battery OFF.... But it stay On at 16,9 cause you say 1,7 is the border !

Alternate: Simply let the Preconditions like now and remove the Transform $*10 in hte READOUT Config.... Then 17 is correct cause the value is raw now.



I hope my result was correct... If not please explane again whats the problem is.
Good Luck !
2018-03-08 00:11
Avatar
torbentheisen
Posts: 6
Thanks again!

Yes you've got it right. I also needed to change the Comparison to <170 (from <17) and print 'space space space' and its working perfectly now.
Offset 2870 is the main battery voltage output, in the Pc12 it is displayed as a two digit+1 decimal place readout from 17.0-25.0V (not 16.0 like i originally said sorry!)
Using an 8 bit float I get a direct voltage output and then I multiply that by 10 to get the decimal place.

At the moment everything seems to be working perfectly, I will start working on the Amps readout next which I will put on the same display in the unused digits (it is also a two digit one decimal readout and works just like the voltmeter). Unfortunately the PC12 has 2 main batteries which have systems like this but I cant find the Offsets for separate batteries/ammeters off the same engine so I will find a way to simulate both panels. I'm happy to have the single one working now so I'll concentrate on the other one later

Thank you so much again for your help I really appreciate it!
2018-03-08 09:55
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
At First....
Take care about the blanking of AMP Display....
You must know youreself how it work in the real aircraft and how it should simmulate in your cockpit....
If the AMP get blank for example also when Voltage is below xxx then you not need a second blank config for that display....

In that case for example you use a precondition in the AMP Display Config that use same indicator like in voltage....
You say then AMP Display should only work if VOLT Readout is >=170 ( Like the volt Display) ...
And The current Blank Config now is used for both.... Simply activate the Diggits from AMP Display additional to the Volt Diggits in that Config....
Then this Blank Logic will work for Both !

****

About the 2 Batterys.... Thats difficult. Are you shure there are 2 Battery in your AddOn Aircraft or do we talk about the 2 generators ?
I´m not a Aircraft Ingeneur.... But i always thought there exist only ONE battery in a Aircraft ( Whatever the number of Engines)
In a B737 Jet there is also only one Main Battery i think.

Please check this..... If we talk about generators and not a second battery then Data is available..... ( Like Offset 2890/2898 for GEN2 )
If realy a second Battery is used then it is not possible ( Only if your addon support that data by itself.... But NOT via FSUIPC Standard Offsets)
Good Luck !
2018-03-08 13:11
Avatar
torbentheisen
Posts: 6
Thanks for the reply!
Sorry for my late reply I've been away with work.


Great I will use the voltage blank cofig for the amps too.

I'm incredibly lucky to be able to fly the real aircraft so I have access to all the POH/AFM sections as well as being able to look at it all in the real aircraft and get dimensions etc.

Regarding the number of batteries in aircraft it varies, we actually have 3 (2 main batteries, #2 is mainly used to start the engine and at a certain Ng the #1 comes online to assist, both remain on for the flight and the 3rd battery is a very small Emergency Power Supply which basically runs a standalone digital attitude indicator with heading and altitude sensing so if we lost the batteries and gens (highly unlikely hopefully!) we will still be able to safely leave IMC) but I only need to simulate two, if i can't do that using the simulator I will use another Arduino and come up with a solution using timings and configurations.

Regarding Generators, this is also where the Pc12 is a little different, we use generator #2 as a starter/generator, so power is supplied from batt2 to gen2, above around 50%ng the starter switches over to generator mode so I will definitely be using the separate feeds for 2 generators thank you!

At the moment everything is working fine however I'm having a slight issue as I'm using the carenado PC12 and from what I've found online, aparently carenado don't allow for button mapping to certain functions, for example when I turn on my mobiflight master battery switch theres no way to map it in the simulator, you have to turn the switches on in the simulator and then off on the mobiflight module and then you can use the switches as required, do you know if anyone has come up with a solution for this issue?


Thank you again for all your help!
2018-03-10 10:42
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Basicly there is a rule..... You can only read or write informations that are simulated....

Whatever your real Aircraft have 3 batterys.... that not means your simulated aircraft got 3 batterys, too.
Or whatever you use Battery 2 for starting..... That not means in simulator it´s 1:1 the same.

So mostly there are 4 situations....

1. Your aircraft simulate a situation and use standard stuff....
For example 99% of aircrafts use the FSX Standard Gear Logic.... So you can use the standard Gear Offsets for Inputs or for controlling the "3 Green" lights
Same is with COM1.... Nearly all Aircrafts work here with standard offsets, too.

2. Your aircraft simulate a situation internal indipendent from FSX
For example the VNAV and LNAV Switches in PMDG B737.... Those Switches not exist in Stnadard FSX B737.... So there can be no Offset.
BUT.... PMDG simulate that internal and support that data on special PMDG Offset Range. So we can simply work with it when we know the offsets.

3. Your aircraft simulate a situation but NOT support that data.
For example the Radio Controll Panels in Jeehell FMGS. Those panels are availible in the Sim but no FSUIPC Offsets exist. In that case you need to find a way to readout the data.... For example with SIOC or with a own written code that readout the AddOn internal.

4. Your aircraft basicly NOT simulate a system
In that case it is not possible to work with this system..... To solve those problems you need to build a own improvisional solution.
For example you use data of battery 1 and duplicate it.... Then you can simulate 2 batterys but both got same data....
Or you write a code with a "random logic" so data from Battery 2 ( That not exist in simulator) is a random value generate by your programm.... Make not realy sense.... But then you got different data on Display and it looks cool .


******
About your Switch problem.... I Not work with that addon.... And i not understand your situation.
Please explane more detailed wat you mean with you have to put it ON in Sim to be able to put it off with mobiflight.
Tell us what you use here... keysend offset, eventid ??
Good Luck !
2018-03-12 11:10
Avatar
torbentheisen
Posts: 6
hello!

Yep I understand that, my plan is to use other info to run the second battery as well as correctly simulate the start sequence, this will be done outside of mobiflight using another arduino.

Regarding the issue its like this:

simply put, I have a physical battery master switch wired into a mobiflight module which was very easy to do using an fsuipc offset but I cant use it to start the aircraft from cold and dark.

In the simulator, if you start with a cold and dark setup, ie EVERYTHING off, all the switches/batteries/gens/avionics etc, and you turn on the battery master for example (the switch that I have got on the mobiflight module) the battery comes online for about half a second and then the aircraft powers down (almost as if you had turned it on and turned it off immediately afterwards). The only way to get around this is to use your mouse to turn the battery master in the virtual cockpit on, and then use the mobiflight module to turn it off again and after that you can use the mobiflight battery master switch to turn the battery on and off.

Any suggestions?

Thanks again!
2018-03-12 15:16
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
In That case i must see your config.... And i must know the logic of your AddOn.

What do you set in OnPress and OnRelease ? Is it a ON/OFF switch, a Button or a ON/ON Switch ?
Do you work with OFFSET, Keycommand or EventID ? ... Do you use a Toggle Logic like "if($=1,0,1)" ???

Finaly do you controll the AddOn Master Battery switch or do you controll the FSX Standard Battery Switch ? AND Do the AddOn Switch work simular to the Standard Function or is it internal in the Addon logic ?

You see... You need a User that have same AddOn to help you.... or you do the "testing work" yourself and find out how it workes.... THEN you can set correct Inputs so the switch work 100% relaistic !
Good Luck !
2018-03-13 12:22
icon