histogram set working
All checks were successful
EIVE/-/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-10-27 10:36:51 +02:00
parent d9530271c3
commit 2ca7bc5a70
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -108,7 +108,7 @@ class OpCodes:
NORMAL = "nml"
OFF = "off"
PING = "ping"
ONE_SHOOT_HK = "one_shoot_hk"
ONE_SHOOT_HK = "one_shot_hk"
ENABLE_HK = "enable_hk"
DISABLE_HK = "disable_hk"
ADD_SECONDARY_TM_TO_NORMAL_MODE = "add_secondary_tm"
@ -674,75 +674,50 @@ def pack_star_tracker_commands( # noqa C901
)
def request_dataset(q: DefaultPusQueueHelper, type: DataSetRequest):
def request_dataset(q: DefaultPusQueueHelper, req_type: DataSetRequest):
for val in SetId:
print("{:<2}: {:<20}".format(val, val.name))
setId = int(input("Specify the dataset \n" ""))
match type:
set_id = int(input("Specify the dataset \n" ""))
if set_id in [SetId.SOLUTION, SetId.TEMPERATURE]:
is_diag = True
else:
is_diag = False
match req_type:
case DataSetRequest.ONESHOT:
if setId in [
SetId.SOLUTION,
SetId.TEMPERATURE,
]:
if is_diag:
q.add_pus_tc(
create_request_one_diag_command(make_sid(STAR_TRACKER_ID, setId))
)
elif setId in [
SetId.AUTO_BLOB,
SetId.MATCHED_CENTROIDS,
SetId.BLOB,
SetId.BLOBS,
SetId.CENTROID,
SetId.CENTROIDS,
]:
q.add_pus_tc(
create_request_one_hk_command(make_sid(STAR_TRACKER_ID, setId))
create_request_one_diag_command(make_sid(STAR_TRACKER_ID, set_id))
)
else:
print("Not Implemented Yet")
q.add_pus_tc(
create_request_one_hk_command(make_sid(STAR_TRACKER_ID, set_id))
)
case DataSetRequest.ENABLE:
interval = float(
input("Please specify interval in floating point seconds: ")
)
if setId in [SetId.SOLUTION]:
if is_diag:
cmd_tuple = enable_periodic_hk_command_with_interval(
True, make_sid(STAR_TRACKER_ID, setId), interval
True, make_sid(STAR_TRACKER_ID, set_id), interval
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif setId in [
SetId.AUTO_BLOB,
SetId.MATCHED_CENTROIDS,
SetId.BLOB,
SetId.BLOBS,
SetId.CENTROID,
SetId.CENTROIDS,
]:
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(STAR_TRACKER_ID, setId), interval
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
else:
print("Not Implemented Yet")
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(STAR_TRACKER_ID, set_id), interval
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
case DataSetRequest.DISABLE:
if setId in [SetId.SOLUTION]:
if is_diag:
q.add_pus_tc(
disable_periodic_hk_command(True, make_sid(STAR_TRACKER_ID, setId))
)
elif setId in [
SetId.AUTO_BLOB,
SetId.MATCHED_CENTROIDS,
SetId.BLOB,
SetId.BLOBS,
SetId.CENTROID,
SetId.CENTROIDS,
]:
q.add_pus_tc(
disable_periodic_hk_command(False, make_sid(STAR_TRACKER_ID, setId))
disable_periodic_hk_command(True, make_sid(STAR_TRACKER_ID, set_id))
)
else:
print("Not Implemented Yet")
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(STAR_TRACKER_ID, set_id)
)
)
def pack_read_command(object_id: bytes) -> bytearray:
@ -1098,23 +1073,23 @@ def handle_histogram_set(hk_data: bytes, pw: PrintWrapper):
d_bins = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
bins_list.append(d_bins)
pw.dlog(
"{:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8}".format(
"Section", "Index", "0", "1", "2", "3", "4", "5", "6", "7", "8"
"Histogram Sections: A Upper Left | B Upper Right | C Lower Left | D Lower Right"
)
)
for idx in range(4):
name = "?"
pw.dlog("{:<12} {:<8} {:<8} {:<8} {:<8}".format("Range", "A", "B", "C", "D"))
for idx in range(9):
if idx == 0:
name = "A"
if idx == 1:
name = "B"
if idx == 2:
name = "C"
if idx == 3:
name = "D"
val_range = "0 (0-0)"
elif idx == 1:
val_range = "1 (1-1)"
else:
val_range = f"{idx} ({pow(2, idx - 1)}-{pow(2, idx) - 1})"
pw.dlog(
"{:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8} {:<8}".format(
name, idx, *bins_list[idx]
"{:<12} {:<8} {:<8} {:<8} {:<8}".format(
val_range,
bins_list[0][idx],
bins_list[1][idx],
bins_list[2][idx],
bins_list[3][idx],
)
)
pass