changed all table parsing to use gom space API
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
#include "ACUHandler.h"
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include "p60acu_hk.h"
|
||||
|
||||
ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
||||
FailureIsolationBase *customFdir)
|
||||
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS,
|
||||
ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE),
|
||||
ACU::MAX_HKTABLE_ADDRESS, P60ACU_HK_SIZE),
|
||||
coreHk(this),
|
||||
auxHk(this) {}
|
||||
|
||||
@ -13,7 +14,7 @@ ACUHandler::~ACUHandler() {}
|
||||
|
||||
ReturnValue_t ACUHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
*id = GOMSPACE::REQUEST_HK_TABLE;
|
||||
return buildCommandFromCommand(*id, NULL, 0);
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
|
||||
void ACUHandler::fillCommandAndReplyMap() { GomspaceDeviceHandler::fillCommandAndReplyMap(); }
|
||||
@ -48,7 +49,6 @@ LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) {
|
||||
}
|
||||
|
||||
ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
||||
uint16_t dataOffset = 0;
|
||||
PoolReadGuard pg0(&coreHk);
|
||||
PoolReadGuard pg1(&auxHk);
|
||||
auto res0 = pg0.getReadResult();
|
||||
@ -59,80 +59,51 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
||||
if (res1 != RETURN_OK) {
|
||||
return res1;
|
||||
}
|
||||
dataOffset += 12;
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.currentInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.currentInChannels[idx] = as<int16_t>(packet + (idx*2));
|
||||
}
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.voltageInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.voltageInChannels[idx] = as<uint16_t>(packet + 0xc + (idx*2));
|
||||
}
|
||||
|
||||
coreHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.vcc = as<uint16_t>(packet + 0x1a);
|
||||
coreHk.vbat = as<uint16_t>(packet + 0x18);
|
||||
|
||||
for (size_t idx = 0; idx < 3; idx++) {
|
||||
coreHk.temperatures[idx] =
|
||||
static_cast<int16_t>((packet[dataOffset] << 8) | packet[dataOffset + 1]) * 0.1;
|
||||
dataOffset += 4;
|
||||
coreHk.temperatures[idx] = as<int16_t>(packet + 0x1c + (idx*2)) * 0.1;
|
||||
}
|
||||
|
||||
coreHk.mpptMode = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
coreHk.mpptMode = packet[0x22];
|
||||
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.vboostInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.vboostInChannels[idx] = as<uint16_t>(packet + 0x24 + (idx*2));
|
||||
}
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
coreHk.powerInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
coreHk.powerInChannels[idx] = as<uint16_t>(packet + 0x30 + (idx*2));
|
||||
}
|
||||
for (size_t idx = 0; idx < 3; idx++) {
|
||||
auxHk.dacEnables[idx] = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
auxHk.dacEnables[idx] = *(packet + 0x3c + idx);
|
||||
}
|
||||
for (size_t idx = 0; idx < 6; idx++) {
|
||||
auxHk.dacRawChannelVals[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
||||
dataOffset += 4;
|
||||
auxHk.dacRawChannelVals[idx] = as<uint16_t>(packet + 0x40 + (idx*2));
|
||||
}
|
||||
|
||||
auxHk.bootCause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(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);
|
||||
dataOffset += 6;
|
||||
coreHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
||||
dataOffset += 6;
|
||||
auxHk.resetCause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
coreHk.mpptTime = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
/* +12 because here starts the second csp packet */
|
||||
dataOffset += 2 + 12;
|
||||
|
||||
coreHk.mpptPeriod = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
||||
dataOffset += 4;
|
||||
auxHk.bootCause = as<uint32_t>(packet + 0x50);
|
||||
coreHk.bootcnt = as<uint32_t>(packet + 0x54);
|
||||
coreHk.uptime = as<uint32_t>(packet + 0x58);
|
||||
auxHk.resetCause = as<uint16_t>(packet + 0x5c);
|
||||
coreHk.mpptTime = as<uint16_t>(packet + 0x5e);
|
||||
coreHk.mpptPeriod = as<uint16_t>(packet + 0x60);
|
||||
|
||||
for (size_t idx = 0; idx < 8; idx++) {
|
||||
auxHk.deviceTypes[idx] = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
auxHk.deviceTypes[idx] = *(packet + 0x64 + idx);
|
||||
}
|
||||
for (size_t idx = 0; idx < 8; idx++) {
|
||||
auxHk.devicesStatus[idx] = packet[dataOffset];
|
||||
dataOffset += 3;
|
||||
auxHk.devicesStatus[idx] = *(packet + 0x6c + idx);
|
||||
}
|
||||
|
||||
auxHk.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
||||
*(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);
|
||||
dataOffset += 6;
|
||||
auxHk.wdtCntGnd = as<uint32_t>(packet + 0x74);
|
||||
auxHk.wdtGndLeft = as<uint32_t>(packet + 0x78);
|
||||
coreHk.setValidity(true, true);
|
||||
auxHk.setValidity(true, true);
|
||||
return RETURN_OK;
|
||||
|
Reference in New Issue
Block a user