created all pool entries for bpx handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-02-02 16:33:36 +01:00
parent 89bbf98b4a
commit 0067cac94d
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 159 additions and 122 deletions

View File

@ -65,6 +65,8 @@ ReturnValue_t BpxBatteryHandler::buildCommandFromCommand(DeviceCommandId_t devic
cmdBuf[3] = 0x80; cmdBuf[3] = 0x80;
cmdBuf[4] = 0x07; cmdBuf[4] = 0x07;
this->rawPacketLen = 5; this->rawPacketLen = 5;
// This instructs the FDIR to set the device mode off and on again
// to ensure the I2C communication is also verified
triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT); triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT);
break; break;
} }
@ -167,8 +169,7 @@ ReturnValue_t BpxBatteryHandler::scanForReply(const uint8_t* start, size_t remai
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
const uint8_t* packet) {
switch (id) { switch (id) {
case (BpxBattery::GET_HK): { case (BpxBattery::GET_HK): {
ReturnValue_t result = hkSet.parseRawHk(packet, 21); ReturnValue_t result = hkSet.parseRawHk(packet, 21);
@ -183,7 +184,23 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id,
} }
break; break;
} }
case(BpxBattery::RESET_COUNTERS): { case (BpxBattery::RESET_COUNTERS):
case (BpxBattery::CONFIG_CMD):
case (BpxBattery::CONFIG_SET): {
break;
}
case (BpxBattery::MAN_HEAT_ON):
case (BpxBattery::MAN_HEAT_OFF): {
if (packet[0] != 0x01) {
return DeviceHandlerIF::DEVICE_DID_NOT_EXECUTE;
}
break;
}
case (BpxBattery::CONFIG_GET): {
ReturnValue_t result = cfgSet.parseRawHk(packet, 3);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
break; break;
} }
default: { default: {
@ -197,5 +214,15 @@ uint32_t BpxBatteryHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo)
ReturnValue_t BpxBatteryHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t BpxBatteryHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_1, &battTemp1);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_2, &battTemp2);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_3, &battTemp3);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_4, &battTemp4);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::CHARGE_CURRENT, &chargeCurrent);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::DISCHARGE_CURRENT, &dischargeCurrent);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::HEATER_CURRENT, &heaterCurrent);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_VOLTAGE, &battVolt);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::REBOOT_COUNTER, &rebootCounter);
localDataPoolMap.emplace(BpxBattery::HkPoolIds::BOOTCAUSE, &bootCause);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -24,6 +24,16 @@ class BpxBatteryHandler : public DeviceHandlerBase {
DeviceCommandId_t lastCmd = DeviceHandlerIF::NO_COMMAND_ID; DeviceCommandId_t lastCmd = DeviceHandlerIF::NO_COMMAND_ID;
BpxBatteryCfg cfgSet; BpxBatteryCfg cfgSet;
std::array<uint8_t, 8> cmdBuf = {}; std::array<uint8_t, 8> cmdBuf = {};
PoolEntry<uint16_t> chargeCurrent = PoolEntry<uint16_t>({0});
PoolEntry<uint16_t> dischargeCurrent = PoolEntry<uint16_t>({0});
PoolEntry<uint16_t> heaterCurrent = PoolEntry<uint16_t>({0});
PoolEntry<uint16_t> battVolt = PoolEntry<uint16_t>({0});
PoolEntry<int16_t> battTemp1 = PoolEntry<int16_t>({0});
PoolEntry<int16_t> battTemp2 = PoolEntry<int16_t>({0});
PoolEntry<int16_t> battTemp3 = PoolEntry<int16_t>({0});
PoolEntry<int16_t> battTemp4 = PoolEntry<int16_t>({0});
PoolEntry<uint32_t> rebootCounter = PoolEntry<uint32_t>({0});
PoolEntry<uint8_t> bootCause = PoolEntry<uint8_t>({0});
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;