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
ec-cts
From: Pozuelo de Alarcon, Spain
Posts: 79
Hallo Freunde:

Ich konfiguriere das ADF-Radio der Cessna 172.

Ich habe Zweifel an seiner Funktionsweise.

1.) Die ADF-Frequenz besteht aus 5 Ziffern mit einem Punkt in der 4. Stelle.

2º) Ich verwende zwei fsuipc Offsets für Frequenzmanagement:
       a) ADF1 = 0x0356 für die 3 Ziffern dazwischen (X234.X)
       b) ADF2 = 0x034C für die 2 Ziffern, erster und letzter (1XXX.5).

3.) Ich habe zwei Ausgänge ADF1 und ADF2 erstellt, einen für jedes Offset.
       Es zeigt mir die Daten richtig an. Wenn ich die Daten im Simulator ändere,
       zeigt richtig an.

4.) Ich habe zwei Einträge für Encoder erstellt, einen für jeden ADF. (Ich benutze wirklich nur einen Encoder mit Druckknopf).

5.) Ich habe einen Exit für PRECONDITION erstellt.

6.) Ich habe einen Eintrag für Button erstellt, mit dem ich nach der PRECONDITION den Wert des Offsets der PRECONDITION (1 oder 0) ändere.

Der Code ist dies:

OUTPUTS:
iconCode:
    <config guid="9a238f67-874d-43e6-b285-7975f21defe1">
      <active>true</active>
      <description>Adf1</description>
      <settings msdata:InstanceType="MobiFlight.OutputConfigItem, MFConnector, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <source type="FSUIPC" offset="0x0356" offsetType="Integer" size="2" mask="0xFFFF" bcdMode="True" />
        <comparison active="True" value="10" operand="=" ifValue="$-90" elseValue="" />
        <display type="Display Module" serial="Arduino MB-02/ SN-3c6-e5f" trigger="normal" ledAddress="LedAdfDmeXpdr" ledConnector="1" ledModuleSize="8" ledPadding="True" ledPaddingChar="0" ledDigits="2,6" />
        <preconditions />
        <transformation active="False" expression="$" substrStart="0" substrEnd="7" />
        <configrefs />
      </settings>
    </config>
    <config guid="ab119ea7-1332-4e30-8e38-83b9095f9ee0">
      <active>true</active>
      <description>Adf2</description>
      <settings msdata:InstanceType="MobiFlight.OutputConfigItem, MFConnector, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <source type="FSUIPC" offset="0x034C" offsetType="Integer" size="2" mask="0xFFFF" bcdMode="True" />
        <comparison active="False" value="" operand="=" ifValue="1" elseValue="0" />
        <display type="Display Module" serial="Arduino MB-02/ SN-3c6-e5f" trigger="normal" ledAddress="LedAdfDmeXpdr" ledConnector="1" ledModuleSize="8" ledPadding="True" ledPaddingChar="0" ledDigits="3,4,5" ledDecimalPoints="3" />
        <preconditions />
        <transformation active="False" expression="$" substrStart="0" substrEnd="7" />
        <configrefs />
      </settings>
    </config>
    <config guid="f42997cf-b057-4e63-ad04-d94fd36efb73">
      <active>true</active>
      <description>Adf-Select</description>
      <settings msdata:InstanceType="MobiFlight.OutputConfigItem, MFConnector, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <source type="FSUIPC" offset="0x66C0" offsetType="Integer" size="1" mask="0x00FF" bcdMode="False" />
        <comparison active="False" value="" operand="" ifValue="" elseValue="" />
        <display type="" serial="-" trigger="normal" pin="" pinBrightness="255" />
        <preconditions />
        <transformation active="False" expression="$" substrStart="0" substrEnd="7" />
        <configrefs />
      </settings>
    </config>


