added HK deserializer

This commit is contained in:
Robin Müller 2022-01-17 16:21:33 +01:00
parent a9cd072acd
commit 1d6f999ab6
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 66 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#ifndef MISSION_DEVICES_BPXBATTERYHANDLER_H_ #ifndef MISSION_DEVICES_BPXBATTERYHANDLER_H_
#define MISSION_DEVICES_BPXBATTERYHANDLER_H_ #define MISSION_DEVICES_BPXBATTERYHANDLER_H_
#include "devicedefinitions/BpxBatteryDefinitions.h"
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
class BpxBatteryHandler : public DeviceHandlerBase { class BpxBatteryHandler : public DeviceHandlerBase {

View File

@ -1,8 +1,72 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_
#include <fsfw/serialize/SerialLinkedListAdapter.h>
#include <cstdint>
namespace BpxBattery { namespace BpxBattery {
static constexpr uint8_t PORT_PING = 1;
static constexpr uint8_t PORT_REBOOT = 4;
static constexpr uint8_t PORT_GET_HK = 9;
static constexpr uint8_t PORT_RESET_COUNTERS = 15;
static constexpr uint8_t PORT_CONFIG_CMD = 17;
static constexpr uint8_t PORT_CONFIG_GET = 18;
static constexpr uint8_t PORT_CONFIG_SET = 19;
static constexpr uint8_t PORT_MAN_HEAT_ON = 20;
static constexpr uint8_t PORT_MAN_HEAT_OFF = 21;
// Taken from BPX manual 3.14
typedef struct __attribute__((packed)) {
//! Mode for battheater [0=OFF,1=Auto]
uint8_t battheater_mode;
int8_t battheater_low;
//! Turn heater on at [degC]
int8_t battheater_high;
//! Turn heater off at [degC]
} bpx_config_t;
class BpxHkDeserializer: public SerialLinkedListAdapter<SerializeIF> {
public:
BpxHkDeserializer() {
setLinks();
}
//! Charge current in mA
SerializeElement<uint16_t> chargeCurrent;
//! Discharge current in mA
SerializeElement<uint16_t> dischargeCurrent;
//! Heater current in mA
SerializeElement<uint16_t> heaterCurrent;
//! Battery voltage in mV
SerializeElement<uint16_t> battVoltage;
//! Battery temperature 1 in degC
SerializeElement<uint16_t> battTemp1;
//! Battery temperature 2 in degC
SerializeElement<uint16_t> battTemp2;
//! Battery temperature 3 in degC
SerializeElement<uint16_t> battTemp3;
//! Battery temperature 4 in degC
SerializeElement<uint16_t> battTemp4;
SerializeElement<uint32_t> rebootCounter;
SerializeElement<uint8_t> bootcause;
private:
void setLinks() {
setStart(&chargeCurrent);
chargeCurrent.setNext(&dischargeCurrent);
dischargeCurrent.setNext(&heaterCurrent);
heaterCurrent.setNext(&battVoltage);
battVoltage.setNext(&battTemp1);
battTemp1.setNext(&battTemp2);
battTemp2.setNext(&battTemp3);
battTemp3.setNext(&battTemp4);
battTemp4.setNext(&rebootCounter);
rebootCounter.setNext(&bootcause);
}
};
} }
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_BPXBATTERYDEFINITIONS_H_ */