From f4249e82e3672dddc5472b38db8264635ea163fb Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Mon, 8 Feb 2021 11:48:58 +0100 Subject: [PATCH] issue with PDU Handler --- bsp_q7s/ObjectFactory.cpp | 2 +- fsfw | 2 +- mission/devices/GomspaceDeviceHandler.cpp | 2 +- mission/devices/PCDUHandler.cpp | 50 +++++++++++-------- mission/devices/PDU1Handler.cpp | 2 +- .../devicedefinitions/GomSpacePackets.h | 8 +-- .../devicedefinitions/GomspaceDefinitions.h | 4 +- tmtc | 2 +- 8 files changed, 39 insertions(+), 33 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 9bf3e82e..5ddb1b36 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -85,7 +85,7 @@ void ObjectFactory::produce(){ new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); - new PCDUHandler(objects::PCDU_HANDLER); + new PCDUHandler(objects::PCDU_HANDLER, 50); /* Temperature sensors */ Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, diff --git a/fsfw b/fsfw index 2f374aef..7d0916a4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 2f374aef347a1b0e7a04305eadc768ea63e35077 +Subproject commit 7d0916a44e18c87b00998448333023186b3d85b1 diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index f02548c2..e223aaca 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -4,7 +4,7 @@ GomspaceDeviceHandler::GomspaceDeviceHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie, uint16_t maxConfigTableAddress, uint16_t maxHkTableAddress, uint16_t hkTableReplySize, LocalPoolDataSetBase* hkTableDataset) : - DeviceHandlerBase(objectId, comIF, comCookie), maxConfigTableAddress(maxConfigTableAddress), + DeviceHandlerBase(objectId, comIF, comCookie, nullptr, 60), maxConfigTableAddress(maxConfigTableAddress), maxHkTableAddress(maxHkTableAddress), hkTableReplySize(hkTableReplySize), hkTableDataset(hkTableDataset) { mode = MODE_NORMAL; if (comCookie == NULL) { diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index f6edc817..6b1261c9 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -55,18 +55,18 @@ ReturnValue_t PCDUHandler::initialize() { } /* Subscribing for housekeeping table update messages of the PDU1 */ - HasLocalDataPoolIF* pdu1Handler = objectManager->get(objects::PDU1_HANDLER); - if(pdu1Handler == nullptr) { - sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl; - return RETURN_FAILED; - } - result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessages( - PDU1::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); - if (result != RETURN_OK) { - sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " - << "PDU1Handler" << std::endl; - return result; - } +// HasLocalDataPoolIF* pdu1Handler = objectManager->get(objects::PDU1_HANDLER); +// if(pdu1Handler == nullptr) { +// sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl; +// return RETURN_FAILED; +// } +// result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessages( +// PDU1::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); +// if (result != RETURN_OK) { +// sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " +// << "PDU1Handler" << std::endl; +// return result; +// } return RETURN_OK; } @@ -116,7 +116,7 @@ void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId) { updateHkTableDataset(storeId, &pdu2HkTableDataset, &timeStampPdu2HkDataset); updatePdu2SwitchStates(); } - if (sid == sid_t(objects::PDU1_HANDLER, PDU1::HK_TABLE_DATA_SET_ID)) { + else if (sid == sid_t(objects::PDU1_HANDLER, PDU1::HK_TABLE_DATA_SET_ID)) { updateHkTableDataset(storeId, &pdu1HkTableDataset, &timeStampPdu1HkDataset); updatePdu1SwitchStates(); } @@ -130,7 +130,7 @@ void PCDUHandler::updateHkTableDataset(store_address_t storeId, ReturnValue_t result; HousekeepingSnapshot packetUpdate(reinterpret_cast(datasetTimeStamp), - sizeof(*datasetTimeStamp), dataset); + sizeof(CCSDSTime::CDS_short), dataset); const uint8_t* packet_ptr = NULL; size_t size; result = IPCStore->getData(storeId, &packet_ptr, &size); @@ -173,14 +173,20 @@ void PCDUHandler::updatePdu2SwitchStates() { } void PCDUHandler::updatePdu1SwitchStates() { - switchStates[pcduSwitches::TCS_BOARD_3V3] = pdu1HkTableDataset.voltageOutTCSBoard3V3.value; - switchStates[pcduSwitches::SYRLINKS] = pdu1HkTableDataset.voltageOutSyrlinks.value; - switchStates[pcduSwitches::STAR_TRACKER] = pdu1HkTableDataset.voltageOutStarTracker.value; - switchStates[pcduSwitches::MGT] = pdu1HkTableDataset.voltageOutMGT.value; - switchStates[pcduSwitches::SUS_NOMINAL] = pdu1HkTableDataset.voltageOutSUSNominal.value; - switchStates[pcduSwitches::SOLAR_CELL_EXP] = pdu1HkTableDataset.voltageOutSolarCellExp.value; - switchStates[pcduSwitches::PLOC] = pdu1HkTableDataset.voltageOutPLOC.value; - switchStates[pcduSwitches::ACS_BORAD_SIDE_A] = pdu1HkTableDataset.voltageOutACSBoardSideA.value; + if (pdu1HkTableDataset.read() == RETURN_OK) { + switchStates[pcduSwitches::TCS_BOARD_3V3] = pdu1HkTableDataset.voltageOutTCSBoard3V3.value; + switchStates[pcduSwitches::SYRLINKS] = pdu1HkTableDataset.voltageOutSyrlinks.value; + switchStates[pcduSwitches::STAR_TRACKER] = pdu1HkTableDataset.voltageOutStarTracker.value; + switchStates[pcduSwitches::MGT] = pdu1HkTableDataset.voltageOutMGT.value; + switchStates[pcduSwitches::SUS_NOMINAL] = pdu1HkTableDataset.voltageOutSUSNominal.value; + switchStates[pcduSwitches::SOLAR_CELL_EXP] = pdu1HkTableDataset.voltageOutSolarCellExp.value; + switchStates[pcduSwitches::PLOC] = pdu1HkTableDataset.voltageOutPLOC.value; + switchStates[pcduSwitches::ACS_BORAD_SIDE_A] = pdu1HkTableDataset.voltageOutACSBoardSideA.value; + } + else { + sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl; + } + pdu1HkTableDataset.commit(); } LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index b7b0bf6a..d9aa0d8c 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -21,7 +21,7 @@ ReturnValue_t PDU1Handler::buildNormalDeviceCommand( void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { parseHkTableReply(packet); - handleDeviceTM(&pdu1HkTableDataset, id, true); +// handleDeviceTM(&pdu1HkTableDataset, id, true); #if OBSW_ENHANCED_PRINTOUT == 1 && PDU1_DEBUG == 1 pdu1HkTableDataset.read(); diff --git a/mission/devices/devicedefinitions/GomSpacePackets.h b/mission/devices/devicedefinitions/GomSpacePackets.h index 0570732f..cd2b1f28 100644 --- a/mission/devices/devicedefinitions/GomSpacePackets.h +++ b/mission/devices/devicedefinitions/GomSpacePackets.h @@ -328,8 +328,8 @@ public: * @param tableId_ The id of the requested table. * @param tableDataset_ The dataset holding the table data. */ - Pdu2FullTableReply(uint8_t action_, uint8_t tableId_, PDU2::PDU2HkTableDataset tableDataset_) : - action(action_), tableId(tableId_), tableDataset(tableDataset_) { + Pdu2FullTableReply(uint8_t action_, uint8_t tableId_, SerializeIF* tableDataset_) : + action(action_), tableId(tableId_), dataset(tableDataset_) { setLinks(); } @@ -338,11 +338,11 @@ private: void setLinks() { setStart(&action); action.setNext(&tableId); - tableId.setNext(&tableDataset); + tableId.setNext(&dataset); } SerializeElement action; SerializeElement tableId; - SerializeElement tableDataset; + LinkedElement dataset; }; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index c10c109b..970af25f 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -637,11 +637,11 @@ namespace PDU1 { public: PDU1HkTableDataset(HasLocalDataPoolIF* owner): - StaticLocalDataSet(owner, PDU1::HK_TABLE_DATA_SET_ID) { + StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { } PDU1HkTableDataset(object_id_t objectId): - StaticLocalDataSet(sid_t(objectId, PDU1::HK_TABLE_DATA_SET_ID)) { + StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { } /** Measured output currents */ diff --git a/tmtc b/tmtc index 39e8ff71..b4868b78 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 39e8ff713431ed1a6484f6980b518aecd0d8288b +Subproject commit b4868b78e1eca3680e3d21924da80418737d11e9