INPUTS:
iconCode:
    <config guid="b2ca8cac-c6b2-4f08-960f-6e2bf5d50b99">
      <active>true</active>
      <description>EncoderAdf1</description>
      <settings msdata:InstanceType="MobiFlight.InputConfigItem, MFConnector, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null" serial="Arduino MB-02/ SN-3c6-e5f" name="EncoderAdf" type="Encoder" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <encoder>
          <onLeft type="EventIdInputAction" eventId="66543" param="0" />
          <onLeftFast />
          <onRight type="EventIdInputAction" eventId="66542" param="0" />
          <onRightFast />
        </encoder>
        <preconditions>
          <precondition type="config" active="true" ref="f42997cf-b057-4e63-ad04-d94fd36efb73" operand="=" value="1" logic="and" />
        </preconditions>
      </settings>
    </config>
    <config guid="93afbfd1-1984-49e2-950f-2ee67c876174">
      <active>true</active>
      <description>EncoderAdf2</description>
      <settings msdata:InstanceType="MobiFlight.InputConfigItem, MFConnector, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null" serial="Arduino MB-02/ SN-3c6-e5f" name="EncoderAdf" type="Encoder" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <encoder>
          <onLeft type="EventIdInputAction" eventId="66453" param="0" />
          <onLeftFast />
          <onRight type="EventIdInputAction" eventId="66454" param="0" />
          <onRightFast />
        </encoder>
        <preconditions>
          <precondition type="config" active="true" ref="f42997cf-b057-4e63-ad04-d94fd36efb73" operand="=" value="0" logic="and" />
        </preconditions>
      </settings>
    </config>
    <config guid="986e7389-5ee0-4982-88e7-1cd164ebac0b">
      <active>true</active>
      <description>ButtonSwapAdf</description>
      <settings msdata:InstanceType="MobiFlight.InputConfigItem, MFConnector, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null" serial="Arduino MB-02/ SN-3c6-e5f" name="ButtonSwapAdf" type="Button" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <button>
          <onPress type="FsuipcOffsetInputAction">
            <source type="FSUIPC" offset="0x66C0" offsetType="Integer" size="1" mask="0x00FF" bcdMode="False" inputValue="if($=0,1,0)" />
          </onPress>
          <onRelease />
        </button>
        <preconditions />
      </settings>
    </config>
  </inputs>


Anscheinend funktioniert alles gut.

Probleme:
Als erstes merke ich, dass wenn ich die Taste drücke um zwischen den beiden Encodern zu wechseln (es ist wirklich derselbe Encoder) ein rotes Warnzeichen auf mobiflight erscheint, wie auf dem Foto gezeigt:





Wenn ich den Mauszeiger darüber stecke, heißt es "die Vorbedingung ist nicht erfüllt" und es ändert die Warnung zu dem anderen Encoder, den ich auswähle.

Ist das normal? Oder erzählst du mir von einem Fehler?

Zweitens habe ich wirklich einen Fehler.
Es stellt sich heraus, dass, wenn die Frequenz die erste Ziffer um eine 1 ändert, zum Beispiel von 0999,5 auf 1099,5 geht, der Encoder aufhört, am Ausgang zu arbeiten (ab max7219) er weiter im Simulator arbeitet.
Wenn ich die Frequenz so verändere, dass die erste Ziffer eine 0 ist, ändert sich beim Wechsel mit dem Encoder die Ausgabe (von max7219) und auch im Simulator.

Was mache ich falsch?

Ich habe jede Hilfe geschätzt.

Grüße

Carlos (ec-cts)
[Last edited by ec-cts, 2017-11-01 01:01]
2017-11-01 00:45
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi Carlos.

