Skip to content

Commit

Permalink
FEATURE: Output APJ_BOARD_ID information
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Nov 27, 2024
1 parent 38212b3 commit 09fbec7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
30 changes: 17 additions & 13 deletions MethodicConfigurator/backend_flightcontroller_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pymavlink import mavutil

# import pymavlink.dialects.v20.ardupilotmega
from MethodicConfigurator import _


class BackendFlightcontrollerInfo: # pylint: disable=too-many-instance-attributes
Expand All @@ -33,6 +34,7 @@ def __init__(self) -> None:
self.flight_sw_version: str = ""
self.flight_sw_version_and_type: str = ""
self.board_version: str = ""
self.apj_board_id: str = ""
self.flight_custom_version: str = ""
self.os_custom_version: str = ""
self.vendor: str = ""
Expand All @@ -48,18 +50,19 @@ def __init__(self) -> None:

def get_info(self) -> dict[str, Union[str, dict[str, str]]]:
return {
"Vendor": self.vendor_and_vendor_id,
"Product": self.product_and_product_id,
"Hardware Version": self.board_version,
"Autopilot Type": self.autopilot,
"ArduPilot FW Type": self.vehicle_type,
"MAV Type": self.mav_type,
"Firmware Version": self.flight_sw_version_and_type,
"Git Hash": self.flight_custom_version,
"OS Git Hash": self.os_custom_version,
"Capabilities": self.capabilities,
"System ID": self.system_id,
"Component ID": self.component_id,
_("Vendor"): self.vendor_and_vendor_id,
_("Product"): self.product_and_product_id,
_("Board Type"): self.apj_board_id,
_("Hardware Version"): self.board_version,
_("Autopilot Type"): self.autopilot,
_("ArduPilot FW Type"): self.vehicle_type,
_("MAV Type"): self.mav_type,
_("Firmware Version"): self.flight_sw_version_and_type,
_("Git Hash"): self.flight_custom_version,
_("OS Git Hash"): self.os_custom_version,
_("Capabilities"): self.capabilities,
_("System ID"): self.system_id,
_("Component ID"): self.component_id,
}

def set_system_id_and_component_id(self, system_id: str, component_id: str) -> None:
Expand All @@ -80,7 +83,8 @@ def set_flight_sw_version(self, version: int) -> None:
self.flight_sw_version_and_type = self.flight_sw_version + " " + v_fw_type

def set_board_version(self, board_version: int) -> None:
self.board_version = str(board_version)
self.board_version = str(board_version & 0x0FFFF)
self.apj_board_id = str(board_version >> 16)

def set_flight_custom_version(self, flight_custom_version: Sequence[int]) -> None:
self.flight_custom_version = "".join(chr(c) for c in flight_custom_version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self, flight_controller: FlightController) -> None:
logging_info(_("Firmware Version: %s"), flight_controller.info.flight_sw_version_and_type)
logging_info(_("Firmware first 8 hex bytes of the FC git hash: %s"), flight_controller.info.flight_custom_version)
logging_info(_("Firmware first 8 hex bytes of the ChibiOS git hash: %s"), flight_controller.info.os_custom_version)
logging_info(_("Flight Controller board type: %s"), flight_controller.info.apj_board_id)
logging_info(_("Flight Controller HW / board version: %s"), flight_controller.info.board_version)
logging_info(_("Flight Controller USB vendor ID: %s"), flight_controller.info.vendor)
logging_info(_("Flight Controller USB product ID: %s"), flight_controller.info.product)
Expand Down

0 comments on commit 09fbec7

Please sign in to comment.