-
Notifications
You must be signed in to change notification settings - Fork 82
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
base: master
Are you sure you want to change the base?
Conversation
37b0dca
to
e471d50
Compare
|
||
def load_dict(self, data): | ||
presets = data.get("settings", {}).get("presets", {}) | ||
for chan, freq in presets.items(): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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? |
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 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the newline?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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
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.