run afmt
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-05-23 11:25:58 +02:00
parent 3bdad61ac0
commit 99e27a5a63
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
9 changed files with 58 additions and 56 deletions

View File

@ -1,4 +1,5 @@
#include <fsfw/health/HealthTableIF.h> #include <fsfw/health/HealthTableIF.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h" #include "bsp_q7s/core/ObjectFactory.h"

View File

@ -4,11 +4,11 @@
#include <iostream> #include <iostream>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "q7sConfig.h"
#include "commonConfig.h" #include "commonConfig.h"
#include "core/InitMission.h" #include "core/InitMission.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/version.h" #include "fsfw/version.h"
#include "q7sConfig.h"
#include "watchdog/definitions.h" #include "watchdog/definitions.h"
static int OBSW_ALREADY_RUNNING = -2; static int OBSW_ALREADY_RUNNING = -2;

View File

@ -6,7 +6,8 @@ ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCoo
FailureIsolationBase *customFdir) FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS, : GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS,
ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE), ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE),
coreHk(this), auxHk(this) {} coreHk(this),
auxHk(this) {}
ACUHandler::~ACUHandler() {} ACUHandler::~ACUHandler() {}
@ -15,10 +16,7 @@ ReturnValue_t ACUHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return buildCommandFromCommand(*id, NULL, 0); return buildCommandFromCommand(*id, NULL, 0);
} }
void ACUHandler::fillCommandAndReplyMap() { void ACUHandler::fillCommandAndReplyMap() { GomspaceDeviceHandler::fillCommandAndReplyMap(); }
GomspaceDeviceHandler::fillCommandAndReplyMap();
this->insertInCommandMap(PRINT_CHANNEL_STATS);
}
void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet); parseHkTableReply(packet);
@ -26,15 +24,14 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
PoolReadGuard pg0(&auxHk); PoolReadGuard pg0(&auxHk);
PoolReadGuard pg1(&coreHk); PoolReadGuard pg1(&coreHk);
if(pg0.getReadResult() != RETURN_OK or pg1.getReadResult() != RETURN_OK) { if (pg0.getReadResult() != RETURN_OK or pg1.getReadResult() != RETURN_OK) {
return; return;
} }
for(size_t idx = 0; idx < 3; idx++) { for (size_t idx = 0; idx < 3; idx++) {
float tempC = coreHk.temperatures[idx] * 0.1; float tempC = coreHk.temperatures[idx] * 0.1;
sif::info << "ACU: Temperature " << idx << ": " << tempC << " °C" << std::endl; sif::info << "ACU: Temperature " << idx << ": " << tempC << " °C" << std::endl;
} }
sif::info << "ACU: Ground Watchdog Timer Count: " << auxHk.wdtCntGnd.value sif::info << "ACU: Ground Watchdog Timer Count: " << auxHk.wdtCntGnd.value << std::endl;
<< std::endl;
sif::info << "ACU: Ground watchdog timer, seconds left before reboot: " sif::info << "ACU: Ground watchdog timer, seconds left before reboot: "
<< auxHk.wdtGndLeft.value << std::endl; << auxHk.wdtGndLeft.value << std::endl;
#endif #endif
@ -44,7 +41,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) {
if (sid == coreHk.getSid()) { if (sid == coreHk.getSid()) {
return &coreHk; return &coreHk;
} else if(sid == auxHk.getSid()) { } else if (sid == auxHk.getSid()) {
return &auxHk; return &auxHk;
} }
return nullptr; return nullptr;
@ -56,29 +53,28 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
PoolReadGuard pg1(&auxHk); PoolReadGuard pg1(&auxHk);
auto res0 = pg0.getReadResult(); auto res0 = pg0.getReadResult();
auto res1 = pg1.getReadResult(); auto res1 = pg1.getReadResult();
if(res0 != RETURN_OK) { if (res0 != RETURN_OK) {
return res0; return res0;
} }
if(res1 != RETURN_OK) { if (res1 != RETURN_OK) {
return res1; return res1;
} }
dataOffset += 12; dataOffset += 12;
for(size_t idx = 0; idx < 6; idx++) { for (size_t idx = 0; idx < 6; idx++) {
coreHk.currentInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; coreHk.currentInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4; dataOffset += 4;
} }
for(size_t idx = 0; idx < 6; idx++) { for (size_t idx = 0; idx < 6; idx++) {
coreHk.voltageInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; coreHk.voltageInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4; dataOffset += 4;
} }
coreHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1); coreHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4; dataOffset += 4;
coreHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1); coreHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4; dataOffset += 4;
for(size_t idx = 0; idx < 3; idx++) { for (size_t idx = 0; idx < 3; idx++) {
coreHk.temperatures[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; coreHk.temperatures[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4; dataOffset += 4;
} }
@ -86,19 +82,19 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
coreHk.mpptMode = packet[dataOffset]; coreHk.mpptMode = packet[dataOffset];
dataOffset += 3; dataOffset += 3;
for(size_t idx = 0; idx < 6; idx++) { for (size_t idx = 0; idx < 6; idx++) {
coreHk.vboostInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; coreHk.vboostInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4; dataOffset += 4;
} }
for(size_t idx = 0; idx < 6; idx++) { for (size_t idx = 0; idx < 6; idx++) {
coreHk.powerInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; coreHk.powerInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4; dataOffset += 4;
} }
for(size_t idx = 0; idx < 3; idx++) { for (size_t idx = 0; idx < 3; idx++) {
auxHk.dacEnables[idx] = packet[dataOffset]; auxHk.dacEnables[idx] = packet[dataOffset];
dataOffset += 3; dataOffset += 3;
} }
for(size_t idx = 0; idx < 6; idx++) { for (size_t idx = 0; idx < 6; idx++) {
auxHk.dacRawChannelVal0[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; auxHk.dacRawChannelVal0[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
dataOffset += 4; dataOffset += 4;
} }
@ -121,11 +117,11 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
coreHk.mpptPeriod = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1); coreHk.mpptPeriod = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4; dataOffset += 4;
for(size_t idx = 0; idx < 8; idx++) { for (size_t idx = 0; idx < 8; idx++) {
auxHk.deviceTypes[idx] = packet[dataOffset]; auxHk.deviceTypes[idx] = packet[dataOffset];
dataOffset += 3; dataOffset += 3;
} }
for(size_t idx = 0; idx < 8; idx++) { for (size_t idx = 0; idx < 8; idx++) {
auxHk.devicesStatus[idx] = packet[dataOffset]; auxHk.devicesStatus[idx] = packet[dataOffset];
dataOffset += 3; dataOffset += 3;
} }
@ -176,23 +172,10 @@ ReturnValue_t ACUHandler::initializeLocalDataPool(localpool::DataPool &localData
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t ACUHandler::childCommandHook(DeviceCommandId_t cmd, const uint8_t *commandData,
size_t commandDataLen) {
switch (cmd) {
case PRINT_CHANNEL_STATS: {
printChannelStats();
return RETURN_OK;
}
default: {
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
}
}
void ACUHandler::printChannelStats() { void ACUHandler::printChannelStats() {
PoolReadGuard pg(&coreHk); PoolReadGuard pg(&coreHk);
sif::info << "ACU Info: Current [mA], Voltage [mV]" << std::endl; sif::info << "ACU Info: Current [mA], Voltage [mV]" << std::endl;
for(size_t idx = 0; idx < 6; idx++) { for (size_t idx = 0; idx < 6; idx++) {
sif::info << std::setw(8) << std::left << "Channel " << idx << std::dec << "| " sif::info << std::setw(8) << std::left << "Channel " << idx << std::dec << "| "
<< static_cast<unsigned int>(coreHk.currentInChannels[idx]) << std::setw(15) << static_cast<unsigned int>(coreHk.currentInChannels[idx]) << std::setw(15)
<< std::right << coreHk.voltageInChannels[idx] << std::endl; << std::right << coreHk.voltageInChannels[idx] << std::endl;
@ -200,3 +183,25 @@ void ACUHandler::printChannelStats() {
} }
void ACUHandler::setDebugMode(bool enable) { this->debugMode = enable; } void ACUHandler::setDebugMode(bool enable) { this->debugMode = enable; }
ReturnValue_t ACUHandler::printStatus(DeviceCommandId_t cmd) {
ReturnValue_t result = RETURN_OK;
switch (cmd) {
case (GOMSPACE::PRINT_SWITCH_V_I): {
PoolReadGuard pg(&coreHk);
result = pg.getReadResult();
if (result != HasReturnvaluesIF::RETURN_OK) {
break;
}
printChannelStats();
break;
}
default: {
return DeviceHandlerIF::COMMAND_NOT_SUPPORTED;
}
}
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Reading PDU1 HK table failed!" << std::endl;
}
return result;
}

View File

@ -29,16 +29,13 @@ class ACUHandler : public GomspaceDeviceHandler {
*/ */
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override; virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
virtual void fillCommandAndReplyMap() override; ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
virtual ReturnValue_t childCommandHook(DeviceCommandId_t cmd, const uint8_t* commandData, virtual void fillCommandAndReplyMap() override;
size_t commandDataLen) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
private: private:
static const DeviceCommandId_t PRINT_CHANNEL_STATS = 51;
ACU::CoreHk coreHk; ACU::CoreHk coreHk;
ACU::AuxHk auxHk; ACU::AuxHk auxHk;
bool debugMode = false; bool debugMode = false;

View File

@ -251,7 +251,7 @@ ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
default: { default: {
return HasReturnvaluesIF::RETURN_FAILED; return DeviceHandlerIF::COMMAND_NOT_SUPPORTED;
} }
} }
sif::warning << "Reading P60 Dock HK table failed" << std::endl; sif::warning << "Reading P60 Dock HK table failed" << std::endl;

View File

@ -122,7 +122,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) {
break; break;
} }
default: { default: {
return HasReturnvaluesIF::RETURN_FAILED; return DeviceHandlerIF::COMMAND_NOT_SUPPORTED;
} }
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -76,7 +76,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
break; break;
} }
default: { default: {
return HasReturnvaluesIF::RETURN_FAILED; return DeviceHandlerIF::COMMAND_NOT_SUPPORTED;
} }
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -38,7 +38,8 @@ static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t PARAM_SET = 255; //!< [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_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
//!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console //! [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console
//! For the ACU device, only print voltages and currents of the 6 ACU channels
static const DeviceCommandId_t PRINT_SWITCH_V_I = 32; static const DeviceCommandId_t PRINT_SWITCH_V_I = 32;
static const DeviceCommandId_t PRINT_LATCHUPS = 33; static const DeviceCommandId_t PRINT_LATCHUPS = 33;
@ -550,8 +551,8 @@ static const uint16_t MAX_HKTABLE_ADDRESS = 120;
static const uint8_t HK_TABLE_ENTRIES = 64; static const uint8_t HK_TABLE_ENTRIES = 64;
static const uint16_t HK_TABLE_REPLY_SIZE = 262; static const uint16_t HK_TABLE_REPLY_SIZE = 262;
class CoreHk: public StaticLocalDataSet<14> { class CoreHk : public StaticLocalDataSet<14> {
public: public:
CoreHk(HasLocalDataPoolIF* owner) CoreHk(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::ACU_CORE)) {} : StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::ACU_CORE)) {}
@ -583,7 +584,6 @@ public:
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_TIME, this); lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_TIME, this);
lp_var_t<uint16_t> mpptPeriod = lp_var_t<uint16_t> mpptPeriod =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_PERIOD, this); lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_PERIOD, this);
}; };
/** /**
* @brief This class defines a dataset for the hk table of the ACU. * @brief This class defines a dataset for the hk table of the ACU.
@ -596,7 +596,6 @@ class AuxHk : public StaticLocalDataSet<12> {
AuxHk(object_id_t objectId) AuxHk(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU_AUX))) {} : StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU_AUX))) {}
lp_vec_t<uint8_t, 3> dacEnables = lp_vec_t<uint8_t, 3> dacEnables =
lp_vec_t<uint8_t, 3>(sid.objectId, P60System::pool::ACU_DAC_ENABLES, this); lp_vec_t<uint8_t, 3>(sid.objectId, P60System::pool::ACU_DAC_ENABLES, this);

2
tmtc

@ -1 +1 @@
Subproject commit ff66dd5dd2bc2ee3150ce45160303bc79ed2599d Subproject commit c01f1d01916160888cf745ee3db6a2c46d795408