From 8aa65ebbd666b458283de11dea56f423d11a31f7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Aug 2022 09:55:42 +0200 Subject: [PATCH 01/22] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index d19cdfa5..4f5559c5 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d19cdfa5663966548918091005c7e9bc912e4041 +Subproject commit 4f5559c50fce2f044359df89fff1bcbba1807291 From 74b45f30a053da4e261cfc54a76b166ce887acbc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Aug 2022 15:53:20 +0200 Subject: [PATCH 02/22] move to new DHB TM handler --- CMakeLists.txt | 5 +++-- fsfw | 2 +- linux/devices/GPSHyperionLinuxController.cpp | 2 +- linux/devices/Max31865RtdLowlevelHandler.cpp | 2 +- linux/devices/ploc/PlocSupervisorHandler.cpp | 2 +- linux/devices/startracker/StarTrackerHandler.cpp | 2 +- mission/controller/AcsController.cpp | 2 +- mission/devices/ACUHandler.cpp | 3 ++- mission/devices/GomspaceDeviceHandler.cpp | 6 ++++-- mission/devices/P60DockHandler.cpp | 7 +------ mission/devices/PDU1Handler.cpp | 5 +++-- mission/devices/PDU2Handler.cpp | 9 +++------ 12 files changed, 22 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 976bc6ee..9b8190ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -451,8 +451,9 @@ if(TGT_BSP MATCHES "arm/q7s") target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC}) endif() -target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} - rapidcsv ${LIB_DUMMIES} ${LIB_GOMSPACE_CLIENTS}) +target_link_libraries( + ${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} rapidcsv ${LIB_DUMMIES} + ${LIB_GOMSPACE_CLIENTS}) if(TGT_BSP MATCHES "arm/egse") target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) diff --git a/fsfw b/fsfw index 9a590a3f..21ac8661 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 9a590a3fcd81ed4dd48de503522b6d71f64205d2 +Subproject commit 21ac86619e2b1fecf71bd2aa0f09ecbd471c8531 diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 556db7ef..84200baf 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -87,7 +87,7 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool( localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry()); localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry()); localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry()); - poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), 30.0}); + poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), false, 30.0}); return returnvalue::OK; } diff --git a/linux/devices/Max31865RtdLowlevelHandler.cpp b/linux/devices/Max31865RtdLowlevelHandler.cpp index f2815f5f..1be2b1c2 100644 --- a/linux/devices/Max31865RtdLowlevelHandler.cpp +++ b/linux/devices/Max31865RtdLowlevelHandler.cpp @@ -311,7 +311,7 @@ ReturnValue_t Max31865RtdReader::readReceivedMessage(CookieIF* cookie, uint8_t** return returnvalue::FAILED; } auto* rtdCookie = dynamic_cast(cookie); - if(rtdCookie == nullptr) { + if (rtdCookie == nullptr) { return returnvalue::FAILED; } uint8_t* exchangePtr = rtdCookie->exchangeBuf.data(); diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 1cff8884..3846e4a4 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -417,7 +417,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d break; } case LOGGING_SET_TOPIC: { - if(commandData == nullptr or commandDataLen == 0) { + if (commandData == nullptr or commandDataLen == 0) { return HasActionsIF::INVALID_PARAMETERS; } uint8_t tpc = *(commandData); diff --git a/linux/devices/startracker/StarTrackerHandler.cpp b/linux/devices/startracker/StarTrackerHandler.cpp index 698887b8..47312934 100644 --- a/linux/devices/startracker/StarTrackerHandler.cpp +++ b/linux/devices/startracker/StarTrackerHandler.cpp @@ -1830,7 +1830,7 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() { } PoolReadGuard rg(&checksumSet); checksumSet.checksum = checksumReply.getChecksum(); - handleDeviceTM(&checksumSet, startracker::CHECKSUM); + handleDeviceTm(util::DataWrapper(checksumSet), startracker::CHECKSUM); #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 checksumReply.printChecksum(); #endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */ diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index c6b3207e..09e91e26 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -45,7 +45,7 @@ ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localD localDataPoolMap.emplace(acsctrl::PoolIds::MGM_3_RM3100_UT, &mgm3PoolVec); localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_NT, &imtqMgmPoolVec); localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_ACT_STATUS, &imtqCalActStatus); - poolManager.subscribeForRegularPeriodicPacket({mgmData.getSid(), 5.0}); + poolManager.subscribeForRegularPeriodicPacket({mgmData.getSid(), false, 5.0}); return returnvalue::OK; } diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index f229d248..e86c0801 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -43,7 +43,8 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack } void ACUHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - handleDeviceTM(packet, ACU::CONFIG_TABLE_SIZE, id); + util::DataWrapper wrapper(packet, ACU::CONFIG_TABLE_SIZE); + handleDeviceTm(wrapper, id); } LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) { diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index cc4786d0..9278ed77 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -177,7 +177,9 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, switch (id) { case (GOMSPACE::PING): { SerializeElement replyTime = *packet; - handleDeviceTM(&replyTime, id, true); + util::DataWrapper wrapper; + wrapper.setSerializable(replyTime); + handleDeviceTm(wrapper, id, true); break; } case (GOMSPACE::PARAM_GET): { @@ -204,7 +206,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, uint16_t address = cspGetParamReply.getAddress(); /* Pack relevant information into a tm packet */ ParamReply paramReply(action, tableId, address, payloadLength, tempPayloadBuffer); - handleDeviceTM(¶mReply, id, true); + handleDeviceTm(util::DataWrapper(paramReply), id, true); break; } case (GOMSPACE::PARAM_SET): { diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 4d4d4ed2..574efd81 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -24,11 +24,6 @@ ReturnValue_t P60DockHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { parseHkTableReply(packet); - /** - * Hk table will be sent to the commander if hk table request was not triggered by the - * P60DockHandler itself. - */ - handleDeviceTM(&coreHk, id, true); } void P60DockHandler::parseHkTableReply(const uint8_t *packet) { @@ -273,5 +268,5 @@ void P60DockHandler::printHkTableLatchups() { void P60DockHandler::setDebugMode(bool enable) { this->debugMode = enable; } void P60DockHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - handleDeviceTM(packet, P60Dock::CONFIG_TABLE_SIZE, id); + handleDeviceTm(util::DataWrapper(packet, P60Dock::CONFIG_TABLE_SIZE), id); } diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index deb747db..e7a077ba 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -22,7 +22,6 @@ ReturnValue_t PDU1Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) { void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { parseHkTableReply(packet); - handleDeviceTM(&coreHk, id, true); } void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) { @@ -81,7 +80,9 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker, } void PDU1Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - handleDeviceTM(packet, PDU::CONFIG_TABLE_SIZE, id); + util::DataWrapper wrapper; + wrapper.setRawData({packet, PDU::CONFIG_TABLE_SIZE}); + handleDeviceTm(wrapper, id); } void PDU1Handler::parseHkTableReply(const uint8_t *packet) { diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 65de91a7..9fb0fffe 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -22,15 +22,12 @@ ReturnValue_t PDU2Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) { void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { parseHkTableReply(packet); - /** - * Hk table will be sent to the commander if hk table request was not triggered by the - * PDU2Handler itself. - */ - handleDeviceTM(&coreHk, id, true); } void PDU2Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - handleDeviceTM(packet, PDU::CONFIG_TABLE_SIZE, id); + util::DataWrapper wrapper; + wrapper.setRawData({packet, PDU::CONFIG_TABLE_SIZE}); + handleDeviceTm(wrapper, id); } void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) { From 4649ae2edb63cfeb07120a6b7e1717a4b2f9735b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Aug 2022 16:06:17 +0200 Subject: [PATCH 03/22] minor tweaks --- fsfw | 2 +- mission/devices/ACUHandler.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fsfw b/fsfw index 21ac8661..141dcb1f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 21ac86619e2b1fecf71bd2aa0f09ecbd471c8531 +Subproject commit 141dcb1f149b824b5bd6e5d3339ecb712835751e diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index e86c0801..727b4ae5 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -43,8 +43,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack } void ACUHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - util::DataWrapper wrapper(packet, ACU::CONFIG_TABLE_SIZE); - handleDeviceTm(wrapper, id); + handleDeviceTm(util::DataWrapper(packet, ACU::CONFIG_TABLE_SIZE), id); } LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) { From 822e8eea4aa04197f43773d8e77d4d8cf87f1e80 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Aug 2022 23:54:05 +0200 Subject: [PATCH 04/22] this is better --- fsfw | 2 +- linux/devices/startracker/StarTrackerHandler.cpp | 2 +- mission/devices/ACUHandler.cpp | 2 +- mission/devices/GomspaceDeviceHandler.cpp | 6 ++---- mission/devices/P60DockHandler.cpp | 2 +- mission/devices/PDU1Handler.cpp | 4 +--- mission/devices/PDU2Handler.cpp | 4 +--- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/fsfw b/fsfw index 141dcb1f..726f44ca 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 141dcb1f149b824b5bd6e5d3339ecb712835751e +Subproject commit 726f44cafeb8cde21b75df8f061619d51b9d9cfd diff --git a/linux/devices/startracker/StarTrackerHandler.cpp b/linux/devices/startracker/StarTrackerHandler.cpp index 47312934..a4cd432c 100644 --- a/linux/devices/startracker/StarTrackerHandler.cpp +++ b/linux/devices/startracker/StarTrackerHandler.cpp @@ -1830,7 +1830,7 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() { } PoolReadGuard rg(&checksumSet); checksumSet.checksum = checksumReply.getChecksum(); - handleDeviceTm(util::DataWrapper(checksumSet), startracker::CHECKSUM); + handleDeviceTm(checksumSet, startracker::CHECKSUM); #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 checksumReply.printChecksum(); #endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */ diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index 727b4ae5..2a8ffe8b 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -43,7 +43,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack } void ACUHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - handleDeviceTm(util::DataWrapper(packet, ACU::CONFIG_TABLE_SIZE), id); + handleDeviceTm(packet, ACU::CONFIG_TABLE_SIZE, id); } LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) { diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 9278ed77..5acd209e 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -177,9 +177,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, switch (id) { case (GOMSPACE::PING): { SerializeElement replyTime = *packet; - util::DataWrapper wrapper; - wrapper.setSerializable(replyTime); - handleDeviceTm(wrapper, id, true); + handleDeviceTm(replyTime, true); break; } case (GOMSPACE::PARAM_GET): { @@ -206,7 +204,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, uint16_t address = cspGetParamReply.getAddress(); /* Pack relevant information into a tm packet */ ParamReply paramReply(action, tableId, address, payloadLength, tempPayloadBuffer); - handleDeviceTm(util::DataWrapper(paramReply), id, true); + handleDeviceTm(paramReply, id, true); break; } case (GOMSPACE::PARAM_SET): { diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 574efd81..8c768847 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -268,5 +268,5 @@ void P60DockHandler::printHkTableLatchups() { void P60DockHandler::setDebugMode(bool enable) { this->debugMode = enable; } void P60DockHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - handleDeviceTm(util::DataWrapper(packet, P60Dock::CONFIG_TABLE_SIZE), id); + handleDeviceTm(packet, P60Dock::CONFIG_TABLE_SIZE, id); } diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index e7a077ba..9a44da5e 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -80,9 +80,7 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker, } void PDU1Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - util::DataWrapper wrapper; - wrapper.setRawData({packet, PDU::CONFIG_TABLE_SIZE}); - handleDeviceTm(wrapper, id); + handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id); } void PDU1Handler::parseHkTableReply(const uint8_t *packet) { diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 9fb0fffe..4db6999f 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -25,9 +25,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac } void PDU2Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { - util::DataWrapper wrapper; - wrapper.setRawData({packet, PDU::CONFIG_TABLE_SIZE}); - handleDeviceTm(wrapper, id); + handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id); } void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) { From 20df16916ad3c43bd51152484624841a34af68ff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Aug 2022 00:03:00 +0200 Subject: [PATCH 05/22] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 726f44ca..2fa76d36 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 726f44cafeb8cde21b75df8f061619d51b9d9cfd +Subproject commit 2fa76d366325372e92a2188f71f143a485e652fc From 7dde1150e8bf355c82ae858eac6cba86d9f7f3a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Aug 2022 22:52:32 +0200 Subject: [PATCH 06/22] gom space commands --- fsfw | 2 +- linux/csp/CspComIF.cpp | 10 +++++ mission/core/GenericFactory.cpp | 2 +- mission/csp/CspCookie.h | 2 +- mission/devices/GomspaceDeviceHandler.cpp | 41 +++++++++++++++++++ .../devicedefinitions/GomspaceDefinitions.h | 15 +++++-- tmtc | 2 +- 7 files changed, 67 insertions(+), 7 deletions(-) diff --git a/fsfw b/fsfw index 2fa76d36..496dac89 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 2fa76d366325372e92a2188f71f143a485e652fc +Subproject commit 496dac89e4c094e03578f40d8651485f7f378cb2 diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index eb6487ed..b52bcfa2 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -166,6 +166,16 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s if (result != 0) { return returnvalue::FAILED; } + } else if(req == GOMSPACE::SpecialRequestTypes::SAVE_TABLE) { + if(sendLen < 2) { + return returnvalue::FAILED; + } + const TableInfo* tableInfo = reinterpret_cast(sendData); + int result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, + tableInfo->targetTable); + if (result != 0) { + return returnvalue::FAILED; + } } } else { /* No CSP fixed port was selected. Send data to the specified port and diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 0a9be3f9..bbd2bb98 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -96,7 +96,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15, 45); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW, - pus::PUS_SERVICE_8, 3, 60); + pus::PUS_SERVICE_8, 16, 60); new Service9TimeManagement( PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9)); diff --git a/mission/csp/CspCookie.h b/mission/csp/CspCookie.h index 441eb413..9eb0a639 100644 --- a/mission/csp/CspCookie.h +++ b/mission/csp/CspCookie.h @@ -28,7 +28,7 @@ class CspCookie : public CookieIF { uint32_t getTimeout() const; private: - uint8_t cspPort; + uint8_t cspPort = 0; uint16_t maxReplyLength; uint8_t cspAddress; size_t replyLen = 0; diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 5acd209e..aa4459b4 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -115,6 +115,45 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } break; } + case (GOMSPACE::SAVE_TABLE_FILE): { + if(commandDataLen > 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto* info = reinterpret_cast(cspPacket); + if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and commandData[0] != 4) { + return HasActionsIF::INVALID_PARAMETERS; + } + info->sourceTable = commandData[0]; + if (info->sourceTable != 4) { + if(commandDataLen == 2) { + info->targetTable = commandData[1]; + } else { + info->targetTable = info->sourceTable; + } + } else { + // Will be ignored, still set the value which is always used + info->targetTable = 4; + } + rawPacket = cspPacket; + rawPacketLen = sizeof(GOMSPACE::TableInfo); + rememberCommandId = deviceCommand; + break; + } + case (GOMSPACE::SAVE_TABLE_DEFAULT): { + if(commandDataLen != 1) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto* info = reinterpret_cast(cspPacket); + if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + info->sourceTable = commandData[0]; + info->targetTable = info->sourceTable + 4; + rawPacket = cspPacket; + rawPacketLen = sizeof(GOMSPACE::TableInfo); + rememberCommandId = deviceCommand; + break; + } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } @@ -131,6 +170,8 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap() { this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I); this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS); + insertInCommandMap(GOMSPACE::SAVE_TABLE_FILE); + insertInCommandMap(GOMSPACE::SAVE_TABLE_DEFAULT); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 5447bf42..52a66e84 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -18,6 +18,11 @@ namespace GOMSPACE { +struct TableInfo { + uint8_t sourceTable; + uint8_t targetTable; +}; + enum SpecialRequestTypes { DEFAULT_COM_IF, GET_PDU_HK, @@ -25,7 +30,8 @@ enum SpecialRequestTypes { GET_ACU_HK, GET_ACU_CONFIG, GET_P60DOCK_HK, - GET_P60DOCK_CONFIG + GET_P60DOCK_CONFIG, + SAVE_TABLE }; enum CspPorts : uint8_t { @@ -53,14 +59,17 @@ static const uint8_t P60_PORT_GNDWDT_RESET = 9; * Device commands are derived from the rparam.h of the gomspace lib.. * IDs above 50 are reserved for device specific commands. */ +static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t NONE = 2; // Set when no command is pending static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t SAVE_TABLE_FILE = 18; +static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19; +static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] + // Not implemented yet // static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND] //! [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console diff --git a/tmtc b/tmtc index 05dd1738..cc31a756 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 05dd17386070b9f333977f1f2b9f5651f9053b65 +Subproject commit cc31a756856623ecc2eec80e155557ac208f10a2 From 3d71cce30b2f317c5449e359928a00f6fba298ae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 11:04:24 +0200 Subject: [PATCH 07/22] bugfix --- fsfw | 2 +- mission/devices/GomspaceDeviceHandler.cpp | 10 ++++++---- mission/devices/GomspaceDeviceHandler.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fsfw b/fsfw index 496dac89..cf8fe7ea 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 496dac89e4c094e03578f40d8651485f7f378cb2 +Subproject commit cf8fe7ea728bea077b9936bcf0db96845bc6419e diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index aa4459b4..ec0001ac 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -44,6 +44,8 @@ ReturnValue_t GomspaceDeviceHandler::buildTransitionDeviceCommand(DeviceCommandI ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData, size_t commandDataLen) { + auto* cspCookie = dynamic_cast(comCookie); + cspCookie->setRequest(SpecialRequestTypes::DEFAULT_COM_IF, 0); ReturnValue_t result = childCommandHook(deviceCommand, commandData, commandDataLen); switch (deviceCommand) { case (GOMSPACE::PING): { @@ -93,7 +95,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d reqType = SpecialRequestTypes::GET_P60DOCK_HK; } result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize, - deviceCommand); + deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } @@ -109,7 +111,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d reqType = SpecialRequestTypes::GET_P60DOCK_CONFIG; } result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG, - tableCfg.cfgTableSize, deviceCommand); + tableCfg.cfgTableSize, deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } @@ -506,13 +508,13 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType, uint8_t tableId, uint16_t tableReplySize, - DeviceCommandId_t id) { + DeviceCommandId_t id, + CspCookie* cspCookie) { uint16_t querySize = tableReplySize; if (reqType == SpecialRequestTypes::DEFAULT_COM_IF) { sif::warning << "Default communication for table requests not implemented anymore" << std::endl; return returnvalue::FAILED; } - auto* cspCookie = dynamic_cast(comCookie); cspCookie->setRequest(reqType, tableReplySize); cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); rememberRequestedSize = querySize; diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index af847b8a..da4fc136 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -84,7 +84,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { */ virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType, uint8_t tableId, uint16_t tableSize, - DeviceCommandId_t id); + DeviceCommandId_t id, CspCookie* cspCookie); /** * This command handles printing the HK table to the console. This is useful for debugging From 27129f3b66971aaac83dd844d9565e54a61e3986 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 11:18:55 +0200 Subject: [PATCH 08/22] increase number of allowed consecutive commands for service 8 --- mission/core/GenericFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 0a9be3f9..bbd2bb98 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -96,7 +96,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15, 45); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW, - pus::PUS_SERVICE_8, 3, 60); + pus::PUS_SERVICE_8, 16, 60); new Service9TimeManagement( PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9)); From 4e92fd442117ab2cb039c65937ac0f02c8a8e262 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 15:23:39 +0200 Subject: [PATCH 09/22] some simplifications --- mission/devices/GomspaceDeviceHandler.cpp | 95 ++++++++++++------- mission/devices/GomspaceDeviceHandler.h | 19 +++- .../devicedefinitions/GomspaceDefinitions.h | 4 +- tmtc | 2 +- 4 files changed, 80 insertions(+), 40 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index ec0001ac..5ae676e4 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -86,48 +86,41 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d break; } case (GOMSPACE::REQUEST_HK_TABLE): { - auto reqType = SpecialRequestTypes::DEFAULT_COM_IF; - if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) { - reqType = SpecialRequestTypes::GET_PDU_HK; - } else if (getObjectId() == objects::ACU_HANDLER) { - reqType = SpecialRequestTypes::GET_ACU_HK; - } else if (getObjectId() == objects::P60DOCK_HANDLER) { - reqType = SpecialRequestTypes::GET_P60DOCK_HK; + DeviceType devType; + if(getDevType(devType) != returnvalue::OK) { + return returnvalue::FAILED; } - result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize, - deviceCommand, cspCookie); + result = + generateRequestFullHkTableCmd(devType, tableCfg.hkTableSize, deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } break; } case (GOMSPACE::REQUEST_CONFIG_TABLE): { - auto reqType = SpecialRequestTypes::DEFAULT_COM_IF; - if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) { - reqType = SpecialRequestTypes::GET_PDU_CONFIG; - } else if (getObjectId() == objects::ACU_HANDLER) { - reqType = SpecialRequestTypes::GET_ACU_CONFIG; - } else if (getObjectId() == objects::P60DOCK_HANDLER) { - reqType = SpecialRequestTypes::GET_P60DOCK_CONFIG; + DeviceType devType; + if(getDevType(devType) != returnvalue::OK) { + return returnvalue::FAILED; } - result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG, - tableCfg.cfgTableSize, deviceCommand, cspCookie); + result = generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize, + deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } break; } case (GOMSPACE::SAVE_TABLE_FILE): { - if(commandDataLen > 2) { + if (commandDataLen > 2) { return HasActionsIF::INVALID_PARAMETERS; } auto* info = reinterpret_cast(cspPacket); - if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and commandData[0] != 4) { + if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and + commandData[0] != 4) { return HasActionsIF::INVALID_PARAMETERS; } info->sourceTable = commandData[0]; if (info->sourceTable != 4) { - if(commandDataLen == 2) { + if (commandDataLen == 2) { info->targetTable = commandData[1]; } else { info->targetTable = info->sourceTable; @@ -142,11 +135,11 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d break; } case (GOMSPACE::SAVE_TABLE_DEFAULT): { - if(commandDataLen != 1) { + if (commandDataLen != 1) { return HasActionsIF::INVALID_PARAMETERS; } auto* info = reinterpret_cast(cspPacket); - if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) { + if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) { return HasActionsIF::INVALID_PARAMETERS; } info->sourceTable = commandData[0]; @@ -486,6 +479,19 @@ bool GomspaceDeviceHandler::validTableId(uint8_t id) { return false; } +ReturnValue_t GomspaceDeviceHandler::getDevType(GOMSPACE::DeviceType& type) const { + if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) { + type = DeviceType::PDU; + } else if (getObjectId() == objects::ACU_HANDLER) { + type = DeviceType::ACU; + } else if (getObjectId() == objects::P60DOCK_HANDLER) { + type = DeviceType::P60DOCK; + } else { + return returnvalue::FAILED; + } + return returnvalue::OK; +} + ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { WatchdogResetCommand watchdogResetCommand; size_t cspPacketLen = 0; @@ -505,19 +511,40 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { return returnvalue::OK; } -ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType, - uint8_t tableId, - uint16_t tableReplySize, - DeviceCommandId_t id, - CspCookie* cspCookie) { - uint16_t querySize = tableReplySize; - if (reqType == SpecialRequestTypes::DEFAULT_COM_IF) { - sif::warning << "Default communication for table requests not implemented anymore" << std::endl; - return returnvalue::FAILED; +ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(DeviceType dev, + uint16_t tableReplySize, + DeviceCommandId_t id, + CspCookie* cspCookie) { + if (dev == DeviceType::ACU) { + cspCookie->setRequest(SpecialRequestTypes::GET_ACU_HK, tableReplySize); + } else if (dev == DeviceType::P60DOCK) { + cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_HK, tableReplySize); + } else if (dev == DeviceType::PDU) { + cspCookie->setRequest(SpecialRequestTypes::GET_PDU_HK, tableReplySize); } - cspCookie->setRequest(reqType, tableReplySize); cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); - rememberRequestedSize = querySize; + rememberRequestedSize = tableReplySize; + rememberCommandId = id; + return returnvalue::OK; +} + +ReturnValue_t GomspaceDeviceHandler::generateRequestFullCfgTableCmd(DeviceType dev, + uint16_t tableReplySize, + DeviceCommandId_t id, + CspCookie* cspCookie) { + if (dev == DeviceType::ACU) { + cspCookie->setRequest(SpecialRequestTypes::GET_ACU_CONFIG, tableReplySize); + } else if (dev == DeviceType::P60DOCK) { + cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_CONFIG, tableReplySize); + } else if (dev == DeviceType::PDU) { + cspCookie->setRequest(SpecialRequestTypes::GET_PDU_CONFIG, tableReplySize); + } + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + // Unfortunately, this does not work.. + // cspPacket[0] = defaultTable; + // rawPacket = cspPacket; + // rawPacketLen = 1; + rememberRequestedSize = tableReplySize; rememberCommandId = id; return returnvalue::OK; } diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index da4fc136..528cd2dd 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -82,10 +82,21 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { * @brief The command to generate a request to receive the full housekeeping table is device * specific. Thus the child has to build this command. */ - virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType, - uint8_t tableId, uint16_t tableSize, - DeviceCommandId_t id, CspCookie* cspCookie); - + ReturnValue_t generateRequestFullHkTableCmd(GOMSPACE::DeviceType devType, uint16_t tableSize, + DeviceCommandId_t id, CspCookie *cspCookie); + /** + * Unfortunately, it was not possible to specify the table ID (e.g. request table from + * default store) + * @param devType + * @param tableSize + * @param id + * @param cspCookie + * @return + */ + ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType, + uint16_t tableSize, DeviceCommandId_t id, + CspCookie *cspCookie); + ReturnValue_t getDevType(GOMSPACE::DeviceType& type) const; /** * This command handles printing the HK table to the console. This is useful for debugging * purposes diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 52a66e84..4a356aa9 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -23,6 +23,8 @@ struct TableInfo { uint8_t targetTable; }; +enum DeviceType { PDU, ACU, P60DOCK }; + enum SpecialRequestTypes { DEFAULT_COM_IF, GET_PDU_HK, @@ -68,7 +70,7 @@ static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMM static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t SAVE_TABLE_FILE = 18; static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19; -static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] // Not implemented yet // static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND] diff --git a/tmtc b/tmtc index cc31a756..abecbe44 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit cc31a756856623ecc2eec80e155557ac208f10a2 +Subproject commit abecbe44016313f1b51a29d1358fccb9f541d542 From 87f430fdee6e95ad9d2ed8e8eb9a14bcc710f629 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 16:58:51 +0200 Subject: [PATCH 10/22] some bugfixes for save table feature --- mission/devices/GomspaceDeviceHandler.cpp | 4 ++++ tmtc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 5ae676e4..197195e6 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -131,6 +131,8 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } rawPacket = cspPacket; rawPacketLen = sizeof(GOMSPACE::TableInfo); + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0); rememberCommandId = deviceCommand; break; } @@ -146,6 +148,8 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d info->targetTable = info->sourceTable + 4; rawPacket = cspPacket; rawPacketLen = sizeof(GOMSPACE::TableInfo); + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0); rememberCommandId = deviceCommand; break; } diff --git a/tmtc b/tmtc index abecbe44..e162e5c5 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit abecbe44016313f1b51a29d1358fccb9f541d542 +Subproject commit e162e5c51b0bf08b2018e4169a07eed1e4f7eacb From 6ae0249fdc2367577e00afecb4e660f2e0474987 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 17:31:43 +0200 Subject: [PATCH 11/22] load table command --- linux/csp/CspComIF.cpp | 10 ++++++++++ mission/csp/CspCookie.cpp | 3 ++- mission/devices/GomspaceDeviceHandler.cpp | 15 +++++++++++++++ .../devicedefinitions/GomspaceDefinitions.h | 6 ++++-- tmtc | 2 +- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index b52bcfa2..5d8c3fd6 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -176,6 +176,16 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s if (result != 0) { return returnvalue::FAILED; } + } else if(req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) { + if(sendLen < 2) { + return returnvalue::FAILED; + } + const TableInfo* tableInfo = reinterpret_cast(sendData); + int result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, + tableInfo->targetTable); + if (result != 0) { + return returnvalue::FAILED; + } } } else { /* No CSP fixed port was selected. Send data to the specified port and diff --git a/mission/csp/CspCookie.cpp b/mission/csp/CspCookie.cpp index f6ab1eed..228a8058 100644 --- a/mission/csp/CspCookie.cpp +++ b/mission/csp/CspCookie.cpp @@ -1,10 +1,11 @@ #include "CspCookie.h" +using namespace GOMSPACE; CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs) : maxReplyLength(maxReplyLength_), cspAddress(cspAddress_), timeoutMs(timeoutMs), - reqType(GOMSPACE::DEFAULT_COM_IF) {} + reqType(SpecialRequestTypes::DEFAULT_COM_IF) {} CspCookie::~CspCookie() {} diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 197195e6..ebfcf2a9 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -109,6 +109,20 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } break; } + case (GOMSPACE::LOAD_TABLE): { + if (commandDataLen != 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto* info = reinterpret_cast(cspPacket); + info->sourceTable = commandData[0]; + info->targetTable = commandData[1]; + rawPacket = cspPacket; + rawPacketLen = sizeof(GOMSPACE::TableInfo); + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + cspCookie->setRequest(SpecialRequestTypes::LOAD_TABLE, 0); + rememberCommandId = deviceCommand; + break; + } case (GOMSPACE::SAVE_TABLE_FILE): { if (commandDataLen > 2) { return HasActionsIF::INVALID_PARAMETERS; @@ -171,6 +185,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap() { this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS); insertInCommandMap(GOMSPACE::SAVE_TABLE_FILE); insertInCommandMap(GOMSPACE::SAVE_TABLE_DEFAULT); + insertInCommandMap(GOMSPACE::LOAD_TABLE); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 4a356aa9..cab71362 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -25,7 +25,7 @@ struct TableInfo { enum DeviceType { PDU, ACU, P60DOCK }; -enum SpecialRequestTypes { +enum class SpecialRequestTypes { DEFAULT_COM_IF, GET_PDU_HK, GET_PDU_CONFIG, @@ -33,7 +33,8 @@ enum SpecialRequestTypes { GET_ACU_CONFIG, GET_P60DOCK_HK, GET_P60DOCK_CONFIG, - SAVE_TABLE + SAVE_TABLE, + LOAD_TABLE }; enum CspPorts : uint8_t { @@ -70,6 +71,7 @@ static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMM static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t SAVE_TABLE_FILE = 18; static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19; +static const DeviceCommandId_t LOAD_TABLE = 20; static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] // Not implemented yet diff --git a/tmtc b/tmtc index e162e5c5..6085c654 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit e162e5c51b0bf08b2018e4169a07eed1e4f7eacb +Subproject commit 6085c6543c0beb24cc427fae16d1fa2897a2fe5a From 923adbdb1a98ea46fbdd6cb643d61f42dffe1b23 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 17:40:21 +0200 Subject: [PATCH 12/22] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 6085c654..f366b1c3 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 6085c6543c0beb24cc427fae16d1fa2897a2fe5a +Subproject commit f366b1c3f61f9d19bc0a5829caecdd2ae4285601 From a76816f05536ceb66007ac09eabc6ce787942bf9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 2 Sep 2022 13:16:56 +0200 Subject: [PATCH 13/22] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce393fea..30890da2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ list yields a list of all related PRs for each release. GomSpace TM tables - Add API to retrieve GomSpace device parameter tables PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/287 +- Add API to save and load GomSpace config tables + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/293 +- Increase number of allowed consescutive action commands from 3 to 16 + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/294 # [v1.13.0] 24.08.2022 From e381b00a131d1adb2307371138c43a59b3f6d77b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 2 Sep 2022 13:19:55 +0200 Subject: [PATCH 14/22] re-point tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index f366b1c3..603b7e85 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f366b1c3f61f9d19bc0a5829caecdd2ae4285601 +Subproject commit 603b7e8574d74ba60692115133cde3cd8b8bd423 From f7196a47916799154525abc8374db7c6fb9972be Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Wed, 14 Sep 2022 12:47:15 +0200 Subject: [PATCH 15/22] updated to new fsfw --- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 4 ++++ linux/obc/PtmeConfig.h | 1 + mission/memory/NVMParameterBase.h | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fsfw b/fsfw index cf8fe7ea..bd594123 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit cf8fe7ea728bea077b9936bcf0db96845bc6419e +Subproject commit bd594123a2a1579f505071f9c76d1249433c070e diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 072c47c8..25772ce7 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -4,6 +4,10 @@ #include #include +// It is assumed the user has a subsystem and class ID list in some user header files. +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + //! Used to determine whether C++ ostreams are used which can increase //! the binary size significantly. If this is disabled, //! the C stdio functions can be used alternatively diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index 06aff2e2..aa5c663a 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -4,6 +4,7 @@ #include "AxiPtmeConfig.h" #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/returnvalues/returnvalue.h" +#include "returnvalues/classIds.h" #include "linux/obc/PtmeConfig.h" /** diff --git a/mission/memory/NVMParameterBase.h b/mission/memory/NVMParameterBase.h index 4f644fcc..dd02fffe 100644 --- a/mission/memory/NVMParameterBase.h +++ b/mission/memory/NVMParameterBase.h @@ -6,6 +6,7 @@ #include #include "fsfw/returnvalues/returnvalue.h" +#include "returnvalues/classIds.h" class NVMParameterBase { public: From ff3bc7da73fbff1e8063428d117344c10cabe0ec Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Wed, 14 Sep 2022 13:18:50 +0200 Subject: [PATCH 16/22] fix for new fsfw --- mission/devices/devicedefinitions/RwDefinitions.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mission/devices/devicedefinitions/RwDefinitions.h b/mission/devices/devicedefinitions/RwDefinitions.h index d6a43622..2923b41b 100644 --- a/mission/devices/devicedefinitions/RwDefinitions.h +++ b/mission/devices/devicedefinitions/RwDefinitions.h @@ -5,6 +5,7 @@ #include #include +#include "events/subsystemIdRanges.h" #include "objects/systemObjectList.h" namespace RwDefinitions { From 4d93368b4c744278f8229f2abc0504ff9b089c9f Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Wed, 14 Sep 2022 13:44:43 +0200 Subject: [PATCH 17/22] fixed for new fsfw --- mission/devices/HeaterHandler.h | 2 ++ mission/devices/IMTQHandler.h | 3 +++ mission/devices/RwHandler.h | 3 +++ mission/devices/SolarArrayDeploymentHandler.h | 3 +++ mission/devices/SusHandler.h | 3 +++ mission/devices/SyrlinksHkHandler.h | 1 + mission/system/SusAssembly.h | 2 ++ mission/system/TcsBoardAssembly.h | 3 +++ 8 files changed, 20 insertions(+) diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index 75badf91..b63f4dfe 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -18,6 +18,8 @@ #include #include "devices/heaterSwitcherList.h" +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" class PowerSwitchIF; class HealthTableIF; diff --git a/mission/devices/IMTQHandler.h b/mission/devices/IMTQHandler.h index 481d554c..5102b2e0 100644 --- a/mission/devices/IMTQHandler.h +++ b/mission/devices/IMTQHandler.h @@ -5,6 +5,9 @@ #include #include +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + /** * @brief This is the device handler for the ISIS Magnetorquer iMTQ. * diff --git a/mission/devices/RwHandler.h b/mission/devices/RwHandler.h index 008d5746..f9f66bd5 100644 --- a/mission/devices/RwHandler.h +++ b/mission/devices/RwHandler.h @@ -6,6 +6,9 @@ #include #include +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + class GpioIF; /** diff --git a/mission/devices/SolarArrayDeploymentHandler.h b/mission/devices/SolarArrayDeploymentHandler.h index 691bdf77..89be12a6 100644 --- a/mission/devices/SolarArrayDeploymentHandler.h +++ b/mission/devices/SolarArrayDeploymentHandler.h @@ -14,6 +14,9 @@ #include +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + /** * @brief This class is used to control the solar array deployment. * diff --git a/mission/devices/SusHandler.h b/mission/devices/SusHandler.h index c1fc08c4..94673c40 100644 --- a/mission/devices/SusHandler.h +++ b/mission/devices/SusHandler.h @@ -7,6 +7,9 @@ #include "fsfw/globalfunctions/PeriodicOperationDivider.h" #include "mission/devices/max1227.h" +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + /** * @brief This is the device handler class for the SUS sensor based on the MAX1227 ADC. * diff --git a/mission/devices/SyrlinksHkHandler.h b/mission/devices/SyrlinksHkHandler.h index 44b154f6..a3bf0a67 100644 --- a/mission/devices/SyrlinksHkHandler.h +++ b/mission/devices/SyrlinksHkHandler.h @@ -8,6 +8,7 @@ #include "fsfw/timemanager/Countdown.h" #include "fsfw_hal/linux/gpio/Gpio.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" +#include "returnvalues/classIds.h" /** * @brief This is the device handler for the syrlinks transceiver. It handles the command diff --git a/mission/system/SusAssembly.h b/mission/system/SusAssembly.h index b9216072..3cce9d86 100644 --- a/mission/system/SusAssembly.h +++ b/mission/system/SusAssembly.h @@ -5,6 +5,8 @@ #include #include "DualLaneAssemblyBase.h" +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" struct SusAssHelper { public: diff --git a/mission/system/TcsBoardAssembly.h b/mission/system/TcsBoardAssembly.h index 10b451b2..6042abaa 100644 --- a/mission/system/TcsBoardAssembly.h +++ b/mission/system/TcsBoardAssembly.h @@ -5,6 +5,9 @@ #include #include +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + struct TcsBoardHelper { TcsBoardHelper(std::array, 16> rtdInfos) : rtdInfos(std::move(rtdInfos)) {} From 63e4448178d48b4047771991757834f2af24eeae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Sep 2022 16:47:58 +0200 Subject: [PATCH 18/22] run afmt, bump proj files --- linux/csp/CspComIF.cpp | 12 ++++++------ misc/eclipse/.cproject | 24 +++++++++++------------ mission/devices/GomspaceDeviceHandler.cpp | 8 ++++---- mission/devices/GomspaceDeviceHandler.h | 7 +++---- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index 5d8c3fd6..ea508a31 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -166,23 +166,23 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s if (result != 0) { return returnvalue::FAILED; } - } else if(req == GOMSPACE::SpecialRequestTypes::SAVE_TABLE) { - if(sendLen < 2) { + } else if (req == GOMSPACE::SpecialRequestTypes::SAVE_TABLE) { + if (sendLen < 2) { return returnvalue::FAILED; } const TableInfo* tableInfo = reinterpret_cast(sendData); int result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, - tableInfo->targetTable); + tableInfo->targetTable); if (result != 0) { return returnvalue::FAILED; } - } else if(req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) { - if(sendLen < 2) { + } else if (req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) { + if (sendLen < 2) { return returnvalue::FAILED; } const TableInfo* tableInfo = reinterpret_cast(sendData); int result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, - tableInfo->targetTable); + tableInfo->targetTable); if (result != 0) { return returnvalue::FAILED; } diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index d30ef1ec..19c18545 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -57,7 +57,7 @@ - + @@ -119,7 +119,7 @@ - + @@ -187,7 +187,7 @@ - + @@ -255,7 +255,7 @@ - + @@ -418,7 +418,7 @@ - + @@ -580,7 +580,7 @@ - + @@ -750,7 +750,7 @@ - + @@ -917,7 +917,7 @@ - + @@ -1084,7 +1084,7 @@ - + @@ -1149,7 +1149,7 @@ - + @@ -1317,7 +1317,7 @@ - + @@ -1386,7 +1386,7 @@ - + diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index ebfcf2a9..412f2e46 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -87,7 +87,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } case (GOMSPACE::REQUEST_HK_TABLE): { DeviceType devType; - if(getDevType(devType) != returnvalue::OK) { + if (getDevType(devType) != returnvalue::OK) { return returnvalue::FAILED; } result = @@ -99,11 +99,11 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } case (GOMSPACE::REQUEST_CONFIG_TABLE): { DeviceType devType; - if(getDevType(devType) != returnvalue::OK) { + if (getDevType(devType) != returnvalue::OK) { return returnvalue::FAILED; } - result = generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize, - deviceCommand, cspCookie); + result = + generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize, deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index 528cd2dd..af9d3411 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -93,10 +93,9 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { * @param cspCookie * @return */ - ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType, - uint16_t tableSize, DeviceCommandId_t id, - CspCookie *cspCookie); - ReturnValue_t getDevType(GOMSPACE::DeviceType& type) const; + ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType, uint16_t tableSize, + DeviceCommandId_t id, CspCookie *cspCookie); + ReturnValue_t getDevType(GOMSPACE::DeviceType &type) const; /** * This command handles printing the HK table to the console. This is useful for debugging * purposes From 94a70aa2fc9e114d5a98c11511fa173b10e57d80 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 11:36:04 +0200 Subject: [PATCH 19/22] update .cproject file --- misc/eclipse/.cproject | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 19c18545..9bb5f401 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -1256,7 +1256,7 @@ - + @@ -1268,7 +1268,7 @@ - +