From f0d55f9e5b5d8edb1a6e438ea76de8eb7888ba4e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 20:35:00 +0200 Subject: [PATCH 1/6] prep v1.45.0 --- CHANGELOG.md | 3 +++ CMakeLists.txt | 4 ++-- tmtc | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5078b7e2..d2981d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,10 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v1.45.0] 2023-04-14 + - q7s-package: v2.5.0 +- eive-tmtc: v3.0.0 - STR firmware was updated to v10.7. `wire` library still needs to be updated. ## Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 71a94ff9..2d96ca08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR 1) -set(OBSW_VERSION_MINOR 44) -set(OBSW_VERSION_REVISION 1) +set(OBSW_VERSION_MINOR 45) +set(OBSW_VERSION_REVISION 0) # set(CMAKE_VERBOSE TRUE) diff --git a/tmtc b/tmtc index a07f2132..d00e4247 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a07f21329adcffa963d75769d523b3df34222543 +Subproject commit d00e4247f66eb2f010f1fe53ee7f59b7fb992481 -- 2.43.0 From b964b03b2d2b13d19f37ff833598c8e7f3788b7f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 20:41:50 +0200 Subject: [PATCH 2/6] fix STR dummy --- dummies/StarTrackerDummy.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dummies/StarTrackerDummy.cpp b/dummies/StarTrackerDummy.cpp index d70c9a1b..4ee26c7d 100644 --- a/dummies/StarTrackerDummy.cpp +++ b/dummies/StarTrackerDummy.cpp @@ -64,6 +64,7 @@ ReturnValue_t StarTrackerDummy::initializeLocalDataPool(localpool::DataPool &loc localDataPoolMap.emplace(startracker::LISA_NR_CLOSE, new PoolEntry({0})); localDataPoolMap.emplace(startracker::TRUST_WORTHY, new PoolEntry({0})); localDataPoolMap.emplace(startracker::STABLE_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::STR_MODE, new PoolEntry({0})); localDataPoolMap.emplace(startracker::SOLUTION_STRATEGY, new PoolEntry({0})); return returnvalue::OK; } -- 2.43.0 From d24a983985f7cb5b87f784ef4ec8bcdfc7b53051 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 21:02:39 +0200 Subject: [PATCH 3/6] some EM fixes --- CHANGELOG.md | 5 +++++ dummies/ImtqDummy.cpp | 2 ++ dummies/StarTrackerDummy.cpp | 2 +- dummies/TemperatureSensorInserter.cpp | 2 +- mission/genericFactory.cpp | 8 ++++---- mission/tmtc/PusLiveDemux.cpp | 1 + 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2981d89..fe42fb59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,11 @@ will consitute of a breaking change warranting a new major release: - Custom FDIR for TMP1075 sensors. The device handlers reject `NEEDS_RECOVERY` health commands anyway, so it does not really make sense to use the default FDIR. - Reject `NEEDS_RECOVERY` health commands for the heater health devices. +- Adapted some queue sizes so that EM startup works without queue errors + - Event Manager: 120 -> 160 + - UDP TMTC Bridge: 50 -> 120 + - TCP TMTC Bridge: 50 -> 120 + - Service 5: 120 -> 160, number of events handled in one cycle increased to 80 ## Added diff --git a/dummies/ImtqDummy.cpp b/dummies/ImtqDummy.cpp index fc99d321..b2f61bb3 100644 --- a/dummies/ImtqDummy.cpp +++ b/dummies/ImtqDummy.cpp @@ -43,5 +43,7 @@ ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool &localDataP localDataPoolMap.emplace(imtq::ACTUATION_CAL_STATUS, new PoolEntry({0})); localDataPoolMap.emplace(imtq::MTM_RAW, new PoolEntry({0.12, 0.76, -0.45}, true)); 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})); return DeviceHandlerBase::initializeLocalDataPool(localDataPoolMap, poolManager); } diff --git a/dummies/StarTrackerDummy.cpp b/dummies/StarTrackerDummy.cpp index 4ee26c7d..6e21b762 100644 --- a/dummies/StarTrackerDummy.cpp +++ b/dummies/StarTrackerDummy.cpp @@ -64,7 +64,7 @@ ReturnValue_t StarTrackerDummy::initializeLocalDataPool(localpool::DataPool &loc localDataPoolMap.emplace(startracker::LISA_NR_CLOSE, new PoolEntry({0})); localDataPoolMap.emplace(startracker::TRUST_WORTHY, new PoolEntry({0})); localDataPoolMap.emplace(startracker::STABLE_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(startracker::STR_MODE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::STR_MODE, new PoolEntry({0})); localDataPoolMap.emplace(startracker::SOLUTION_STRATEGY, new PoolEntry({0})); return returnvalue::OK; } diff --git a/dummies/TemperatureSensorInserter.cpp b/dummies/TemperatureSensorInserter.cpp index b6f46fb8..cfba0ef9 100644 --- a/dummies/TemperatureSensorInserter.cpp +++ b/dummies/TemperatureSensorInserter.cpp @@ -15,7 +15,7 @@ TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId, tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {} ReturnValue_t TemperatureSensorInserter::initialize() { - testCase = TestCase::COLD_STR_CONSECUTIVE; + testCase = TestCase::NONE; return returnvalue::OK; } diff --git a/mission/genericFactory.cpp b/mission/genericFactory.cpp index 08d14f45..06f1220e 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -98,7 +98,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun StorageManagerIF** ipcStore, StorageManagerIF** tmStore, PersistentTmStores& stores) { // Framework objects - new EventManager(objects::EVENT_MANAGER, 120); + new EventManager(objects::EVENT_MANAGER, 160); auto healthTable = new HealthTable(objects::HEALTH_TABLE); if (healthTable_ != nullptr) { *healthTable_ = healthTable; @@ -131,7 +131,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun #if OBSW_ADD_TCPIP_SERVERS == 1 #if OBSW_ADD_TMTC_UDP_SERVER == 1 auto udpBridge = - new UdpTmTcBridge(objects::UDP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR, 50); + new UdpTmTcBridge(objects::UDP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR, 120); new UdpTcPollingTask(objects::UDP_TMTC_POLLING_TASK, objects::UDP_TMTC_SERVER); sif::info << "Created UDP server for TMTC commanding with listener port " << udpBridge->getUdpPort() << std::endl; @@ -139,7 +139,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun #endif #if OBSW_ADD_TMTC_TCP_SERVER == 1 auto tcpBridge = - new TcpTmTcBridge(objects::TCP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR, 50); + new TcpTmTcBridge(objects::TCP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR, 120); TcpTmTcServer::TcpConfig cfg(true, true); auto tcpServer = new TcpTmTcServer(objects::TCP_TMTC_POLLING_TASK, objects::TCP_TMTC_SERVER, cfg); // TCP is stream based. Use packet ID as start marker when parsing for space packets @@ -240,7 +240,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun pus::PUS_SERVICE_3, config::HK_SERVICE_QUEUE_DEPTH); new Service5EventReporting( PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, config::EIVE_PUS_APID, pus::PUS_SERVICE_5), - 40, 120); + 80, 160); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_8, 16, 60); new Service9TimeManagement( diff --git a/mission/tmtc/PusLiveDemux.cpp b/mission/tmtc/PusLiveDemux.cpp index d8ae1126..bbe1be4f 100644 --- a/mission/tmtc/PusLiveDemux.cpp +++ b/mission/tmtc/PusLiveDemux.cpp @@ -33,6 +33,7 @@ ReturnValue_t PusLiveDemux::demultiplexPackets(StorageManagerIF& tmStore, if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "PusLiveDemux::handlePacket: Error sending TM to downlink handler " << dest.name + << ", failed with code 0x" << std::hex << std::setw(4) << result << std::dec << std::endl; #endif tmStore.deleteData(message.getStorageId()); -- 2.43.0 From 078a04b317fa8ab6bbf81b41c92e4ace947ea338 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 21:08:55 +0200 Subject: [PATCH 4/6] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index ffa2fa47..7f61d17c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit ffa2fa477f105cc876264335d5b25fc9b174a181 +Subproject commit 7f61d17ceeee76ffd2206831a9288e5c8da5b6f0 -- 2.43.0 From b47bda8ed1b05d88b0cc712e27eca718eea31897 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 21:22:55 +0200 Subject: [PATCH 5/6] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 7f61d17c..5eb9ee8b 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7f61d17ceeee76ffd2206831a9288e5c8da5b6f0 +Subproject commit 5eb9ee8bc1e6f8640cbea46febd11e4b92241881 -- 2.43.0 From b98f91f6c1e07da5d5902497921e69f8dbd966ec Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 21:44:23 +0200 Subject: [PATCH 6/6] hopefully last EM fix for v2.0 --- CHANGELOG.md | 3 ++ bsp_q7s/em/emObjectFactory.cpp | 3 +- dummies/PcduHandlerDummy.cpp | 58 +++++++++++++--------------------- dummies/PcduHandlerDummy.h | 53 +++++++++++++++++++++---------- 4 files changed, 62 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe42fb59..6c3e4e50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,9 @@ will consitute of a breaking change warranting a new major release: - UDP TMTC Bridge: 50 -> 120 - TCP TMTC Bridge: 50 -> 120 - Service 5: 120 -> 160, number of events handled in one cycle increased to 80 +- EM: PCDU dummy is not a device handler anymore, but a custom power switcher object. This avoids + some issues where the event manager could not send an event message to the PCDU dummy because + the FDIR event queue was too small. ## Added diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 2d06e697..05a3fee0 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -63,8 +63,7 @@ void ObjectFactory::produce(void* args) { PowerSwitchIF* pwrSwitcher = nullptr; #if OBSW_ADD_GOMSPACE_PCDU == 0 - auto* comCookieDummy = new ComCookieDummy(); - pwrSwitcher = new PcduHandlerDummy(objects::PCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + pwrSwitcher = new PcduHandlerDummy(objects::PCDU_HANDLER); #else createPcduComponents(gpioComIF, &pwrSwitcher, enableHkSets); #endif diff --git a/dummies/PcduHandlerDummy.cpp b/dummies/PcduHandlerDummy.cpp index 0b1dec69..c91de74c 100644 --- a/dummies/PcduHandlerDummy.cpp +++ b/dummies/PcduHandlerDummy.cpp @@ -1,49 +1,20 @@ #include "PcduHandlerDummy.h" +#include #include #include "mission/power/defs.h" -PcduHandlerDummy::PcduHandlerDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) - : DeviceHandlerBase(objectId, comif, comCookie), dummySwitcher(objectId, 18, 18, false) { +PcduHandlerDummy::PcduHandlerDummy(object_id_t objectId) + : SystemObject(objectId), manager(this, nullptr), dummySwitcher(objectId, 18, 18, false) { switcherLock = MutexFactory::instance()->createMutex(); + queue = QueueFactory::instance()->createMessageQueue(20); } PcduHandlerDummy::~PcduHandlerDummy() {} -void PcduHandlerDummy::doStartUp() { setMode(MODE_NORMAL); } - -void PcduHandlerDummy::doShutDown() { setMode(MODE_OFF); } - -ReturnValue_t PcduHandlerDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { - return NOTHING_TO_SEND; -} - -ReturnValue_t PcduHandlerDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { - return NOTHING_TO_SEND; -} - -ReturnValue_t PcduHandlerDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData, - size_t commandDataLen) { - return returnvalue::OK; -} - -ReturnValue_t PcduHandlerDummy::scanForReply(const uint8_t *start, size_t len, - DeviceCommandId_t *foundId, size_t *foundLen) { - return returnvalue::OK; -} - -ReturnValue_t PcduHandlerDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { - return returnvalue::OK; -} - -void PcduHandlerDummy::fillCommandAndReplyMap() {} - -uint32_t PcduHandlerDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } - -ReturnValue_t PcduHandlerDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, - LocalDataPoolManager &poolManager) { +ReturnValue_t PcduHandlerDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { return returnvalue::OK; } @@ -76,7 +47,8 @@ ReturnValue_t PcduHandlerDummy::getFuseState(uint8_t fuseNr) const { uint32_t PcduHandlerDummy::getSwitchDelayMs(void) const { return dummySwitcher.getSwitchDelayMs(); } -void PcduHandlerDummy::performOperationHook() { +ReturnValue_t PcduHandlerDummy::performOperation(uint8_t opCode) { + // TODO: Handle HK messages in queue. SwitcherBoolArray switcherChangeCopy{}; { MutexGuard mg(switcherLock); @@ -93,4 +65,18 @@ void PcduHandlerDummy::performOperationHook() { switchChangeArray[idx] = false; } } + return returnvalue::OK; } + +object_id_t PcduHandlerDummy::getObjectId() const { return SystemObject::getObjectId(); } + +MessageQueueId_t PcduHandlerDummy::getCommandQueue() const { return queue->getId(); } + +dur_millis_t PcduHandlerDummy::getPeriodicOperationFrequency() const { + // TODO: dummy value. Retrieve from intiitalize after task creation.. + return 400; +} + +LocalDataPoolManager* PcduHandlerDummy::getHkManagerHandle() { return &manager; } + +LocalPoolDataSetBase* PcduHandlerDummy::getDataSetHandle(sid_t sid) { return nullptr; } diff --git a/dummies/PcduHandlerDummy.h b/dummies/PcduHandlerDummy.h index 7980629b..c41846f3 100644 --- a/dummies/PcduHandlerDummy.h +++ b/dummies/PcduHandlerDummy.h @@ -3,7 +3,10 @@ #include #include -class PcduHandlerDummy : public DeviceHandlerBase, public PowerSwitchIF { +class PcduHandlerDummy : public PowerSwitchIF, + public HasLocalDataPoolIF, + public SystemObject, + public ExecutableObjectIF { public: static const DeviceCommandId_t SIMPLE_COMMAND = 1; static const DeviceCommandId_t PERIODIC_REPLY = 2; @@ -11,33 +14,49 @@ class PcduHandlerDummy : public DeviceHandlerBase, public PowerSwitchIF { static const uint8_t SIMPLE_COMMAND_DATA = 1; static const uint8_t PERIODIC_REPLY_DATA = 2; - PcduHandlerDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); + PcduHandlerDummy(object_id_t objectId); virtual ~PcduHandlerDummy(); protected: - MutexIF *switcherLock; + MessageQueueIF* queue; + LocalDataPoolManager manager; + MutexIF* switcherLock; DummyPowerSwitcher dummySwitcher; using SwitcherBoolArray = std::array; + ReturnValue_t performOperation(uint8_t opCode) override; SwitcherBoolArray switchChangeArray{}; - void performOperationHook() override; - void doStartUp() override; - void doShutDown() override; - ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; - ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; - ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) override; - ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, - size_t *foundLen) override; - ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; - void fillCommandAndReplyMap() override; - uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; - ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, - LocalDataPoolManager &poolManager) override; + + ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; ReturnValue_t sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) override; ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override; ReturnValue_t getSwitchState(power::Switch_t switchNr) const override; ReturnValue_t getFuseState(uint8_t fuseNr) const override; uint32_t getSwitchDelayMs(void) const override; + + object_id_t getObjectId() const override; + + /** Command queue for housekeeping messages. */ + MessageQueueId_t getCommandQueue() const override; + + dur_millis_t getPeriodicOperationFrequency() const override; + + /** + * Every class implementing this interface should have a local data pool manager. This + * function will return a reference to the manager. + * @return + */ + LocalDataPoolManager* getHkManagerHandle() override; + + /** + * This function is used by the pool manager to get a valid dataset + * from a SID. This function is protected to prevent users from + * using raw data set pointers which could not be thread-safe. Users + * should use the #ProvidesDataPoolSubscriptionIF. + * @param sid Corresponding structure ID + * @return + */ + LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; }; -- 2.43.0