From 9ff154cedce3daf02592243dd51adbc50088883d Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 23 May 2023 14:56:04 +0200 Subject: [PATCH 01/33] added missing parameter --- mission/controller/acs/AcsParameters.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mission/controller/acs/AcsParameters.cpp b/mission/controller/acs/AcsParameters.cpp index 03500cc3..53f25bb1 100644 --- a/mission/controller/acs/AcsParameters.cpp +++ b/mission/controller/acs/AcsParameters.cpp @@ -539,6 +539,9 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, case 0xA: parameterWrapper->setVector(nadirModeControllerParameters.quatRef); break; + case 0xB: + parameterWrapper->setVector(nadirModeControllerParameters.refRotRate); + break; case 0xC: parameterWrapper->set(nadirModeControllerParameters.timeElapsedMax); break; From 5390e947cae6a4e966f0874715b219afc00dec57 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 23 May 2023 15:02:35 +0200 Subject: [PATCH 02/33] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7ed6681..a85086a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ will consitute of a breaking change warranting a new major release: - PLOC MPSoC special communication is now scheduled, which allows flash read and flash write commands to work. - Fixed the MPSoC flash write command. +- Added missing ACS parameter. # [v2.0.5] 2023-05-11 From 62ae7ff48296e3d3bd75524171c4371989cd0701 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 23 May 2023 15:04:43 +0200 Subject: [PATCH 03/33] frmt --- mission/controller/acs/AcsParameters.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/controller/acs/AcsParameters.cpp b/mission/controller/acs/AcsParameters.cpp index 53f25bb1..e9ba7c3a 100644 --- a/mission/controller/acs/AcsParameters.cpp +++ b/mission/controller/acs/AcsParameters.cpp @@ -540,8 +540,8 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, parameterWrapper->setVector(nadirModeControllerParameters.quatRef); break; case 0xB: - parameterWrapper->setVector(nadirModeControllerParameters.refRotRate); - break; + parameterWrapper->setVector(nadirModeControllerParameters.refRotRate); + break; case 0xC: parameterWrapper->set(nadirModeControllerParameters.timeElapsedMax); break; From 32a4aa48d9936dfa1d50208f41242886572ed243 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 23 May 2023 15:07:23 +0200 Subject: [PATCH 04/33] frmt --- mission/controller/acs/AcsParameters.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/controller/acs/AcsParameters.cpp b/mission/controller/acs/AcsParameters.cpp index e9ba7c3a..792a72ec 100644 --- a/mission/controller/acs/AcsParameters.cpp +++ b/mission/controller/acs/AcsParameters.cpp @@ -540,8 +540,8 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, parameterWrapper->setVector(nadirModeControllerParameters.quatRef); break; case 0xB: - parameterWrapper->setVector(nadirModeControllerParameters.refRotRate); - break; + parameterWrapper->setVector(nadirModeControllerParameters.refRotRate); + break; case 0xC: parameterWrapper->set(nadirModeControllerParameters.timeElapsedMax); break; From 7ac2271eabb6041b636a3430e4800d9124a80d4e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 May 2023 19:12:35 +0200 Subject: [PATCH 05/33] buuuug --- bsp_q7s/core/ObjectFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 17b14b56..cea90bf2 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -805,7 +805,7 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(CcsdsComponentArgs& args) { // Core task which handles the HK store and takes care of dumping it as TM using a VC directly auto* hkStore = new PersistentSingleTmStoreTask( objects::HK_STORE_AND_TM_TASK, args.ipcStore, *args.stores.hkStore, *vc, - persTmStore::DUMP_HK_STORE_DONE, persTmStore::DUMP_HK_STORE_DONE, *SdCardManager::instance(), + persTmStore::DUMP_HK_STORE_DONE, persTmStore::DUMP_HK_CANCELLED, *SdCardManager::instance(), PTME_LOCKED); hkStore->connectModeTreeParent(satsystem::com::SUBSYSTEM); From 6bfb0d4fb058b3afe20e7d01b5b21e14cb921ede Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 May 2023 19:14:03 +0200 Subject: [PATCH 06/33] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c81828..cc74f261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ will consitute of a breaking change warranting a new major release: - PLOC MPSoC special communication is now scheduled, which allows flash read and flash write commands to work. - Fixed the MPSoC flash write command. +- HK TM store: The HK store dump success event was triggered for cancelled HK dumps. # [v2.0.5] 2023-05-11 From 28beb006b2c39792eb4f158916027a473469f857 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 May 2023 19:37:01 +0200 Subject: [PATCH 07/33] thats an annoying bug --- CHANGELOG.md | 2 ++ mission/com/TmStoreTaskBase.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c81828..c7997dac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,8 @@ will consitute of a breaking change warranting a new major release: - PLOC MPSoC special communication is now scheduled, which allows flash read and flash write commands to work. - Fixed the MPSoC flash write command. +- When a PUS parsing error occured while parsing a TM store file, the dump completion procedure + was always executed. # [v2.0.5] 2023-05-11 diff --git a/mission/com/TmStoreTaskBase.cpp b/mission/com/TmStoreTaskBase.cpp index 6598225d..0d3da770 100644 --- a/mission/com/TmStoreTaskBase.cpp +++ b/mission/com/TmStoreTaskBase.cpp @@ -140,7 +140,7 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store, ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped); if (result != returnvalue::OK) { sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl; - } else if (fileHasSwapped or result == PersistentTmStore::DUMP_DONE) { + } else if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) { // This can happen if a file is corrupted and the next file swap completes the dump. dumpDoneHandler(); return returnvalue::OK; From 303df55a1298a5c027a521c3a9fb8604bd3d266b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 May 2023 20:10:52 +0200 Subject: [PATCH 08/33] always dump data into the VC --- mission/com/VirtualChannel.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mission/com/VirtualChannel.cpp b/mission/com/VirtualChannel.cpp index 8e225674..ea5527a8 100644 --- a/mission/com/VirtualChannel.cpp +++ b/mission/com/VirtualChannel.cpp @@ -11,10 +11,7 @@ ReturnValue_t VirtualChannel::sendNextTm(const uint8_t* data, size_t size) { } ReturnValue_t VirtualChannel::write(const uint8_t* data, size_t size) { - if (txOn) { - return ptme.writeToVc(vcId, data, size); - } - return returnvalue::OK; + return ptme.writeToVc(vcId, data, size); } uint8_t VirtualChannel::getVcid() const { return vcId; } @@ -22,10 +19,6 @@ uint8_t VirtualChannel::getVcid() const { return vcId; } const char* VirtualChannel::getName() const { return vcName.c_str(); } bool VirtualChannel::isBusy() const { - // Data is discarded, so channel is not busy. - if (not txOn) { - return false; - } return ptme.isBusy(vcId); } From 042b8fb3c324ccab5ba56bf9d03980b7b091a456 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 May 2023 20:13:02 +0200 Subject: [PATCH 09/33] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c81828..8890ad7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,9 @@ will consitute of a breaking change warranting a new major release: - Disable missed deadlines per default. Not useful in orbit, and triggers all the time on the EM build after a number of subsequent runs, without any apparent reason (deadlines are not actually missed, thread usage displayed is nominal) +- Transmitter state is not taken into account anymore for writing into the PTME. The PTME should + be perfectly capable of generating a valid CADU, even when the transmitter is not ON for any + reason. ## Added From 266abad3b3a63efb1b2c45c287e335a13545c9a2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 May 2023 20:15:36 +0200 Subject: [PATCH 10/33] no dump cancel on TX OFF --- CHANGELOG.md | 3 +++ mission/com/TmStoreTaskBase.cpp | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c81828..b021a184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,9 @@ will consitute of a breaking change warranting a new major release: - Disable missed deadlines per default. Not useful in orbit, and triggers all the time on the EM build after a number of subsequent runs, without any apparent reason (deadlines are not actually missed, thread usage displayed is nominal) +- TM store dumpes will not be cancelled anymore if the transmitter is off. The dump can be cancelled + with an OFF command, and the PTME is perfectly capable of dumping without the transmitter being + on. ## Added diff --git a/mission/com/TmStoreTaskBase.cpp b/mission/com/TmStoreTaskBase.cpp index 6598225d..c8abbae8 100644 --- a/mission/com/TmStoreTaskBase.cpp +++ b/mission/com/TmStoreTaskBase.cpp @@ -94,13 +94,6 @@ void TmStoreTaskBase::cancelDump(DumpContext& ctx, PersistentTmStore& store, boo ReturnValue_t TmStoreTaskBase::handleOneDump(PersistentTmStoreWithTmQueue& store, DumpContext& dumpContext, bool& dumpPerformed) { ReturnValue_t result = returnvalue::OK; - // The PTME might have been reset an transmitter state change, so there is no point in continuing - // the dump. - // TODO: Will be solved in a cleaner way, this is kind of a hack. - if (not channel.isTxOn()) { - cancelDump(dumpContext, store, false); - return returnvalue::FAILED; - } // It is assumed that the PTME will only be locked for a short period (e.g. to change datarate). if (not channel.isBusy() and not ptmeLocked) { performDump(store, dumpContext, dumpPerformed); From ee0646caf140373c6f1132718fa8f5d767120cb9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 May 2023 11:04:07 +0200 Subject: [PATCH 11/33] enable IMTQ HK sets --- bsp_q7s/em/emObjectFactory.cpp | 2 +- dummies/ImtqDummy.cpp | 40 ++++++++++++++++++++++++++++++++-- dummies/ImtqDummy.h | 26 +++++++++++++++++++++- dummies/helperFactory.cpp | 6 +++-- dummies/helperFactory.h | 2 +- 5 files changed, 69 insertions(+), 7 deletions(-) diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 36863b89..59660b86 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -79,7 +79,7 @@ void ObjectFactory::produce(void* args) { #endif satsystem::EIVE_SYSTEM.setI2cRecoveryParams(pwrSwitcher); - dummy::createDummies(dummyCfg, *pwrSwitcher, gpioComIF); + dummy::createDummies(dummyCfg, *pwrSwitcher, gpioComIF, enableHkSets); new CoreController(objects::CORE_CONTROLLER, enableHkSets); diff --git a/dummies/ImtqDummy.cpp b/dummies/ImtqDummy.cpp index b2f61bb3..8f8d1513 100644 --- a/dummies/ImtqDummy.cpp +++ b/dummies/ImtqDummy.cpp @@ -2,8 +2,12 @@ #include -ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) - : DeviceHandlerBase(objectId, comif, comCookie) {} +ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, + bool enableHkSets) + : DeviceHandlerBase(objectId, comif, comCookie), + setNoTorque(this), + setWithTorque(this), + enableHkSets(enableHkSets) {} ImtqDummy::~ImtqDummy() = default; @@ -45,5 +49,37 @@ ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool &localDataP localDataPoolMap.emplace(imtq::ACTUATION_RAW_STATUS, new PoolEntry({0})); localDataPoolMap.emplace(imtq::DIPOLES_ID, new PoolEntry({0, 0, 0})); localDataPoolMap.emplace(imtq::CURRENT_TORQUE_DURATION, new PoolEntry({0})); + + // ENG HK No Torque + localDataPoolMap.emplace(imtq::DIGITAL_VOLTAGE_MV, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::ANALOG_VOLTAGE_MV, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::DIGITAL_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::ANALOG_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::COIL_CURRENTS, &coilCurrentsMilliampsNoTorque); + localDataPoolMap.emplace(imtq::COIL_TEMPERATURES, &coilTempsNoTorque); + localDataPoolMap.emplace(imtq::MCU_TEMPERATURE, new PoolEntry({0})); + + // ENG HK With Torque + localDataPoolMap.emplace(imtq::DIGITAL_VOLTAGE_MV_WT, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::ANALOG_VOLTAGE_MV_WT, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::DIGITAL_CURRENT_WT, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::ANALOG_CURRENT_WT, new PoolEntry({0})); + localDataPoolMap.emplace(imtq::COIL_CURRENTS_WT, &coilCurrentsMilliampsWithTorque); + localDataPoolMap.emplace(imtq::COIL_TEMPERATURES_WT, &coilTempsWithTorque); + localDataPoolMap.emplace(imtq::MCU_TEMPERATURE_WT, new PoolEntry({0})); + + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(setNoTorque.getSid(), enableHkSets, 30.0)); + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(setWithTorque.getSid(), enableHkSets, 30.0)); return DeviceHandlerBase::initializeLocalDataPool(localDataPoolMap, poolManager); } + +LocalPoolDataSetBase *ImtqDummy::getDataSetHandle(sid_t sid) { + if (sid == setNoTorque.getSid()) { + return &setNoTorque; + } else if (sid == setWithTorque.getSid()) { + return &setWithTorque; + } + return nullptr; +} diff --git a/dummies/ImtqDummy.h b/dummies/ImtqDummy.h index 0cfdf518..5a1de175 100644 --- a/dummies/ImtqDummy.h +++ b/dummies/ImtqDummy.h @@ -3,6 +3,8 @@ #include +#include "mission/acs/imtqHelpers.h" + class ImtqDummy : public DeviceHandlerBase { public: static const DeviceCommandId_t SIMPLE_COMMAND = 1; @@ -11,10 +13,31 @@ class ImtqDummy : public DeviceHandlerBase { static const uint8_t SIMPLE_COMMAND_DATA = 1; static const uint8_t PERIODIC_REPLY_DATA = 2; - ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets); ~ImtqDummy() override; protected: + imtq::HkDatasetNoTorque setNoTorque; + imtq::HkDatasetWithTorque setWithTorque; + bool enableHkSets; + + PoolEntry statusMode = PoolEntry({0}); + PoolEntry statusError = PoolEntry({0}); + PoolEntry statusConfig = PoolEntry({0}); + PoolEntry statusUptime = PoolEntry({0}); + + PoolEntry mgmCalEntry = PoolEntry(3); + PoolEntry dipolesPoolEntry = PoolEntry({0, 0, 0}, false); + PoolEntry torqueDurationEntry = PoolEntry({0}, false); + PoolEntry coilCurrentsMilliampsNoTorque = PoolEntry(3); + PoolEntry coilCurrentsMilliampsWithTorque = PoolEntry(3); + PoolEntry coilTempsNoTorque = PoolEntry(3); + PoolEntry coilTempsWithTorque = PoolEntry(3); + PoolEntry mtmRawNoTorque = PoolEntry(3); + PoolEntry actStatusNoTorque = PoolEntry(1); + PoolEntry mtmRawWithTorque = PoolEntry(3); + PoolEntry actStatusWithTorque = PoolEntry(1); + void doStartUp() override; void doShutDown() override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; @@ -28,6 +51,7 @@ class ImtqDummy : public DeviceHandlerBase { uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; + LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override; }; #endif /* DUMMIES_IMTQDUMMY_H_ */ diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index d7fdafbd..90a50160 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -42,7 +42,8 @@ #include "mission/system/tree/payloadModeTree.h" #include "mission/tcs/defs.h" -void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) { +void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF, + bool enableHkSets) { new ComIFDummy(objects::DUMMY_COM_IF); auto* comCookieDummy = new ComCookieDummy(); if (cfg.addBpxBattDummy) { @@ -74,7 +75,8 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio } 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); + auto* imtqDummy = + new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets); imtqDummy->enableThermalModule(ThermalStateCfg()); imtqDummy->connectModeTreeParent(*imtqAssy); if (cfg.addOnlyAcuDummy) { diff --git a/dummies/helperFactory.h b/dummies/helperFactory.h index e3809404..467cb172 100644 --- a/dummies/helperFactory.h +++ b/dummies/helperFactory.h @@ -22,6 +22,6 @@ struct DummyCfg { bool addCamSwitcherDummy = true; }; -void createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch, GpioIF* gpioIF); +void createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch, GpioIF* gpioIF, bool enableHkSets); } // namespace dummy From 758f2b9d7ab312196a0dda273c3be6ced0edf008 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 May 2023 11:15:58 +0200 Subject: [PATCH 12/33] add ACU HK sets --- dummies/AcuDummy.cpp | 49 +++++++++++++++++++++++++++++++++++++-- dummies/AcuDummy.h | 8 ++++++- dummies/helperFactory.cpp | 4 ++-- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/dummies/AcuDummy.cpp b/dummies/AcuDummy.cpp index 7c18f6bf..c9844eb1 100644 --- a/dummies/AcuDummy.cpp +++ b/dummies/AcuDummy.cpp @@ -2,8 +2,11 @@ #include -AcuDummy::AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) - : DeviceHandlerBase(objectId, comif, comCookie) {} +AcuDummy::AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets) + : DeviceHandlerBase(objectId, comif, comCookie), + coreHk(this), + auxHk(this), + enableHkSets(enableHkSets) {} AcuDummy::~AcuDummy() {} @@ -37,7 +40,49 @@ uint32_t AcuDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + using namespace ACU; + localDataPoolMap.emplace(pool::ACU_CURRENT_IN_CHANNELS, new PoolEntry(6)); + localDataPoolMap.emplace(pool::ACU_VOLTAGE_IN_CHANNELS, new PoolEntry(6)); + + localDataPoolMap.emplace(pool::ACU_VCC, new PoolEntry({0})); + localDataPoolMap.emplace(pool::ACU_VBAT, new PoolEntry({0})); + localDataPoolMap.emplace(ACU::pool::ACU_TEMPERATURES, new PoolEntry({10.0, 10.0, 10.0}, true)); + + localDataPoolMap.emplace(pool::ACU_MPPT_MODE, new PoolEntry({0})); + + localDataPoolMap.emplace(pool::ACU_VBOOST_IN_CHANNELS, new PoolEntry(6)); + localDataPoolMap.emplace(pool::ACU_POWER_IN_CHANNELS, new PoolEntry(6)); + + localDataPoolMap.emplace(pool::ACU_DAC_ENABLES, new PoolEntry(3)); + localDataPoolMap.emplace(pool::ACU_DAC_RAW_CHANNELS, new PoolEntry(6)); + + localDataPoolMap.emplace(pool::ACU_BOOTCAUSE, new PoolEntry({0})); + localDataPoolMap.emplace(pool::ACU_BOOTCNT, new PoolEntry({0})); + localDataPoolMap.emplace(pool::ACU_UPTIME, new PoolEntry({0})); + localDataPoolMap.emplace(pool::ACU_RESET_CAUSE, new PoolEntry({0})); + localDataPoolMap.emplace(pool::ACU_MPPT_TIME, new PoolEntry({0})); + localDataPoolMap.emplace(pool::ACU_MPPT_PERIOD, new PoolEntry({0})); + + localDataPoolMap.emplace(pool::ACU_DEVICES, new PoolEntry(8)); + localDataPoolMap.emplace(pool::ACU_DEVICES_STATUS, new PoolEntry(8)); + + localDataPoolMap.emplace(pool::ACU_WDT_CNT_GND, new PoolEntry({0})); + localDataPoolMap.emplace(pool::ACU_WDT_GND_LEFT, new PoolEntry({0})); + + poolManager.subscribeForDiagPeriodicPacket( + subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), enableHkSets, 30.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(auxHk.getSid(), enableHkSets, 6000.0)); return returnvalue::OK; } + +LocalPoolDataSetBase *AcuDummy::getDataSetHandle(sid_t sid) { + if (sid == coreHk.getSid()) { + return &coreHk; + } else if (sid == auxHk.getSid()) { + return &auxHk; + } + return nullptr; +} diff --git a/dummies/AcuDummy.h b/dummies/AcuDummy.h index d5527222..8d855281 100644 --- a/dummies/AcuDummy.h +++ b/dummies/AcuDummy.h @@ -2,6 +2,7 @@ #define DUMMIES_ACUDUMMY_H_ #include +#include class AcuDummy : public DeviceHandlerBase { public: @@ -11,10 +12,14 @@ class AcuDummy : public DeviceHandlerBase { static const uint8_t SIMPLE_COMMAND_DATA = 1; static const uint8_t PERIODIC_REPLY_DATA = 2; - AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets); virtual ~AcuDummy(); protected: + ACU::CoreHk coreHk; + ACU::AuxHk auxHk; + bool enableHkSets; + void doStartUp() override; void doShutDown() override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; @@ -28,6 +33,7 @@ class AcuDummy : public DeviceHandlerBase { uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; + LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override; }; #endif /* DUMMIES_ACUDUMMY_H_ */ diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 90a50160..16de01f0 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -80,9 +80,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio imtqDummy->enableThermalModule(ThermalStateCfg()); imtqDummy->connectModeTreeParent(*imtqAssy); if (cfg.addOnlyAcuDummy) { - new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets); } else if (cfg.addPowerDummies) { - new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets); new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); From 9e0989915c6087be44247352933db4106db2a44b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 May 2023 11:16:35 +0200 Subject: [PATCH 13/33] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cda8e93b..bae37800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ will consitute of a breaking change warranting a new major release: - Add the remaining system modes. - PLOC MPSoC flash read command working. - BPX battery handler is added for EM by default. +- ACU dummy HK sets. ## Fixed From b899bad0a81c30de37951c3b2ed85011ea756f4a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 May 2023 11:17:00 +0200 Subject: [PATCH 14/33] IMTQ HK sets --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cda8e93b..56943595 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ will consitute of a breaking change warranting a new major release: - Add the remaining system modes. - PLOC MPSoC flash read command working. - BPX battery handler is added for EM by default. +- IMTQ HK sets ## Fixed From 31e24e297ff6baf5d4683bbf67951938fcf6f470 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 May 2023 11:53:07 +0200 Subject: [PATCH 15/33] fix host SW --- bsp_hosted/ObjectFactory.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 018d0e56..dd88d552 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -62,6 +62,10 @@ void ObjectFactory::produce(void* args) { StorageManagerIF* tmStore; StorageManagerIF* ipcStore; PersistentTmStores persistentStores; + bool enableHkSets = false; +#if OBSW_ENABLE_PERIODIC_HK == 1 + enableHkSets = true; +#endif auto sdcMan = new DummySdCardManager("/tmp"); ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore, &tmStore, persistentStores, 120); @@ -101,7 +105,7 @@ void ObjectFactory::produce(void* args) { #endif dummy::DummyCfg cfg; - dummy::createDummies(cfg, *dummySwitcher, dummyGpioIF); + dummy::createDummies(cfg, *dummySwitcher, dummyGpioIF, enableHkSets); HeaterHandler* heaterHandler = nullptr; // new ThermalController(objects::THERMAL_CONTROLLER); From 276501c504d50e7822dbb44d2163eff957140ad5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 May 2023 08:43:52 +0200 Subject: [PATCH 16/33] another tweak for TM stores --- mission/com/TmStoreTaskBase.cpp | 23 ++++++++++------------- mission/com/VirtualChannel.cpp | 4 +--- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/mission/com/TmStoreTaskBase.cpp b/mission/com/TmStoreTaskBase.cpp index 2158cf2a..0470dc04 100644 --- a/mission/com/TmStoreTaskBase.cpp +++ b/mission/com/TmStoreTaskBase.cpp @@ -131,25 +131,22 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store, dumpContext.ptmeBusyCounter = 0; tmSinkBusyCd.resetTimer(); ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped); - if (result != returnvalue::OK) { - sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl; - } else if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) { + if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) { // This can happen if a file is corrupted and the next file swap completes the dump. dumpDoneHandler(); return returnvalue::OK; + } else if (result != returnvalue::OK) { + sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl; + return result; } dumpedLen = tmReader.getFullPacketLen(); - // Only write to VC if mode is on, but always confirm the dump. - // If the mode is OFF, it is assumed the PTME is not usable and is not allowed to be written - // (e.g. to confirm a reset or the transmitter is off anyway). - if (mode == MODE_ON) { - result = channel.write(tmReader.getFullData(), dumpedLen); - if (result == DirectTmSinkIF::IS_BUSY) { - sif::warning << "PersistentTmStore: Unexpected VC channel busy" << std::endl; - } else if (result != returnvalue::OK) { - sif::warning << "PersistentTmStore: Unexpected VC channel write failure" << std::endl; - } + result = channel.write(tmReader.getFullData(), dumpedLen); + if (result == DirectTmSinkIF::IS_BUSY) { + sif::warning << "PersistentTmStore: Unexpected VC channel busy" << std::endl; + } else if (result != returnvalue::OK) { + sif::warning << "PersistentTmStore: Unexpected VC channel write failure" << std::endl; } + result = store.confirmDump(tmReader, fileHasSwapped); if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK)) { dumpPerformed = true; diff --git a/mission/com/VirtualChannel.cpp b/mission/com/VirtualChannel.cpp index ea5527a8..ff3749a9 100644 --- a/mission/com/VirtualChannel.cpp +++ b/mission/com/VirtualChannel.cpp @@ -18,9 +18,7 @@ uint8_t VirtualChannel::getVcid() const { return vcId; } const char* VirtualChannel::getName() const { return vcName.c_str(); } -bool VirtualChannel::isBusy() const { - return ptme.isBusy(vcId); -} +bool VirtualChannel::isBusy() const { return ptme.isBusy(vcId); } void VirtualChannel::cancelTransfer() { ptme.cancelTransfer(vcId); } From 8d041c67538a1f1dc85f16591a71d2e88920a04c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 May 2023 08:45:20 +0200 Subject: [PATCH 17/33] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 376a7f64..7e7ba753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ will consitute of a breaking change warranting a new major release: - Transmitter state is not taken into account anymore for writing into the PTME. The PTME should be perfectly capable of generating a valid CADU, even when the transmitter is not ON for any reason. +- OFF mode is ignores in TM store for determining whether a store will be written. The modes will + only be used to cancel a transfer. ## Added From e1aff4c641ac2ee7df2475d3aba6a5ea963fab36 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 May 2023 08:48:03 +0200 Subject: [PATCH 18/33] another small logic fix --- CHANGELOG.md | 1 + mission/tmtc/PersistentTmStore.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e7ba753..341f1a26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ will consitute of a breaking change warranting a new major release: - HK TM store: The HK store dump success event was triggered for cancelled HK dumps. - When a PUS parsing error occured while parsing a TM store file, the dump completion procedure was always executed. +- Some smaller logic fixes in the TM store base class # [v2.0.5] 2023-05-11 diff --git a/mission/tmtc/PersistentTmStore.cpp b/mission/tmtc/PersistentTmStore.cpp index 7c3738fc..8174f8a0 100644 --- a/mission/tmtc/PersistentTmStore.cpp +++ b/mission/tmtc/PersistentTmStore.cpp @@ -256,6 +256,7 @@ ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fi if (state == State::IDLE or dumpParams.pendingPacketDump) { return returnvalue::FAILED; } + fileHasSwapped = false; reader.setReadOnlyData(fileBuf.data() + dumpParams.currentSize, fileBuf.size() - dumpParams.currentSize); // CRC check to fully ensure this is a valid TM @@ -270,7 +271,6 @@ ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fi fileHasSwapped = true; return loadNextDumpFile(); } - fileHasSwapped = false; dumpParams.pendingPacketDump = true; return returnvalue::OK; } From db79e34d3bcc3c72fad0dbf2352d530d15702b69 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 25 May 2023 11:20:28 +0200 Subject: [PATCH 19/33] added switcher for IMTQ dummy --- dummies/ImtqDummy.cpp | 14 ++++++++++++-- dummies/ImtqDummy.h | 6 +++++- dummies/helperFactory.cpp | 5 +++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/dummies/ImtqDummy.cpp b/dummies/ImtqDummy.cpp index 8f8d1513..0c8f9076 100644 --- a/dummies/ImtqDummy.cpp +++ b/dummies/ImtqDummy.cpp @@ -3,11 +3,12 @@ #include ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, - bool enableHkSets) + power::Switch_t pwrSwitcher, bool enableHkSets) : DeviceHandlerBase(objectId, comif, comCookie), setNoTorque(this), setWithTorque(this), - enableHkSets(enableHkSets) {} + enableHkSets(enableHkSets), + switcher(pwrSwitcher) {} ImtqDummy::~ImtqDummy() = default; @@ -15,6 +16,15 @@ void ImtqDummy::doStartUp() { setMode(MODE_NORMAL); } void ImtqDummy::doShutDown() { setMode(_MODE_POWER_DOWN); } +ReturnValue_t ImtqDummy::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) { + if (switcher != power::NO_SWITCH) { + *numberOfSwitches = 1; + *switches = &switcher; + return returnvalue::OK; + } + return DeviceHandlerBase::NO_SWITCH; +} + ReturnValue_t ImtqDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { diff --git a/dummies/ImtqDummy.h b/dummies/ImtqDummy.h index 5a1de175..990df6e0 100644 --- a/dummies/ImtqDummy.h +++ b/dummies/ImtqDummy.h @@ -13,10 +13,12 @@ class ImtqDummy : public DeviceHandlerBase { static const uint8_t SIMPLE_COMMAND_DATA = 1; static const uint8_t PERIODIC_REPLY_DATA = 2; - ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets); + ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, + power::Switch_t pwrSwitcher, bool enableHkSets); ~ImtqDummy() override; protected: + ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override; imtq::HkDatasetNoTorque setNoTorque; imtq::HkDatasetWithTorque setWithTorque; bool enableHkSets; @@ -38,6 +40,8 @@ class ImtqDummy : public DeviceHandlerBase { PoolEntry mtmRawWithTorque = PoolEntry(3); PoolEntry actStatusWithTorque = PoolEntry(1); + power::Switch_t switcher = power::NO_SWITCH; + void doStartUp() override; void doShutDown() override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 16de01f0..157d11d3 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -75,9 +75,10 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio } 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, enableHkSets); + auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, + power::Switches::PDU1_CH3_MGT_5V, enableHkSets); imtqDummy->enableThermalModule(ThermalStateCfg()); + imtqDummy->setPowerSwitcher(&pwrSwitcher); imtqDummy->connectModeTreeParent(*imtqAssy); if (cfg.addOnlyAcuDummy) { new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets); From a6787538f2baaa6481ad9cbb1596b014952a16f6 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 25 May 2023 11:21:28 +0200 Subject: [PATCH 20/33] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 341f1a26..39f6a0a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ will consitute of a breaking change warranting a new major release: - BPX battery handler is added for EM by default. - ACU dummy HK sets - IMTQ HK sets +- IMTQ dummy now handles power switch ## Fixed From 5afe22bc92042144b1bb54a91066f5a0a05f70b0 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 25 May 2023 15:48:28 +0200 Subject: [PATCH 21/33] heater mode fix --- mission/tcs/HeaterHandler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mission/tcs/HeaterHandler.cpp b/mission/tcs/HeaterHandler.cpp index 630dc92c..f422f382 100644 --- a/mission/tcs/HeaterHandler.cpp +++ b/mission/tcs/HeaterHandler.cpp @@ -268,6 +268,8 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switch heaterIdx) { triggerEvent(GPIO_PULL_HIGH_FAILED, result); } else { triggerEvent(HEATER_WENT_ON, heaterIdx, 0); + EventManagerIF::triggerEvent(helper.heaters[heaterIdx].first->getObjectId(), MODE_INFO, + MODE_ON, MODE_OFF); { MutexGuard mg(handlerLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX); heater.switchState = ON; @@ -324,6 +326,8 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switch heaterIdx) { heater.switchState = OFF; } triggerEvent(HEATER_WENT_OFF, heaterIdx, 0); + EventManagerIF::triggerEvent(helper.heaters[heaterIdx].first->getObjectId(), MODE_INFO, + MODE_OFF, MODE_ON); // When all switches are off, also main line switch will be turned off if (allSwitchesOff()) { mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); From 335394b8639814edee4b107e087482ac46cd9cd9 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 26 May 2023 13:51:24 +0200 Subject: [PATCH 22/33] fixed use of c abs which will truncate the value --- mission/controller/acs/ActuatorCmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/controller/acs/ActuatorCmd.cpp b/mission/controller/acs/ActuatorCmd.cpp index d2fe2d65..a8fab6a4 100644 --- a/mission/controller/acs/ActuatorCmd.cpp +++ b/mission/controller/acs/ActuatorCmd.cpp @@ -61,7 +61,7 @@ void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentAct // Scaling along largest element if dipol exceeds maximum uint8_t maxIdx = 0; VectorOperations::maxAbsValue(dipolMomentActuatorDouble, 3, &maxIdx); - double maxAbsValue = abs(dipolMomentActuatorDouble[maxIdx]); + double maxAbsValue = std::abs(dipolMomentActuatorDouble[maxIdx]); if (maxAbsValue > maxDipol) { double scalingFactor = maxDipol / maxAbsValue; VectorOperations::mulScalar(dipolMomentActuatorDouble, scalingFactor, From a7c6cd017d80b88bfe64418d6f00b6634dc5c264 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 26 May 2023 13:53:46 +0200 Subject: [PATCH 23/33] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39f6a0a8..1dfeed76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,8 @@ will consitute of a breaking change warranting a new major release: - When a PUS parsing error occured while parsing a TM store file, the dump completion procedure was always executed. - Some smaller logic fixes in the TM store base class +- Fixed usage of C `abs` instead of C++ `std::abs`, which results in MTQ commands not being + scaled correctly between 1Am² and 0.2Am². # [v2.0.5] 2023-05-11 From 71eca867ea630fad8bcb4c5feb4d197af0e3c3a7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 27 May 2023 17:03:33 +0200 Subject: [PATCH 24/33] i think the rad sesnor messing everything up --- CMakeLists.txt | 2 +- bsp_q7s/em/emObjectFactory.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5ecf173..d47be117 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,7 @@ set(OBSW_ADD_THERMAL_TEMP_INSERTER ${OBSW_Q7S_EM} CACHE STRING "Add thermal sensor temperature inserter") set(OBSW_ADD_ACS_BOARD - 1 + ${INIT_VAL} CACHE STRING "Add ACS board module") set(OBSW_ADD_GPS_CTRL ${INIT_VAL} diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 59660b86..72a58987 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -98,7 +98,7 @@ void ObjectFactory::produce(void* args) { // and will cause xsc_boot_copy commands to always boot to 0 0 // createRadSensorComponent(gpioComIF); // Still initialize chip select to avoid SPI bus issues. - createRadSensorChipSelect(gpioComIF); + // createRadSensorChipSelect(gpioComIF); #if OBSW_ADD_ACS_BOARD == 1 createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true, From ada77ed53bb7f070fa3f2c71cd8443c6bc0aad8a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 09:22:59 +0200 Subject: [PATCH 25/33] ACS board still required --- bsp_q7s/em/emObjectFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 72a58987..5b2935b7 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -97,10 +97,10 @@ void ObjectFactory::produce(void* args) { // TODO: Careful! Switching this on somehow messes with the communication with the ProASIC // and will cause xsc_boot_copy commands to always boot to 0 0 // createRadSensorComponent(gpioComIF); - // Still initialize chip select to avoid SPI bus issues. - // createRadSensorChipSelect(gpioComIF); #if OBSW_ADD_ACS_BOARD == 1 + // Still initialize chip select to avoid SPI bus issues. + createRadSensorChipSelect(gpioComIF); createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true, adis1650x::Type::ADIS16507); #else From c5640c9fca3f62bef8afe1dba93dbc1bf90bf221 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 15:14:07 +0200 Subject: [PATCH 26/33] prevent SPAM --- mission/controller/ThermalController.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 7133dd88..4c475e35 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1631,13 +1631,18 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) { bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch redSwitchNr) { bool heaterAvailable = true; - if (heaterHandler.getHealth(switchNr) != HasHealthIF::HEALTHY) { - if (heaterHandler.getHealth(redSwitchNr) == HasHealthIF::HEALTHY) { + HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr); + HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr); + if (mainHealth != HasHealthIF::HEALTHY) { + if (redHealth == HasHealthIF::HEALTHY) { switchNr = redSwitchNr; redSwitchNrInUse = true; } else { heaterAvailable = false; - triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); + // Special case: Ground might command/do something with the heaters, so prevent spam. + if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) { + triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); + } } } else { redSwitchNrInUse = false; From b135e2f6a155fd9accd1165d773294133412bf04 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 15:14:47 +0200 Subject: [PATCH 27/33] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dfeed76..a9b4f3ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ will consitute of a breaking change warranting a new major release: - Some smaller logic fixes in the TM store base class - Fixed usage of C `abs` instead of C++ `std::abs`, which results in MTQ commands not being scaled correctly between 1Am² and 0.2Am². +- Prevent spam of TCS controller heater unavailability event if all heaters are in external control. # [v2.0.5] 2023-05-11 From 7811a4cc6ba36840977c7166dec79f9d43c2e38b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 15:17:11 +0200 Subject: [PATCH 28/33] small fix for mode event heater --- mission/tcs/HeaterHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/tcs/HeaterHandler.cpp b/mission/tcs/HeaterHandler.cpp index f422f382..de4b600d 100644 --- a/mission/tcs/HeaterHandler.cpp +++ b/mission/tcs/HeaterHandler.cpp @@ -269,7 +269,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switch heaterIdx) { } else { triggerEvent(HEATER_WENT_ON, heaterIdx, 0); EventManagerIF::triggerEvent(helper.heaters[heaterIdx].first->getObjectId(), MODE_INFO, - MODE_ON, MODE_OFF); + MODE_ON, 0); { MutexGuard mg(handlerLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX); heater.switchState = ON; @@ -327,7 +327,7 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switch heaterIdx) { } triggerEvent(HEATER_WENT_OFF, heaterIdx, 0); EventManagerIF::triggerEvent(helper.heaters[heaterIdx].first->getObjectId(), MODE_INFO, - MODE_OFF, MODE_ON); + MODE_OFF, 0); // When all switches are off, also main line switch will be turned off if (allSwitchesOff()) { mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); From ebf5609680f6010976f541c0efad9eb9559173bf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 16:45:09 +0200 Subject: [PATCH 29/33] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dfeed76..c48e327f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,8 @@ will consitute of a breaking change warranting a new major release: - Some smaller logic fixes in the TM store base class - Fixed usage of C `abs` instead of C++ `std::abs`, which results in MTQ commands not being scaled correctly between 1Am² and 0.2Am². +- TCS Heater Handler: Always trigger mode event if a heater goes `OFF` or `ON`. This event might + soon replace the `HEATER_WENT_ON` and `HEATER_WENT_OFF` events. # [v2.0.5] 2023-05-11 From 0aa617d4401ee3641b8e167db963366feb69aa04 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 16:54:56 +0200 Subject: [PATCH 30/33] switch info fix --- CHANGELOG.md | 2 ++ mission/controller/ThermalController.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a12c68bb..990ed751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,8 @@ will consitute of a breaking change warranting a new major release: - TCS Heater Handler: Always trigger mode event if a heater goes `OFF` or `ON`. This event might soon replace the `HEATER_WENT_ON` and `HEATER_WENT_OFF` events. - Prevent spam of TCS controller heater unavailability event if all heaters are in external control. +- TCS heater switch info set contained invalid values because of a faulty `memcpy` in the TCS + controller. There is not crash risk but the heater states were invalid. # [v2.0.5] 2023-05-11 diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 4c475e35..6205ce44 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -175,7 +175,7 @@ void ThermalController::performControlOperation() { heaterHandler.getAllSwitchStates(heaterSwitchStateArray); { PoolReadGuard pg(&heaterInfo); - std::memcpy(heaterInfo.heaterSwitchState.value, heaterStates.data(), 8); + std::memcpy(heaterInfo.heaterSwitchState.value, heaterSwitchStateArray.data(), 8); { PoolReadGuard pg2(¤tVecPdu2); if (pg.getReadResult() == returnvalue::OK and pg2.getReadResult() == returnvalue::OK) { From 170cb4d99cb970734af34d338be467157cde8f94 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 May 2023 10:45:40 +0200 Subject: [PATCH 31/33] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 990ed751..7890df35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ will consitute of a breaking change warranting a new major release: # [v2.2.0] to be released -# [v2.1.0] to be released +# [v3.0.0] to be released ## Changed From ec8e8533d67d966208c8cc5d59ab53a5dc4210b6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 May 2023 11:49:18 +0200 Subject: [PATCH 32/33] bump version --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d47be117..eaa2d340 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,9 @@ # ############################################################################## cmake_minimum_required(VERSION 3.13) -set(OBSW_VERSION_MAJOR 2) +set(OBSW_VERSION_MAJOR 3) set(OBSW_VERSION_MINOR 0) -set(OBSW_VERSION_REVISION 5) +set(OBSW_VERSION_REVISION 0) # set(CMAKE_VERBOSE TRUE) From f93e299296f6e93ce46f75c1b983fe93cb865e56 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 May 2023 17:29:01 +0200 Subject: [PATCH 33/33] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 6ec0ce20..6182369e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 6ec0ce20fa98877c9f88acb5fe9129254291344b +Subproject commit 6182369e4f40872c5c26e59be25d5fa79339176a