From cbb7fdfa9969ff090ed2b2f079cabc8dfee4ae05 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 11:47:19 +0200 Subject: [PATCH] p60 print command --- mission/devices/GomspaceDeviceHandler.cpp | 4 +- mission/devices/P60DockHandler.cpp | 101 ++++++++++++++++-- mission/devices/P60DockHandler.h | 8 ++ mission/devices/PDU1Handler.cpp | 2 +- mission/devices/PDU2Handler.cpp | 2 +- .../devicedefinitions/GomspaceDefinitions.h | 5 +- tmtc | 2 +- 7 files changed, 109 insertions(+), 15 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 348bd35e..e5912969 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -75,7 +75,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { result = printStatus(deviceCommand); break; } @@ -99,7 +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_HK_TABLE); + this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 357bee30..928a9883 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -1,3 +1,4 @@ +#include #include "P60DockHandler.h" #include "OBSWConfig.h" @@ -27,15 +28,24 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t * #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_P60DOCK == 1 p60dockHkTableDataset.read(); - sif::info << "P60 Dock: ACU VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl; - sif::info << "P60 Dock: PDU1 VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl; - sif::info << "P60 Dock: PDU2 VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl; - sif::info << "P60 Dock: ACU VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl; - sif::info << "P60 Dock: PDU1 VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl; - sif::info << "P60 Dock: PDU2 VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl; - sif::info << "P60 Dock: Stack VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl; - sif::info << "P60 Dock: Stack 3V3 switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl; - sif::info << "P60 Dock: Stack 5V switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl; + sif::info << "P60 Dock: ACU VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl; + sif::info << "P60 Dock: PDU1 VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl; + sif::info << "P60 Dock: PDU2 VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl; + sif::info << "P60 Dock: ACU VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl; + sif::info << "P60 Dock: PDU1 VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl; + sif::info << "P60 Dock: PDU2 VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl; + sif::info << "P60 Dock: Stack VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl; + sif::info << "P60 Dock: Stack 3V3 switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl; + sif::info << "P60 Dock: Stack 5V switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl; float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1; sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl; @@ -395,3 +405,76 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool( return HasReturnvaluesIF::RETURN_OK; } + + +ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) { + switch(cmd) { + case(GOMSPACE::PRINT_SWITCH_V_I): { + PoolReadGuard pg(&p60dockHkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU1 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printHkTable(); + return HasReturnvaluesIF::RETURN_OK; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} + +void P60DockHandler::printHkTable() { + sif::info << "P60 Dock Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + + sif::info << std::setw(30) << std::left << "ACU VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentAcuVcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageAcuVcc.value << std::endl; + sif::info << std::setw(30) << std::left << "ACU VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentAcuVbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageAcuVbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "PDU1 VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu1Vcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu1Vcc.value << std::endl; + sif::info << std::setw(30) << std::left << "PDU1 VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu1Vbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu1Vbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "PDU2 VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu2Vcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu2Vcc.value << std::endl; + sif::info << std::setw(30) << std::left << "PDU2 VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu2Vbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu2Vbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "Stack VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStackVbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStackVbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStackVbat.value << std::endl; + sif::info << std::setw(30) << std::left << "Stack 3V3" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStack3V3.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStack3V3.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStack3V3.value << std::endl; + sif::info << std::setw(30) << std::left << "Stack 5V" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStack5V.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStack5V.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStack5V.value << std::endl; +} + diff --git a/mission/devices/P60DockHandler.h b/mission/devices/P60DockHandler.h index 6326e407..cee0ecec 100644 --- a/mission/devices/P60DockHandler.h +++ b/mission/devices/P60DockHandler.h @@ -26,6 +26,14 @@ protected: virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + /** + * This command handles printing the HK table to the console. This is useful for debugging + * purposes + * @return + */ + ReturnValue_t printStatus(DeviceCommandId_t cmd) override; + + void printHkTable(); private: P60Dock::HkTableDataset p60dockHkTableDataset; diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index 378a9589..a17b4abb 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -335,7 +335,7 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool( ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&pdu1HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 15166323..e0400b6f 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -312,7 +312,7 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&pdu2HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index e14745a4..bd509239 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -34,7 +34,7 @@ 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] //!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console -static const DeviceCommandId_t PRINT_HK_TABLE = 32; +static const DeviceCommandId_t PRINT_SWITCH_V_I = 32; } @@ -379,6 +379,9 @@ static const uint16_t HK_TABLE_REPLY_SIZE = 407; /** * @brief This class defines a dataset for the hk table of the P60 Dock. + * @details + * The GS port and X3 are not required for EIVE. X3 is another slot on the P60 dock and + * GS is required for a module from Gomspace which is not used. */ class HkTableDataset: public StaticLocalDataSet { diff --git a/tmtc b/tmtc index f3a2e755..53bf6508 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f3a2e755fdc73ee791ea32dc6f2dfce43af70e60 +Subproject commit 53bf65083889af10f77c3899972b1153ea835f3c