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! 

icon
Avatar
Drunkencelt
Posts: 5
Hi,

Spent all morning researching the issue I'm having without success. I would appreciate help trying to diagnose what the issue may be. Thanks.

Windows 10, FSX, PMDG 737NGX (latest version), MF Connect, FSUIPC v4.974 (paid version). PMDG is setup for sending/receiving offsets.

I have a rotary encoder set up on arduino mega. It works great when I test it on left turn - Com_Radio_Whole_Dec (event 65636, para 0) and right turn Com_Radio_Whole_Inc (event 65637, para 0) using event presets. Works as it should so I know my rotary is hooked up and working ok as well as MF Connect etc etc.

My problem comes when I change the event IDs to the OH_Press_Flt_alt_knob events.

I assign event 69850 to right (increase) and 69851 left (decrease) both with parameter 0. Nothing happens on FSX when I turn the encoder. Mobiflight reports the right/left action but the Flight Alt display on FSX doesn't change. I've tried stopping and starting Mobiflight after changes and also a variety of parameters. (1, 1000, 500, 5000 and various other combinations with + & - in front of various integers). I suspect I have not entered the correct parameter but otherwise no luck. MF shows FSUIPC & FSX connected and other configurations eg LEDs work as they should.

Sort of run out of ideas now. Any suggestions would be greatly appreciated.
Jock Munro
2018-05-19 13:48
Avatar
StephanHo
From: EDDG, Germany
Posts: 1499
Supporter
Especially with the PMDG not every parameter is automatically 0 or 1 with encoders.

0 and 1 are usually assigned to the "normal" switches or the rotary switches.

Here you should see how the PMDG reacts on the screen and then implement this parameter accordingly in MF.

For the PMDG, you should pay attention to the parameters given at the end of the EVENTID list. That usually helps.

Please report to which result you came.
Grüße,
Stephan
2018-05-19 14:41
Avatar
Drunkencelt
Posts: 5
Hi Stephan,

Thanks for your tip.

I have almost got this working now.

Left turn (69850) counts down perfectly with Parameter 536870912 (which equals a left mouse click). However when I configure the right turn with event 69851 parameter -2147483648 (which is the output for a right click as shown in the log output) the display will not count up. At the back of the list right-single mouse click does not have a '-' at the start but MF will not let me use just 2147483648. I get an error message "Value must be a number between -2147483648 and 2147483647."

I must be missing something....

Thanks
[Last edited by Drunkencelt, 2018-05-19 15:25]
Jock Munro
2018-05-19 15:01
Avatar
StephanHo
From: EDDG, Germany
Posts: 1499
Supporter
Hi Jock Munro,

The problem you are talking about is known in MobiFlight.

It's the numerical value of the right single mouse click: 2,147,483,648
This numerical value is exactly 1 above the maximum range of the signed long INT range.

Binary this area goes to 0111 1111 1111 1111 1111 1111 1111 1111,
These are (+)2,147,483,647. As you can see, the MSB is 0, which is why the number is considered a positive number. If 1 is added, we have

1000 0000 0000 0000 0000 0000 0000 0000

If the sign is negative and the rest of all bits is 0. So -0. 0, mathematically speaking, can not be negative, so an error is output.

If, however, the 2.147.483.648 is preceded by a minus (-), then it is almost the smallest representable number of -2,147,483,648, so the result is -2,147,483,648, which is binary 1000 0000 0000 0000 0000 0000 0000 0000. Mobiflight can take this value.

So much for explaining why (only) this value must be negative.

Where did you actually get the EventID 69751 from? According to my documents, that is not forgiven or documented.

Please try also for the clockwise rotation (increase) the EventID 69850 and the parameter -2147483648. That should work;)
Grüße,
Stephan
2018-05-19 21:18
Avatar
Drunkencelt
Posts: 5
Stephan! You are a star!

Everything works great now thanks to your guidance. It never crossed my mind the event number should have been the same for left and right. Hours of experimenting and I missed it.

