|
|
@@ -8,7 +8,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace BpxBattery {
|
|
|
|
namespace BpxBattery {
|
|
|
|
|
|
|
|
|
|
|
|
enum BpxPoolIds {
|
|
|
|
enum HkPoolIds {
|
|
|
|
CHARGE_CURRENT = 0,
|
|
|
|
CHARGE_CURRENT = 0,
|
|
|
|
DISCHARGE_CURRENT = 1,
|
|
|
|
DISCHARGE_CURRENT = 1,
|
|
|
|
HEATER_CURRENT = 2,
|
|
|
|
HEATER_CURRENT = 2,
|
|
|
@@ -21,7 +21,21 @@ enum BpxPoolIds {
|
|
|
|
BOOTCAUSE = 9
|
|
|
|
BOOTCAUSE = 9
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum CfgPoolIds { BATTERY_HEATER_MODE = 0, BATTHEAT_LOW_LIMIT = 1, BATTHEAT_HIGH_LIMIT = 2 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t READ_HK = 0;
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t PING = 1;
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t REBOOT = 2;
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t RESET_COUNTERS = 3;
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t RESTORE_DEFAULT_CONFIG = 4;
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t READ_CONFIG = 5;
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t WRITE_CONFIG = 6;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t MANUAL_HEATER_ON = 10;
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t MANUAL_HEATER_OFF = 11;
|
|
|
|
|
|
|
|
|
|
|
|
static constexpr uint32_t HK_SET_ID = 0;
|
|
|
|
static constexpr uint32_t HK_SET_ID = 0;
|
|
|
|
|
|
|
|
static constexpr uint32_t CFG_SET_ID = 1;
|
|
|
|
|
|
|
|
|
|
|
|
static constexpr uint8_t PORT_PING = 1;
|
|
|
|
static constexpr uint8_t PORT_PING = 1;
|
|
|
|
static constexpr uint8_t PORT_REBOOT = 4;
|
|
|
|
static constexpr uint8_t PORT_REBOOT = 4;
|
|
|
@@ -34,7 +48,7 @@ static constexpr uint8_t PORT_MAN_HEAT_ON = 20;
|
|
|
|
static constexpr uint8_t PORT_MAN_HEAT_OFF = 21;
|
|
|
|
static constexpr uint8_t PORT_MAN_HEAT_OFF = 21;
|
|
|
|
|
|
|
|
|
|
|
|
static constexpr uint8_t HK_ENTRIES = 10;
|
|
|
|
static constexpr uint8_t HK_ENTRIES = 10;
|
|
|
|
|
|
|
|
static constexpr uint8_t CFG_ENTRIES = 3;
|
|
|
|
|
|
|
|
|
|
|
|
// Taken from BPX manual 3.14
|
|
|
|
// Taken from BPX manual 3.14
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
@@ -46,7 +60,6 @@ typedef struct __attribute__((packed)) {
|
|
|
|
//! Turn heater off at [degC]
|
|
|
|
//! Turn heater off at [degC]
|
|
|
|
} bpx_config_t;
|
|
|
|
} bpx_config_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! Not used for more but might still be useful
|
|
|
|
//! Not used for more but might still be useful
|
|
|
|
class BpxHkDeserializer : public SerialLinkedListAdapter<SerializeIF> {
|
|
|
|
class BpxHkDeserializer : public SerialLinkedListAdapter<SerializeIF> {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
@@ -88,11 +101,12 @@ class BpxHkDeserializer : public SerialLinkedListAdapter<SerializeIF> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; // namespace BpxBattery
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief BPX HK data holder
|
|
|
|
* @brief BPX HK data holder
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class BpxBatteryHk : public StaticLocalDataSet<HK_ENTRIES> {
|
|
|
|
class BpxBatteryHk : public StaticLocalDataSet<BpxBattery::HK_ENTRIES> {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Constructor for data users
|
|
|
|
* Constructor for data users
|
|
|
@@ -148,38 +162,36 @@ class BpxBatteryHk : public StaticLocalDataSet<HK_ENTRIES> {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BpxBatteryHk();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
//! Charge current in mA
|
|
|
|
//! Charge current in mA
|
|
|
|
lp_var_t<uint16_t> chargeCurrent =
|
|
|
|
lp_var_t<uint16_t> chargeCurrent =
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::BpxPoolIds::CHARGE_CURRENT, this);
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::HkPoolIds::CHARGE_CURRENT, this);
|
|
|
|
//! Discharge current in mA
|
|
|
|
//! Discharge current in mA
|
|
|
|
lp_var_t<uint16_t> dischargeCurrent =
|
|
|
|
lp_var_t<uint16_t> dischargeCurrent =
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::BpxPoolIds::DISCHARGE_CURRENT, this);
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::HkPoolIds::DISCHARGE_CURRENT, this);
|
|
|
|
//! Heater current in mA
|
|
|
|
//! Heater current in mA
|
|
|
|
lp_var_t<uint16_t> heaterCurrent =
|
|
|
|
lp_var_t<uint16_t> heaterCurrent =
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::BpxPoolIds::HEATER_CURRENT, this);
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::HkPoolIds::HEATER_CURRENT, this);
|
|
|
|
|
|
|
|
|
|
|
|
//! Battery voltage in mV
|
|
|
|
//! Battery voltage in mV
|
|
|
|
lp_var_t<uint16_t> battVoltage =
|
|
|
|
lp_var_t<uint16_t> battVoltage =
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::BpxPoolIds::BATT_VOLTAGE, this);
|
|
|
|
lp_var_t<uint16_t>(sid.objectId, BpxBattery::HkPoolIds::BATT_VOLTAGE, this);
|
|
|
|
//! Battery temperature 1 in degC
|
|
|
|
//! Battery temperature 1 in degC
|
|
|
|
SerializeElement<int16_t> battTemp1 =
|
|
|
|
SerializeElement<int16_t> battTemp1 =
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::BpxPoolIds::BATT_TEMP_1, this);
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_1, this);
|
|
|
|
//! Battery temperature 2 in degC
|
|
|
|
//! Battery temperature 2 in degC
|
|
|
|
SerializeElement<int16_t> battTemp2 =
|
|
|
|
SerializeElement<int16_t> battTemp2 =
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::BpxPoolIds::BATT_TEMP_2, this);
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_2, this);
|
|
|
|
//! Battery temperature 3 in degC
|
|
|
|
//! Battery temperature 3 in degC
|
|
|
|
SerializeElement<int16_t> battTemp3 =
|
|
|
|
SerializeElement<int16_t> battTemp3 =
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::BpxPoolIds::BATT_TEMP_3, this);
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_3, this);
|
|
|
|
//! Battery temperature 4 in degC
|
|
|
|
//! Battery temperature 4 in degC
|
|
|
|
SerializeElement<int16_t> battTemp4 =
|
|
|
|
SerializeElement<int16_t> battTemp4 =
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::BpxPoolIds::BATT_TEMP_4, this);
|
|
|
|
lp_var_t<int16_t>(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_4, this);
|
|
|
|
SerializeElement<uint32_t> rebootCounter =
|
|
|
|
SerializeElement<uint32_t> rebootCounter =
|
|
|
|
lp_var_t<uint32_t>(sid.objectId, BpxBattery::BpxPoolIds::REBOOT_COUNTER, this);
|
|
|
|
lp_var_t<uint32_t>(sid.objectId, BpxBattery::HkPoolIds::REBOOT_COUNTER, this);
|
|
|
|
SerializeElement<uint8_t> bootcause =
|
|
|
|
SerializeElement<uint8_t> bootcause =
|
|
|
|
lp_var_t<uint8_t>(sid.objectId, BpxBattery::BpxPoolIds::BOOTCAUSE, this);
|
|
|
|
lp_var_t<uint8_t>(sid.objectId, BpxBattery::HkPoolIds::BOOTCAUSE, this);
|
|
|
|
|
|
|
|
|
|
|
|
friend class BpxBatteryHandler;
|
|
|
|
friend class BpxBatteryHandler;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@@ -189,6 +201,44 @@ class BpxBatteryHk : public StaticLocalDataSet<HK_ENTRIES> {
|
|
|
|
BpxBatteryHk(HasLocalDataPoolIF* hkOwner) : StaticLocalDataSet(hkOwner, BpxBattery::HK_SET_ID) {}
|
|
|
|
BpxBatteryHk(HasLocalDataPoolIF* hkOwner) : StaticLocalDataSet(hkOwner, BpxBattery::HK_SET_ID) {}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BpxBatteryCfg : public StaticLocalDataSet<BpxBattery::CFG_ENTRIES> {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Constructor for data users
|
|
|
|
|
|
|
|
* @param gyroId
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
BpxBatteryCfg(object_id_t bpxId) : StaticLocalDataSet(sid_t(bpxId, BpxBattery::CFG_SET_ID)) {
|
|
|
|
|
|
|
|
setAllVariablesReadOnly();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReturnValue_t parseRawHk(const uint8_t* data, size_t size) {
|
|
|
|
|
|
|
|
if (size < 3) {
|
|
|
|
|
|
|
|
return SerializeIF::STREAM_TOO_SHORT;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
battheatermode.value = data[0];
|
|
|
|
|
|
|
|
battheaterLow.value = data[1];
|
|
|
|
|
|
|
|
battheaterHigh.value = data[2];
|
|
|
|
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! Mode for battheater [0=OFF,1=Auto]
|
|
|
|
|
|
|
|
lp_var_t<uint8_t> battheatermode =
|
|
|
|
|
|
|
|
lp_var_t<uint8_t>(sid.objectId, BpxBattery::CfgPoolIds::BATTERY_HEATER_MODE, this);
|
|
|
|
|
|
|
|
//! Turn heater on at [degC]
|
|
|
|
|
|
|
|
lp_var_t<int8_t> battheaterLow =
|
|
|
|
|
|
|
|
lp_var_t<int8_t>(sid.objectId, BpxBattery::CfgPoolIds::BATTHEAT_LOW_LIMIT, this);
|
|
|
|
|
|
|
|
//! Turn heater off at [degC]
|
|
|
|
|
|
|
|
lp_var_t<int8_t> battheaterHigh =
|
|
|
|
|
|
|
|
lp_var_t<int8_t>(sid.objectId, BpxBattery::CfgPoolIds::BATTHEAT_HIGH_LIMIT, this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
friend class BpxBatteryHandler;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Constructor for data creator
|
|
|
|
|
|
|
|
* @param hkOwner
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
BpxBatteryCfg(HasLocalDataPoolIF* hkOwner)
|
|
|
|
|
|
|
|
: StaticLocalDataSet(hkOwner, BpxBattery::CFG_SET_ID) {}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_ */
|
|
|
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_ */
|
|
|
|