|
|
|
@ -6,7 +6,8 @@ ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCoo
|
|
|
|
|
FailureIsolationBase *customFdir)
|
|
|
|
|
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS,
|
|
|
|
|
ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE),
|
|
|
|
|
coreHk(this), auxHk(this) {}
|
|
|
|
|
coreHk(this),
|
|
|
|
|
auxHk(this) {}
|
|
|
|
|
|
|
|
|
|
ACUHandler::~ACUHandler() {}
|
|
|
|
|
|
|
|
|
@ -15,10 +16,7 @@ ReturnValue_t ACUHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
|
|
|
|
return buildCommandFromCommand(*id, NULL, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ACUHandler::fillCommandAndReplyMap() {
|
|
|
|
|
GomspaceDeviceHandler::fillCommandAndReplyMap();
|
|
|
|
|
this->insertInCommandMap(PRINT_CHANNEL_STATS);
|
|
|
|
|
}
|
|
|
|
|
void ACUHandler::fillCommandAndReplyMap() { GomspaceDeviceHandler::fillCommandAndReplyMap(); }
|
|
|
|
|
|
|
|
|
|
void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
|
|
|
|
|
parseHkTableReply(packet);
|
|
|
|
@ -26,15 +24,14 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
|
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
|
|
|
|
PoolReadGuard pg0(&auxHk);
|
|
|
|
|
PoolReadGuard pg1(&coreHk);
|
|
|
|
|
if(pg0.getReadResult() != RETURN_OK or pg1.getReadResult() != RETURN_OK) {
|
|
|
|
|
if (pg0.getReadResult() != RETURN_OK or pg1.getReadResult() != RETURN_OK) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for(size_t idx = 0; idx < 3; idx++) {
|
|
|
|
|
for (size_t idx = 0; idx < 3; idx++) {
|
|
|
|
|
float tempC = coreHk.temperatures[idx] * 0.1;
|
|
|
|
|
sif::info << "ACU: Temperature " << idx << ": " << tempC << " °C" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
sif::info << "ACU: Ground Watchdog Timer Count: " << auxHk.wdtCntGnd.value
|
|
|
|
|
<< std::endl;
|
|
|
|
|
sif::info << "ACU: Ground Watchdog Timer Count: " << auxHk.wdtCntGnd.value << std::endl;
|
|
|
|
|
sif::info << "ACU: Ground watchdog timer, seconds left before reboot: "
|
|
|
|
|
<< auxHk.wdtGndLeft.value << std::endl;
|
|
|
|
|
#endif
|
|
|
|
@ -44,7 +41,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
|
|
|
|
|
LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) {
|
|
|
|
|
if (sid == coreHk.getSid()) {
|
|
|
|
|
return &coreHk;
|
|
|
|
|
} else if(sid == auxHk.getSid()) {
|
|
|
|
|
} else if (sid == auxHk.getSid()) {
|
|
|
|
|
return &auxHk;
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
@ -56,29 +53,28 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
|
|
|
|
PoolReadGuard pg1(&auxHk);
|
|
|
|
|
auto res0 = pg0.getReadResult();
|
|
|
|
|
auto res1 = pg1.getReadResult();
|
|
|
|
|
if(res0 != RETURN_OK) {
|
|
|
|
|
if (res0 != RETURN_OK) {
|
|
|
|
|
return res0;
|
|
|
|
|
}
|
|
|
|
|
if(res1 != RETURN_OK) {
|
|
|
|
|
if (res1 != RETURN_OK) {
|
|
|
|
|
return res1;
|
|
|
|
|
}
|
|
|
|
|
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];
|
|
|
|
|
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];
|
|
|
|
|
dataOffset += 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
coreHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
|
|
|
dataOffset += 4;
|
|
|
|
|
coreHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
|
|
|
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];
|
|
|
|
|
dataOffset += 4;
|
|
|
|
|
}
|
|
|
|
@ -86,31 +82,31 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
|
|
|
|
coreHk.mpptMode = packet[dataOffset];
|
|
|
|
|
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];
|
|
|
|
|
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];
|
|
|
|
|
dataOffset += 4;
|
|
|
|
|
}
|
|
|
|
|
for(size_t idx = 0; idx < 3; idx++) {
|
|
|
|
|
for (size_t idx = 0; idx < 3; idx++) {
|
|
|
|
|
auxHk.dacEnables[idx] = packet[dataOffset];
|
|
|
|
|
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];
|
|
|
|
|
dataOffset += 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auxHk.bootCause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
dataOffset += 6;
|
|
|
|
|
coreHk.bootcnt = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
dataOffset += 6;
|
|
|
|
|
coreHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
dataOffset += 6;
|
|
|
|
|
auxHk.resetCause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
|
|
|
dataOffset += 4;
|
|
|
|
@ -121,20 +117,20 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
|
|
|
|
coreHk.mpptPeriod = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
|
|
|
dataOffset += 4;
|
|
|
|
|
|
|
|
|
|
for(size_t idx = 0; idx < 8; idx++) {
|
|
|
|
|
for (size_t idx = 0; idx < 8; idx++) {
|
|
|
|
|
auxHk.deviceTypes[idx] = packet[dataOffset];
|
|
|
|
|
dataOffset += 3;
|
|
|
|
|
}
|
|
|
|
|
for(size_t idx = 0; idx < 8; idx++) {
|
|
|
|
|
for (size_t idx = 0; idx < 8; idx++) {
|
|
|
|
|
auxHk.devicesStatus[idx] = packet[dataOffset];
|
|
|
|
|
dataOffset += 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auxHk.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
dataOffset += 6;
|
|
|
|
|
auxHk.wdtGndLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
|
|
|
dataOffset += 6;
|
|
|
|
|
return RETURN_OK;
|
|
|
|
|
}
|
|
|
|
@ -176,23 +172,10 @@ ReturnValue_t ACUHandler::initializeLocalDataPool(localpool::DataPool &localData
|
|
|
|
|
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() {
|
|
|
|
|
PoolReadGuard pg(&coreHk);
|
|
|
|
|
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 << "| "
|
|
|
|
|
<< static_cast<unsigned int>(coreHk.currentInChannels[idx]) << std::setw(15)
|
|
|
|
|
<< std::right << coreHk.voltageInChannels[idx] << std::endl;
|
|
|
|
@ -200,3 +183,25 @@ void ACUHandler::printChannelStats() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|