From 5e4c3728edb3abab62e0ac68b2e0ec9ff1a553db Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Apr 2022 12:53:51 +0200 Subject: [PATCH] split up p60 hk packets --- mission/devices/PCDUHandler.cpp | 10 ++-- .../devicedefinitions/GomspaceDefinitions.h | 55 ++++++++++--------- tmtc | 2 +- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 44b9181a..c819b223 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -51,7 +51,8 @@ ReturnValue_t PCDUHandler::initialize() { return RETURN_FAILED; } result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( - PDU2::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); + static_cast(P60System::SetIds::PDU_2), this->getObjectId(), commandQueue->getId(), + true); if (result != RETURN_OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " << "PDU2Handler" << std::endl; @@ -66,7 +67,8 @@ ReturnValue_t PCDUHandler::initialize() { return RETURN_FAILED; } result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( - PDU1::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); + static_cast(P60System::SetIds::PDU_1), this->getObjectId(), commandQueue->getId(), + true); if (result != RETURN_OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " << "PDU1Handler" << std::endl; @@ -101,10 +103,10 @@ void PCDUHandler::readCommandQueue() { MessageQueueId_t PCDUHandler::getCommandQueue() const { return commandQueue->getId(); } void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) { - if (sid == sid_t(objects::PDU2_HANDLER, PDU2::HK_TABLE_DATA_SET_ID)) { + if (sid == sid_t(objects::PDU2_HANDLER, static_cast(P60System::SetIds::PDU_2))) { updateHkTableDataset(storeId, &pdu2HkTableDataset, &timeStampPdu2HkDataset); updatePdu2SwitchStates(); - } else if (sid == sid_t(objects::PDU1_HANDLER, PDU1::HK_TABLE_DATA_SET_ID)) { + } else if (sid == sid_t(objects::PDU1_HANDLER, static_cast(P60System::SetIds::PDU_1))) { updateHkTableDataset(storeId, &pdu1HkTableDataset, &timeStampPdu1HkDataset); updatePdu1SwitchStates(); } else { diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 4b277b40..93fe9e6b 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -43,6 +43,8 @@ static const DeviceCommandId_t PRINT_LATCHUPS = 33; namespace P60System { +enum class SetIds : uint32_t { PDU_1 = 1, PDU_2 = 2, P60_CORE = 3, P60_AUX = 4, ACU = 5 }; + namespace pool { enum Ids : lp_id_t { @@ -351,9 +353,6 @@ static const uint16_t MAX_CONFIGTABLE_ADDRESS = 408; static const uint16_t MAX_HKTABLE_ADDRESS = 187; static const uint16_t HK_TABLE_SIZE = 188; -static constexpr uint32_t CORE_TABLE_SET_ID = 0x3; -static constexpr uint32_t AUX_TABLE_DATA_SET_ID = 0x4; - static const uint8_t HK_TABLE_ENTRIES = 100; /** @@ -364,9 +363,11 @@ static const uint16_t HK_TABLE_REPLY_SIZE = 407; class CoreHkSet : public StaticLocalDataSet<16> { public: - CoreHkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, CORE_TABLE_SET_ID) {} + CoreHkSet(HasLocalDataPoolIF* owner) + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::P60_CORE)) {} - CoreHkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, CORE_TABLE_SET_ID)) {} + CoreHkSet(object_id_t objectId) + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::P60_CORE))) {} /** Measured output currents */ lp_vec_t currents = @@ -406,10 +407,16 @@ class CoreHkSet : public StaticLocalDataSet<16> { */ class HkTableDataset : public StaticLocalDataSet<32> { public: - HkTableDataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, AUX_TABLE_DATA_SET_ID) {} + HkTableDataset(HasLocalDataPoolIF* owner) + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::P60_AUX)) {} HkTableDataset(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, AUX_TABLE_DATA_SET_ID)) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::P60_AUX))) {} + + /** Number of detected latchups on each output channel */ + lp_vec_t latchups = + lp_vec_t(sid.objectId, P60System::pool::LATCHUPS, + this); lp_var_t bootcause = lp_var_t(sid.objectId, P60System::pool::P60DOCK_BOOT_CAUSE, this); @@ -424,11 +431,6 @@ class HkTableDataset : public StaticLocalDataSet<32> { lp_var_t converter5VStatus = lp_var_t(sid.objectId, P60System::pool::P60DOCK_CONV_5V_ENABLE_STATUS, this); - /** Number of detected latchups on each output channel */ - lp_vec_t latchups = - lp_vec_t(sid.objectId, P60System::pool::LATCHUPS, - this); - lp_var_t dockVbatVoltageValue = lp_var_t(sid.objectId, P60System::pool::P60DOCK_DOCK_VBAT, this); lp_var_t dockVccCurrent = @@ -439,11 +441,6 @@ class HkTableDataset : public StaticLocalDataSet<32> { lp_var_t batteryTemperature2 = lp_var_t(sid.objectId, P60System::pool::P60DOCK_BATTERY_TEMPERATURE_2, this); - lp_vec_t devicesType = - lp_vec_t(sid.objectId, P60System::pool::DEVICES_TYPE, this); - lp_vec_t devicesStatus = - lp_vec_t(sid.objectId, P60System::pool::DEVICES_STATUS, this); - lp_var_t dearmStatus = lp_var_t(sid.objectId, P60System::pool::P60DOCK_DEARM_STATUS, this); @@ -477,6 +474,11 @@ class HkTableDataset : public StaticLocalDataSet<32> { lp_var_t(sid.objectId, P60System::pool::P60DOCK_ANT6_DEPL, this); lp_var_t ar6Depl = lp_var_t(sid.objectId, P60System::pool::P60DOCK_AR6_DEPL, this); + + lp_vec_t devicesType = + lp_vec_t(sid.objectId, P60System::pool::DEVICES_TYPE, this); + lp_vec_t devicesStatus = + lp_vec_t(sid.objectId, P60System::pool::DEVICES_STATUS, this); }; } // namespace P60Dock @@ -494,7 +496,6 @@ static const uint8_t HK_TABLE_ENTRIES = 73; } // namespace PDU namespace PDU1 { -static const uint32_t HK_TABLE_DATA_SET_ID = 0x1; // hk table has table id 4 enum SwitchChannels : uint8_t { TCS_BOARD_3V3 = 0, @@ -527,10 +528,11 @@ static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x50; */ class PDU1HkTableDataset : public StaticLocalDataSet { public: - PDU1HkTableDataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) {} + PDU1HkTableDataset(HasLocalDataPoolIF* owner) + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::PDU_1)) {} PDU1HkTableDataset(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::PDU_1))) {} /** Measured output currents */ lp_var_t currentOutTCSBoard3V3 = @@ -698,7 +700,6 @@ class PDU1HkTableDataset : public StaticLocalDataSet { } // namespace PDU1 namespace PDU2 { -static const uint32_t HK_TABLE_DATA_SET_ID = 0x2; enum SwitchChannels : uint8_t { Q7S = 0, @@ -731,10 +732,11 @@ static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50; */ class PDU2HkTableDataset : public StaticLocalDataSet { public: - PDU2HkTableDataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) {} + PDU2HkTableDataset(HasLocalDataPoolIF* owner) + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::PDU_2)) {} PDU2HkTableDataset(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::PDU_2))) {} /** Measured output currents */ lp_var_t currentOutQ7S = @@ -903,8 +905,6 @@ class PDU2HkTableDataset : public StaticLocalDataSet { namespace ACU { -static const uint32_t HK_TABLE_DATA_SET_ID = 0x4; - /* When receiving full housekeeping (telemetry) table */ static const uint16_t MAX_REPLY_LENGTH = 262; static const uint16_t MAX_CONFIGTABLE_ADDRESS = 26; @@ -917,10 +917,11 @@ static const uint16_t HK_TABLE_REPLY_SIZE = 262; */ class HkTableDataset : public StaticLocalDataSet { public: - HkTableDataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) {} + HkTableDataset(HasLocalDataPoolIF* owner) + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::ACU)) {} HkTableDataset(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::ACU))) {} lp_var_t currentInChannel0 = lp_var_t(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL0, this); diff --git a/tmtc b/tmtc index 8f2ff303..ab5cca85 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8f2ff3034fff627b807f32c02fd9e676126bae5f +Subproject commit ab5cca85bfb71875ba0c49e8ed6ef575f851c0c5