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
JohanKotze
Posts: 52
Well everything on my default b737 Diy Autopilot is working except for my momentary push buttons with LEDs.
Buttons on input and leds on output.
[Last edited by JohanKotze, 2022-01-30 07:21]
2022-01-29 19:32
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
???? :confused:

Non of your Buttons work? Non of your LED work ?

iconJohanKotze:

Autopilot is working except for my momentary push buttons with LEDs.
Buttons on input and leds on output.



Like always.... Why not simply TEST in a clean situation instead of try to handle the Sim itself.

Wire your stuff... And then test LED by press the TEST Button in the Display Tab to light the LED momentary.
Also test your buttons by enable the Logging Mode in MF (Typ Debug) and check the LOG ( on the Botom of MF Window)
if there is a indication when your Buttons are pressed or released.

*****
So Confirm Hardware is fine, and correctly connected. If YES then your configs are wrong.... If NO then you need to wire your stuff as recommend !
Good Luck !
2022-01-30 08:00
Avatar
JohanKotze
Posts: 52
Would love to do the test but now my mobiflight card ardiuno Mega 2560, do not show under mobiflight modules, the models sates "none". Scan for cards are selected. I restart my PC twice same problem.
The card powered as there is green light but no orange light.
2022-01-30 09:40
Avatar
JohanKotze
Posts: 52
I have checked under Device Manger/Ports (com & lpt) there is no Arduino Mega 2560 there only "Communications Port (Com1)"
Then I went to the Arduino IDE/Tools/ and note that Arduino is on Com1 previously it was om COM3

So I go to Device Manger/Ports (com & lpt)/Communications Port COM1, right click on it and select properties click on Port Setting and then on Advanced/Select COM port here I see that COM3 is in use but not COM1. Must I select COM3 even though it is use.
2022-01-30 10:35
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Make a EEPROM Clear.
Looks like you "kill" your Firmware....
This can hapen in rare cases by itself.... May while a upload you do something wrong.... A bad cable or so.

Open Arduino IDE .... Load the EEPROM CLEAR Sketch from the Examples List, and und it.

After that the Arduino is "clean" an cna be flashed again with MF....
Badly through this procedure your devices are deletet.
If you have a backup ( *.mfmc ) you can use it. If not you need to create them for new !
Good Luck !
2022-01-30 12:40
Avatar
JohanKotze
Posts: 52
I have a filed saved under Mobiflight that is called MCP.mcc which is my configuration of the MCP

I got this message from Arduino

Arduino: 1.8.13 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 1374 bytes (0%) of program storage space. Maximum is 253952 bytes.

Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.

avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_getsync(): timeout communicating with programmer

An error occurred while uploading the sketch



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
[Last edited by JohanKotze, 2022-01-30 13:26]
2022-01-30 12:54
Avatar
JohanKotze
Posts: 52
By change or luck Device Manger pick up Arduino Mega COM3, I change USB port. So now for the matter on hand. DIY MCP all 7 segments displays, Toggle AT Armed with LED and FD with LED (LEDs are separate to the toggle switches) is working as per FSX virtual MCP.

I am now busy with the momentary buttons which have built in LEDs

I up loaded the button on input side and button LED output under Mobiflight Modules

BUTTON INPUT
Action Type: fsuipc event ID
Preset: AP_PANEL_SPEED_ON
Event ID: 66112
Para: 1

--------on release-----
Action Type: fsuipc event ID
Preset: AP_PANEL_SPEED_OFF
Event ID: 66113
Para: 0

BUTTON OUPUT (LED)
Action Type: fsuipc OFFEST
Preset: Autopilot - AP Air Speed Hold
Offset: 0x07DC
Value Type: Int
Byte: 4
Mask value with: 0xFFFFFFFF
Transform: $

-----on the display tab-----
Module: Arduino Mega
Use type: Pin
Select pin: BTNSPDHOLDLED

Activate Input and Output but when pressed nothing happened.
So I test on the FSX Virtual MCP I select Throttle Armed and select Speed Hold and the LED on Speed hold Button lid up when I unselect FSX Virtual MCP speed button and the LED on my diy MCP unlit . But when selecting on diy MCP Throttle armed (which is working) speed button, when selected, does not respond and LED not working.
[Last edited by JohanKotze, 2022-01-30 15:14]
2022-01-30 15:04
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Please come to Discord....
It looks like you got some basic problems.
Takes a lot of time to write this down here.
If possible we can talk there for 5 min and solve all the Problems at once.
Good Luck !
2022-01-30 16:07
Avatar
JohanKotze
Posts: 52
I have now connected the button with build in LED arduino mega and load it to MF. Button wiring are a follow
1 wire to ground
1 wire to input pin A2
1 wire to output for led pin D2

Test the button LED and it lit up. Click stop and it unlit. But no response from the input side of the button.
2022-02-03 19:12
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
I not know your button! ( Datasheet)

You must know yourself what button Pins need to be wired.
Mostly there are TWO GRD Pins... One for the LED Circuit and another for the switch!