Not shure if you prefer German or English language..... Spanish i can´t speak :(

About the Problems....

1. I recomend you to use other "Names" here.... In a Aircraft there can exist TWO ADF Receivers..... They are called ADF1 and ADF2
If you use ADF1/ADF2 for the Two Parts of the Real ADF1 Frequency that "can" Confusing you in the future or is not understandable for other users when you share your config !
Maby call it ADF1Main and ADF1decimal

***
2. The Red "!" Sign is NO issue.
THATS absolutly correct in that situation. It show you WHAT Config is currently "Disabled by a Precondition"
You say with a button click the Customoffset 66C0 should toggle between 0 and 1.
You say in Preconditions of Configs "Encoder ADF1" and "Encoder ADF2" that each should work only if Readout Config of Offset 66C0 is 0 or on the other config if it´s 1.
THAT finaly occures in that "!" Sign.... The Config that is currently disabled will me marked with that "!" .... If you Push the Button now then the currently marked Config come allive and the other config that work till now is then Disabled and THEN marked with the "!".

***
3. Your Output Problem.

That is completly explaned here..... https://www.mobiflight.com/forum/message/3406.html

In Easy words.....

If you observe theMobiflight Connector while running in the OUTPUT Tab you see the "Output Value" of your Config "ADF2" .
If Frequency is below 1000 it is just a Number between 0 and 9 ( ONE DIGGIT) With setting LEFT PADDING ON / SPACE your display will show the correct decimal Part on the RIGHT Diggit of the Display.

BUT PROBLEM If Value is OVER 1000 The Output value now is a 3 Diggit Number its now between 100 and 109.... Last Number is the Decimal.... the Hundret Number means the 1 of 1000 Part.

Without a compare you now try to show a 3 Diggit number ( for example 102) on a 2 Diggit Display.... Result it show only 10 and not 102 cause you have only 2 diggits in the Display!
That means whatever you have a value 100, 101,102,103 and so on... Al are shown as 10 .... That means your Display show 1xxx.0 all the time !



To prevent this i give a guide in the linked Thread...... Use the Compare If value Bigger as 10 " >10 " THEN $-90
Then a Value like 102 compared into 12 .... And That is shown Perfect on the Display like 1xxx.2
ALTERNATE you can use 2 Configs for the two diggits.... then One is controll the decimal and the other controll the 1000 Part.
Both is working.... The Compare is maby the easyer way !

********************
Please report if all is fine now so i can close this topic !
Good Luck !
2017-11-01 02:34
Avatar
ec-cts
From: Pozuelo de Alarcon, Spain
Posts: 79
Thanks Pizman82.

I prefer English, because for German I write through translator.google.

I will try your solution and follow the instructions of the thread you indicate. (Look that in the search engine of the forum I put ADF and nothing comes out).

I inform you of the result.

Thanks again for your help.

Carlos (ec-cts)
2017-11-01 11:37
Avatar
ec-cts
From: Pozuelo de Alarcon, Spain
Posts: 79
Hi Pizman82:

I think I have not explained well.

Everything works fine, except when the first digit of the frequency is a 1.
I have the comparison in the ADF-Decimal that when the value is= 10, the value is transformed to $ -90.

But if the first digit of the frequency of a 1, although you change in the simulator or in the physical encoder the Adf-Decimal frequency, it does not show the changes in the led, but in the simulator if you change it.

As I am not sure of explaining myself well, I made a video in which the problem is seen.

Edited 01/11/2017 ELIMINATED VIDEO.

Thanks again.

PD.: I followed your instructions and changed the names of adf inputs and outputs.

Regards

Carlos (ec-cts)
[Last edited by ec-cts, 2017-11-01 18:50]
2017-11-01 12:36
Avatar
ec-cts
From: Pozuelo de Alarcon, Spain
Posts: 79
SOLVED.
The error was in the comparison that was made.

We were comparing: If the value is equal to 10 but this comparison did not work by logic.

The ADF-Decimal frequency gives us eg:

Frequency 0708.9 ADF Decimal-> 08 with left padding at 0 --->>> 8
well it works correctly. The led shows everything perfectly. the encoders work well.

Frequency 1708.9 ADF Decimal-> 108. The LED does not display the decimal digit correctly. (First digit 1, decimal last digit 0). The decimal changes in the simulator, but does not change in the led.

Comparison: Current value is called $
[if $ = 10], in this case the current value is ($ = 108) and (108 ! = 10) -> does not transform value

View photo:
In the OUTPUT VALUE column of the OUTPUTS tab you can see the transformation performed by the comparison.




Solution:
Correct comparison (at least for me): Current value is called $
[if $> = 100] set it to [$ -90]; in this case the current value is ($ = 108), and here if the condition is fulfilled since = or > of 100 and it is transformed with: [$ -90] that is, (108-90 = 18), and it shows 1xxx.8

In the OUTPUT VALUE column of the OUTPUTS tab you can see the transformation performed by the comparison.



This has been my solution. I get the doubt that in the thread that you indicated to me, it was compared with [if $ = 10] and has not reported that it does not work well.

But come on, changing the comparison to [if $> = 100] set it to [$ -90] works perfectly for me.

Thanks again for your help.

Regards

Carlos (ec-cts)
[Last edited by ec-cts, 2017-11-01 13:34]
2017-11-01 13:19
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Sorry you got this Problem BUT you not read my instructions correct......

In my last Post is said.....

iconpizman82:



To prevent this i give a guide in the linked Thread...... Use the Compare If value Bigger as 10 " >10 " THEN $-90



In the Linked Topic i said....

iconpizman82:

To make a 2 diggit Value we use " Compare : IF Value bigger then 10 ..... >10 .... THEN $-90 " So 105 come into 15 (and can be shown on 7 Segment Display)



So i already explaned correct i think... I never said IF Value =10 .

By the Way.....
The Compare must work if Value is 100 101 102 103 104 105 106 107 108 109
its no mater if we say >10 or >20 or > 30 or in your case >=100 .... Important is only that it work on all Sitautions that Value is 100 or Bigger and it NOT work on values that are less then 10 .

****
But who care.... It Work ! Thats important !
Good Luck !
2017-11-01 16:44
Avatar
ec-cts
From: Pozuelo de Alarcon, Spain
Posts: 79
I'm sorry Pizman82.

It's true that you said > 10 and not = 10. That was my main error, that is, that was the error that I did not detect and that's why I put this post.

Of course, it is indifferent then to put > 10 or > 100, since it works equally well as you says.

Thanks again for your help.

Regards

Carlos (ec-cts)
[Last edited by ec-cts, 2017-11-01 19:40]
2017-11-01 18:46
icon