diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 702264ab..085d27de 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -32,8 +32,13 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP; xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY; CoreController::CoreController(object_id_t objectId) - : ExtendedControllerBase(objectId, 5), cmdExecutor(4096), cmdReplyBuf(4096, true), cmdRepliesSizes(128), - opDivider5(5), opDivider10(10), hkSet(this) { + : ExtendedControllerBase(objectId, 5), + cmdExecutor(4096), + cmdReplyBuf(4096, true), + cmdRepliesSizes(128), + opDivider5(5), + opDivider10(10), + hkSet(this) { cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes); try { sdcMan = SdCardManager::instance(); @@ -102,14 +107,14 @@ void CoreController::performControlOperation() { sdStateMachine(); performMountedSdCardOperations(); readHkData(); - if(shellCmdIsExecuting) { + if (shellCmdIsExecuting) { bool replyReceived = false; // TODO: We could read the data in the ring buffer and send it as an action data reply. - if(cmdExecutor.check(replyReceived) == CommandExecutor::EXECUTION_FINISHED) { + if (cmdExecutor.check(replyReceived) == CommandExecutor::EXECUTION_FINISHED) { actionHelper.finish(true, successRecipient, EXECUTE_SHELL_CMD); shellCmdIsExecuting = false; cmdReplyBuf.clear(); - while(not cmdRepliesSizes.empty()) { + while (not cmdRepliesSizes.empty()) { cmdRepliesSizes.pop(); } successRecipient = MessageQueueIF::NO_QUEUE; @@ -316,14 +321,15 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ // Warning: This function will never return, because it reboots the system return actionReboot(data, size); } - case(EXECUTE_SHELL_CMD): { + case (EXECUTE_SHELL_CMD): { std::string cmd = std::string(cmd, size); - if(cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or shellCmdIsExecuting) { + if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or + shellCmdIsExecuting) { return HasActionsIF::IS_BUSY; } cmdExecutor.load(cmd, false, false); ReturnValue_t result = cmdExecutor.execute(); - if(result != returnvalue::OK) { + if (result != returnvalue::OK) { return result; } shellCmdIsExecuting = true; diff --git a/dummies/GyroAdisDummy.cpp b/dummies/GyroAdisDummy.cpp index ed581138..c7c40a1a 100644 --- a/dummies/GyroAdisDummy.cpp +++ b/dummies/GyroAdisDummy.cpp @@ -7,9 +7,9 @@ GyroAdisDummy::GyroAdisDummy(object_id_t objectId, object_id_t comif, CookieIF * GyroAdisDummy::~GyroAdisDummy() {} -void GyroAdisDummy::doStartUp() {} +void GyroAdisDummy::doStartUp() { setMode(MODE_NORMAL); } -void GyroAdisDummy::doShutDown() {} +void GyroAdisDummy::doShutDown() { setMode(MODE_OFF); } ReturnValue_t GyroAdisDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; diff --git a/dummies/GyroL3GD20Dummy.cpp b/dummies/GyroL3GD20Dummy.cpp index 8c89f59d..ef2a7e59 100644 --- a/dummies/GyroL3GD20Dummy.cpp +++ b/dummies/GyroL3GD20Dummy.cpp @@ -7,9 +7,9 @@ GyroL3GD20Dummy::GyroL3GD20Dummy(object_id_t objectId, object_id_t comif, Cookie GyroL3GD20Dummy::~GyroL3GD20Dummy() {} -void GyroL3GD20Dummy::doStartUp() {} +void GyroL3GD20Dummy::doStartUp() { setMode(MODE_NORMAL); } -void GyroL3GD20Dummy::doShutDown() {} +void GyroL3GD20Dummy::doShutDown() { setMode(MODE_OFF); } ReturnValue_t GyroL3GD20Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; diff --git a/dummies/ImtqDummy.cpp b/dummies/ImtqDummy.cpp index 9fcca838..01ec6457 100644 --- a/dummies/ImtqDummy.cpp +++ b/dummies/ImtqDummy.cpp @@ -7,9 +7,9 @@ ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCooki ImtqDummy::~ImtqDummy() = default; -void ImtqDummy::doStartUp() {} +void ImtqDummy::doStartUp() { setMode(MODE_NORMAL); } -void ImtqDummy::doShutDown() {} +void ImtqDummy::doShutDown() { setMode(_MODE_POWER_DOWN); } ReturnValue_t ImtqDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } diff --git a/dummies/MgmLIS3MDLDummy.cpp b/dummies/MgmLIS3MDLDummy.cpp index 9038d963..0ce9a520 100644 --- a/dummies/MgmLIS3MDLDummy.cpp +++ b/dummies/MgmLIS3MDLDummy.cpp @@ -7,9 +7,9 @@ MgmLIS3MDLDummy::MgmLIS3MDLDummy(object_id_t objectId, object_id_t comif, Cookie MgmLIS3MDLDummy::~MgmLIS3MDLDummy() {} -void MgmLIS3MDLDummy::doStartUp() {} +void MgmLIS3MDLDummy::doStartUp() { setMode(MODE_NORMAL); } -void MgmLIS3MDLDummy::doShutDown() {} +void MgmLIS3MDLDummy::doShutDown() { setMode(MODE_OFF); } ReturnValue_t MgmLIS3MDLDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; diff --git a/dummies/MgmRm3100Dummy.cpp b/dummies/MgmRm3100Dummy.cpp index fa5582c1..2c0c3f74 100644 --- a/dummies/MgmRm3100Dummy.cpp +++ b/dummies/MgmRm3100Dummy.cpp @@ -7,18 +7,22 @@ MgmRm3100Dummy::MgmRm3100Dummy(object_id_t objectId, object_id_t comif, CookieIF MgmRm3100Dummy::~MgmRm3100Dummy() = default; -void MgmRm3100Dummy::doStartUp() {} +void MgmRm3100Dummy::doStartUp() { setMode(MODE_NORMAL); } -void MgmRm3100Dummy::doShutDown() {} +void MgmRm3100Dummy::doShutDown() { setMode(MODE_OFF); } -ReturnValue_t MgmRm3100Dummy::buildNormalDeviceCommand(DeviceCommandId_t* id) { return OK; } +ReturnValue_t MgmRm3100Dummy::buildNormalDeviceCommand(DeviceCommandId_t* id) { + return NOTHING_TO_SEND; +} -ReturnValue_t MgmRm3100Dummy::buildTransitionDeviceCommand(DeviceCommandId_t* id) { return OK; } +ReturnValue_t MgmRm3100Dummy::buildTransitionDeviceCommand(DeviceCommandId_t* id) { + return NOTHING_TO_SEND; +} ReturnValue_t MgmRm3100Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData, size_t commandDataLen) { - return OK; + return NOTHING_TO_SEND; } ReturnValue_t MgmRm3100Dummy::scanForReply(const uint8_t* start, size_t len, diff --git a/dummies/SusDummy.cpp b/dummies/SusDummy.cpp index d1129a49..75e36676 100644 --- a/dummies/SusDummy.cpp +++ b/dummies/SusDummy.cpp @@ -5,9 +5,9 @@ SusDummy::SusDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) SusDummy::~SusDummy() {} -void SusDummy::doStartUp() {} +void SusDummy::doStartUp() { setMode(MODE_NORMAL); } -void SusDummy::doShutDown() {} +void SusDummy::doShutDown() { setMode(MODE_OFF); } ReturnValue_t SusDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } diff --git a/dummies/Tmp1075Dummy.cpp b/dummies/Tmp1075Dummy.cpp index 9715a346..8cfede50 100644 --- a/dummies/Tmp1075Dummy.cpp +++ b/dummies/Tmp1075Dummy.cpp @@ -6,8 +6,10 @@ using namespace returnvalue; Tmp1075Dummy::Tmp1075Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) : DeviceHandlerBase(objectId, comif, comCookie), set(this) {} -void Tmp1075Dummy::doStartUp() { setMode(MODE_ON); } -void Tmp1075Dummy::doShutDown() { setMode(_MODE_POWER_DOWN); } + +void Tmp1075Dummy::doStartUp() { setMode(MODE_NORMAL); } +void Tmp1075Dummy::doShutDown() { setMode(MODE_OFF); } + ReturnValue_t Tmp1075Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } diff --git a/dummies/helpers.cpp b/dummies/helpers.cpp index f93a8127..336738d2 100644 --- a/dummies/helpers.cpp +++ b/dummies/helpers.cpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include "TemperatureSensorInserter.h" @@ -56,17 +58,21 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio rws[3] = new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy); ObjectFactory::createRwAssy(pwrSwitcher, pcdu::Switches::PDU2_CH2_RW_5V, rws, rwIds); new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER); + auto* strAssy = new StrAssembly(objects::STR_ASSY); + strAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); auto* strDummy = new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy); - strDummy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); + strDummy->connectModeTreeParent(*strAssy); if (cfg.addSyrlinksDummies) { auto* syrlinksDummy = new SyrlinksDummy(objects::SYRLINKS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); syrlinksDummy->connectModeTreeParent(satsystem::com::SUBSYSTEM); } + auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY); + imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); imtqDummy->enableThermalModule(ThermalStateCfg()); - imtqDummy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); + imtqDummy->connectModeTreeParent(*imtqAssy); if (cfg.addPowerDummies) { new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); diff --git a/mission/controller/acs/ActuatorCmd.cpp b/mission/controller/acs/ActuatorCmd.cpp index 457cacce..d2fe2d65 100644 --- a/mission/controller/acs/ActuatorCmd.cpp +++ b/mission/controller/acs/ActuatorCmd.cpp @@ -49,7 +49,7 @@ void ActuatorCmd::cmdSpeedToRws(int32_t speedRw0, int32_t speedRw1, int32_t spee } else if (rwCmdSpeed[i] < -maxRwSpeed) { rwCmdSpeed[i] = -maxRwSpeed; } - } + } } void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentActuator, diff --git a/mission/core/pollingSeqTables.cpp b/mission/core/pollingSeqTables.cpp index 88b5b95a..79bf8868 100644 --- a/mission/core/pollingSeqTables.cpp +++ b/mission/core/pollingSeqTables.cpp @@ -49,7 +49,6 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.3, DeviceHandlerIF::GET_READ); #endif // These are actually part of another bus, but this works, so keep it like this for now -#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); @@ -92,7 +91,6 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::GET_READ); -#endif static_cast(length); return thisSequence->checkSequence(); }