Skip to content

DRAFT: Add support for ProSim for the A322 #2042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tristanmcpherson
Copy link
Contributor

@tristanmcpherson tristanmcpherson commented Mar 23, 2025

Draft for now to trigger a build

Copy link

Build for this pull request:
MobiFlightConnector.zip

Copy link

Build for this pull request:
MobiFlightConnector.zip

@Koseng
Copy link
Contributor

Koseng commented Mar 24, 2025

Great!
Since the Prosim userbase is probably smaller than the regular user base, I thought not force everyone to the "pythonnet" package. Everyone will be annoyed again by the popup message. I thought about making a special check for that, only in case the prosim scripts are started. So a new script dependent check and message.

@tristanmcpherson
Copy link
Contributor Author

tristanmcpherson commented Mar 24, 2025 via email

@Koseng
Copy link
Contributor

Koseng commented Mar 24, 2025

But on the other hand, that package also might be valuable in the future and we are still in beta. So for now just leave it like it is.

while True:
dataref = self.prosim_client.get_dataref_value(self.cdu_dataref_name)
if dataref:
asyncio.run_coroutine_threadsafe(self.mobiflight.send(create_mobi_json(dataref)), self.event_loop)
Copy link
Contributor

@Koseng Koseng Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are polling, I would propose to store the current value and only send to mobiflight if the value has changed. There is also an internal check in mobiflight before sending to the winwing device, but not sending at all to mobiflight would be the best. I assume each 100ms the same value is returned.

Copy link
Contributor

@Koseng Koseng Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or this currently is just a temp solution, since there also is the callback based stuff.

Copy link
Contributor Author

@tristanmcpherson tristanmcpherson Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep exactly, if you check the 737 implementation, I have exactly that, where I store the last value sent and only send if there is a diff. Just need to update the a320 implementation to match

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with the callback solution is that pythonnet runs it on the C# side, and it has problems interoping with asyncio. I was never able to get the callback solution to work nicely, so I think polling with checking should be good enough most likely

@Koseng
Copy link
Contributor

Koseng commented Apr 7, 2025

@tristanmcpherson will you adjust that PR to the GraphQL based version? And then please adjust the title to add the 737.

@tristanmcpherson
Copy link
Contributor Author

tristanmcpherson commented Apr 7, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants