eive-obsw/mission/power/gsDefs.h

756 lines
28 KiB
C
Raw Normal View History

2023-03-26 16:13:54 +02:00
#ifndef MISSION_POWER_GSDEFS_H_
#define MISSION_POWER_GSDEFS_H_
2020-12-20 13:31:44 +01:00
2021-01-28 14:55:21 +01:00
#include <fsfw/datapoollocal/LocalPoolVariable.h>
2022-01-18 11:41:19 +01:00
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
2022-04-07 19:48:09 +02:00
#include <fsfw/power/definitions.h>
2023-03-26 16:13:54 +02:00
#include <mission/power/gsLibDefs.h>
2020-12-20 13:31:44 +01:00
2022-01-18 11:41:19 +01:00
#include <cstdint>
2022-04-07 19:48:09 +02:00
#include "devices/powerSwitcherList.h"
2022-09-27 23:59:38 +02:00
#include "fsfw/platform.h"
#include "mission/power/defs.h"
2022-04-07 19:48:09 +02:00
2022-01-18 11:41:19 +01:00
namespace GOMSPACE {
2022-01-19 17:17:06 +01:00
2022-08-31 22:52:32 +02:00
struct TableInfo {
uint8_t sourceTable;
uint8_t targetTable;
};
2022-09-01 15:23:39 +02:00
enum DeviceType { PDU, ACU, P60DOCK };
2022-09-01 17:31:43 +02:00
enum class SpecialRequestTypes {
DEFAULT_COM_IF,
GET_PDU_HK,
GET_PDU_CONFIG,
GET_ACU_HK,
GET_ACU_CONFIG,
GET_P60DOCK_HK,
2022-08-31 22:52:32 +02:00
GET_P60DOCK_CONFIG,
2022-09-01 17:31:43 +02:00
SAVE_TABLE,
LOAD_TABLE
};
2022-08-26 14:28:06 +02:00
enum CspPorts : uint8_t {
2022-08-26 03:20:44 +02:00
CSP_PING = 1,
CSP_REBOOT = 4,
P60_PORT_RPARAM_ENUM = 7,
P60_PORT_GNDWDT_RESET_ENUM = 9
};
2022-01-19 18:05:17 +01:00
enum class Pdu { PDU1, PDU2 };
using ChannelSwitchHook = void (*)(Pdu pdu, uint8_t channel, bool on, void* args);
2022-01-19 17:17:06 +01:00
2021-09-07 16:11:02 +02:00
static const uint16_t IGNORE_CHECKSUM = 0xbb0;
/** The size of the header of a gomspace CSP packet. */
static const uint8_t GS_HDR_LENGTH = 12;
/** CSP port to ping gomspace devices. */
static const uint8_t PING_PORT = 1;
static const uint8_t REBOOT_PORT = 4;
/** CSP port of gomspace devices to request or set parameters */
static const uint8_t PARAM_PORT = 7;
static const uint8_t P60_PORT_GNDWDT_RESET = 9;
2021-12-17 10:45:55 +01:00
/**
* Device commands are derived from the rparam.h of the gomspace lib..
* IDs above 50 are reserved for device specific commands.
*/
2022-08-31 22:52:32 +02:00
static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND]
2022-08-26 00:39:06 +02:00
static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t NONE = 2; // Set when no command is pending
static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
2022-08-25 18:19:33 +02:00
static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND]
2022-08-31 22:52:32 +02:00
static const DeviceCommandId_t SAVE_TABLE_FILE = 18;
static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19;
2022-09-01 17:31:43 +02:00
static const DeviceCommandId_t LOAD_TABLE = 20;
2022-09-01 15:23:39 +02:00
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
2022-08-31 22:52:32 +02:00
2022-08-25 18:19:33 +02:00
// Not implemented yet
// static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND]
2022-05-23 11:25:58 +02:00
//! [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console
//! For the ACU device, only print voltages and currents of the 6 ACU channels
2021-09-20 11:47:19 +02:00
static const DeviceCommandId_t PRINT_SWITCH_V_I = 32;
static const DeviceCommandId_t PRINT_LATCHUPS = 33;
2021-09-16 14:51:14 +02:00
2022-08-26 00:39:06 +02:00
enum ParamRequestIds : uint8_t {
2022-08-25 18:19:33 +02:00
GET = 0x00,
REPLY = 0x55,
SET = 0xFF,
TABLE_SPEC = 0x44,
// Copy memory slot to memory slot
COPY = 0x77,
// Load from file to slot. Load from primary slot
LOAD = 0x88,
// Load by name(s)
LOAD_FROM_STORE = 0x89,
// Save to primary slot
SAVE = 0x99,
// Save by name(s)
SAVE_TO_STORE = 0x9a
};
2022-08-26 00:39:06 +02:00
enum TableIds : uint8_t { BOARD_PARAMS = 0, CONFIG = 1, CALIBRATION = 2, HK = 4 };
2022-08-25 18:19:33 +02:00
2022-01-18 11:41:19 +01:00
} // namespace GOMSPACE
2021-01-28 14:55:21 +01:00
2021-02-03 08:09:54 +01:00
namespace P60System {
2022-04-04 17:16:52 +02:00
enum class BatteryModes : uint8_t { CRITICAL = 1, SAFE = 2, NORMAL = 3, FULL = 4 };
2022-10-19 10:46:57 +02:00
enum class SetIds : uint32_t { CORE = 1, AUX = 2, CONFIG = 3 };
2022-04-07 12:53:51 +02:00
2022-08-27 01:02:08 +02:00
} // namespace P60System
namespace P60Dock {
2023-04-03 16:25:32 +02:00
static const uint16_t CONFIG_ADDRESS_OUT_EN_3V3_STACK = 0x71;
2022-12-21 13:40:31 +01:00
static const uint16_t CONFIG_ADDRESS_OUT_EN_5V_STACK = 0x72;
2022-04-04 17:16:52 +02:00
namespace pool {
enum Ids : lp_id_t {
2022-04-07 19:48:09 +02:00
P60_CURRENTS,
P60_VOLTAGES,
P60_OUTPUT_ENABLE,
2022-01-18 11:41:19 +01:00
P60DOCK_TEMPERATURE_1,
P60DOCK_TEMPERATURE_2,
P60DOCK_BOOT_CAUSE,
P60DOCK_BOOT_CNT,
P60DOCK_UPTIME,
P60DOCK_RESETCAUSE,
P60DOCK_BATT_MODE,
P60DOCK_HEATER_ON,
P60DOCK_CONV_5V_ENABLE_STATUS,
2022-04-04 17:16:52 +02:00
LATCHUPS,
P60DOCK_DOCK_VBAT,
P60DOCK_DOCK_VCC_CURRENT,
// Difference between charge and discharge
2022-01-18 11:41:19 +01:00
P60DOCK_BATTERY_CURRENT,
P60DOCK_BATTERY_VOLTAGE,
P60DOCK_BATTERY_TEMPERATURE_1,
P60DOCK_BATTERY_TEMPERATURE_2,
2022-04-04 17:16:52 +02:00
DEVICES_TYPE,
DEVICES_STATUS,
2022-01-18 11:41:19 +01:00
P60DOCK_DEVICE_TYPE_GROUP,
P60DOCK_DEVICE_STATUS_GROUP,
P60DOCK_DEARM_STATUS,
P60DOCK_WDT_CNT_GND,
P60DOCK_WDT_CNT_I2C,
P60DOCK_WDT_CNT_CAN,
P60DOCK_WDT_CNT_CSP_1,
P60DOCK_WDT_CNT_CSP_2,
P60DOCK_WDT_GND_LEFT,
P60DOCK_WDT_I2C_LEFT,
P60DOCK_WDT_CAN_LEFT,
P60DOCK_WDT_CSP_LEFT_1,
P60DOCK_WDT_CSP_LEFT_2,
P60DOCK_BATT_CHARGE_CURRENT,
P60DOCK_BATT_DISCHARGE_CURRENT,
P60DOCK_ANT6_DEPL,
P60DOCK_AR6_DEPL,
2021-09-07 16:11:02 +02:00
};
2021-02-03 08:09:54 +01:00
}
2021-02-14 15:49:03 +01:00
2022-04-04 17:16:52 +02:00
static constexpr uint8_t NUM_DEVS = 8;
namespace hk {
enum Index : uint8_t {
ACU_VCC = 0,
PDU1_VCC = 1,
X3_IDLE_VCC = 2,
PDU2_VCC = 3,
ACU_VBAT = 4,
PDU1_VBAT = 5,
X3_IDLE_VBAT = 6,
PDU2_VBAT = 7,
STACK_VBAT = 8,
STACK_3V3 = 9,
STACK_5V = 10,
GS3V3 = 11,
GS5V = 12,
CHNLS_LEN = 13
};
}
2022-01-27 16:04:45 +01:00
enum SwitchChannels : uint8_t {
ACU = 0,
PDU1 = 1,
X3_IDLE = 2,
PDU2_VCC = 3,
ACU_VBAT = 4,
PDU1_VBAT = 5,
X3_IDLE_VBAT = 6,
PDU2_VBAT = 7,
STACK_VBAT = 8,
STACK_3V3 = 9,
STACK_5V = 10,
GS3V3 = 11,
GS5V = 12
};
2021-09-07 16:11:02 +02:00
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 408;
static const uint16_t MAX_HKTABLE_ADDRESS = 187;
2022-08-25 18:48:07 +02:00
// Sources:
// GomSpace library lib/p60-dock_client/include/gs/p60-dock/param
2022-09-28 00:19:29 +02:00
static const uint16_t HK_TABLE_SIZE = gsConstants::P60DOCK_HK_SIZE;
static const uint16_t CONFIG_TABLE_SIZE = gsConstants::P60DOCK_PARAM_SIZE;
2022-08-26 14:28:06 +02:00
static const size_t MAX_REPLY_SIZE = CONFIG_TABLE_SIZE;
2022-08-25 18:48:07 +02:00
static const uint16_t CAL_TABLE = 0xAE;
2021-09-07 16:11:02 +02:00
static const uint8_t HK_TABLE_ENTRIES = 100;
2021-02-03 08:09:54 +01:00
2022-04-07 12:22:08 +02:00
class CoreHkSet : public StaticLocalDataSet<16> {
2022-01-18 11:41:19 +01:00
public:
2022-04-07 12:53:51 +02:00
CoreHkSet(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::CORE)) {}
2022-01-18 11:41:19 +01:00
2022-04-07 12:53:51 +02:00
CoreHkSet(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::CORE))) {}
2022-01-18 11:41:19 +01:00
/** Measured output currents */
2022-04-04 17:16:52 +02:00
lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN> currents =
2022-08-27 01:02:08 +02:00
lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::P60_CURRENTS, this);
2022-01-18 11:41:19 +01:00
/** Measured output voltages */
2022-04-04 17:16:52 +02:00
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN> voltages =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::P60_VOLTAGES, this);
2022-01-18 11:41:19 +01:00
/** Output enable states */
2022-04-04 17:16:52 +02:00
lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN> outputEnables =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::P60_OUTPUT_ENABLE, this);
lp_var_t<uint32_t> bootCount = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_BOOT_CNT, this);
lp_var_t<uint8_t> battMode = lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_BATT_MODE, this);
2022-04-07 12:22:08 +02:00
// Difference between charge and discharge current
lp_var_t<int16_t> batteryCurrent =
2022-08-27 01:02:08 +02:00
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATTERY_CURRENT, this);
2022-04-07 12:22:08 +02:00
lp_var_t<uint16_t> batteryVoltage =
2022-08-27 01:02:08 +02:00
lp_var_t<uint16_t>(sid.objectId, pool::P60DOCK_BATTERY_VOLTAGE, this);
2022-01-18 11:41:19 +01:00
2022-08-27 01:02:08 +02:00
lp_var_t<float> temperature1 = lp_var_t<float>(sid.objectId, pool::P60DOCK_TEMPERATURE_1, this);
lp_var_t<float> temperature2 = lp_var_t<float>(sid.objectId, pool::P60DOCK_TEMPERATURE_2, this);
2022-04-07 12:22:08 +02:00
};
/**
* @brief This class defines a dataset for the hk table of the P60 Dock.
* @details
* The GS port and X3 are not required for EIVE. X3 is another slot on the P60 dock and
* GS is required for a module from Gomspace which is not used.
*/
class HkTableDataset : public StaticLocalDataSet<32> {
public:
2022-04-07 12:53:51 +02:00
HkTableDataset(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::AUX)) {}
2022-04-07 12:22:08 +02:00
HkTableDataset(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::AUX))) {}
2022-04-07 12:53:51 +02:00
/** Number of detected latchups on each output channel */
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN> latchups =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, pool::LATCHUPS, this);
2022-01-18 11:41:19 +01:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> bootcause = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_BOOT_CAUSE, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_UPTIME, this);
lp_var_t<uint16_t> resetcause = lp_var_t<uint16_t>(sid.objectId, pool::P60DOCK_RESETCAUSE, this);
2022-04-07 12:22:08 +02:00
2022-01-18 11:41:19 +01:00
/** Battery heater control only possible on BP4 packs */
2023-05-16 11:36:19 +02:00
lp_var_t<uint8_t> heaterForBp4PackOn =
lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_HEATER_ON, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint8_t> converter5VStatus =
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_CONV_5V_ENABLE_STATUS, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint16_t> dockVbatVoltageValue =
2022-08-27 01:02:08 +02:00
lp_var_t<uint16_t>(sid.objectId, pool::P60DOCK_DOCK_VBAT, this);
lp_var_t<int16_t> dockVccCurrent =
2022-08-27 01:02:08 +02:00
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_DOCK_VCC_CURRENT, this);
2022-01-18 11:41:19 +01:00
lp_var_t<int16_t> batteryTemperature1 =
2022-08-27 01:02:08 +02:00
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATTERY_TEMPERATURE_1, this);
2022-01-18 11:41:19 +01:00
lp_var_t<int16_t> batteryTemperature2 =
2022-08-27 01:02:08 +02:00
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATTERY_TEMPERATURE_2, this);
2022-01-18 11:41:19 +01:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t> dearmStatus = lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_DEARM_STATUS, this);
2022-01-18 11:41:19 +01:00
/** Number of reboots due to gnd, i2c, csp watchdog timeout */
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> wdtCntGnd = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtCntI2c = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_I2C, this);
lp_var_t<uint32_t> wdtCntCan = lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_CAN, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint32_t> wdtCntCsp1 =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_CSP_1, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint32_t> wdtCntCsp2 =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CNT_CSP_2, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint32_t> wdtGndLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_GND_LEFT, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint32_t> wdtI2cLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_I2C_LEFT, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint32_t> wdtCanLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::P60DOCK_WDT_CAN_LEFT, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint8_t> wdtCspLeft1 =
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_WDT_CSP_LEFT_1, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint8_t> wdtCspLeft2 =
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t>(sid.objectId, pool::P60DOCK_WDT_CSP_LEFT_2, this);
2022-01-18 11:41:19 +01:00
lp_var_t<int16_t> batteryChargeCurrent =
2022-08-27 01:02:08 +02:00
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATT_CHARGE_CURRENT, this);
2022-01-18 11:41:19 +01:00
lp_var_t<int16_t> batteryDischargeCurrent =
2022-08-27 01:02:08 +02:00
lp_var_t<int16_t>(sid.objectId, pool::P60DOCK_BATT_DISCHARGE_CURRENT, this);
lp_var_t<int8_t> ant6Depl = lp_var_t<int8_t>(sid.objectId, pool::P60DOCK_ANT6_DEPL, this);
lp_var_t<int8_t> ar6Depl = lp_var_t<int8_t>(sid.objectId, pool::P60DOCK_AR6_DEPL, this);
2022-04-07 12:53:51 +02:00
lp_vec_t<uint8_t, P60Dock::NUM_DEVS> devicesType =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, pool::DEVICES_TYPE, this);
2022-04-07 12:53:51 +02:00
lp_vec_t<uint8_t, P60Dock::NUM_DEVS> devicesStatus =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, pool::DEVICES_STATUS, this);
2021-09-07 16:11:02 +02:00
};
2022-01-18 11:41:19 +01:00
} // namespace P60Dock
2021-01-28 14:55:21 +01:00
2021-02-03 08:09:54 +01:00
/**
* @brief Constants common for both PDU1 and PDU2.
*/
2022-01-18 11:41:19 +01:00
namespace PDU {
2022-08-26 14:28:06 +02:00
2022-08-27 01:02:08 +02:00
namespace pool {
enum Ids {
// IDs for both PDUs
PDU_CURRENTS,
PDU_VOLTAGES,
PDU_VCC,
PDU_VBAT,
PDU_TEMPERATURE,
PDU_CONV_EN,
PDU_OUT_ENABLE,
PDU_BOOTCAUSE,
PDU_BOOTCNT,
PDU_UPTIME,
PDU_RESETCAUSE,
PDU_BATT_MODE,
PDU_LATCHUPS,
PDU_DEVICES,
PDU_STATUSES,
PDU_WDT_CNT_GND,
PDU_WDT_CNT_I2C,
PDU_WDT_CNT_CAN,
PDU_WDT_CNT_CSP1,
PDU_WDT_CNT_CSP2,
PDU_WDT_GND_LEFT,
PDU_WDT_I2C_LEFT,
PDU_WDT_CAN_LEFT,
PDU_WDT_CSP_LEFT1,
PDU_WDT_CSP_LEFT2,
OUT_ON_CNT,
OUT_OFF_CNT,
INIT_OUT_NORM,
INIT_OUT_SAFE,
INIT_ON_DLY,
INIT_OFF_DLY,
SAFE_OFF_DLY,
CUR_LU_LIM,
CUR_LIM,
CUR_EMA,
OUT_LINK,
OUT_CONV,
OUT_VOLTAGE,
CONV_EN,
CUR_EMA_GAIN,
BATT_HWMAX,
BATT_MAX,
BATT_NORM,
BATT_SAFE,
BATT_CRIT,
WDT_I2C_RST,
WDT_CAN_RST,
WDT_I2C,
WDT_CAN,
WDT_CSP,
WDT_CSP_PING,
WDT_CSP_CHAN,
WDT_CSP_ADDR
};
}
2021-09-07 16:11:02 +02:00
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 316;
static const uint16_t MAX_HKTABLE_ADDRESS = 141;
/** The size of the csp reply containing the housekeeping table data */
2022-09-28 00:19:29 +02:00
static const uint16_t HK_TABLE_SIZE = gsConstants::P60PDU_HK_SIZE;
static const uint16_t CONFIG_TABLE_SIZE = gsConstants::P60PDU_PARAM_SIZE;
2022-08-26 14:28:06 +02:00
/** When retrieving full configuration parameter table */
static const uint16_t MAX_REPLY_SIZE = CONFIG_TABLE_SIZE;
2021-09-07 16:11:02 +02:00
static const uint8_t HK_TABLE_ENTRIES = 73;
2021-02-03 08:09:54 +01:00
2022-04-07 19:48:09 +02:00
static constexpr uint8_t CHANNELS_LEN = 9;
static constexpr uint8_t DEVICES_NUM = 8;
2022-01-19 18:05:17 +01:00
2022-04-07 19:48:09 +02:00
class PduCoreHk : public StaticLocalDataSet<9> {
public:
PduCoreHk(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
2022-01-19 18:05:17 +01:00
2022-04-07 19:48:09 +02:00
PduCoreHk(object_id_t objectId, uint32_t setId) : StaticLocalDataSet(sid_t(objectId, setId)) {}
/** Measured output currents */
2022-08-27 01:02:08 +02:00
lp_vec_t<int16_t, 9> currents = lp_vec_t<int16_t, 9>(sid.objectId, pool::PDU_CURRENTS, this);
2022-04-07 19:48:09 +02:00
/** Measured output currents */
2022-08-27 01:02:08 +02:00
lp_vec_t<int16_t, 9> voltages = lp_vec_t<int16_t, 9>(sid.objectId, pool::PDU_VOLTAGES, this);
2022-04-07 19:48:09 +02:00
/** Output switch states */
lp_vec_t<uint8_t, 9> outputEnables =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, 9>(sid.objectId, pool::PDU_OUT_ENABLE, this);
2022-04-07 19:48:09 +02:00
/** Number of reboots */
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> bootcount = lp_var_t<uint32_t>(sid.objectId, pool::PDU_BOOTCNT, this);
2022-04-07 19:48:09 +02:00
/** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t> battMode = lp_var_t<uint8_t>(sid.objectId, pool::PDU_BATT_MODE, this);
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId, pool::PDU_TEMPERATURE, this);
2023-05-31 09:53:13 +02:00
/** Measured VCC */
lp_var_t<int16_t> vcc = lp_var_t<int16_t>(sid.objectId, pool::PDU_VCC, this);
/** Measured VBAT */
lp_var_t<int16_t> vbat = lp_var_t<int16_t>(sid.objectId, pool::PDU_VBAT, this);
2022-08-27 01:02:08 +02:00
};
class PduConfig : public StaticLocalDataSet<32> {
public:
PduConfig(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
lp_vec_t<uint16_t, 9> outOnDelaySecs =
lp_vec_t<uint16_t, 9>(sid.objectId, pool::OUT_ON_CNT, this);
lp_vec_t<uint16_t, 9> outOffDelaySecs =
lp_vec_t<uint16_t, 9>(sid.objectId, pool::OUT_OFF_CNT, this);
lp_vec_t<uint8_t, 9> initOutNorm = lp_vec_t<uint8_t, 9>(sid.objectId, pool::INIT_OUT_NORM, this);
lp_vec_t<uint8_t, 9> initOutSafe = lp_vec_t<uint8_t, 9>(sid.objectId, pool::INIT_OUT_SAFE, this);
lp_vec_t<uint16_t, 9> initOnDly = lp_vec_t<uint16_t, 9>(sid.objectId, pool::INIT_ON_DLY, this);
lp_vec_t<uint16_t, 9> initOffDly = lp_vec_t<uint16_t, 9>(sid.objectId, pool::INIT_OFF_DLY, this);
lp_vec_t<uint8_t, 9> safeOffDly = lp_vec_t<uint8_t, 9>(sid.objectId, pool::SAFE_OFF_DLY, this);
lp_vec_t<uint16_t, 9> curLuLim = lp_vec_t<uint16_t, 9>(sid.objectId, pool::CUR_LU_LIM, this);
lp_vec_t<uint16_t, 9> curLim = lp_vec_t<uint16_t, 9>(sid.objectId, pool::CUR_LIM, this);
lp_vec_t<uint16_t, 9> curEma = lp_vec_t<uint16_t, 9>(sid.objectId, pool::CUR_EMA, this);
lp_vec_t<uint8_t, 9> outLink = lp_vec_t<uint8_t, 9>(sid.objectId, pool::OUT_LINK, this);
lp_vec_t<uint8_t, 9> outConv = lp_vec_t<uint8_t, 9>(sid.objectId, pool::OUT_CONV, this);
lp_vec_t<uint16_t, 9> outVoltage = lp_vec_t<uint16_t, 9>(sid.objectId, pool::OUT_VOLTAGE, this);
lp_vec_t<uint8_t, 9> convEnable = lp_vec_t<uint8_t, 9>(sid.objectId, pool::CONV_EN, this);
lp_var_t<float> curEmaGain = lp_var_t<float>(sid.objectId, pool::CUR_EMA_GAIN, this);
lp_var_t<uint16_t> battHwMax = lp_var_t<uint16_t>(sid.objectId, pool::BATT_HWMAX, this);
lp_var_t<uint16_t> battMax = lp_var_t<uint16_t>(sid.objectId, pool::BATT_MAX, this);
lp_var_t<uint16_t> battNorm = lp_var_t<uint16_t>(sid.objectId, pool::BATT_NORM, this);
lp_var_t<uint16_t> battSafe = lp_var_t<uint16_t>(sid.objectId, pool::BATT_SAFE, this);
lp_var_t<uint16_t> battCrit = lp_var_t<uint16_t>(sid.objectId, pool::BATT_CRIT, this);
lp_var_t<uint16_t> wdtI2cRst = lp_var_t<uint16_t>(sid.objectId, pool::WDT_I2C_RST, this);
lp_var_t<uint16_t> wdtCanRst = lp_var_t<uint16_t>(sid.objectId, pool::WDT_CAN_RST, this);
lp_var_t<uint32_t> wdtI2c = lp_var_t<uint32_t>(sid.objectId, pool::WDT_I2C, this);
lp_var_t<uint32_t> wdtCan = lp_var_t<uint32_t>(sid.objectId, pool::WDT_CAN, this);
lp_vec_t<uint32_t, 2> wdtCsp = lp_vec_t<uint32_t, 2>(sid.objectId, pool::WDT_CSP, this);
lp_vec_t<uint8_t, 2> wdtCspPing = lp_vec_t<uint8_t, 2>(sid.objectId, pool::WDT_CSP_PING, this);
lp_vec_t<uint8_t, 2> wdtCspChannel = lp_vec_t<uint8_t, 2>(sid.objectId, pool::WDT_CSP_CHAN, this);
lp_vec_t<uint8_t, 2> wdtCspAddr = lp_vec_t<uint8_t, 2>(sid.objectId, pool::WDT_CSP_ADDR, this);
2022-04-07 19:48:09 +02:00
};
2021-09-07 16:11:02 +02:00
/**
2022-04-07 19:48:09 +02:00
* @brief This class defines a dataset for the hk table of a PDU
2021-09-07 16:11:02 +02:00
*/
2022-04-07 19:48:09 +02:00
class PduAuxHk : public StaticLocalDataSet<36> {
2022-01-18 11:41:19 +01:00
public:
2022-04-07 19:48:09 +02:00
PduAuxHk(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
2022-01-18 11:41:19 +01:00
2022-04-07 19:48:09 +02:00
PduAuxHk(object_id_t objectId, uint32_t setId) : StaticLocalDataSet(sid_t(objectId, setId)) {}
2022-01-18 11:41:19 +01:00
/** Output converter enable status */
2022-04-12 16:36:04 +02:00
lp_vec_t<uint8_t, 3> converterEnable =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, 3>(sid.objectId, pool::PDU_CONV_EN, this);
2022-04-07 19:48:09 +02:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> bootcause = lp_var_t<uint32_t>(sid.objectId, pool::PDU_BOOTCAUSE, this);
2022-04-07 19:48:09 +02:00
2022-01-18 11:41:19 +01:00
/** Uptime in seconds */
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, pool::PDU_UPTIME, this);
lp_var_t<uint16_t> resetcause = lp_var_t<uint16_t>(sid.objectId, pool::PDU_RESETCAUSE, this);
2022-01-18 11:41:19 +01:00
/** Number of detected latchups on each output channel */
2022-08-27 01:02:08 +02:00
lp_vec_t<uint16_t, 9> latchups = lp_vec_t<uint16_t, 9>(sid.objectId, pool::PDU_LATCHUPS, this);
2022-01-18 11:41:19 +01:00
/**
* There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is
* identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18.
*/
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, 8> deviceTypes = lp_vec_t<uint8_t, 8>(sid.objectId, pool::PDU_DEVICES, this);
2022-01-18 11:41:19 +01:00
/** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, 8> devicesStatus = lp_vec_t<uint8_t, 8>(sid.objectId, pool::PDU_STATUSES, this);
2022-01-18 11:41:19 +01:00
/** Number of reboots triggered by the ground watchdog */
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> gndWdtReboots = lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_CNT_GND, this);
2022-01-18 11:41:19 +01:00
/** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> i2cWdtReboots = lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_CNT_I2C, this);
2022-01-18 11:41:19 +01:00
/** Number of reboots triggered through the CAN watchdog */
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> canWdtReboots = lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_CNT_CAN, this);
2022-01-18 11:41:19 +01:00
/** Number of reboots triggered through the CSP watchdog */
lp_var_t<uint32_t> csp1WdtReboots =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_CNT_CSP1, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint32_t> csp2WdtReboots =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_CNT_CSP2, this);
2022-01-18 11:41:19 +01:00
/** Ground watchdog remaining seconds before rebooting */
lp_var_t<uint32_t> groundWatchdogSecondsLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_GND_LEFT, this);
2022-01-18 11:41:19 +01:00
/** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWatchdogSecondsLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_I2C_LEFT, this);
2022-01-18 11:41:19 +01:00
/** CAN watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> canWatchdogSecondsLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t>(sid.objectId, pool::PDU_WDT_CAN_LEFT, this);
2022-01-18 11:41:19 +01:00
/** CSP watchdogs remaining pings before rebooting. */
lp_var_t<uint8_t> csp2WatchdogPingsLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t>(sid.objectId, pool::PDU_WDT_CSP_LEFT1, this);
2022-01-18 11:41:19 +01:00
lp_var_t<uint8_t> csp1WatchdogPingsLeft =
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t>(sid.objectId, pool::PDU_WDT_CSP_LEFT2, this);
2022-04-07 19:48:09 +02:00
};
} // namespace PDU
namespace PDU1 {
enum Channels : uint8_t {
TCS_BOARD_3V3 = 0,
SYRLINKS = 1,
STR = 2,
MGT = 3,
SUS_NOMINAL = 4,
SOL_CELL_EXPERIMENT = 5,
PLOC = 6,
ACS_A_SIDE = 7,
UNUSED = 8,
LEN = 9
};
/**
* Addresses within configuration table to enable or disable output channels. Refer also to
* gs-man-nanopower-p60-pdu-200.pdf on page 16.
*/
static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3 = 0x48;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SYRLINKS = 0x49;
static const uint16_t CONFIG_ADDRESS_OUT_EN_STAR_TRACKER = 0x4A;
static const uint16_t CONFIG_ADDRESS_OUT_EN_MGT = 0x4B;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL = 0x4C;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP = 0x4D;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PLOC = 0x4E;
static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A = 0x4F;
static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x50;
class Pdu1CoreHk : public ::PDU::PduCoreHk {
public:
Pdu1CoreHk(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: PduCoreHk(owner, static_cast<uint32_t>(::P60System::SetIds::CORE)) {}
2022-04-07 19:48:09 +02:00
Pdu1CoreHk(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: PduCoreHk(objectId, static_cast<uint32_t>(::P60System::SetIds::CORE)) {}
2022-04-07 19:48:09 +02:00
};
class Pdu1AuxHk : public ::PDU::PduAuxHk {
public:
Pdu1AuxHk(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: PduAuxHk(owner, static_cast<uint32_t>(::P60System::SetIds::AUX)) {}
2022-04-07 19:48:09 +02:00
Pdu1AuxHk(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::AUX)) {}
2021-09-07 16:11:02 +02:00
};
2022-04-07 19:48:09 +02:00
2022-08-27 01:02:08 +02:00
class Pdu1Config : public ::PDU::PduConfig {
public:
Pdu1Config(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: PduConfig(owner, static_cast<uint32_t>(::P60System::SetIds::CONFIG)) {}
2022-08-27 01:02:08 +02:00
};
2022-01-18 11:41:19 +01:00
} // namespace PDU1
2021-01-28 14:55:21 +01:00
namespace PDU2 {
2022-01-19 18:05:17 +01:00
2022-04-07 19:48:09 +02:00
enum Channels : uint8_t {
2022-01-19 18:05:17 +01:00
Q7S = 0,
PAYLOAD_PCDU_CH1 = 1,
RW = 2,
TCS_HEATER_IN = 3,
SUS_REDUNDANT = 4,
DEPY_MECHANISM = 5,
PAYLOAD_PCDU_CH6 = 6,
ACS_B_SIDE = 7,
2022-04-07 19:48:09 +02:00
PAYLOAD_CAMERA = 8,
LEN = 9
2022-01-19 18:05:17 +01:00
};
2021-09-07 16:11:02 +02:00
/**
* Addresses within configuration table to enable or disable output channels. Refer also to
* gs-man-nanopower-p60-pdu-200.pdf on page 16.
*/
static const uint16_t CONFIG_ADDRESS_OUT_EN_Q7S = 0x48;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1 = 0x49;
static const uint16_t CONFIG_ADDRESS_OUT_EN_RW = 0x4A;
static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN = 0x4B;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT = 0x4C;
static const uint16_t CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM = 0x4D;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6 = 0x4E;
2021-09-07 16:11:02 +02:00
static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B = 0x4F;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50;
2022-04-07 19:48:09 +02:00
class Pdu2CoreHk : public ::PDU::PduCoreHk {
2022-01-18 11:41:19 +01:00
public:
2022-04-07 19:48:09 +02:00
Pdu2CoreHk(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: PduCoreHk(owner, static_cast<uint32_t>(::P60System::SetIds::CORE)) {}
2022-01-18 11:41:19 +01:00
2022-04-07 19:48:09 +02:00
Pdu2CoreHk(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: PduCoreHk(objectId, static_cast<uint32_t>(::P60System::SetIds::CORE)) {}
2022-04-07 19:48:09 +02:00
};
2022-01-18 11:41:19 +01:00
2022-04-07 19:48:09 +02:00
class Pdu2AuxHk : public ::PDU::PduAuxHk {
public:
Pdu2AuxHk(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: PduAuxHk(owner, static_cast<uint32_t>(::P60System::SetIds::AUX)) {}
2022-01-18 11:41:19 +01:00
2022-04-07 19:48:09 +02:00
Pdu2AuxHk(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::AUX)) {}
2021-09-07 16:11:02 +02:00
};
2022-04-07 19:48:09 +02:00
2022-08-27 01:02:08 +02:00
class Pdu2Config : public ::PDU::PduConfig {
public:
Pdu2Config(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: PduConfig(owner, static_cast<uint32_t>(::P60System::SetIds::CONFIG)) {}
2022-08-27 01:02:08 +02:00
};
2022-01-18 11:41:19 +01:00
} // namespace PDU2
2020-12-20 17:35:03 +01:00
2021-01-28 14:55:21 +01:00
namespace ACU {
2021-02-03 08:09:54 +01:00
2022-08-27 01:02:08 +02:00
namespace pool {
enum Ids : lp_id_t {
/** ACU Ids */
ACU_CURRENT_IN_CHANNELS,
ACU_VOLTAGE_IN_CHANNELS,
ACU_VCC,
ACU_VBAT,
ACU_TEMPERATURES,
ACU_MPPT_MODE,
ACU_VBOOST_IN_CHANNELS,
ACU_POWER_IN_CHANNELS,
ACU_DAC_ENABLES,
ACU_DAC_RAW_CHANNELS,
ACU_BOOTCAUSE,
ACU_BOOTCNT,
ACU_UPTIME,
ACU_RESET_CAUSE,
ACU_MPPT_TIME,
ACU_MPPT_PERIOD,
ACU_DEVICES,
ACU_DEVICES_STATUS,
ACU_WDT_CNT_GND,
ACU_WDT_GND_LEFT
};
}
2021-09-07 16:11:02 +02:00
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 26;
static const uint16_t MAX_HKTABLE_ADDRESS = 120;
static const uint8_t HK_TABLE_ENTRIES = 64;
2022-09-28 00:19:29 +02:00
static const uint16_t HK_TABLE_SIZE = gsConstants::P60ACU_HK_SIZE;
static const uint16_t CONFIG_TABLE_SIZE = gsConstants::P60ACU_PARAM_SIZE;
2022-08-26 14:28:06 +02:00
static const size_t MAX_REPLY_SIZE = HK_TABLE_SIZE;
2021-02-03 08:09:54 +01:00
2022-05-23 11:25:58 +02:00
class CoreHk : public StaticLocalDataSet<14> {
public:
2022-05-23 10:42:57 +02:00
CoreHk(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::CORE)) {}
2022-01-18 11:41:19 +01:00
2022-05-23 10:42:57 +02:00
CoreHk(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::CORE))) {}
2022-05-23 10:42:57 +02:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint8_t> mpptMode = lp_var_t<uint8_t>(sid.objectId, pool::ACU_MPPT_MODE, this);
2022-05-23 10:42:57 +02:00
lp_vec_t<int16_t, 6> currentInChannels =
2022-08-27 01:02:08 +02:00
lp_vec_t<int16_t, 6>(sid.objectId, pool::ACU_CURRENT_IN_CHANNELS, this);
2022-05-23 10:42:57 +02:00
lp_vec_t<uint16_t, 6> voltageInChannels =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_VOLTAGE_IN_CHANNELS, this);
2022-01-18 11:41:19 +01:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint16_t> vcc = lp_var_t<uint16_t>(sid.objectId, pool::ACU_VCC, this);
lp_var_t<uint16_t> vbat = lp_var_t<uint16_t>(sid.objectId, pool::ACU_VBAT, this);
2022-01-18 11:41:19 +01:00
2022-05-23 10:42:57 +02:00
lp_vec_t<uint16_t, 6> vboostInChannels =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_VBOOST_IN_CHANNELS, this);
2022-05-23 10:42:57 +02:00
lp_vec_t<uint16_t, 6> powerInChannels =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_POWER_IN_CHANNELS, this);
2022-01-18 11:41:19 +01:00
2022-08-27 01:02:08 +02:00
lp_vec_t<float, 3> temperatures = lp_vec_t<float, 3>(sid.objectId, pool::ACU_TEMPERATURES, this);
2022-01-18 11:41:19 +01:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> bootcnt = lp_var_t<uint32_t>(sid.objectId, pool::ACU_BOOTCNT, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, pool::ACU_UPTIME, this);
lp_var_t<uint16_t> mpptTime = lp_var_t<uint16_t>(sid.objectId, pool::ACU_MPPT_TIME, this);
lp_var_t<uint16_t> mpptPeriod = lp_var_t<uint16_t>(sid.objectId, pool::ACU_MPPT_PERIOD, this);
2022-05-23 10:42:57 +02:00
};
/**
* @brief This class defines a dataset for the hk table of the ACU.
*/
class AuxHk : public StaticLocalDataSet<12> {
public:
AuxHk(HasLocalDataPoolIF* owner)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::AUX)) {}
2022-05-23 10:42:57 +02:00
AuxHk(object_id_t objectId)
2022-10-18 11:01:33 +02:00
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::AUX))) {}
2022-05-23 10:42:57 +02:00
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, 3> dacEnables = lp_vec_t<uint8_t, 3>(sid.objectId, pool::ACU_DAC_ENABLES, this);
2022-05-23 10:42:57 +02:00
2022-05-23 14:19:57 +02:00
lp_vec_t<uint16_t, 6> dacRawChannelVals =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint16_t, 6>(sid.objectId, pool::ACU_DAC_RAW_CHANNELS, this);
2022-05-23 10:42:57 +02:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> bootCause = lp_var_t<uint32_t>(sid.objectId, pool::ACU_BOOTCAUSE, this);
lp_var_t<uint16_t> resetCause = lp_var_t<uint16_t>(sid.objectId, pool::ACU_RESET_CAUSE, this);
2022-05-23 10:42:57 +02:00
2022-08-27 01:02:08 +02:00
lp_var_t<uint32_t> wdtCntGnd = lp_var_t<uint32_t>(sid.objectId, pool::ACU_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtGndLeft = lp_var_t<uint32_t>(sid.objectId, pool::ACU_WDT_GND_LEFT, this);
2022-05-23 12:39:10 +02:00
2022-05-23 10:42:57 +02:00
/**
* There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is
* identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18.
*/
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, 8> deviceTypes = lp_vec_t<uint8_t, 8>(sid.objectId, pool::ACU_DEVICES, this);
2022-05-23 10:42:57 +02:00
/** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */
lp_vec_t<uint8_t, 8> devicesStatus =
2022-08-27 01:02:08 +02:00
lp_vec_t<uint8_t, 8>(sid.objectId, pool::ACU_DEVICES_STATUS, this);
2021-09-07 16:11:02 +02:00
};
2022-01-18 11:41:19 +01:00
} // namespace ACU
2020-12-20 17:35:03 +01:00
2022-04-07 19:48:09 +02:00
namespace pcdu {
2023-04-03 16:25:32 +02:00
enum PoolIds : uint32_t { PDU1_SWITCHES, PDU2_SWITCHES, P60DOCK_5V, P60DOCK_3V3 };
2022-04-07 19:48:09 +02:00
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
// Output states after reboot of the PDUs
const std::array<uint8_t, PDU::CHANNELS_LEN> INIT_SWITCHES_PDU1 = {
// Because the TE0720 is not connected to the PCDU, this switch is always on
#ifdef TE0720_1CFA
ON,
#else
OFF,
#endif
OFF, OFF, OFF, OFF, OFF, OFF, OFF, OFF,
};
const std::array<uint8_t, PDU::CHANNELS_LEN> INIT_SWITCHES_PDU2 = {ON, OFF, OFF, OFF, OFF,
OFF, OFF, OFF, OFF};
static constexpr uint32_t SWITCHER_SET_ID = 0;
2023-03-16 18:47:51 +01:00
class SwitcherStates : public StaticLocalDataSet<power::NUMBER_OF_SWITCHES> {
2022-04-07 19:48:09 +02:00
public:
SwitcherStates(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SWITCHER_SET_ID) {}
SwitcherStates(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, SWITCHER_SET_ID)) {}
lp_vec_t<uint8_t, PDU::CHANNELS_LEN> pdu1Switches =
lp_vec_t<uint8_t, PDU::CHANNELS_LEN>(sid.objectId, PDU1_SWITCHES, this);
lp_vec_t<uint8_t, PDU::CHANNELS_LEN> pdu2Switches =
lp_vec_t<uint8_t, PDU::CHANNELS_LEN>(sid.objectId, PDU2_SWITCHES, this);
2023-04-03 16:25:32 +02:00
lp_var_t<uint8_t> p60Dock5VStack = lp_var_t<uint8_t>(sid.objectId, P60DOCK_5V, this);
lp_var_t<uint8_t> p60Dock3V3Stack = lp_var_t<uint8_t>(sid.objectId, P60DOCK_3V3, this);
2022-04-07 19:48:09 +02:00
};
} // namespace pcdu
2023-03-26 16:13:54 +02:00
#endif /* MISSION_POWER_GSDEFS_H_ */