diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index ba3327fa..c7de02bb 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -99,6 +99,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); + this->insertInCommandMap(GOMSPACE::PRINT_OUT_ENB_STATUS); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 47fab6b6..8789695e 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -1,20 +1,22 @@ +#include "OBSWConfig.h" #include "PDU2Handler.h" + #include -#include +#include PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : - GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, - PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu2HkTableDataset), pdu2HkTableDataset( - this) { + GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, + PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu2HkTableDataset), + pdu2HkTableDataset(this) { } PDU2Handler::~PDU2Handler() { } ReturnValue_t PDU2Handler::buildNormalDeviceCommand( - DeviceCommandId_t * id) { - *id = GOMSPACE::REQUEST_HK_TABLE; - return buildCommandFromCommand(*id, NULL, 0); + DeviceCommandId_t * id) { + *id = GOMSPACE::REQUEST_HK_TABLE; + return buildCommandFromCommand(*id, NULL, 0); } void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { @@ -34,23 +36,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac sif::info << "PDU2 VBAT: " << vbat << std::endl; float temperatureC = pdu2HkTableDataset.temperature.value * 0.1; sif::info << "PDU2 Temperature: " << temperatureC << " °C" << std::endl; - sif::info << "PDU2 Q7S enable state: " << unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << std::endl; - sif::info << "PDU2 Payload PCDU channel 1 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << std::endl; - sif::info << "PDU2 reaction wheels enable state: " - << unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << std::endl; - sif::info << "PDU2 TCS Board 8V heater input enable state: " - << unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << std::endl; - sif::info << "PDU2 redundant SUS group enable state: " - << unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << std::endl; - sif::info << "PDU2 deployment mechanism enable state: " - << unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << std::endl; - sif::info << "PDU2 PCDU channel 6 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << std::endl; - sif::info << "PDU2 ACS board side B enable state: " - << unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << std::endl; - sif::info << "PDU2 payload camera enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; + printOutputSwitchStates(); sif::info << "PDU2 uptime: " << pdu2HkTableDataset.uptime << " seconds" << std::endl; sif::info << "PDU2 battery mode: " << unsigned(pdu2HkTableDataset.battMode.value) << std::endl; sif::info << "PDU2 ground watchdog reboots: " << pdu2HkTableDataset.gndWdtReboots << std::endl; @@ -323,3 +309,42 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( return HasReturnvaluesIF::RETURN_OK; } + +ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { + switch(cmd) { + case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputSwitchStates(); + return HasReturnvaluesIF::RETURN_OK; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} + +void PDU2Handler::printOutputSwitchStates() { + sif::info << "PDU2 Q7S enable state: " << + unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << std::endl; + sif::info << "PDU2 Payload PCDU channel 1 enable state: " + << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << std::endl; + sif::info << "PDU2 reaction wheels enable state: " + << unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << std::endl; + sif::info << "PDU2 TCS Board 8V heater input enable state: " + << unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << std::endl; + sif::info << "PDU2 redundant SUS group enable state: " + << unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << std::endl; + sif::info << "PDU2 deployment mechanism enable state: " + << unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << std::endl; + sif::info << "PDU2 PCDU channel 6 enable state: " + << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << std::endl; + sif::info << "PDU2 ACS board side B enable state: " + << unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << std::endl; + sif::info << "PDU2 payload camera enable state: " + << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; +} diff --git a/mission/devices/PDU2Handler.h b/mission/devices/PDU2Handler.h index ee30a12f..0aa7f0b5 100644 --- a/mission/devices/PDU2Handler.h +++ b/mission/devices/PDU2Handler.h @@ -20,25 +20,27 @@ */ class PDU2Handler: public GomspaceDeviceHandler { public: - PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie); - virtual ~PDU2Handler(); + PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie); + virtual ~PDU2Handler(); - virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) override; + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; protected: - /** - * @brief As soon as the device is in MODE_NORMAL, this function is executed periodically. - */ - virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; - virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + /** + * @brief As soon as the device is in MODE_NORMAL, this function is executed periodically. + */ + virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; + virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + ReturnValue_t printStatus(DeviceCommandId_t cmd) override; private: - /** Dataset for the housekeeping table of the PDU2 */ - PDU2::PDU2HkTableDataset pdu2HkTableDataset; + /** Dataset for the housekeeping table of the PDU2 */ + PDU2::PDU2HkTableDataset pdu2HkTableDataset; - void parseHkTableReply(const uint8_t *packet); + void printOutputSwitchStates(); + void parseHkTableReply(const uint8_t *packet); }; #endif /* MISSION_DEVICES_PDU2HANDLER_H_ */ diff --git a/tmtc b/tmtc index b1e89d40..d84c6a7e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b1e89d40467b269774ac8c707c122a7524c90f39 +Subproject commit d84c6a7e70e68f28dcfb21ccfdaae6a0300eab40