added sus temeprature set parsing
This commit is contained in:
parent
38b8f2a02f
commit
8a23e8a96c
@ -1,3 +1,4 @@
|
|||||||
|
import enum
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from pus_tm.defs import PrintWrapper
|
from pus_tm.defs import PrintWrapper
|
||||||
@ -6,10 +7,16 @@ from tmtccmd.utility import ObjectId
|
|||||||
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
|
class SetIds(enum.IntEnum):
|
||||||
|
SENSOR_TEMPERATURE_SET = 0
|
||||||
|
DEVICE_TEMPERATURE_SET = 1
|
||||||
|
SUS_TEMPERATURE_SET = 2
|
||||||
|
|
||||||
|
|
||||||
def handle_thermal_controller_hk_data(
|
def handle_thermal_controller_hk_data(
|
||||||
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if set_id == 0:
|
if set_id is SetIds.SENSOR_TEMPERATURE_SET:
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer)
|
||||||
pw.dlog("Received sensor temperature data")
|
pw.dlog("Received sensor temperature data")
|
||||||
|
|
||||||
@ -25,7 +32,7 @@ def handle_thermal_controller_hk_data(
|
|||||||
|
|
||||||
print(parsed_data)
|
print(parsed_data)
|
||||||
tcp_server_sensor_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
|
tcp_server_sensor_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
|
||||||
elif set_id == 1:
|
elif set_id is SetIds.DEVICE_TEMPERATURE_SET:
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer)
|
||||||
pw.dlog("Received device temperature data")
|
pw.dlog("Received device temperature data")
|
||||||
|
|
||||||
@ -60,4 +67,28 @@ def handle_thermal_controller_hk_data(
|
|||||||
"MGM_1_TEMPERATURE": tm_data[25],
|
"MGM_1_TEMPERATURE": tm_data[25],
|
||||||
"ADC_PL_PCDU_TEMPERATURE": tm_data[26],
|
"ADC_PL_PCDU_TEMPERATURE": tm_data[26],
|
||||||
}
|
}
|
||||||
|
print(parsed_data)
|
||||||
tcp_server_device_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
|
tcp_server_device_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
|
||||||
|
elif set_id is SetIds.SUS_TEMPERATURE_SET:
|
||||||
|
pw = PrintWrapper(printer)
|
||||||
|
pw.dlog("Received SUS temperature data")
|
||||||
|
fmt_str = "!ffffffffffffffffff"
|
||||||
|
tm_data = struct.unpack(fmt_str, hk_data[:4 * 18])
|
||||||
|
parsed_data = {
|
||||||
|
"SUS_0": tm_data[0],
|
||||||
|
"SUS_1": tm_data[1],
|
||||||
|
"SUS_2": tm_data[2],
|
||||||
|
"SUS_3": tm_data[3],
|
||||||
|
"SUS_4": tm_data[4],
|
||||||
|
"SUS_5": tm_data[5],
|
||||||
|
"SUS_6": tm_data[6],
|
||||||
|
"SUS_7": tm_data[7],
|
||||||
|
"SUS_8": tm_data[8],
|
||||||
|
"SUS_9": tm_data[9],
|
||||||
|
"SUS_10": tm_data[10],
|
||||||
|
"SUS_11": tm_data[11],
|
||||||
|
}
|
||||||
|
print(parsed_data)
|
||||||
|
# TODO: Forward data to space simulator
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user