diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index 228b75b..61e3a82 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -273,6 +273,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 14011;0x36bb;I2C_REBOOT;HIGH;I2C is unavailable. Recovery did not work, performing full reboot.;mission/sysDefs.h 14012;0x36bc;PDEC_REBOOT;HIGH;PDEC recovery through reset was not possible, performing full reboot.;mission/sysDefs.h 14013;0x36bd;FIRMWARE_INFO;INFO;Version information of the firmware (not OBSW). P1: Byte 0: Major, Byte 1: Minor, Byte 2: Patch, Byte 3: Has Git Hash P2: First four letters of Git SHA is the last byte of P1 is set.;mission/sysDefs.h +14014;0x36be;ACTIVE_SD_INFO;INFO;Active SD card info. 0: OFF, 1: ON, 2: MOUNTED. P1: SD Card 0, P2: SD Card 1.;mission/sysDefs.h 14100;0x3714;NO_VALID_SENSOR_TEMPERATURE;MEDIUM;No description;mission/controller/tcsDefs.h 14101;0x3715;NO_HEALTHY_HEATER_AVAILABLE;MEDIUM;No description;mission/controller/tcsDefs.h 14102;0x3716;SYRLINKS_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h diff --git a/eive_tmtc/pus_tm/event_handler.py b/eive_tmtc/pus_tm/event_handler.py index fdd5e89..d90d3c2 100644 --- a/eive_tmtc/pus_tm/event_handler.py +++ b/eive_tmtc/pus_tm/event_handler.py @@ -7,6 +7,7 @@ from eive_tmtc.config.object_ids import get_object_ids from eive_tmtc.pus_tm.defs import PrintWrapper from eive_tmtc.pus_tm.verification_handler import generic_retval_printout from eive_tmtc.tmtc.acs.subsystem import AcsMode +from eive_tmtc.tmtc.core import SdState, SdCardSelect from tmtccmd.tc.pus_200_fsfw_mode import Mode from tmtccmd.tc.pus_201_fsfw_health import FsfwHealth @@ -126,6 +127,20 @@ def handle_event_packet( # noqa C901: Complexity okay here time = event_def.param1 + event_def.param2 / 1000.0 time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc) pw.dlog(f"Current time: {time_dt}") + if info.name == "ACTIVE_SD_INFO": + sd_0_state = (event_def.param2 >> 16) & 0xFFFF + sd_1_state = event_def.param2 & 0xFFFF + active_sd = event_def.param1 + try: + active_sd = SdCardSelect(event_def.param1) + sd_0_state = SdState((event_def.param2 >> 16) & 0xFFFF) + sd_1_state = SdState(event_def.param2 & 0xFFFF) + except IndexError: + _LOGGER.error(f"Received invalid event fields for event {event_def}") + finally: + pw.dlog( + f"Active SD card {active_sd!r} | SD 0 State {sd_0_state!r} | SD 1 State {sd_1_state!r}" + ) if info.name == "HEALTH_INFO": specific_handler = True health = FsfwHealth(event_def.param1) diff --git a/eive_tmtc/tmtc/core.py b/eive_tmtc/tmtc/core.py index f8869fa..6a85ce2 100644 --- a/eive_tmtc/tmtc/core.py +++ b/eive_tmtc/tmtc/core.py @@ -24,6 +24,19 @@ from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter _LOGGER = logging.getLogger(__name__) +class SdState(enum.IntEnum): + OFF = 0 + ON = 1 + MOUNTED = 2 + + +class SdCardSelect(enum.IntEnum): + SD_0 = 0 + SD_1 = 1 + BOTH = 2 + NONE = 3 + + class ActionId(enum.IntEnum): ANNOUNCE_VERSION = 1 ANNOUNCE_CURRENT_IMAGE = 2