So only way is you check the data sheet of the button ( or show it to me)
OR
You test it out.... Use a Multimeter or a simple LED Breadboard Setup to find out which Pins of your Button are used for IN and Out of the switching circuit!
Good Luck !
2022-02-03 20:51
Avatar
JohanKotze
Posts: 52
I checked each button has 2 grounds, one for led and one for switch.

I test the led for speed hold with fsx virtual autopilot, select throttle armed, click on speed button and the led on my Diy Autopilot lit up.

What is strange when I tried the same with N1 the FD led lid up and they are on different output pins.
N1 is on pin A2
FD is on pins D12
When I test N1 led in MF it lit up and not the FD led. So I need to investigate.

Can't get the switch to work though. Will try again later.
2022-02-04 06:49
Avatar
JohanKotze
Posts: 52
iconQuote:

What is strange when I tried the same with N1 the FD led lid up and they are on different output pins.
N1 is on pin A2
FD is on pins D12
When I test N1 led in MF it lit up and not the FD led. So I need to investigate.


Solved, linked the wrong button led to the pin
2022-02-04 08:36
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Here i will give you the same recomendation, as in hundrets of other topics....

Not mixup different elements ! If you test something.... Do it always in the most easy and rudimentary way !

1. ( you still have done) is testing the LED if it work ....
Done by set it on a Breadboard and give 5v ( with resistor) to it! With this test you also find out what pins are the right one for the LED!

2. Check if LED is set correctly in Mobiflight ( You also have done)
Set LED ( e.g. to Pin 5) Upload the configuration.... Then Create a NEW Mcc file.... Only make one single Output Config and choose for that LED.
Press the TEST Button in the Display Tab ( NOT the Test Button in the Connector Window). NOT press RUN in MF.... Not start the Sim in the Back !

3. Use the function in Sim you like to test.
As you say.... Some Work, some will not. So in case you do Step 1-3 already, you KNOW that LED is electrical fine, LED is working with MF, and also Sim Connection is fine in case other system still work on THAT LED..... Means you know 100% sure the problem now is the new Sim Variable that is not working.

Why i tell you that.... Make those testings always in a NEW Config File.... Cause so you can know 100% there is no other factor ( like a second config that controll by fault the same LED, or a broke config that kill Sim Connection or so!

By the way.... SAME Ide with the Switch.
Step1: Check electrical function of the switch with a simple LED or Multimeter.
Step2: Connect switch and test MF connection by the Logging Mode ( No Sim Event.... NOT using RUN Mode !.... Just testing if MF correctly receive a signal)
Step3: Use a Sim Function for Testing!

Without Step 1 and 2 you can not know if your final problem is in case of a wrong Event or missing Sim connection or broke Switch.

So... Split it up.... Maybe your testings takes some minutes more.... But they are effective !
Good Luck !
2022-02-04 12:30
Avatar
JohanKotze
Posts: 52
I found the problem. Positive wire of the Speed Hold Button was on the wrong pin of the button. It is working now but have a problem. When I disengaged the Speed Hold Button I have to press the button several times to activate the Speed Hold again. I use FSUIIPC Offsets on input

ON PRESS
Preset: Autopilot - AP Air Speed Hold
Offset: 0x07DC
Value Type: Int
Byte: 4
Mask Value: 0xFFFFFFFF
Set value: 1

ON RELEASE
Preset: Autopilot - AP Air Speed Hold
Offset: 0x07DC
Value Type: Int
Byte: 4
Mask Value: 0xFFFFFFFF
Set value: 0
2022-02-05 08:54
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Now we are a step forward....

Next is to understand how the inputs work !

In FSX/P3D you have 2 kind of Inputs..... Offset Writes OR EventID
A Offset write ( as you do) write the status of a Offset.... Mostly possible aslong the Offsets allow that ( will do in your case)
A EventID is a internal predefined Action we "trigger" by our Button.
Mostly the better option, cause here we not need to think.... The Event do the same action as we would click with the mouse oin the Virtual Cockpit to that button.

the second thing you need to understand is the difference between "Momentary" and "Latching".
These Button on the MCP is a momentary.... Means it not "hold" in the ON Position... It is pressed like a "Toggle".
So you say something like "IF Function is currently ON then set it to OFF.... ELSE if its already OFF then set it to ON"

Your issue is.... You think this Offset stands for the virtual Button ( So you need to press and release it in a sequence.....
But the Offset stands correctly for the Function! Means your logic would Enable the SPDHld by Press and Disable it shortly behind by the release again !

You currently say On Press set it to ON .... And On Release ( milliseconds later) you set it to OFF again !
Pretty sure correct way is to use ON PRESS Only ! And in Value field you would say if($=1,0,1)



****************

BUT..... Lets use the EventID instead.... Cause its much more easy !


Correct EventID is..... 66353 AP_PANEL_SPEED_HOLD_TOGGLE

Select in the Input Config at first the OnRelease to "none" .... We not need it.
Set then the OnPress to Typ "EventID" and use "66353" as Event .... Parameter remains "0"

Now if you press your Button you "toggle" the Function in the Sim!
Good Luck !
2022-02-05 12:19
icon