new event for battery mode: broadcast and changed
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-04-07 13:07:28 +02:00
parent 5e4c3728ed
commit 64b3afae22
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 27 additions and 1 deletions

View File

@ -24,6 +24,10 @@ enum: uint8_t {
ACS_BOARD_ASS = 123,
SUS_BOARD_ASS = 124,
TCS_BOARD_ASS = 125,
P60_DOCK_HANDLER = 126,
PDU1_HANDLER = 127,
PDU2_HANDLER = 128,
ACU_HANDLER = 129,
COMMON_SUBSYSTEM_ID_END
};
}

View File

@ -116,8 +116,16 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.resetcause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
coreHk.battMode = *(packet + dataOffset);
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;
dataOffset += 3;
auxHk.heaterOn = *(packet + dataOffset);
/* + 13 because here begins a new gomspace csp data field */
@ -195,6 +203,9 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
auxHk.ant6Depl = *(packet + dataOffset);
dataOffset += 3;
auxHk.ar6Depl = *(packet + dataOffset);
if (firstHk) {
firstHk = false;
}
coreHk.setValidity(true, true);
auxHk.setValidity(true, true);
}

View File

@ -4,6 +4,7 @@
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include "GomspaceDeviceHandler.h"
#include "commonSubsystemIds.h"
/**
* @brief Device handler for the P60Dock. The P60Dock serves as carrier for the ACU, PDU1 and
@ -11,6 +12,13 @@
*/
class P60DockHandler : public GomspaceDeviceHandler {
public:
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::P60_DOCK_HANDLER;
//! [EXPORT] : [COMMENT] Battery mode is broadcasted at startup. P1: Mode
static constexpr Event BATT_MODE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Battery mode has changed. P1: Old mode. P2: New mode
static constexpr Event BATT_MODE_CHANGED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie);
virtual ~P60DockHandler();
@ -39,6 +47,7 @@ class P60DockHandler : public GomspaceDeviceHandler {
private:
P60Dock::CoreHkSet coreHk;
P60Dock::HkTableDataset auxHk;
bool firstHk = true;
static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 16;
PoolEntry<int16_t> hkCurrents = PoolEntry<int16_t>(P60Dock::hk::CHNLS_LEN);

View File

@ -43,6 +43,8 @@ static const DeviceCommandId_t PRINT_LATCHUPS = 33;
namespace P60System {
enum class BatteryModes : uint8_t { CRITICAL = 1, SAFE = 2, NORMAL = 3, FULL = 4 };
enum class SetIds : uint32_t { PDU_1 = 1, PDU_2 = 2, P60_CORE = 3, P60_AUX = 4, ACU = 5 };
namespace pool {