rework hk eng printout

This commit is contained in:
Robin Müller 2023-02-19 02:22:18 +01:00
parent 201e08afe1
commit b19d1e8869
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -263,6 +263,10 @@ def raise_dipole_error(dipole_str: str, value: int):
ENG_HK_HEADERS = [
"Status Byte Mode",
"Status Byte Error",
"Status Byte Config",
"Status Byte Uptime [s]",
"Digital Voltage [mV]",
"Analog Voltage [mV]",
"Digital Current [mA]",
@ -278,18 +282,26 @@ ENG_HK_HEADERS = [
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]
digital_current = struct.unpack("!f", hk_data[4:8])[0]
analog_current = struct.unpack("!f", hk_data[8:12])[0]
coil_x_current = struct.unpack("!f", hk_data[12:16])[0]
coil_y_current = struct.unpack("!f", hk_data[16:20])[0]
coil_z_current = struct.unpack("!f", hk_data[20:24])[0]
coil_x_temperature = struct.unpack("!h", hk_data[24:26])[0]
coil_y_temperature = struct.unpack("!h", hk_data[26:28])[0]
coil_z_temperature = struct.unpack("!h", hk_data[28:30])[0]
mcu_temperature = struct.unpack("!h", hk_data[30:32])[0]
status_mode = hk_data[0]
status_error = hk_data[1]
status_conf = hk_data[2]
status_uptime = struct.unpack("!I", hk_data[3:7])[0]
digital_voltage = struct.unpack("!H", hk_data[7:9])[0]
analog_voltage = struct.unpack("!H", hk_data[9:11])[0]
digital_current = struct.unpack("!f", hk_data[11:15])[0]
analog_current = struct.unpack("!f", hk_data[15:19])[0]
coil_x_current = struct.unpack("!f", hk_data[19:23])[0]
coil_y_current = struct.unpack("!f", hk_data[23:27])[0]
coil_z_current = struct.unpack("!f", hk_data[27:31])[0]
coil_x_temperature = struct.unpack("!h", hk_data[31:33])[0]
coil_y_temperature = struct.unpack("!h", hk_data[33:35])[0]
coil_z_temperature = struct.unpack("!h", hk_data[35:37])[0]
mcu_temperature = struct.unpack("!h", hk_data[37:39])[0]
content_list = [
status_mode,
status_error,
status_conf,
status_uptime,
digital_voltage,
analog_voltage,
digital_current,
@ -308,11 +320,11 @@ def unpack_eng_hk(hk_data: bytes) -> List:
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
pw = PrintWrapper(printer)
content_list = unpack_eng_hk(hk_data)
validity_buffer = hk_data[32:]
validity_buffer = hk_data[39:]
num_of_vars = len(ENG_HK_HEADERS)
pw.dlog(str(ENG_HK_HEADERS))
pw.dlog(str(content_list))
for k, v in zip(ENG_HK_HEADERS, content_list):
pw.dlog(f"{k.ljust(30)}: {v}")
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)