Skip to content

Commit 5852783

Browse files
committed
feature(param_logic): Display MCU series
Will later be used to make parameter value decisions
1 parent 7e1e4b6 commit 5852783

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

ardupilot_methodic_configurator/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def component_editor(
111111
component_editor_window.set_vehicle_type_and_version(vehicle_type, flight_controller.info.flight_sw_version_and_type)
112112
component_editor_window.set_fc_manufacturer(flight_controller.info.vendor)
113113
component_editor_window.set_fc_model(flight_controller.info.firmware_type)
114+
component_editor_window.set_mcu_series(flight_controller.info.mcu_series)
114115
if vehicle_dir_window and vehicle_dir_window.configuration_template:
115116
component_editor_window.set_vehicle_configuration_template(vehicle_dir_window.configuration_template)
116117
if args.skip_component_editor:

ardupilot_methodic_configurator/backend_flightcontroller_info.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# import pymavlink.dialects.v20.ardupilotmega
1717
from ardupilot_methodic_configurator import _
1818
from ardupilot_methodic_configurator.middleware_fc_ids import (
19+
APJ_BOARD_ID_MCU_SERIES_DICT,
1920
APJ_BOARD_ID_NAME_DICT,
2021
APJ_BOARD_ID_VENDOR_DICT,
2122
VID_PID_PRODUCT_DICT,
@@ -50,6 +51,7 @@ def __init__(self) -> None:
5051
self.product: str = ""
5152
self.product_id: str = ""
5253
self.product_and_product_id: str = ""
54+
self.mcu_series: str = ""
5355
self.capabilities: dict[str, str] = {}
5456

5557
self.is_supported = False
@@ -71,6 +73,7 @@ def get_info(self) -> dict[str, Union[str, dict[str, str]]]:
7173
_("Capabilities"): self.capabilities,
7274
_("System ID"): self.system_id,
7375
_("Component ID"): self.component_id,
76+
_("MCU Series"): self.mcu_series,
7477
}
7578

7679
def set_system_id_and_component_id(self, system_id: str, component_id: str) -> None:
@@ -99,6 +102,7 @@ def set_board_version(self, board_version: int) -> None:
99102
vendor_derived_from_apj_board_id = str(APJ_BOARD_ID_VENDOR_DICT.get(apj_board_id, "ArduPilot"))
100103
if vendor_derived_from_apj_board_id != "ArduPilot" and self.vendor in ["ArduPilot", _("Unknown")]:
101104
self.vendor = vendor_derived_from_apj_board_id
105+
self.mcu_series = str(APJ_BOARD_ID_MCU_SERIES_DICT.get(apj_board_id, _("Unknown")))
102106

103107
def set_flight_custom_version(self, flight_custom_version: Sequence[int]) -> None:
104108
self.flight_custom_version = "".join(chr(c) for c in flight_custom_version)

ardupilot_methodic_configurator/frontend_tkinter_component_editor.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def __init__(self, version: str, local_filesystem: LocalFilesystem) -> None:
230230
_vehicle_components_strings = _("Version")
231231
_vehicle_components_strings = _("Firmware")
232232
_vehicle_components_strings = _("Type")
233+
_vehicle_components_strings = _("MCU Series")
233234
_vehicle_components_strings = _("Notes")
234235
_vehicle_components_strings = _("Frame")
235236
_vehicle_components_strings = _("Specifications")
@@ -270,7 +271,7 @@ def update_json_data(self) -> None:
270271
if "Capacity mAh" not in self.data["Components"]["Battery"]["Specifications"]:
271272
self.data["Components"]["Battery"]["Specifications"]["Capacity mAh"] = 0
272273

273-
# To update old JSON files that do not have these new fields
274+
# To update old JSON files that do not have these new "Frame.Specifications.TOW * Kg" fields
274275
if "Frame" not in self.data["Components"]:
275276
self.data["Components"]["Frame"] = {}
276277
if "Specifications" not in self.data["Components"]["Frame"]:
@@ -286,6 +287,17 @@ def update_json_data(self) -> None:
286287

287288
self.data["Program version"] = __version__
288289

290+
# To update old JSON files that do not have this new "Flight Controller.Specifications.MCU Series" field
291+
if "Flight Controller" not in self.data["Components"]:
292+
self.data["Components"]["Flight Controller"] = {}
293+
if "Specifications" not in self.data["Components"]["Flight Controller"]:
294+
self.data["Components"]["Flight Controller"] = {
295+
"Product": self.data["Components"]["Flight Controller"]["Product"],
296+
"Firmware": self.data["Components"]["Flight Controller"]["Firmware"],
297+
"Specifications": {"MCU Series": "Unknown"},
298+
"Notes": self.data["Components"]["Flight Controller"]["Notes"],
299+
}
300+
289301
def set_vehicle_type_and_version(self, vehicle_type: str, version: str) -> None:
290302
self._set_component_value_and_update_ui(("Flight Controller", "Firmware", "Type"), vehicle_type)
291303
if version:
@@ -299,6 +311,10 @@ def set_fc_model(self, model: str) -> None:
299311
if model and model not in (_("Unknown"), "MAVLink"):
300312
self._set_component_value_and_update_ui(("Flight Controller", "Product", "Model"), model)
301313

314+
def set_mcu_series(self, mcu: str) -> None:
315+
if mcu:
316+
self._set_component_value_and_update_ui(("Flight Controller", "Specifications", "MCU Series"), mcu)
317+
302318
def set_vehicle_configuration_template(self, configuration_template: str) -> None:
303319
self.data["Configuration template"] = configuration_template
304320

0 commit comments

Comments
 (0)