run black

This commit is contained in:
Robin Müller 2022-05-23 13:47:01 +02:00
parent 580b381848
commit e033609177
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 19 additions and 9 deletions

View File

@ -311,7 +311,7 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
def gen_six_entry_u16_list(hk_data: bytes, current_idx: int) -> Tuple[int, List[int]]:
u16_list = []
for idx in range(6):
u16_list.append(hk_data[current_idx : current_idx + 2])
u16_list.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
current_idx += 2
return current_idx, u16_list
@ -322,7 +322,9 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
current_idx = 0
fmt_str = "!B"
inc_len = struct.calcsize(fmt_str)
mppt_mode = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
mppt_mode = struct.unpack(
fmt_str, hk_data[current_idx : current_idx + inc_len]
)[0]
current_idx += inc_len
current_idx, currents = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
@ -330,9 +332,9 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
current_idx, voltages = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
)
vcc = hk_data[current_idx : current_idx + 2]
vcc = struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
current_idx += 2
vbat = hk_data[current_idx : current_idx + 2]
vbat = struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
current_idx += 2
current_idx, vboosts = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
@ -348,13 +350,19 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
current_idx += inc_len
pw.dlog("Received ACU Core HK. Voltages in mV, currents in mA")
pw.dlog(f"VCC {vcc} mV | VBAT {vbat} mV | MPPT Mode {mppt_mode}")
header_str = f"Channel | Input U [mV] | Input I [mA] | U Boost [mV] | Power [?]"
header_str = (
f"Channel | Input U [mV] | Input I [mA] | U Boost [mV] | Power [mW]"
)
pw.dlog(header_str)
for i in range(6):
pw.dlog(f"{i} | {voltages[i]} | {currents[i]} | {vboosts[i]} | {powers[i]}")
pw.dlog(f"Temperatures in C: Ch0 {tmp0} | Ch1 {tmp1} | Ch2 {tmp2}")
pw.dlog(
f"{i} | {str(voltages[i]).ljust(4)} | {str(currents[i]).ljust(4)} | {str(vboosts[i]).ljust(4)} | {str(powers[i]).ljust(2)}"
)
pw.dlog(
f"Boot Count {bootcnt} | Uptime {uptime} | "
f"Temperatures in C: Ch0 {tmp0/10.0} | Ch1 {tmp1/10.0} | Ch2 {tmp2/10.0}"
)
pw.dlog(
f"Boot Count {bootcnt} | Uptime {uptime} sec | "
f"MPPT Time {mppt_time} msec | MPPT Period {mppt_period} msec"
)
printer.print_validity_buffer(

View File

@ -15,7 +15,7 @@ from pus_tm.devs.bpx_bat import handle_bpx_hk_data
from pus_tm.devs.gps import handle_gps_data
from pus_tm.devs.gyros import handle_gyros_hk_data
from pus_tm.devs.imtq_mgt import handle_self_test_data
from pus_tm.devs.pcdu import handle_pdu_data, handle_p60_hk_data
from pus_tm.devs.pcdu import handle_pdu_data, handle_p60_hk_data, handle_acu_hk_data
from pus_tm.devs.syrlinks import handle_syrlinks_hk_data
from pus_tc.devs.imtq import ImtqSetIds
from pus_tm.devs.reaction_wheels import handle_rw_hk_data
@ -92,6 +92,8 @@ def handle_regular_hk_print(
return handle_pdu_data(
printer=printer, pdu_idx=2, set_id=set_id, hk_data=hk_data
)
if objb == obj_ids.ACU_HANDLER_ID:
return handle_acu_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
if objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
return handle_rw_hk_data(
printer=printer, object_id=object_id, set_id=set_id, hk_data=hk_data