diff --git a/.gitignore b/.gitignore index 50cba5f..ec6e113 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ log /lib /lib64 /share + +/venv diff --git a/config/custom_mode_op.py b/config/custom_mode_op.py index a82797b..159e350 100644 --- a/config/custom_mode_op.py +++ b/config/custom_mode_op.py @@ -6,9 +6,9 @@ import enum from tmtccmd.core.backend import TmTcHandler -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger -LOGGER = get_logger() +LOGGER = get_console_logger() class CustomModeList(enum.IntEnum): diff --git a/config/globals_config.py b/config/globals_config.py index b8274bb..3fc9b35 100644 --- a/config/globals_config.py +++ b/config/globals_config.py @@ -14,9 +14,9 @@ from config.custom_mode_op import CustomModeList from tmtccmd.config.definitions import CoreComInterfaces from tmtccmd.config.globals import set_default_globals_pre_args_parsing, \ set_default_globals_post_args_parsing -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger -LOGGER = get_logger() +LOGGER = get_console_logger() class CustomGlobalIds(enum.Enum): diff --git a/config/object_ids.py b/config/object_ids.py index 3dd4c29..733107b 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -6,19 +6,19 @@ from typing import Dict PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17]) -TEST_DEVICE_ID = bytes([0x44, 0x00, 0xAF, 0xFE]) -P60_DOCK_HANDLER = bytes([0x44, 0x00, 0x00, 0x1]) -PDU_1_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x2]) -PDU_2_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x3]) -ACU_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x4]) -TMP_1075_1_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x5]) -TMP_1075_2_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x6]) -HEATER_ID = bytes([0x54, 0x00, 0x00, 0x1]) -PCDU_HANDLER_ID = bytes([0x44, 0x00, 0x10, 0x00]) -SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x00, 0x10, 0x01]) -SYRLINKS_HANDLER = bytes([0x44, 0x00, 0x10, 0x02]) -IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x14]) -PLOC_ID = bytearray([0x44, 0x00, 0x00, 0x15]) +TEST_DEVICE_ID = bytes([0x54, 0x00, 0xAF, 0xFE]) +P60_DOCK_HANDLER = bytes([0x44, 0x25, 0x00, 0x00]) +PDU_1_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x01]) +PDU_2_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x02]) +ACU_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x03]) +TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04]) +TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05]) +HEATER_ID = bytes([0x44, 0x41, 0x00, 0xA4]) +PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0xA1]) +SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0xA2]) +SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0xA3]) +IMTQ_HANDLER_ID = bytearray([0x44, 0x14, 0x00, 0x14]) +PLOC_ID = bytearray([0x44, 0x33, 0x00, 0x15]) def get_object_ids() -> Dict[bytes, list]: diff --git a/lint.py b/lint.py new file mode 100755 index 0000000..f0f66f0 --- /dev/null +++ b/lint.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import os +import sys + + +def main(): + status = os.system("flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics") + if os.WEXITSTATUS(status) != 0: + print("Flake8 linter errors") + sys.exit(0) + os.system("flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics") + + +if __name__ == "__main__": + main() diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 41b572b..b1ee736 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -9,7 +9,7 @@ from collections import deque from typing import Union from tmtccmd.config.definitions import CoreServiceList -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger from tmtccmd.pus_tc.definitions import TcQueueT from tmtccmd.pus_tc.service_5_event import pack_generic_service5_test_into from tmtccmd.pus_tc.service_17_test import pack_service17_ping_command @@ -27,7 +27,7 @@ from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_ID -LOGGER = get_logger() +LOGGER = get_console_logger() def pack_service_queue_user(service: Union[str, int], op_code: str, service_queue: TcQueueT): diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index ab2b264..d1a2bac 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -5,7 +5,7 @@ """ from tmtccmd.pus_tm.service_8_functional_cmd import Service8TM from tmtccmd.ecss.tm import PusTelemetry -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger from tmtccmd.pus_tm.service_1_verification import Service1TM from tmtccmd.pus_tm.service_3_housekeeping import Service3TM @@ -15,7 +15,7 @@ from tmtccmd.utility.tmtc_printer import TmTcPrinter from config.definitions import PUS_APID -LOGGER = get_logger() +LOGGER = get_console_logger() def ccsds_tm_handler(apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter) -> None: diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py index f093ae7..681c8aa 100644 --- a/pus_tm/hk_handling.py +++ b/pus_tm/hk_handling.py @@ -8,11 +8,11 @@ import struct from typing import Tuple from tmtccmd.pus_tm.service_3_housekeeping import Service3Base -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger from pus_tc.syrlinks_hk_handler import SetIds from pus_tc.imtq import ImtqSetIds from config.object_ids import SYRLINKS_HANDLER, IMTQ_HANDLER_ID -LOGGER = get_logger() +LOGGER = get_console_logger() def handle_user_hk_packet(object_id: bytes, set_id: int, hk_data: bytearray, diff --git a/tmtccmd b/tmtccmd index b4358a1..657b7b3 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit b4358a15fd945a9e0103a707b2a2dc56c458b24a +Subproject commit 657b7b3f36f931eabf6ee4ff8267a119702099c8