I assumed event no 69751 was correct because in the document PMDG 737NGX Custom Event ID's SP1d Cockpit Builder edition, it gives event ID 69850 for EVT_OH_PRESS_FLT_ALT_KNOB which needs two inputs, increase and decrease. The next event listed was 69852 so I assumed 69851 was assigned to increase (right) with 69850 decrease (left). Similar to the way the list of offsets are given in the document Offset Mapping for PMDG 737NGX. Where an offset is given for a multiple item it only gives the first offset, the second being implied. For example, there are two landing light switches - LTS_LandingLtFixedSw. Offset 64F4 is given but not 64F5 which is used for the second switch. The next item is allocated 64F6. So therein lies the reason for my wrong assumption with event IDs.

Just so it's clear for anyone else who who may not know how to configure Mobiflight for an encoder to increase/decrease a FSX/P3D non standard digital display:

1. Attach your encoder (usually two arduino pins and GND)
2. Open Mobiflight and go to Settings - Mobiflight Modules
3. Add a new device - Encoder. Give it a name and enter your pin nos.
4. Upload to the Arduino.
5. Go to Inputs and add a new config.
6. Go to Edit. On left & right tabs enter the Event ID and this is the key bit...For parameter you need to enter the respective 'Mouse Flag for mouse simulated events' found on the last page of the document PMDG 737NGX Custom Event ID's SP1d Cockpit Builder edition. In this case 536870912 for left click (decrease) and -2147483648 for right click (increase). Ignore fast left & right tabs, PMDG doesn't support them.
7. Activate the item and set Mobiflight to run and test your encoder.

Simple when you know how.

Thanks very much to Stephan for putting me on the right track.
[Last edited by Drunkencelt, 2018-05-20 10:27]
Jock Munro
2018-05-20 10:22
Avatar
StephanHo
From: EDDG, Germany
Posts: 1499
Supporter
Hi Jock Munro,

wonderful, if everything works now, I'm glad!

For the sake of completeness:
In this case, it is true that there is only one EventID for both counting up and down counting. But this is the exception!
The rule is that, as you suspected, there are two EventIDs. But no rule without exception.
The offsets (0x ....) are easier. There is always at how many bytes are needed for it and if square gulls [.] Are there, special care is required, because this then counts several times (or even for the FO).

Further success in your construction projects! If you have questions, you know ...
Thanks for your nice feedback.
Grüße,
Stephan
2018-05-20 11:12
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3411
Supporter
Just for info...

For Better understanding....

The EventID means normaly a "internal Sequence" that is done by FSUIPC... (Or better explaned a sequence that is done by the Sim internal)

Your Right... The FSX Standard Events normaly are all "Execute Events" .... They use no Parameter ( No matter if you use 0,1,2 or 9999999 ) ALL Parameters start the same event there. So this Standard Events normaly do ONE THING.... Means you got a Event for Increase and a other for decrease .
PMDG is a AddOn and the Table of EventID is verry limmited that PMDG can use ( supported by FSX/FSUIPC) .... So PMDG work with a different logic....
In PMDG a Event is normaly Fixed to ONE ELEMENT.... Like Event 69850 is the Press FLT ALT Knob .... And ALL You will do here ( Increase, decrease etc) is done by the SAME Event but now with different Parameters ! So PMDG can handle much more things with less ID´s in use.


Last Note:
Most of Encoders in PMDG work in best result when you use the MOUSE WHEEL Controlls.
( Left/Rigth Click will work too... But Mousewheel give better "Fast Turn" results i think )
So check out for Mousewheel Up / Down Parameters 16384/8192
Look Up ! Some Elements will not work with Wheel Parameters.... (For example the N1 Speed selector if i remeber right)
Good Luck !
2018-05-21 16:45
Avatar
horenh
Posts: 19
What is the correct code for the 7 segment display Airpressure
alt and land alt.
I heve the ext for the codes PMDG SP1D
2019-08-27 16:36
Avatar
StephanHo
From: EDDG, Germany
Posts: 1499
Supporter
Hi horenh,

try the offsets
0x64E4 AIR_FltAltWindow 4 Bytes and
0x64E8 AIR_LandAltWindow 4 Bytes
Grüße,
Stephan
2019-08-27 17:53
icon