diff --git a/pyproject.toml b/pyproject.toml index dbdd5f9..b44bc83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ ] dependencies = [ "bitstring", - "cfdp-py", + "cfdp-py==0.1.2", "dataclasses-json", "oresat-configs", "oresat-olaf>=3.5.0", diff --git a/requirements.txt b/requirements.txt index 4a9dab9..8a5b743 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ bitstring black build -cfdp-py +cfdp-py==0.1.2 dataclasses-json isort oresat-configs diff --git a/scripts/edl_cmd_shell.py b/scripts/edl_cmd_shell.py index ab6ac33..cefd011 100755 --- a/scripts/edl_cmd_shell.py +++ b/scripts/edl_cmd_shell.py @@ -221,11 +221,14 @@ def help_sdo_write(self): print(" is the index or object name") print(" is the subindex or object name") print(" is value to write") + print() + print("If . is of type DOMAIN, will be interpreted as a filename") + print("and the contents will be written.") def do_sdo_write(self, arg: str): """Do the sdo_write command.""" - args = arg.split(" ") + args = arg.split(" ", maxsplit=3) if len(args) != 4: self.help_sdo_write() return @@ -284,8 +287,21 @@ def do_sdo_write(self, arg: str): value = float(args[3]) elif obj.data_type == canopen.objectdictionary.VISIBLE_STRING: value = args[3] + elif obj.data_type == canopen.objectdictionary.DOMAIN: + try: + with open(args[3], "rb") as f: + value = f.read() + except FileNotFoundError as e: + print(f"{e.__class__.__name__}: {e}") + return + elif obj.data_type == canopen.objectdictionary.OCTET_STRING: + try: + value = bytes.fromhex(args[3]) + except ValueError: + value = args[3].encode("ascii") + else: - print("invaid") + print(f"invalid OD obj type {obj} 0x{obj.data_type:X}") return raw = obj.encode_raw(value) diff --git a/scripts/edl_file_upload.py b/scripts/edl_file_upload.py index f066834..6e335e5 100755 --- a/scripts/edl_file_upload.py +++ b/scripts/edl_file_upload.py @@ -142,6 +142,7 @@ def run(self): packet = EdlPacket(payload, self._sequence_number, SRC_DEST_ORESAT) message = packet.pack(self._hmac_key) uplink.send(message) + print("Current sequence number:", self._sequence_number) self._sequence_number += 1 time.sleep(self._delay)