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! 

Go to page 1Go to page 1123Go to page 3Go to page 3
Avatar
Ryan27679
Posts: 52
Preconditions is another thing I have zero clue about so far, but I'll start reading as I need the function I believe for changing radio frequencies on a single encoder.

I'm hoping I can adjust MHz on the regular encoder, then KHz with the encoder button pushed in during rotation.

I did see a 'how-to' somewhere but none of the images were there anymore :(

I seem to be developing a talent for killing/crashing mobiflight and/or P3D while I'm doing this, particularly after uploading to the Mega 2560. Should I unplug it after upload or restart the whole PC?

Thanks again guys.
2018-08-12 21:39
Avatar
paul_max
From: United Kingdom
Posts: 74
Supporter
Ryan

The MHz / KHz idea should work. There might be some timing issues with the switch and encoder events changing at the same times...it depends how MB handles input debounce.

Paul
2018-08-13 23:10
Avatar
paul_max
From: United Kingdom
Posts: 74
Supporter
Ryan

Regarding your reboot question, I have found that restarting MF makes it reconnect to the Arduino(s) and FSUIPC.
That reconnection seems to resolve any problems due to recent changes.

Of course the occasional reboot of Windows is good for FSX, Xplane, P3D and FSUIPC issues.

Cheers Paul
2018-08-15 07:49
Avatar
Ryan27679
Posts: 52
Thanks Paul.

At the moment I'm finding that Mobiflight wont load at all (no error message, just nothing) if my arduino is plugged in. It will run with it unplugged, but then won't recognise it when it's connected. Each time I'm having to flash a random script to it via Arduino software, then Mobiflight will load and reinstall itself to the board, after which I can work away with it for a while. Usually after an upload I have to do this..

The MHz KHz idea worked fine. It's a little slow to update it and the software or the arduino tends to miss 'clicks' on the encoder, but it's still fine for my purposes.

I added an 'Output' (Com1 Freq Precondition) to offset 0x66C0, Used 'Com1 select' (Encoder button) to set value 1 in 0x66C0, then created 2 inputs (Com1 MHz Encoder and Com1 KHZ etc) using precondition value 1 for one and 0 for the other.

Worked a treat.

First row of LEDs tonight too... Loving it.
2018-08-15 20:08
Avatar
Ryan27679
Posts: 52
Might be worth noting in case someone arrives at this post in the future, I had the 16x2's output named with a forward-slash i.e. "Com/Nav1 Display". For the sake of experimentation I removed the forward slash from the names, and since then Mobiflight has been able to load with the arduino connected. Prior to this I'd have to flash another script, then reflash mobiflight to get it to run at all.

Might be worth sticking to alphanumeric naming of inputs and outputs?
2018-08-20 09:05
Avatar
paul_max
From: United Kingdom
Posts: 74
Supporter
iconRyan27679:


Might be worth sticking to alphanumeric naming of inputs and outputs?



Yes.

This looks like a string handling bug in the software. The "/N" is a newline instruction in the C++.

It is likely the name comparison failed either in the Windows code or the Android code. As a result the Arduino connection failed.

That's my best guess based on 37 years of software development. All developers have made the /n mistake, including myself!

Cheers Paul
2018-08-20 10:17
Avatar
Ryan27679
Posts: 52
Thanks Paul, my experience of programming goes way back to Basic on the old BBC microcomputers back in the 1980s. I think I made a calculator.... :D

Loving that Mobiflight allows me to do these things without having to learn too much!
2018-08-20 10:43
Avatar
paul_max
From: United Kingdom
Posts: 74
Supporter
Ryan,

Try /t in the names. If that fails like /n it's definitely a name comparison bug.

/t means 'tab', like pressing the Tab key.

Paul
2018-08-20 11:18
Avatar
Ryan27679
Posts: 52
So the guitar switch arrived last night.

It does have contacts on both sides of the mechanism, but with 4 points and a ground on the 'outside', I only need to use those and it will work as expected - there won't be combined points.

I'm not sure what kind of guitar it was for, but that must give a crazy combination of pickups!

All good in any case, will hopefully get it experimented with tonight.
2018-08-22 09:09
Avatar
paul_max
From: United Kingdom
Posts: 74
Supporter
Ryan

Good luck with the guitar switch. I'm interested if it supports 4 or 5 flap settings.

Yes the pickup switching is crazy, I posted a list of the combinations as an example.

Paul
2018-08-22 09:45
Avatar
Ryan27679
Posts: 52
You're fairly right Paul and my strats work the same way, I'm just a little relieved I don't have to try to figure out a raft of preconditions to make it work!

What I ordered was a 4 position switch (for FSX default C172), but 5-way ones were also available.

I'm hoping to be able to set it to 'Flaps up' and 3 positions down with the 4 positions available.

It's too early in the morning for me to figure out how many potential combinations a 4-way switch with 8 contacts would give. Or maybe I'm just too old...!
2018-08-22 09:49
Avatar
Ryan27679
Posts: 52
Okay so the switch is sort of working, sort of not.... The connections are good, the arduino blinks every time I change the switch position, but P3D often isn't picking up the command.

All positions work some of the time, but I never get a complete cycle down and up again without it missing a step or refusing to complete it at all. If I cycle the switch half a dozen times it'll eventually move, but on the whole at the moment it's too frustrating to use so might resort to toggle switches again or something..

I'm not sure where the communication is breaking down, but I wish it'd either work completely or not at all as a half-problem makes no sense to me..
EventIDs are 65595, 65597, 65599 and 65603, Param=1 (but seemed no different at 0).
2018-08-24 19:51
Avatar
paul_max
From: United Kingdom
Posts: 74
Supporter
Ryan,

Try a config with just the 4 way switch, and nothing else, on a Mega.

The Arduino software should then scan the switch at full speed. Ideally it would be interrupt driven, but thats a whole new story.

Paul
2018-08-24 20:24
Avatar
StephanHo
From: EDDG, Germany
Posts: 1785
Supporter
Ryan,

please activate in EXTRAS -> SETTINGS the logging and set it to DEBUG.

The blinking LED on the MEGA says only that there is communication on the bus, but not what.

After activating the DEBUG mode you can see in the main MF-window (bottom) which configuration MF has recognized and if that matches with your made action.

In addition, you can change the speed at which Mobiflight exchanges data with FSUIPC.

Under EXTRAS -> SETTINGS in the tab FSUIPC push the speed in the direction of 100ms.
Grüße,
Stephan (Time: UTC+1)
2018-08-24 23:43
Avatar
Ryan27679
Posts: 52
Thanks Stephan, I'd totally forgotten about that. Apologies as ever for being the most frequent poster around here these days..

I got a few hours at it last night but the debug option had slipped my mind entirely.

I set up an encoder to act as a trim wheel, but it turns out to have quadrature output rather than the usual 2-bit type. I don't pretend to know what that means, but the sim only picks up a few of the signals here and there and will often continue turning the trim wheel long after I've stopped. Perhaps the debug flag might help that too?

In other news I got a stepper that can turn in both directions (unlike the last one..) but its about 30-40 degrees short of a full rotation. I set sim/stepper to 360/360 with no interpolation, and thats as close as I can get it - if I set it to 360/2048 or 360/4096 it spins many times per in-flight rotation.

in any case, I'll try the debug option and see where that gets me. I have a second arduino on the way but there are already 2 displays and a couple dozen buttons/switches/encoders waiting for it.

Thanks as always for your helpful responses Stephan. Very much appreciated.
2018-08-25 09:05
Go to page 1Go to page 1123Go to page 3Go to page 3