diff --git a/eive_tmtc/tmtc/acs/imtq.py b/eive_tmtc/tmtc/acs/imtq.py index be2d2d3..b5c9b26 100644 --- a/eive_tmtc/tmtc/acs/imtq.py +++ b/eive_tmtc/tmtc/acs/imtq.py @@ -439,6 +439,8 @@ def handle_imtq_hk(printer: FsfwTmTcPrinter, hk_data: bytes, set_id: int): return handle_raw_mtm_measurement(printer, hk_data, False) elif set_id == ImtqSetId.RAW_MTM_WITH_TORQUE: return handle_raw_mtm_measurement(printer, hk_data, True) + elif set_id == ImtqSetId.DIPOLES: + return handle_dipole_set(printer, hk_data) elif set_id == ImtqSetId.STATUS_SET: return handle_status_set(printer, hk_data) else: @@ -455,6 +457,24 @@ def unpack_status_set(hk_data: bytes) -> List: return [status_mode, status_error, status_conf, status_uptime] +def handle_dipole_set(printer: FsfwTmTcPrinter, hk_data: bytes): + pw = PrintWrapper(printer) + pw.dlog("Received iMTQ dipole set") + fmt_str = "!hhhH" + fmt_len = struct.calcsize(fmt_str) + ( + dipole_x, + dipole_y, + dipole_z, + current_torque_duration + ) = struct.unpack(fmt_str, hk_data) + pw.dlog(f"Dipole X: {dipole_x}") + pw.dlog(f"Dipole Y: {dipole_y}") + pw.dlog(f"Dipole Z: {dipole_z}") + pw.dlog(f"Current torque duration: {current_torque_duration}") + pw.printer.print_validity_buffer(hk_data[fmt_len:], 2) + + def unpack_eng_hk(hk_data: bytes) -> List: digital_voltage = struct.unpack("!H", hk_data[0:2])[0] analog_voltage = struct.unpack("!H", hk_data[2:4])[0]