From 73971ad4862d10009e02c4761ad96c7e0cb44393 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Thu, 18 Aug 2022 16:33:53 +0200 Subject: [PATCH] fixes --- bsp_q7s/core/CoreActions.h | 5 ----- bsp_q7s/core/CoreController.cpp | 24 ++++++++++++------------ bsp_q7s/core/CoreController.h | 11 ++++++++++- linux/obc/PdecHandler.h | 9 ++++++--- mission/devices/HeaterHandler.cpp | 4 ++-- mission/devices/HeaterHandler.h | 2 ++ mission/tmtc/CCSDSHandler.h | 11 +++++++++++ 7 files changed, 43 insertions(+), 23 deletions(-) diff --git a/bsp_q7s/core/CoreActions.h b/bsp_q7s/core/CoreActions.h index 9d00b451..09afcb54 100644 --- a/bsp_q7s/core/CoreActions.h +++ b/bsp_q7s/core/CoreActions.h @@ -79,11 +79,6 @@ class XscRebootObcAction : public TemplateAction copy = Parameter::createParameter(this, "Copy"); }; -class MountOtherCopyAction : public TemplateAction { - public: - MountOtherCopyAction(CoreController *owner) : TemplateAction(owner, ActionId::MOUNT_OTHER_COPY){}; -}; - class RebootObcAction : public TemplateAction { public: RebootObcAction(CoreController *owner) : TemplateAction(owner, ActionId::REBOOT_OBC){}; diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 5f1cdf8c..630c4550 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -169,7 +169,7 @@ ReturnValue_t CoreController::handleAction(core::SwitchRebootFileHandlingAction std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE; // Disable the reboot file mechanism parseRebootFile(path, rebootFile); - if (action->enableRebootFile == core::Boolenum::NO) { + if (action->enableRebootFile.value == core::Boolenum::NO) { rebootFile.enabled = false; rewriteRebootFile(rebootFile); } else { @@ -181,7 +181,7 @@ ReturnValue_t CoreController::handleAction(core::SwitchRebootFileHandlingAction ReturnValue_t CoreController::handleAction(core::ResetRebootCountersAction *action) { xsc::Chip chip = xsc::NO_CHIP; - switch (action->chip) { + switch (action->chip.value) { case core::ResetRebootCountersAction::Selection::ALL: chip = xsc::ALL_CHIP; break; @@ -193,7 +193,7 @@ ReturnValue_t CoreController::handleAction(core::ResetRebootCountersAction *acti break; } xsc::Copy copy = xsc::NO_COPY; - switch (action->copy) { + switch (action->copy.value) { case core::ResetRebootCountersAction::Selection::ALL: copy = xsc::ALL_COPY; break; @@ -210,13 +210,13 @@ ReturnValue_t CoreController::handleAction(core::ResetRebootCountersAction *acti } ReturnValue_t CoreController::handleAction(core::SwitchImageLockAction *action) { - bool lock = action->lock == core::Boolenum::YES; + bool lock = action->lock.value == core::Boolenum::YES; xsc::Chip chip = xsc::CHIP_0; - if (action->chip == core::SwitchImageLockAction::Selection::ONE) { + if (action->chip.value == core::SwitchImageLockAction::Selection::ONE) { chip = xsc::CHIP_1; } xsc::Copy copy = xsc::COPY_0; - if (action->copy == core::SwitchImageLockAction::Selection::ONE) { + if (action->copy.value == core::SwitchImageLockAction::Selection::ONE) { copy = xsc::COPY_0; } setRebootMechanismLock(lock, chip, copy); @@ -855,13 +855,13 @@ void CoreController::initPrint() { } ReturnValue_t CoreController::handleAction(core::XscRebootObcAction *action) { - if (action->chip == core::XscRebootObcAction::Selection::SAME and - not(action->copy == core::XscRebootObcAction::Selection::SAME)) { + if (action->chip.value == core::XscRebootObcAction::Selection::SAME and + not(action->copy.value == core::XscRebootObcAction::Selection::SAME)) { return HasActionsIF::INVALID_PARAMETERS; } bool rebootSameBootCopy = false; - if (action->chip == core::XscRebootObcAction::Selection::SAME and - action->copy == core::XscRebootObcAction::Selection::SAME) { + if (action->chip.value == core::XscRebootObcAction::Selection::SAME and + action->copy.value == core::XscRebootObcAction::Selection::SAME) { rebootSameBootCopy = true; } bool protOpPerformed = false; @@ -888,11 +888,11 @@ ReturnValue_t CoreController::handleAction(core::XscRebootObcAction *action) { generateChipStateFile(); // If any boot copies are unprotected, protect them here auto tgtChip = xsc::CHIP_0; - if (action->chip == core::XscRebootObcAction::Selection::ONE) { + if (action->chip.value == core::XscRebootObcAction::Selection::ONE) { tgtChip = xsc::CHIP_1; } auto tgtCopy = xsc::COPY_0; - if (action->copy == core::XscRebootObcAction::Selection::ONE) { + if (action->copy.value == core::XscRebootObcAction::Selection::ONE) { tgtCopy = xsc::COPY_1; } diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 92a639c6..2cfe4e08 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -91,7 +91,6 @@ class CoreController : public ExtendedControllerBase { ReturnValue_t handleAction(core::SwitchImageLockAction* action); ReturnValue_t handleAction(core::SetMaxRebootCntAction* action); ReturnValue_t handleAction(core::XscRebootObcAction* action); - ReturnValue_t handleAction(core::MountOtherCopyAction* action); ReturnValue_t handleAction(core::RebootObcAction* action); ReturnValue_t handleCommandMessage(CommandMessage* message) override; @@ -194,6 +193,16 @@ class CoreController : public ExtendedControllerBase { core::HkSet hkSet; + core::ListDirectoryIntoFileAction listDirectoryIntoFileAction = + core::ListDirectoryIntoFileAction(this); + core::SwitchRebootFileHandlingAction switchRebootFileHandlingAction = + core::SwitchRebootFileHandlingAction(this); + core::ResetRebootCountersAction resetRebootCountersAction = core::ResetRebootCountersAction(this); + core::SwitchImageLockAction switchImageLockAction = core::SwitchImageLockAction(this); + core::SetMaxRebootCntAction setMaxRebootCntAction = core::SetMaxRebootCntAction(this); + core::XscRebootObcAction xscRebootObcAction = core::XscRebootObcAction(this); + core::RebootObcAction rebootObcAction = core::RebootObcAction(this); + ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; Countdown sdCardCheckCd = Countdown(120000); diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 8db11464..9924f173 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -58,10 +58,10 @@ class PdecHandler : public SystemObject, MessageQueueId_t getCommandQueue() const; - ActionHelper *getActionHelper() override; + ActionHelper* getActionHelper() override; ReturnValue_t executeAction(Action* action) override; - ReturnValue_t handleAction(PdecPrintClcwAction * action); - ReturnValue_t handleAction(PdecPrintMonAction * action); + ReturnValue_t handleAction(PdecPrintClcwAction* action); + ReturnValue_t handleAction(PdecPrintMonAction* action); static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PDEC_HANDLER; @@ -225,6 +225,9 @@ class PdecHandler : public SystemObject, enum class State : uint8_t { INIT, RUNNING, WAIT_FOR_RECOVERY }; + PdecPrintClcwAction pdecPrintClcwAction = PdecPrintClcwAction(this); + PdecPrintMonAction pdecPrintMonAction = PdecPrintMonAction(this); + /** * @brief Reads and handles messages stored in the commandQueue */ diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index 365e671d..23e9bf78 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -108,7 +108,7 @@ ReturnValue_t HeaterHandler::executeAction(Action* action) { return action->hand ReturnValue_t HeaterHandler::handleAction(SetHeaterAction* heaterAction) { auto& heater = heaterVec.at(heaterAction->switchNr); - auto action = heaterAction->switchAction; + auto action = heaterAction->switchAction.value; // Always accepts OFF commands if (action == SetHeaterAction::SwitchAction::SET_SWITCH_ON) { HasHealthIF::HealthState health = heater.healthDevice->getHealth(); @@ -116,7 +116,7 @@ ReturnValue_t HeaterHandler::handleAction(SetHeaterAction* heaterAction) { health == HasHealthIF::NEEDS_RECOVERY) { return HasHealthIF::OBJECT_NOT_HEALTHY; } - auto cmdSource = heaterAction->cmdSource; + auto cmdSource = heaterAction->cmdSource.value; if (health == HasHealthIF::EXTERNAL_CONTROL and cmdSource == SetHeaterAction::CmdSourceParam::INTERNAL) { return HasHealthIF::IS_EXTERNALLY_CONTROLLED; diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index f4c334ce..386b55b4 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -142,6 +142,8 @@ class HeaterHandler : public ExecutableObjectIF, StorageManagerIF* ipcStore = nullptr; + SetHeaterAction heaterAction = SetHeaterAction(this); + void readCommandQueue(); /** diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index 83d2edc5..bf5524d7 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -143,6 +143,17 @@ class CCSDSHandler : public SystemObject, bool linkState = DOWN; + // instances of the actions + SetLowRateAction setLowRateAction = SetLowRateAction(this); + SetHighRateAction setHighRateAction = SetHighRateAction(this); + EnTransmitterAction enTransmitterAction = EnTransmitterAction(this); + DisableTransmitterAction disableTransmitterAction = DisableTransmitterAction(this); + ArbitraryRateAction arbitraryRateAction = ArbitraryRateAction(this); + EnableTxClkManipulatorAction enableTxClkManipulatorAction = EnableTxClkManipulatorAction(this); + DisableTxClkManipulatorAction disableTxClkManipulatorAction = DisableTxClkManipulatorAction(this); + UpdateOnRisingEdgeAction updateOnRisingEdgeAction = UpdateOnRisingEdgeAction(this); + UpdateOnFallingEdgeAction updateOnFallingEdgeAction = UpdateOnFallingEdgeAction(this); + void readCommandQueue(void); void handleTelemetry(); void handleTelecommands();