eive-obsw/mission/devices/P60DockHandler.cpp

507 lines
28 KiB
C++
Raw Normal View History

2021-01-28 14:55:21 +01:00
#include "P60DockHandler.h"
2022-01-17 15:58:27 +01:00
#include <fsfw/datapool/PoolReadGuard.h>
2021-02-12 10:20:39 +01:00
#include "OBSWConfig.h"
2021-02-06 11:57:45 +01:00
2022-01-17 15:58:27 +01:00
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie)
: GomspaceDeviceHandler(objectId, comIF, comCookie, P60Dock::MAX_CONFIGTABLE_ADDRESS,
P60Dock::MAX_HKTABLE_ADDRESS, P60Dock::HK_TABLE_REPLY_SIZE,
&p60dockHkTableDataset),
p60dockHkTableDataset(this) {}
2021-01-28 14:55:21 +01:00
2022-01-17 15:58:27 +01:00
P60DockHandler::~P60DockHandler() {}
2021-01-28 14:55:21 +01:00
2022-01-17 15:58:27 +01:00
ReturnValue_t P60DockHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
*id = GOMSPACE::REQUEST_HK_TABLE;
return buildCommandFromCommand(*id, NULL, 0);
2021-02-12 10:20:39 +01:00
}
2021-01-28 14:55:21 +01:00
void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
2022-01-17 15:58:27 +01:00
parseHkTableReply(packet);
/**
* Hk table will be sent to the commander if hk table request was not triggered by the
* P60DockHandler itself.
*/
handleDeviceTM(&p60dockHkTableDataset, id, true);
2021-02-12 10:20:39 +01:00
2021-08-17 17:48:51 +02:00
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_P60DOCK == 1
2022-01-17 15:58:27 +01:00
p60dockHkTableDataset.read();
sif::info << "P60 Dock: ACU VCC switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVcc.value)
<< std::endl;
sif::info << "P60 Dock: PDU1 VCC switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value)
<< std::endl;
sif::info << "P60 Dock: PDU2 VCC switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value)
<< std::endl;
sif::info << "P60 Dock: ACU VBAT switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVbat.value)
<< std::endl;
sif::info << "P60 Dock: PDU1 VBAT switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value)
<< std::endl;
sif::info << "P60 Dock: PDU2 VBAT switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value)
<< std::endl;
sif::info << "P60 Dock: Stack VBAT switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStackVbat.value)
<< std::endl;
sif::info << "P60 Dock: Stack 3V3 switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack3V3.value)
<< std::endl;
sif::info << "P60 Dock: Stack 5V switch: "
<< static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack5V.value)
<< std::endl;
float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1;
sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl;
temperatureC = p60dockHkTableDataset.temperature2.value * 0.1;
sif::info << "P60 Dock: Temperature 2: " << temperatureC << " °C" << std::endl;
sif::info << "P60 Dock: Watchdog Timer seconds left before reboot: "
2021-02-12 10:20:39 +01:00
<< p60dockHkTableDataset.wdtGndLeft << " seconds" << std::endl;
2022-01-17 15:58:27 +01:00
sif::info << "P60 Dock: CSP 1, pings left before reboot: "
<< (int)p60dockHkTableDataset.wdtCspLeft1.value << std::endl;
sif::info << "P60 Dock: CSP 2, pings left before reboot: "
<< (int)p60dockHkTableDataset.wdtCspLeft1.value << std::endl;
2021-02-12 10:20:39 +01:00
2022-01-17 15:58:27 +01:00
p60dockHkTableDataset.commit();
2021-02-12 10:20:39 +01:00
#endif
2021-01-28 14:55:21 +01:00
}
2021-02-09 10:31:40 +01:00
2021-02-12 10:20:39 +01:00
void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
2022-01-17 15:58:27 +01:00
uint16_t dataOffset = 0;
p60dockHkTableDataset.read();
/**
* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address.
*/
dataOffset += 12;
p60dockHkTableDataset.currentAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu1Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentX3IdleVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu2Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentAcuVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu1Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentX3IdleVbat =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu2Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentStackVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentStack3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentStack5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentGS3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentGS5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu1Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageX3IdleVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu2Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageAcuVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu1Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageX3IdleVbat =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu2Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageStackVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageStack3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageStack5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageGS3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.outputEnableStateAcuVcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu1Vcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateX3IdleVcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu2Vcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateAcuVbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu1Vbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateX3IdleVbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu2Vbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateStackVbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateStack3V3 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateStack5V = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateGS3V3 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateGS5V = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.temperature1 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.temperature2 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.bootcause = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.bootCount = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.resetcause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.battMode = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.heaterOn = *(packet + dataOffset);
/* + 13 because here begins a new gomspace csp data field */
dataOffset += 13;
p60dockHkTableDataset.converter5VStatus = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.latchupsAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu1Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsX3IdleVcc =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu2Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsAcuVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu1Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsX3IdleVbat =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu2Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsStackVbat =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsStack3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsStack5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsGS3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.vbatVoltageValue = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.vccCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryVoltage = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryTemperature1 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryTemperature2 =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.device0 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device1 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device2 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device3 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device4 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device5 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device6 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device7 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device0Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device1Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device2Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device3Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device4Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device5Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device6Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device7Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.dearmStatus = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.wdtCntGnd = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntI2c = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntCan = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntCsp1 = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntCsp2 = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtGndLeft = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtI2cLeft = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCanLeft = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
/* +16 because here begins a new gomspace csp packet */
dataOffset += 16;
p60dockHkTableDataset.wdtCspLeft1 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.wdtCspLeft2 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.batteryChargeCurrent =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryDischargeCurrent =
*(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.ant6Depl = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.ar6Depl = *(packet + dataOffset);
p60dockHkTableDataset.commit();
2021-02-12 10:20:39 +01:00
}
2022-01-17 15:58:27 +01:00
ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_ACU_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU1_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_X3_IDLE_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU2_VCC, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_ACU_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU1_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_X3_IDLE_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU2_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_STACK_VBAT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_STACK_3V3, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_STACK_5V, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_GS3V3, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_GS5V, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_ACU_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU1_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_X3_IDLE_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU2_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_ACU_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU1_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_X3_IDLE_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU2_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_STACK_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_STACK_3V3, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_STACK_5V, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_GS3V3, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_GS5V, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_ACU_VCC, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU1_VCC, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VCC,
new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU2_VCC, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_ACU_VBAT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU1_VBAT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VBAT,
new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU2_VBAT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_STACK_VBAT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_STACK_3V3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_STACK_5V, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_GS3V3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_GS5V, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_TEMPERATURE_1, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_TEMPERATURE_2, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BOOT_CAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BOOT_CNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_RESETCAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BATT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_HEATER_ON, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_CONV_5V_ENABLE_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_ACU_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU1_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_X3_IDLE_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU2_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_ACU_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU1_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_X3_IDLE_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU2_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_STACK_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_STACK_3V3, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_STACK_5V, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_GS3V3, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_GS5V, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VBAT_VALUE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_VCC_CURRENT_VALUE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_CURRENT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_VOLTAGE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_TEMPERATURE_1, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_TEMPERATURE_2, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_0, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_3, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_4, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_5, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_6, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_7, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_0_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_1_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_2_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_3_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_4_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_5_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_6_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_7_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_DEARM_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_CSP_1, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_CSP_2, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CSP_LEFT_1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CSP_LEFT_2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BATT_CHARGE_CURRENT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_BATT_DISCHARGE_CURRENT, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_ANT6_DEPL, new PoolEntry<int8_t>({0}));
localDataPoolMap.emplace(P60System::P60DOCK_AR6_DEPL, new PoolEntry<int8_t>({0}));
return HasReturnvaluesIF::RETURN_OK;
2021-01-28 14:55:21 +01:00
}
2021-09-20 11:47:19 +02:00
ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) {
2022-01-17 15:58:27 +01:00
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;
2021-09-20 11:47:19 +02:00
return HasReturnvaluesIF::RETURN_FAILED;
2022-01-17 15:58:27 +01:00
}
printHkTable();
return HasReturnvaluesIF::RETURN_OK;
2021-09-20 11:47:19 +02:00
}
2022-01-17 15:58:27 +01:00
default: {
return HasReturnvaluesIF::RETURN_FAILED;
2021-09-20 11:47:19 +02:00
}
2022-01-17 15:58:27 +01:00
}
2021-09-20 11:47:19 +02:00
}
void P60DockHandler::printHkTable() {
2022-01-17 15:58:27 +01:00
sif::info << "P60 Dock Info: SwitchState, Currents [mA], Voltages [mV]" << 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;
2021-09-20 11:47:19 +02:00
}