Merge pull request 'GNSS Fixes' (#289) from gnss-fixes into main
All checks were successful
EIVE/-/pipeline/head This commit looks good

Reviewed-on: #289
Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
This commit is contained in:
Marius Eggert 2024-04-10 11:34:58 +02:00
commit e2f0221681
2 changed files with 17 additions and 21 deletions

View File

@ -19,6 +19,7 @@ list yields a list of all related PRs for each release.
## Fixed
- EPS power commands working again.
- GNSS commands working again.
## Changed

View File

@ -15,6 +15,7 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
create_enable_periodic_hk_command_with_interval_with_diag,
create_disable_periodic_hk_command_with_diag,
)
from tmtccmd.pus.tc.s8_fsfw_action import create_action_cmd
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
_LOGGER = logging.getLogger(__name__)
@ -24,6 +25,11 @@ class GpsInfo:
MAX_SATELLITES = 30
class GnssChip(enum.IntEnum):
A_SIDE = 0
B_SIDE = 1
class OpCode:
OFF = "off"
ON = "on"
@ -59,36 +65,25 @@ def create_gnss_node() -> CmdTreeNode:
]
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
combined_dict = dict(zip(op_code_strs, info_strs))
node = CmdTreeNode("gnss", "GNSS device", hide_children_for_print=True)
node = CmdTreeNode("gnss_devs", "GNSS Controller", hide_children_for_print=True)
for op_code, info in combined_dict.items():
node.add_child(CmdTreeNode(op_code, info))
return node
@tmtc_definitions_provider
def add_gps_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=OpCode.OFF, info=Info.OFF)
oce.add(keys=OpCode.ON, info=Info.ON)
oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS)
oce.add(keys=OpCode.REQ_CORE_HK, info=Info.REQ_CORE_HK)
oce.add(keys=OpCode.ENABLE_CORE_HK, info=Info.ENABLE_CORE_HK)
oce.add(keys=OpCode.DISABLE_CORE_HK, info=Info.DISABLE_CORE_HK)
oce.add(keys=OpCode.REQ_SKYVIEW_HK, info=Info.REQ_SKYVIEW_HK)
oce.add(keys=OpCode.ENABLE_SKYVIEW_HK, info=Info.ENABLE_SKYVIEW_HK)
oce.add(keys=OpCode.DISABLE_SKYVIEW_HK, info=Info.DISABLE_SKYVIEW_HK)
defs.add_service(
name=CustomServiceList.GPS_CTRL.value,
info="GPS/GNSS Controller",
op_code_entry=oce,
)
def pack_gps_command( # noqa: C901
object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str
): # noqa: C901:
if cmd_str == OpCode.RESET_GNSS:
# TODO: This needs to be re-implemented
for val in GnssChip:
print("{:<2}: {:<20}".format(val, val.name))
chip: str = ""
while chip not in ["0", "1"]:
chip = input("Please specify which chip to reset: ")
q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}")
q.add_pus_tc(
create_action_cmd(object_id=object_id, action_id=5, user_data=chip.encode())
)
_LOGGER.warning("Reset pin handling needs to be re-implemented")
if cmd_str == OpCode.ENABLE_CORE_HK:
interval = float(input("Please specify interval in floating point seconds: "))