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-04-28 15:58:31 +02:00
|
|
|
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
|
|
|
FailureIsolationBase *customFdir)
|
|
|
|
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir,
|
|
|
|
P60Dock::MAX_CONFIGTABLE_ADDRESS, P60Dock::MAX_HKTABLE_ADDRESS,
|
|
|
|
P60Dock::HK_TABLE_REPLY_SIZE),
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk(this),
|
|
|
|
auxHk(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.
|
|
|
|
*/
|
2022-04-07 12:22:08 +02:00
|
|
|
handleDeviceTM(&coreHk, id, true);
|
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-04-04 17:16:52 +02:00
|
|
|
using namespace P60Dock;
|
2022-01-17 15:58:27 +01:00
|
|
|
uint16_t dataOffset = 0;
|
2022-04-07 12:22:08 +02:00
|
|
|
PoolReadGuard pg0(&coreHk);
|
|
|
|
PoolReadGuard pg1(&auxHk);
|
|
|
|
if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or
|
|
|
|
pg1.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
coreHk.setValidity(false, true);
|
|
|
|
auxHk.setValidity(false, true);
|
2022-04-04 17:16:52 +02:00
|
|
|
return;
|
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
/**
|
|
|
|
* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
|
|
|
|
* address.
|
|
|
|
*/
|
|
|
|
dataOffset += 12;
|
2022-04-04 17:16:52 +02:00
|
|
|
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk.currents[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-04-04 17:16:52 +02:00
|
|
|
dataOffset += 4;
|
|
|
|
}
|
|
|
|
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk.voltages[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-04-04 17:16:52 +02:00
|
|
|
dataOffset += 4;
|
|
|
|
}
|
|
|
|
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk.outputEnables[idx] = *(packet + dataOffset);
|
2022-04-04 17:16:52 +02:00
|
|
|
dataOffset += 3;
|
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
|
2022-06-17 08:31:36 +02:00
|
|
|
coreHk.temperature1 =
|
|
|
|
static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-06-17 08:31:36 +02:00
|
|
|
coreHk.temperature2 =
|
|
|
|
static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.bootcause = *(packet + dataOffset) << 24 |
|
2022-04-04 18:47:09 +02:00
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
*(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 |
|
|
|
|
*(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk.bootCount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-04-07 19:48:09 +02:00
|
|
|
if (firstHk) {
|
2022-04-07 13:11:20 +02:00
|
|
|
triggerEvent(P60_BOOT_COUNT, coreHk.bootCount.value);
|
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.resetcause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-04-07 13:07:28 +02:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-04-07 13:07:28 +02:00
|
|
|
uint8_t newBattMode = packet[dataOffset];
|
|
|
|
if (firstHk) {
|
|
|
|
triggerEvent(BATT_MODE, newBattMode);
|
|
|
|
} else if (newBattMode != coreHk.battMode.value) {
|
|
|
|
triggerEvent(BATT_MODE_CHANGED, coreHk.battMode.value, newBattMode);
|
|
|
|
}
|
|
|
|
coreHk.battMode = newBattMode;
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 3;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.heaterOn = *(packet + dataOffset);
|
2022-01-17 15:58:27 +01:00
|
|
|
/* + 13 because here begins a new gomspace csp data field */
|
|
|
|
dataOffset += 13;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.converter5VStatus = *(packet + dataOffset);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 3;
|
|
|
|
|
2022-04-04 17:16:52 +02:00
|
|
|
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.latchups[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-04-04 17:16:52 +02:00
|
|
|
dataOffset += 4;
|
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.dockVbatVoltageValue = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.dockVccCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk.batteryCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk.batteryVoltage = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.batteryTemperature1 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.batteryTemperature2 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
|
|
|
|
2022-04-04 17:16:52 +02:00
|
|
|
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.devicesType[idx] = *(packet + dataOffset);
|
2022-04-04 17:16:52 +02:00
|
|
|
dataOffset += 3;
|
|
|
|
}
|
|
|
|
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.devicesStatus[idx] = *(packet + dataOffset);
|
2022-04-04 17:16:52 +02:00
|
|
|
dataOffset += 3;
|
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.dearmStatus = *(packet + dataOffset);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 3;
|
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCntI2c = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCntCan = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCntCsp1 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCntCsp2 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtGndLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtI2cLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 6;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCanLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
|
|
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
2022-01-17 15:58:27 +01:00
|
|
|
/* +16 because here begins a new gomspace csp packet */
|
|
|
|
dataOffset += 16;
|
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCspLeft1 = *(packet + dataOffset);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 3;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.wdtCspLeft2 = *(packet + dataOffset);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 3;
|
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.batteryChargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.batteryDischargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 4;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.ant6Depl = *(packet + dataOffset);
|
2022-01-17 15:58:27 +01:00
|
|
|
dataOffset += 3;
|
2022-04-07 12:22:08 +02:00
|
|
|
auxHk.ar6Depl = *(packet + dataOffset);
|
2022-04-07 13:07:28 +02:00
|
|
|
if (firstHk) {
|
|
|
|
firstHk = false;
|
|
|
|
}
|
2022-04-07 12:22:08 +02:00
|
|
|
coreHk.setValidity(true, true);
|
|
|
|
auxHk.setValidity(true, true);
|
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) {
|
2022-04-04 17:16:52 +02:00
|
|
|
using namespace P60System;
|
2022-04-07 19:48:09 +02:00
|
|
|
localDataPoolMap.emplace(pool::P60_CURRENTS, &hkCurrents);
|
2022-04-04 17:16:52 +02:00
|
|
|
|
2022-04-07 19:48:09 +02:00
|
|
|
localDataPoolMap.emplace(pool::P60_VOLTAGES, &hkVoltages);
|
2022-04-04 17:16:52 +02:00
|
|
|
|
2022-04-07 19:48:09 +02:00
|
|
|
localDataPoolMap.emplace(pool::P60_OUTPUT_ENABLE, &outputEnables);
|
2022-04-04 17:16:52 +02:00
|
|
|
|
2022-06-03 18:03:25 +02:00
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_TEMPERATURE_1, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_TEMPERATURE_2, new PoolEntry<float>({0}));
|
2022-04-04 17:16:52 +02:00
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BOOT_CAUSE, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BOOT_CNT, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_UPTIME, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_RESETCAUSE, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BATT_MODE, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_HEATER_ON, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_CONV_5V_ENABLE_STATUS, new PoolEntry<uint8_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::LATCHUPS, &latchups);
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_DOCK_VBAT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_DOCK_VCC_CURRENT, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BATTERY_CURRENT, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BATTERY_VOLTAGE, new PoolEntry<uint16_t>({0}));
|
|
|
|
|
2022-06-03 18:03:25 +02:00
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BATTERY_TEMPERATURE_1, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BATTERY_TEMPERATURE_2, new PoolEntry<int16_t>({0}));
|
2022-04-04 17:16:52 +02:00
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::DEVICES_TYPE, &devicesType);
|
|
|
|
localDataPoolMap.emplace(pool::DEVICES_STATUS, &devicesStatus);
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_DEARM_STATUS, new PoolEntry<uint8_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CNT_I2C, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CNT_CAN, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CNT_CSP_1, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CNT_CSP_2, new PoolEntry<uint32_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_I2C_LEFT, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CAN_LEFT, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CSP_LEFT_1, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_WDT_CSP_LEFT_2, new PoolEntry<uint8_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BATT_CHARGE_CURRENT, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_BATT_DISCHARGE_CURRENT, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_ANT6_DEPL, new PoolEntry<int8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(pool::P60DOCK_AR6_DEPL, new PoolEntry<int8_t>({0}));
|
2022-08-15 11:57:57 +02:00
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
|
|
|
subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0));
|
|
|
|
poolManager.subscribeForRegularPeriodicPacket(
|
|
|
|
subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0));
|
2022-01-17 15:58:27 +01:00
|
|
|
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-03-16 20:13:21 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
2022-01-17 15:58:27 +01:00
|
|
|
switch (cmd) {
|
|
|
|
case (GOMSPACE::PRINT_SWITCH_V_I): {
|
2022-04-07 12:22:08 +02:00
|
|
|
PoolReadGuard pg0(&coreHk);
|
|
|
|
PoolReadGuard pg1(&auxHk);
|
|
|
|
if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or
|
|
|
|
pg1.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
2022-03-16 20:13:21 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
printHkTableSwitchIV();
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
case (GOMSPACE::PRINT_LATCHUPS): {
|
2022-04-07 12:22:08 +02:00
|
|
|
PoolReadGuard pg(&auxHk);
|
2022-03-16 20:13:21 +01:00
|
|
|
result = pg.getReadResult();
|
|
|
|
printHkTableLatchups();
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
break;
|
2022-01-17 15:58:27 +01:00
|
|
|
}
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
2021-09-20 11:47:19 +02:00
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
default: {
|
2022-05-23 11:25:58 +02:00
|
|
|
return DeviceHandlerIF::COMMAND_NOT_SUPPORTED;
|
2021-09-20 11:47:19 +02:00
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
}
|
2022-03-16 20:13:21 +01:00
|
|
|
sif::warning << "Reading P60 Dock HK table failed" << std::endl;
|
|
|
|
return HasReturnvaluesIF::RETURN_FAILED;
|
2021-09-20 11:47:19 +02:00
|
|
|
}
|
|
|
|
|
2022-03-16 20:13:21 +01:00
|
|
|
void P60DockHandler::printHkTableSwitchIV() {
|
2022-04-04 17:16:52 +02:00
|
|
|
using namespace P60Dock;
|
2022-03-16 20:13:21 +01:00
|
|
|
sif::info << "P60 Dock Info:" << std::endl;
|
2022-04-07 12:22:08 +02:00
|
|
|
sif::info << "Boot Cause: " << auxHk.bootcause << " | Boot Count: " << std::setw(4) << std::right
|
|
|
|
<< coreHk.bootCount << std::endl;
|
|
|
|
sif::info << "Reset Cause: " << auxHk.resetcause
|
|
|
|
<< " | Battery Mode: " << static_cast<int>(coreHk.battMode.value) << std::endl;
|
2022-03-16 20:13:21 +01:00
|
|
|
sif::info << "SwitchState, Currents [mA], Voltages [mV]:" << std::endl;
|
|
|
|
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "Dock VBAT VCC" << std::dec
|
2022-04-07 12:22:08 +02:00
|
|
|
<< "| -, " << std::setw(4) << std::right << auxHk.dockVccCurrent << ", " << std::setw(5)
|
|
|
|
<< auxHk.dockVbatVoltageValue << std::endl;
|
2022-03-16 20:13:21 +01:00
|
|
|
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << "BATT" << std::dec << "| -, "
|
2022-04-07 12:22:08 +02:00
|
|
|
<< std::setw(4) << std::right << coreHk.batteryCurrent.value << ", " << std::setw(5)
|
|
|
|
<< coreHk.batteryVoltage.value << std::endl;
|
2022-04-04 17:16:52 +02:00
|
|
|
|
|
|
|
auto genericPrintoutHandler = [&](std::string name, uint8_t idx) {
|
|
|
|
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << name << std::dec << "| "
|
2022-04-07 12:22:08 +02:00
|
|
|
<< unsigned(coreHk.outputEnables[idx]) << ", " << std::setw(4) << std::right
|
|
|
|
<< coreHk.currents[idx] << ", " << std::setw(5) << coreHk.voltages[idx] << std::endl;
|
2022-04-04 17:16:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
genericPrintoutHandler("ACU VCC", hk::ACU_VCC);
|
|
|
|
genericPrintoutHandler("ACU VBAT", hk::ACU_VBAT);
|
|
|
|
genericPrintoutHandler("PDU1 VCC", hk::PDU1_VCC);
|
|
|
|
genericPrintoutHandler("PDU1 VBAT", hk::PDU1_VBAT);
|
|
|
|
genericPrintoutHandler("PDU2 VCC", hk::PDU2_VCC);
|
|
|
|
genericPrintoutHandler("PDU2 VBAT", hk::PDU2_VBAT);
|
|
|
|
genericPrintoutHandler("Stack VBAT", hk::STACK_VBAT);
|
|
|
|
genericPrintoutHandler("Stack 3V3", hk::STACK_3V3);
|
|
|
|
genericPrintoutHandler("Stack 5V", hk::STACK_5V);
|
2021-09-20 11:47:19 +02:00
|
|
|
}
|
2022-03-16 20:13:21 +01:00
|
|
|
|
2022-04-07 12:22:08 +02:00
|
|
|
LocalPoolDataSetBase *P60DockHandler::getDataSetHandle(sid_t sid) {
|
|
|
|
if (sid == coreHk.getSid()) {
|
|
|
|
return &coreHk;
|
|
|
|
} else if (sid == auxHk.getSid()) {
|
|
|
|
return &auxHk;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-03-16 20:13:21 +01:00
|
|
|
void P60DockHandler::printHkTableLatchups() {
|
2022-04-04 17:16:52 +02:00
|
|
|
using namespace P60Dock;
|
2022-03-16 20:13:21 +01:00
|
|
|
sif::info << "P60 Latchup Information" << std::endl;
|
2022-04-04 17:16:52 +02:00
|
|
|
auto genericPrintoutHandler = [&](std::string name, uint8_t idx) {
|
|
|
|
sif::info << std::setw(MAX_CHANNEL_STR_WIDTH) << std::left << name << std::dec << "| "
|
2022-04-07 12:22:08 +02:00
|
|
|
<< std::setw(4) << std::right << auxHk.latchups[idx] << std::endl;
|
2022-04-04 17:16:52 +02:00
|
|
|
};
|
|
|
|
genericPrintoutHandler("ACU VCC", hk::ACU_VCC);
|
|
|
|
genericPrintoutHandler("ACU VBAT", hk::ACU_VBAT);
|
|
|
|
genericPrintoutHandler("PDU1 VCC", hk::PDU1_VCC);
|
|
|
|
genericPrintoutHandler("PDU1 VBAT", hk::PDU1_VBAT);
|
|
|
|
genericPrintoutHandler("PDU2 VCC", hk::PDU2_VCC);
|
|
|
|
genericPrintoutHandler("PDU2 VBAT", hk::PDU2_VBAT);
|
|
|
|
genericPrintoutHandler("STACK VBAT", hk::STACK_VBAT);
|
|
|
|
genericPrintoutHandler("STACK 3V3", hk::STACK_3V3);
|
|
|
|
genericPrintoutHandler("STACK 5V", hk::STACK_5V);
|
|
|
|
genericPrintoutHandler("GS 3V3", hk::GS3V3);
|
|
|
|
genericPrintoutHandler("GS 5V", hk::GS5V);
|
|
|
|
genericPrintoutHandler("X3 VBAT", hk::X3_IDLE_VBAT);
|
|
|
|
genericPrintoutHandler("X3 VCC", hk::X3_IDLE_VCC);
|
2022-03-16 20:13:21 +01:00
|
|
|
}
|
2022-04-26 10:37:25 +02:00
|
|
|
|
|
|
|
void P60DockHandler::setDebugMode(bool enable) { this->debugMode = enable; }
|