handling for bpx cfg set
This commit is contained in:
parent
1702d89576
commit
890a20a078
@ -28,4 +28,15 @@ def pack_bpx_commands(tc_queue: TcQueueT, op_code: str):
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.RESET_COUNTERS
|
||||
)
|
||||
tc_queue.appendleft(cmd.pack_command_tuple())
|
||||
if op_code in ["2", "cfg"]:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counters"))
|
||||
cmd = generate_action_command(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.GET_CFG
|
||||
)
|
||||
tc_queue.appendleft(cmd.pack_command_tuple())
|
||||
if op_code in ["3", "cfg_hk"]:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Requesting BPX Configuration Struct"))
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_CFG_SET)
|
||||
cmd = generate_one_hk_command(sid=sid, ssc=0)
|
||||
tc_queue.appendleft(cmd.pack_command_tuple())
|
||||
pass
|
||||
|
@ -6,6 +6,7 @@ import datetime
|
||||
from tmtccmd.config.definitions import HkReplyUnpacked
|
||||
from tmtccmd.tm.service_3_housekeeping import Service3Base
|
||||
from tmtccmd.utility.logger import get_console_logger
|
||||
from pus_tc.bpx_batt import BpxSetIds
|
||||
from pus_tc.syrlinks_hk_handler import SetIds
|
||||
from pus_tc.imtq import ImtqSetIds
|
||||
from config.object_ids import (
|
||||
@ -40,7 +41,7 @@ def handle_user_hk_packet(
|
||||
elif object_id == GPS_HANDLER_0_ID or object_id == GPS_HANDLER_1_ID:
|
||||
return handle_gps_data(hk_data=hk_data)
|
||||
elif object_id == BPX_HANDLER_ID:
|
||||
return handle_bpx_hk_data(hk_data=hk_data)
|
||||
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id)
|
||||
else:
|
||||
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
|
||||
return HkReplyUnpacked()
|
||||
@ -285,42 +286,58 @@ def handle_gps_data(hk_data: bytearray) -> HkReplyUnpacked:
|
||||
return reply
|
||||
|
||||
|
||||
def handle_bpx_hk_data(hk_data: bytes) -> HkReplyUnpacked:
|
||||
def handle_bpx_hk_data(hk_data: bytes, set_id: int) -> HkReplyUnpacked:
|
||||
LOGGER.info(f"Received BPX data, HK data length {len(hk_data)}")
|
||||
reply = HkReplyUnpacked()
|
||||
charge_current = struct.unpack('!H', hk_data[0:2])[0]
|
||||
discharge_current = struct.unpack('!H', hk_data[2:4])[0]
|
||||
heater_current = struct.unpack('!H', hk_data[4:6])[0]
|
||||
batt_voltage = struct.unpack('!H', hk_data[6:8])[0]
|
||||
batt_temp_1 = struct.unpack('!h', hk_data[8:10])[0]
|
||||
batt_temp_2 = struct.unpack('!h', hk_data[10:12])[0]
|
||||
batt_temp_3 = struct.unpack('!h', hk_data[12:14])[0]
|
||||
batt_temp_4 = struct.unpack('!h', hk_data[14:16])[0]
|
||||
reboot_cntr = struct.unpack('!I', hk_data[16:20])[0]
|
||||
boot_cause = hk_data[20]
|
||||
reply.header_list = [
|
||||
"Charge Current",
|
||||
"Discharge Current",
|
||||
"Heater Current",
|
||||
"Battery Voltage",
|
||||
"Batt Temp 1",
|
||||
"Batt Temp 2",
|
||||
"Batt Temp 3",
|
||||
"Batt Temp 4",
|
||||
"Reboot Counter",
|
||||
"Boot Cause"
|
||||
]
|
||||
reply.content_list = [
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause
|
||||
]
|
||||
reply.validity_buffer = hk_data[21:]
|
||||
if set_id == BpxSetIds.GET_HK_SET:
|
||||
charge_current = struct.unpack('!H', hk_data[0:2])[0]
|
||||
discharge_current = struct.unpack('!H', hk_data[2:4])[0]
|
||||
heater_current = struct.unpack('!H', hk_data[4:6])[0]
|
||||
batt_voltage = struct.unpack('!H', hk_data[6:8])[0]
|
||||
batt_temp_1 = struct.unpack('!h', hk_data[8:10])[0]
|
||||
batt_temp_2 = struct.unpack('!h', hk_data[10:12])[0]
|
||||
batt_temp_3 = struct.unpack('!h', hk_data[12:14])[0]
|
||||
batt_temp_4 = struct.unpack('!h', hk_data[14:16])[0]
|
||||
reboot_cntr = struct.unpack('!I', hk_data[16:20])[0]
|
||||
boot_cause = hk_data[20]
|
||||
reply.header_list = [
|
||||
"Charge Current",
|
||||
"Discharge Current",
|
||||
"Heater Current",
|
||||
"Battery Voltage",
|
||||
"Batt Temp 1",
|
||||
"Batt Temp 2",
|
||||
"Batt Temp 3",
|
||||
"Batt Temp 4",
|
||||
"Reboot Counter",
|
||||
"Boot Cause"
|
||||
]
|
||||
reply.content_list = [
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause
|
||||
]
|
||||
reply.validity_buffer = hk_data[21:]
|
||||
elif set_id == BpxSetIds.GET_CFG_SET:
|
||||
battheat_mode = hk_data[0]
|
||||
battheat_low = struct.unpack('!b', hk_data[1:2])[0]
|
||||
battheat_high = struct.unpack('!b', hk_data[2:3])[0]
|
||||
reply.header_list = [
|
||||
"Battery Heater Mode",
|
||||
"Battery Heater Low Limit",
|
||||
"Battery Heater High Limit"
|
||||
]
|
||||
reply.content_list = [
|
||||
battheat_mode,
|
||||
battheat_low,
|
||||
battheat_high
|
||||
]
|
||||
reply.validity_buffer = hk_data[3:]
|
||||
return reply
|
||||
|
2
tmtccmd
2
tmtccmd
@ -1 +1 @@
|
||||
Subproject commit 683ae401c7b4b2503bd91f23c3e069ced1b0db9c
|
||||
Subproject commit 892d13117f0e3c6d598f157668bff9ed6b31574d
|
Loading…
Reference in New Issue
Block a user