diff --git a/CHANGELOG.md b/CHANGELOG.md index b743777..c261a09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,17 @@ list yields a list of all related PRs for each release. # [unreleased] +## Fixed + +- Bugfix for STR solution set format. +- Update for STR commands. + +## Added + +- Added core commands to execute `systemctl` commands and to execute arbitrary Linux commands. + +# [v2.22.1] 2023-04-12 + ## Added - Prompts to specify custom filename for OBSW update diff --git a/eive_tmtc/__init__.py b/eive_tmtc/__init__.py index 20762d8..65cd98e 100644 --- a/eive_tmtc/__init__.py +++ b/eive_tmtc/__init__.py @@ -1,4 +1,4 @@ -__version__ = "2.22.0" +__version__ = "2.22.1" import logging from pathlib import Path @@ -6,7 +6,7 @@ from pathlib import Path SW_NAME = "eive-tmtc" VERSION_MAJOR = 2 VERSION_MINOR = 22 -VERSION_REVISION = 0 +VERSION_REVISION = 1 EIVE_TMTC_ROOT = Path(__file__).parent PACKAGE_ROOT = EIVE_TMTC_ROOT.parent diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index af15edf..5423323 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -86,13 +86,14 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 10802;0x2a32;SERIALIZATION_ERROR;LOW;No description;fsfw/src/fsfw/cfdp/handler/defs.h 10803;0x2a33;FILESTORE_ERROR;LOW;No description;fsfw/src/fsfw/cfdp/handler/defs.h 10804;0x2a34;FILENAME_TOO_LARGE_ERROR;LOW;P1: Transaction step ID, P2: 0 for source file name, 1 for dest file name;fsfw/src/fsfw/cfdp/handler/defs.h -11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;No description;mission/acs/defs.h -11201;0x2bc1;SAFE_RATE_RECOVERY;MEDIUM;No description;mission/acs/defs.h -11202;0x2bc2;MULTIPLE_RW_INVALID;HIGH;No description;mission/acs/defs.h -11203;0x2bc3;MEKF_INVALID_INFO;INFO;No description;mission/acs/defs.h -11204;0x2bc4;MEKF_RECOVERY;INFO;No description;mission/acs/defs.h -11205;0x2bc5;MEKF_INVALID_MODE_VIOLATION;HIGH;No description;mission/acs/defs.h -11206;0x2bc6;SAFE_MODE_CONTROLLER_FAILURE;HIGH;No description;mission/acs/defs.h +11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;The limits for the rotation in safe mode were violated.;mission/acs/defs.h +11201;0x2bc1;SAFE_RATE_RECOVERY;MEDIUM;The system has recovered from a safe rate rotation violation.;mission/acs/defs.h +11202;0x2bc2;MULTIPLE_RW_INVALID;HIGH;Multiple RWs are invalid, uncommandable and therefore higher ACS modes cannot be maintained.;mission/acs/defs.h +11203;0x2bc3;MEKF_INVALID_INFO;INFO;MEKF was not able to compute a solution. P1: MEKF state on exit;mission/acs/defs.h +11204;0x2bc4;MEKF_RECOVERY;INFO;MEKF is able to compute a solution again.;mission/acs/defs.h +11205;0x2bc5;MEKF_AUTOMATIC_RESET;INFO;MEKF performed an automatic reset after detection of nonfinite values.;mission/acs/defs.h +11206;0x2bc6;MEKF_INVALID_MODE_VIOLATION;HIGH;MEKF was not able to compute a solution during any pointing ACS mode for a prolonged time.;mission/acs/defs.h +11207;0x2bc7;SAFE_MODE_CONTROLLER_FAILURE;HIGH;The ACS safe mode controller was not able to compute a solution and has failed. P1: Missing information about magnetic field, P2: Missing information about rotational rate;mission/acs/defs.h 11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/power/defs.h 11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/power/defs.h 11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;No description;mission/power/defs.h @@ -145,17 +146,20 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12300;0x300c;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;linux/payload/PlocMemoryDumper.h 12301;0x300d;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;linux/payload/PlocMemoryDumper.h 12302;0x300e;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;linux/payload/PlocMemoryDumper.h -12401;0x3071;INVALID_TC_FRAME;HIGH;No description;linux/ipcore/PdecHandler.h -12402;0x3072;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/ipcore/PdecHandler.h -12403;0x3073;CARRIER_LOCK;INFO;Carrier lock detected;linux/ipcore/PdecHandler.h -12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/ipcore/PdecHandler.h -12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/ipcore/PdecHandler.h -12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/ipcore/PdecHandler.h -12407;0x3077;TOO_MANY_IRQS;MEDIUM;Too many IRQs over the time window of one second. P1: Allowed TCs;linux/ipcore/PdecHandler.h -12408;0x3078;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h -12409;0x3079;WRITE_SYSCALL_ERROR_PDEC;HIGH;No description;linux/ipcore/PdecHandler.h -12410;0x307a;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/PdecHandler.h -12411;0x307b;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/PdecHandler.h +12401;0x3071;INVALID_TC_FRAME;HIGH;No description;linux/ipcore/pdec.h +12402;0x3072;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/ipcore/pdec.h +12403;0x3073;CARRIER_LOCK;INFO;Carrier lock detected;linux/ipcore/pdec.h +12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/ipcore/pdec.h +12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/ipcore/pdec.h +12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/ipcore/pdec.h +12407;0x3077;TOO_MANY_IRQS;MEDIUM;Too many IRQs over the time window of one second. P1: Allowed TCs;linux/ipcore/pdec.h +12408;0x3078;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/pdec.h +12409;0x3079;WRITE_SYSCALL_ERROR_PDEC;HIGH;No description;linux/ipcore/pdec.h +12410;0x307a;PDEC_TRYING_RESET_WITH_INIT;LOW;Trying a PDEC reset with complete re-initialization;linux/ipcore/pdec.h +12411;0x307b;PDEC_TRYING_RESET_NO_INIT;LOW;Trying a PDEC reset without re-initialization.;linux/ipcore/pdec.h +12412;0x307c;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/pdec.h +12413;0x307d;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/pdec.h +12414;0x307e;PDEC_INIT_FAILED;HIGH;PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues.;linux/ipcore/pdec.h 12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/acs/StrComHandler.h 12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/acs/StrComHandler.h 12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/acs/StrComHandler.h @@ -208,7 +212,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12901;0x3265;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;No description;mission/system/acs/SusAssembly.h 12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;No description;mission/system/acs/SusAssembly.h 12903;0x3267;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/acs/SusAssembly.h -13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;No description;mission/system/objects/TcsBoardAssembly.h +13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;No description;mission/system/tcs/TcsBoardAssembly.h 13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;mission/acs/archive/GPSDefinitions.h 13101;0x332d;CANT_GET_FIX;LOW;Could not get fix in maximum allowed time. P1: Maximum allowed time to get a fix after the GPS was switched on.;mission/acs/archive/GPSDefinitions.h 13200;0x3390;P60_BOOT_COUNT;INFO;P60 boot count is broadcasted once at SW startup. P1: Boot count;mission/power/P60DockHandler.h @@ -260,8 +264,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 14006;0x36b6;CURRENT_IMAGE_INFO;INFO;P1: Current Chip, P2: Current Copy;mission/sysDefs.h 14007;0x36b7;REBOOT_COUNTER;INFO;Total reboot counter, which is the sum of the boot count of all individual images.;mission/sysDefs.h 14008;0x36b8;INDIVIDUAL_BOOT_COUNTS;INFO;Get the boot count of the individual images. P1: First 16 bits boot count of image 0 0, last 16 bits boot count of image 0 1. P2: First 16 bits boot count of image 1 0, last 16 bits boot count of image 1 1.;mission/sysDefs.h -14010;0x36ba;TRYING_I2C_RECOVERY;MEDIUM;I2C is unavailable. Trying recovery of I2C bus by power cycling all I2C devices.;mission/sysDefs.h -14011;0x36bb;I2C_REBOOT;MEDIUM;I2C is unavailable. Recovery did not work, performing full reboot.;mission/sysDefs.h +14010;0x36ba;TRYING_I2C_RECOVERY;HIGH;I2C is unavailable. Trying recovery of I2C bus by power cycling all I2C devices.;mission/sysDefs.h +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 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/config/returnvalues.csv b/eive_tmtc/config/returnvalues.csv index fcb4a5e..20b76df 100644 --- a/eive_tmtc/config/returnvalues.csv +++ b/eive_tmtc/config/returnvalues.csv @@ -517,21 +517,21 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x5d05;GOMS_UnknownReplyId;No description;5;GOM_SPACE_HANDLER;mission/power/GomspaceDeviceHandler.h 0x5ea0;PLMEMDUMP_MramAddressTooHigh;The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.;160;PLOC_MEMORY_DUMPER;linux/payload/PlocMemoryDumper.h 0x5ea1;PLMEMDUMP_MramInvalidAddressCombination;The specified end address is lower than the start address;161;PLOC_MEMORY_DUMPER;linux/payload/PlocMemoryDumper.h -0x5fa0;PDEC_AbandonedCltuRetval;No description;160;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa1;PDEC_FrameDirtyRetval;No description;161;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa2;PDEC_FrameIllegalMultipleReasons;No description;162;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa3;PDEC_AdDiscardedLockoutRetval;No description;163;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa4;PDEC_AdDiscardedWaitRetval;No description;164;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa5;PDEC_AdDiscardedNsVs;No description;165;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa6;PDEC_NoReportRetval;No description;166;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa7;PDEC_ErrorVersionNumberRetval;No description;167;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa8;PDEC_IllegalCombinationRetval;No description;168;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fa9;PDEC_InvalidScIdRetval;No description;169;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5faa;PDEC_InvalidVcIdMsbRetval;No description;170;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fab;PDEC_InvalidVcIdLsbRetval;No description;171;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fac;PDEC_NsNotZeroRetval;No description;172;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fae;PDEC_InvalidBcCc;No description;174;PDEC_HANDLER;linux/ipcore/PdecHandler.h -0x5fb0;PDEC_CommandNotImplemented;Received action message with unknown action id;176;PDEC_HANDLER;linux/ipcore/PdecHandler.h +0x5fa0;PDEC_AbandonedCltuRetval;No description;160;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa1;PDEC_FrameDirtyRetval;No description;161;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa2;PDEC_FrameIllegalMultipleReasons;No description;162;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa3;PDEC_AdDiscardedLockoutRetval;No description;163;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa4;PDEC_AdDiscardedWaitRetval;No description;164;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa5;PDEC_AdDiscardedNsVs;No description;165;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa6;PDEC_NoReportRetval;No description;166;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa7;PDEC_ErrorVersionNumberRetval;No description;167;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa8;PDEC_IllegalCombinationRetval;No description;168;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fa9;PDEC_InvalidScIdRetval;No description;169;PDEC_HANDLER;linux/ipcore/pdec.h +0x5faa;PDEC_InvalidVcIdMsbRetval;No description;170;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fab;PDEC_InvalidVcIdLsbRetval;No description;171;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fac;PDEC_NsNotZeroRetval;No description;172;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fae;PDEC_InvalidBcCc;No description;174;PDEC_HANDLER;linux/ipcore/pdec.h +0x5fb0;PDEC_CommandNotImplemented;Received action message with unknown action id;176;PDEC_HANDLER;linux/ipcore/pdec.h 0x60a0;CCSDS_CommandNotImplemented;Received action message with unknown action id;160;CCSDS_HANDLER;mission/com/CcsdsIpCoreHandler.h 0x61a0;RS_RateNotSupported;The commanded rate is not supported by the current FPGA design;160;RATE_SETTER;linux/ipcore/PtmeConfig.h 0x61a1;RS_BadBitRate;Bad bitrate has been commanded (e.g. 0);161;RATE_SETTER;linux/ipcore/PtmeConfig.h @@ -583,7 +583,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x68b5;SPVRTVIF_SupvHelperExecuting;Supervisor helper task ist currently executing a command (wait until helper tas has finished or interrupt by sending the terminate command);181;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h 0x68c0;SPVRTVIF_BufTooSmall;No description;192;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h 0x68c1;SPVRTVIF_NoReplyTimeout;No description;193;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h -0x6900;ACSCTRL_FileDeletionFailed;No description;0;ACS_CTRL;mission/controller/AcsController.h +0x6900;ACSCTRL_FileDeletionFailed;File deletion failed and at least one file is still existent.;0;ACS_CTRL;mission/controller/AcsController.h 0x6a02;ACSMEKF_MekfUninitialized;No description;2;ACS_MEKF;mission/controller/acs/MultiplicativeKalmanFilter.h 0x6a03;ACSMEKF_MekfNoGyrData;No description;3;ACS_MEKF;mission/controller/acs/MultiplicativeKalmanFilter.h 0x6a04;ACSMEKF_MekfNoModelVectors;No description;4;ACS_MEKF;mission/controller/acs/MultiplicativeKalmanFilter.h @@ -592,21 +592,18 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x6a07;ACSMEKF_MekfNotFinite;No description;7;ACS_MEKF;mission/controller/acs/MultiplicativeKalmanFilter.h 0x6a08;ACSMEKF_MekfInitialized;No description;8;ACS_MEKF;mission/controller/acs/MultiplicativeKalmanFilter.h 0x6a09;ACSMEKF_MekfRunning;No description;9;ACS_MEKF;mission/controller/acs/MultiplicativeKalmanFilter.h -0x6b01;ACSSAF_SafectrlMekfInputInvalid;No description;1;ACS_SAFE;mission/controller/acs/control/SafeCtrl.h -0x6c01;ACSPTG_PtgctrlMekfInputInvalid;No description;1;ACS_PTG;mission/controller/acs/control/PtgCtrl.h -0x6d01;ACSDTB_DetumbleNoSensordata;No description;1;ACS_DETUMBLE;mission/controller/acs/control/Detumble.h -0x6e00;SDMA_OpOngoing;No description;0;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e01;SDMA_AlreadyOn;No description;1;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e02;SDMA_AlreadyMounted;No description;2;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e03;SDMA_AlreadyOff;No description;3;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e0a;SDMA_StatusFileNexists;No description;10;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e0b;SDMA_StatusFileFormatInvalid;No description;11;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e0c;SDMA_MountError;No description;12;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e0d;SDMA_UnmountError;No description;13;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e0e;SDMA_SystemCallError;No description;14;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6e0f;SDMA_PopenCallError;No description;15;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h -0x6f00;LPH_SdNotReady;No description;0;LOCAL_PARAM_HANDLER;bsp_q7s/memory/LocalParameterHandler.h -0x7000;PTM_DumpDone;No description;0;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h -0x7001;PTM_BusyDumping;No description;1;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h -0x7100;TMS_IsBusy;No description;0;TM_SINK;mission/tmtc/DirectTmSinkIF.h -0x7300;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h +0x6b00;SDMA_OpOngoing;No description;0;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b01;SDMA_AlreadyOn;No description;1;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b02;SDMA_AlreadyMounted;No description;2;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b03;SDMA_AlreadyOff;No description;3;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b0a;SDMA_StatusFileNexists;No description;10;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b0b;SDMA_StatusFileFormatInvalid;No description;11;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b0c;SDMA_MountError;No description;12;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b0d;SDMA_UnmountError;No description;13;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b0e;SDMA_SystemCallError;No description;14;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6b0f;SDMA_PopenCallError;No description;15;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6c00;LPH_SdNotReady;No description;0;LOCAL_PARAM_HANDLER;bsp_q7s/memory/LocalParameterHandler.h +0x6d00;PTM_DumpDone;No description;0;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h +0x6d01;PTM_BusyDumping;No description;1;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h +0x6e00;TMS_IsBusy;No description;0;TM_SINK;mission/tmtc/DirectTmSinkIF.h +0x7000;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h diff --git a/eive_tmtc/tmtc/acs/star_tracker.py b/eive_tmtc/tmtc/acs/star_tracker.py index 9703d36..ad1b734 100644 --- a/eive_tmtc/tmtc/acs/star_tracker.py +++ b/eive_tmtc/tmtc/acs/star_tracker.py @@ -103,6 +103,7 @@ class OpCodes: TAKE_IMAGE = "take_image" UPLOAD_IMAGE = "upload_image" SET_IMG_PROCESSOR_MODE = "set_img_proc_mode" + FW_UPDATE = "fw_update" class Info: @@ -111,6 +112,7 @@ class Info: UPLOAD_IMAGE = "Upload Image" TAKE_IMAGE = "Take Image" SET_IMG_PROCESSOR_MODE = "Set Image Processor Mode" + FW_UPDATE = "Firmware Update" class SetId(enum.IntEnum): @@ -141,6 +143,7 @@ class FileDefs: firmware2_1 = "/home/pi/arcsec/firmware/sagitta-2-1.bin" firmware22_1 = "/home/pi/arcsec/firmware/sagitta-22-1.bin" firmware_origin = "/home/pi/arcsec/firmware/sagitta-origin.bin" + FW_SLOT_Q7S = "/mnt/sd0/startracker/updates/sagitta-update.bin" json_dict = { @@ -158,13 +161,15 @@ json_dict = { ), } -firmware_dict = { +FW_DICT = { + "0": ("Firmware Update Q7S", FileDefs.FW_SLOT_Q7S), "1": ("Firmware Major = 2, Minor = 1", FileDefs.firmware2_1), "2": ("Firmware Major = 22, Minor = 1", FileDefs.firmware22_1), "3": ("Firmware Origin", FileDefs.firmware_origin), } -upload_image_dict = { +UPLOAD_IMAGE_DICT = { + "0": ("custom path", "Custom Path"), "1": ("q7s gemma", "/mnt/sd0/startracker/gemma.bin"), "2": ("egse gemma", "/home/pi/arcsec/star-images/gemma.bin"), "3": ("q7s polaris", "/mnt/sd0/startracker/polaris.bin"), @@ -630,13 +635,13 @@ def pack_star_tracker_commands( + bytearray(json_file, "utf-8") ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if op_code == "69": - q.add_log_cmd("Star tracker: Firmware update") + if op_code == OpCodes.FW_UPDATE: + q.add_log_cmd(Info.FW_UPDATE) firmware = get_firmware() data = ( obyt + struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE) - + bytearray(firmware, "utf-8") + + firmware.encode() ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) @@ -681,17 +686,24 @@ def get_config_file() -> str: def get_firmware() -> str: _LOGGER.info("Specify firmware file") - input_helper = InputHelper(firmware_dict) - key = input_helper.get_key() - firmware = firmware_dict[key][1] + bin_select = int(input("Use hardcoded paths (0) or specify path manually (1) ?: ")) + if bin_select == 0: + input_helper = InputHelper(FW_DICT) + key = input_helper.get_key() + firmware = FW_DICT[key][1] + else: + firmware = input("Specify absolute path of the firmware update file: ") return firmware def get_upload_image() -> str: _LOGGER.info("Specify image to upload") - input_helper = InputHelper(upload_image_dict) + input_helper = InputHelper(UPLOAD_IMAGE_DICT) key = input_helper.get_key() - image = upload_image_dict[key][1] + if UPLOAD_IMAGE_DICT[key][0] == "custom path": + image = input("Please specify custom absolute path: ") + else: + image = UPLOAD_IMAGE_DICT[key][1] return image @@ -797,8 +809,11 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper): ) pw.dlog(f"Number of close stars in LISA solution: {lisa_number_close_stars}") current_idx += fmt_len - is_trusworthy = hk_data[current_idx] - pw.dlog(f"Trustworthy solution: {is_trusworthy}") + str_mode = hk_data[current_idx] + pw.dlog(f"STR mode: {str_mode}") + current_idx += 1 + is_trustworthy = hk_data[current_idx] + pw.dlog(f"Trustworthy solution: {is_trustworthy}") current_idx += 1 stable_count = struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0] pw.dlog(f"Stable count: {stable_count}") @@ -870,7 +885,7 @@ def add_str_cmds(defs: TmtcDefinitionWrapper): oce.add("66", "Star Tracker: Set log level parameters") oce.add("67", "Star Tracker: Set log subscription parameters") oce.add("68", "Star Tracker: Set debug camera parameters") - oce.add("69", "Star Tracker: Firmware update") + oce.add(OpCodes.FW_UPDATE, Info.FW_UPDATE) oce.add("70", "Star Tracker: Disable timestamp generation") oce.add("71", "Star Tracker: Enable timestamp generation") defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce) diff --git a/eive_tmtc/tmtc/com/defs.py b/eive_tmtc/tmtc/com/defs.py index f88df5e..57725b2 100644 --- a/eive_tmtc/tmtc/com/defs.py +++ b/eive_tmtc/tmtc/com/defs.py @@ -2,6 +2,7 @@ import enum class Mode(enum.IntEnum): + NONE = 0 RX_ONLY = 10 RX_AND_TX_DEF_DATARATE = 11 RX_AND_TX_LOW_DATARATE = 12 diff --git a/eive_tmtc/tmtc/com/pdec_handler.py b/eive_tmtc/tmtc/com/pdec_handler.py index fbe10c8..38763b4 100644 --- a/eive_tmtc/tmtc/com/pdec_handler.py +++ b/eive_tmtc/tmtc/com/pdec_handler.py @@ -5,11 +5,13 @@ @author J. Meier @date 22.11.2021 """ +import enum + from spacepackets.ecss.tc import PusTelecommand from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd - +from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter from tmtccmd.config.tmtc import ( @@ -28,16 +30,23 @@ class CommandId: PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1]) -class ParameterId: +class ParameterId(enum.IntEnum): POSITIVE_WINDOW = 0 NEGATIVE_WINDOW = 1 +class ActionId(enum.IntEnum): + RESET_NO_INIT = 2 + RESET_WITH_INIT = 3 + + class OpCode: PRINT_CLCW = "print_clcw" PRINT_MON_REG = "print_mon_reg" POSITIVE_WINDOW = "positive_window" NEGATIVE_WINDOW = "negative_window" + RESET_WITH_INIT = "reset_with_init" + RESET_NO_INIT = "reset_no_init" class Info: @@ -47,6 +56,8 @@ class Info: ) POSITIVE_WINDOW = "Change positive window parameter for AD frames" NEGATIVE_WINDOW = "Change negative window parameter for AD frames" + RESET_WITH_INIT = "Reset with full initialization" + RESET_NO_INIT = "Reset with mandatory initialization" def pack_pdec_handler_test( @@ -88,6 +99,16 @@ def pack_pdec_handler_test( ).pack() ) ) + if op_code == OpCode.RESET_NO_INIT: + q.add_log_cmd(f"{prefix}: {Info.RESET_NO_INIT}") + q.add_pus_tc( + create_action_cmd(object_id=object_id, action_id=ActionId.RESET_NO_INIT) + ) + if op_code == OpCode.RESET_WITH_INIT: + q.add_log_cmd(f"{prefix}: {Info.RESET_WITH_INIT}") + q.add_pus_tc( + create_action_cmd(object_id=object_id, action_id=ActionId.RESET_WITH_INIT) + ) @tmtc_definitions_provider @@ -97,4 +118,6 @@ def add_pdec_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCode.PRINT_MON_REG, Info.PRINT_MON_REG) oce.add(OpCode.POSITIVE_WINDOW, Info.POSITIVE_WINDOW) oce.add(OpCode.NEGATIVE_WINDOW, Info.NEGATIVE_WINDOW) + oce.add(OpCode.RESET_WITH_INIT, Info.RESET_WITH_INIT) + oce.add(OpCode.RESET_NO_INIT, Info.RESET_NO_INIT) defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce) diff --git a/eive_tmtc/tmtc/core.py b/eive_tmtc/tmtc/core.py index 0507d19..9d96b5c 100644 --- a/eive_tmtc/tmtc/core.py +++ b/eive_tmtc/tmtc/core.py @@ -11,6 +11,10 @@ from tmtccmd.config import TmtcDefinitionWrapper from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command +from tmtccmd.tc.pus_20_fsfw_param import ( + create_scalar_u8_parameter, + create_load_param_cmd, +) from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter @@ -35,6 +39,13 @@ class ActionId(enum.IntEnum): SWITCH_TO_BOTH_SD_CARDS = 18 XSC_REBOOT = 32 FULL_REBOOT = 34 + EXECUTE_SHELL_CMD_BLOCKING = 40 + EXECUTE_SHELL_CMD_NON_BLOCKING = 41 + SYSTEMCTL_CMD_EXECUTOR = 42 + + +class ParamId(enum.IntEnum): + PREF_SD = 0 class SetId(enum.IntEnum): @@ -45,6 +56,10 @@ class OpCode: ANNOUNCE_VERSION = "announce_version" ANNOUNCE_CURRENT_IMAGE = "announce_current_image" ANNOUNCE_BOOT_COUNTS = "announce_boot_counts" + EXECUTE_SHELL_CMD_BLOCKING = "exec_cmd_blocking" + EXECUTE_SHELL_CMD_NON_BLOCKING = "exec_cmd_non_blocking" + SYSTEMCTL_CMD_EXECUTOR = "systemctl_cmd" + SET_PREF_SD = "set_pref_sd" REBOOT_XSC = ["reboot_xsc"] XSC_REBOOT_SELF = ["reboot_self"] XSC_REBOOT_0_0 = ["reboot_00"] @@ -73,6 +88,10 @@ class Info: ANNOUNCE_VERSION = "Announce version" ANNOUNCE_CURRENT_IMAGE = "Announce current image" ANNOUNCE_BOOT_COUNTS = "Announce boot counts" + SYSTEMCTL_CMD_EXECUTOR = "Perform systemctl command" + EXECUTE_SHELL_CMD_BLOCKING = "Execute shell command blocking" + EXECUTE_SHELL_CMD_NON_BLOCKING = "Execute shell command non-blocking" + SET_PREF_SD = "Set preferred SD card" REBOOT_XSC = "XSC reboot with prompt" REBOOT_FULL = "Full regular reboot" OBSW_UPDATE_FROM_SD_0 = "Update OBSW from SD Card 0" @@ -95,6 +114,12 @@ class Copy(enum.IntEnum): NONE = 2 +class SystemctlCmd(enum.IntEnum): + START = 0 + STOP = 1 + RESTART = 2 + + @tmtc_definitions_provider def add_core_controller_definitions(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() @@ -109,9 +134,18 @@ def add_core_controller_definitions(defs: TmtcDefinitionWrapper): oce.add(keys=OpCode.XSC_REBOOT_0_1, info="Reboot 0 1") oce.add(keys=OpCode.XSC_REBOOT_1_0, info="Reboot 1 0") oce.add(keys=OpCode.XSC_REBOOT_1_1, info="Reboot 1 1") + oce.add(keys=OpCode.SET_PREF_SD, info=Info.SET_PREF_SD) oce.add(keys=OpCode.OBSW_UPDATE_FROM_TMP, info=Info.OBSW_UPDATE_FROM_TMP) oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_0, info=Info.OBSW_UPDATE_FROM_SD_0) oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_1, info=Info.OBSW_UPDATE_FROM_SD_1) + oce.add(keys=OpCode.SYSTEMCTL_CMD_EXECUTOR, info=Info.SYSTEMCTL_CMD_EXECUTOR) + oce.add( + keys=OpCode.EXECUTE_SHELL_CMD_BLOCKING, info=Info.EXECUTE_SHELL_CMD_BLOCKING + ) + oce.add( + keys=OpCode.EXECUTE_SHELL_CMD_NON_BLOCKING, + info=Info.EXECUTE_SHELL_CMD_NON_BLOCKING, + ) oce.add( keys=OpCode.GET_HK, info="Request housekeeping set", @@ -184,6 +218,41 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str): ) elif op_code in OpCode.XSC_REBOOT_SELF: add_xsc_reboot_cmd(q=q, reboot_self=True) + elif op_code == OpCode.SYSTEMCTL_CMD_EXECUTOR: + print("systemctl command types: ") + for entry in SystemctlCmd: + print(f"{entry}: {entry.name}") + systemctl_cmd = SystemctlCmd( + int(input("Specify systemctl command type by key: ")) + ) + unit_name = input("Specify unit name: ") + cmd_data = bytearray([systemctl_cmd]) + cmd_data.extend(unit_name.encode()) + q.add_pus_tc( + create_action_cmd( + object_id=CORE_CONTROLLER_ID, + action_id=ActionId.SYSTEMCTL_CMD_EXECUTOR, + user_data=cmd_data, + ) + ) + elif op_code == OpCode.EXECUTE_SHELL_CMD_BLOCKING: + custom_cmd = input("Please specify command to execute: ") + q.add_pus_tc( + create_action_cmd( + object_id=CORE_CONTROLLER_ID, + action_id=ActionId.EXECUTE_SHELL_CMD_BLOCKING, + user_data=custom_cmd.encode(), + ) + ) + elif op_code == OpCode.EXECUTE_SHELL_CMD_NON_BLOCKING: + custom_cmd = input("Please specify command to execute: ") + q.add_pus_tc( + create_action_cmd( + object_id=CORE_CONTROLLER_ID, + action_id=ActionId.EXECUTE_SHELL_CMD_NON_BLOCKING, + user_data=custom_cmd.encode(), + ) + ) elif op_code in OpCode.XSC_REBOOT_0_0: add_xsc_reboot_cmd( q=q, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM @@ -283,6 +352,23 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str): q.add_log_cmd("Requesting housekeeping set") sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetId.HK) q.add_pus_tc(generate_one_hk_command(sid)) + elif op_code in OpCode.SET_PREF_SD: + q.add_log_cmd("Set preferred SD card") + pref_sd = int( + input("Specify which SD card to set as the preferred one (0/1): ") + ) + if pref_sd not in [0, 1]: + raise ValueError("Only 0 or 1 allowed for preferred SD card") + q.add_pus_tc( + create_load_param_cmd( + create_scalar_u8_parameter( + object_id=CORE_CONTROLLER_ID, + domain_id=0, + unique_id=ParamId.PREF_SD, + parameter=pref_sd, + ).pack() + ) + ) else: _LOGGER.warning( f"Unknown operation code {op_code} for core controller commands" diff --git a/eive_tmtc/tmtc/obj_prompt.py b/eive_tmtc/tmtc/obj_prompt.py index c3d3558..69ee1f5 100644 --- a/eive_tmtc/tmtc/obj_prompt.py +++ b/eive_tmtc/tmtc/obj_prompt.py @@ -15,6 +15,7 @@ from eive_tmtc.config.object_ids import ( SUS_6_R_LOC_XFYBZM_PT_XF, RW1_ID, RW2_ID, + RTD_0_PLOC_HSPD, ) SUBSYSTEM_DICT = { @@ -40,6 +41,20 @@ ACS_OBJ_DICT = { 13: ("RW 2", RW2_ID), } +TCS_OBJ_DICT = { + 0: ("RTD 0", RTD_0_PLOC_HSPD), +} + + +def get_obj_if_from_dict(lut: dict) -> bytes: + for k, v in lut.items(): + print(f"{k}: {v[0]}") + obj_key = int(input("Please specify target object by key: ")) + name_and_obj_id = lut[obj_key] + if name_and_obj_id is None: + raise ValueError("invalid key") + return name_and_obj_id[1] + def prompt_object() -> bytes: for k, v in SUBSYSTEM_DICT.items(): @@ -49,10 +64,9 @@ def prompt_object() -> bytes: if subsystem is None: raise ValueError("invalid key") if subsystem == "acs": - for k, v in ACS_OBJ_DICT.items(): - print(f"{k}: {v[0]}") - obj_key = int(input("Please specify target object by key: ")) - acs_obj = ACS_OBJ_DICT[obj_key] - if acs_obj is None: - raise ValueError("invalid key") - return acs_obj[1] + return get_obj_if_from_dict(ACS_OBJ_DICT) + elif subsystem == "tcs": + return get_obj_if_from_dict(TCS_OBJ_DICT) + else: + print(f"No object for subsystem {subsystem}") + return bytes()