Skip to content
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

WIP: Add A-10C presets support, with tests #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

magwo
Copy link
Contributor

@magwo magwo commented Aug 19, 2021

A-10C presets are defined globally in a DCS miz file, using a file with the path UHF_RADIO/SETTINGS.lua.

This PR adds support for setting these presets. Apparently both A-10C I and II use these presets.
If no presets were found/set during the loading/editing of a Mission, no such file will be created when saving.

Confirmed working by an A-10C II flying friend.


def load_dict(self, data):
presets = data.get("settings", {}).get("presets", {})
for chan, freq in presets.items():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this is a bit superflous? Could we just assign self.presets to the dict from the data?

Copy link
Collaborator

Choose a reason for hiding this comment

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

should work, until we need/want a deep copy

@magwo
Copy link
Contributor Author

magwo commented Aug 19, 2021

Discovered this now: https://forums.eagle.ru/topic/226274-a10c-radio-presets-overwrite-the-viper-presets/

Was able to reproduce - the Viper presets are indeed overwritten by the presence of this UHF_RADIO/SETTINGS.lua file in the miz.

I don't fully understand the situation. It seems we can produce these SETTINGS.lua files for each individual aircraft now?

@magwo magwo changed the title Add A-10C presets support, with tests WIP: Add A-10C presets support, with tests Aug 19, 2021
@magwo
Copy link
Contributor Author

magwo commented Aug 19, 2021

Ok I now have a better understanding of the A-10C presets, and how their architecture recently changed.

This PR will change course and add support for airframe-individual presets.

@@ -2,6 +2,7 @@
The mission module is the entry point to all pydcs functions.
"""
import copy

Copy link
Collaborator

Choose a reason for hiding this comment

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

why the newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, I ran flake8 and fixed until it stopped complaining. ;)

self.assertIsNotNone(m.a10c_presets)
self.assertEqual(m.get_10c_preset(1), 251.0)
self.assertEqual(m.get_10c_preset(2), 252.0)
self.assertEqual(m.get_10c_preset(20), 253.0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

newline missing here

@@ -254,6 +257,11 @@ def loaddict(fname: str, mizfile: zipfile.ZipFile, reserved_files: List[str]) ->
mapresource_dict = loaddict('l10n/DEFAULT/mapResource', miz, reserved_files)
self.map_resource.load_from_dict(mapresource_dict, miz)

if 'UHF_RADIO/SETTINGS.lua' in miz.namelist():
Copy link
Collaborator

Choose a reason for hiding this comment

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

so is this SETTINGS.lua file always bound to the a10c presets?
I really don't know just asking if there could be more than just a10 preset within this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reviewing!

My understanding is it used to be A-10C and KA-50 only, until recently. See this comment I made on the PR:

Ok I now have a better understanding of the A-10C presets, and how their architecture recently changed. This PR will change course and add support for airframe-individual presets.

Consider this PR paused for now. It will look different when it is done for individual airframes. It will still be these SETTINGS.lua files, but they will be in airframe-id subdirectories in the miz file.


def load_dict(self, data):
presets = data.get("settings", {}).get("presets", {})
for chan, freq in presets.items():
Copy link
Collaborator

Choose a reason for hiding this comment

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

should work, until we need/want a deep copy

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.

3 participants