From a77d5f366962ba9d182e2c78deb249c6cc5ba38c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 3 Feb 2022 15:31:18 +0100 Subject: [PATCH] tested cfg set request --- linux/fsfwconfig/OBSWConfig.h.in | 3 +- mission/devices/BpxBatteryHandler.cpp | 32 ++++++++++------- mission/devices/BpxBatteryHandler.h | 3 ++ .../devicedefinitions/BpxBatteryDefinitions.h | 36 ++++++++++--------- tmtc | 2 +- 5 files changed, 45 insertions(+), 31 deletions(-) diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index bdaf4c4f..6c4e4773 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -54,7 +54,7 @@ debugging. */ #define OBSW_ADD_RAD_SENSORS 0 #define OBSW_ADD_SYRLINKS 0 #define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 -#define OBSW_SYRLINKS_SIMULATED 1 +#define OBSW_ENABLE_PERIODIC_HK 0 #endif @@ -66,6 +66,7 @@ debugging. */ #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_PRINT_MISSED_DEADLINES 1 +#define OBSW_SYRLINKS_SIMULATED 1 #define OBSW_ADD_TEST_CODE 0 // If this is enabled, all other SPI code should be disabled #define OBSW_ADD_SPI_TEST_CODE 0 diff --git a/mission/devices/BpxBatteryHandler.cpp b/mission/devices/BpxBatteryHandler.cpp index b16f8d3c..6c080b04 100644 --- a/mission/devices/BpxBatteryHandler.cpp +++ b/mission/devices/BpxBatteryHandler.cpp @@ -47,7 +47,7 @@ void BpxBatteryHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(BpxBattery::REBOOT, 1, nullptr, 0); insertInCommandAndReplyMap(BpxBattery::RESET_COUNTERS, 1, nullptr, 2); insertInCommandAndReplyMap(BpxBattery::CONFIG_CMD, 1, nullptr, 2); - insertInCommandAndReplyMap(BpxBattery::CONFIG_GET, 1, &cfgSet, 3); + insertInCommandAndReplyMap(BpxBattery::CONFIG_GET, 1, &cfgSet, 5); } ReturnValue_t BpxBatteryHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, @@ -234,6 +234,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons if (result != HasReturnvaluesIF::RETURN_OK) { return result; } + cfgSet.setValidity(true, true); break; } default: { @@ -247,17 +248,24 @@ uint32_t BpxBatteryHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) ReturnValue_t BpxBatteryHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { - localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_1, &battTemp1); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_2, &battTemp2); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_3, &battTemp3); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_TEMP_4, &battTemp4); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::CHARGE_CURRENT, &chargeCurrent); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::DISCHARGE_CURRENT, &dischargeCurrent); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::HEATER_CURRENT, &heaterCurrent); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::BATT_VOLTAGE, &battVolt); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::REBOOT_COUNTER, &rebootCounter); - localDataPoolMap.emplace(BpxBattery::HkPoolIds::BOOTCAUSE, &bootCause); - poolManager.subscribeForPeriodicPacket(hkSet.getSid(), false, 1.0, false); + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_1, &battTemp1); + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_2, &battTemp2); + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_3, &battTemp3); + localDataPoolMap.emplace(BpxBattery::BATT_TEMP_4, &battTemp4); + localDataPoolMap.emplace(BpxBattery::CHARGE_CURRENT, &chargeCurrent); + localDataPoolMap.emplace(BpxBattery::DISCHARGE_CURRENT, &dischargeCurrent); + localDataPoolMap.emplace(BpxBattery::HEATER_CURRENT, &heaterCurrent); + localDataPoolMap.emplace(BpxBattery::BATT_VOLTAGE, &battVolt); + localDataPoolMap.emplace(BpxBattery::REBOOT_COUNTER, &rebootCounter); + localDataPoolMap.emplace(BpxBattery::BOOTCAUSE, &bootCause); + + localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode); + localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow); + localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh); + +#if OBSW_ENABLE_PERIODIC_HK == 1 + poolManager.subscribeForPeriodicPacket(hkSet.getSid(), true, 1.0, false); +#endif return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/BpxBatteryHandler.h b/mission/devices/BpxBatteryHandler.h index d3a02645..eb75fe2c 100644 --- a/mission/devices/BpxBatteryHandler.h +++ b/mission/devices/BpxBatteryHandler.h @@ -36,6 +36,9 @@ class BpxBatteryHandler : public DeviceHandlerBase { PoolEntry battTemp4 = PoolEntry({0}); PoolEntry rebootCounter = PoolEntry({0}); PoolEntry bootCause = PoolEntry({0}); + PoolEntry battheatMode = PoolEntry({0}); + PoolEntry battheatLow = PoolEntry({0}); + PoolEntry battheatHigh = PoolEntry({0}); void doStartUp() override; void doShutDown() override; diff --git a/mission/devices/devicedefinitions/BpxBatteryDefinitions.h b/mission/devices/devicedefinitions/BpxBatteryDefinitions.h index 8123b237..dba9fb59 100644 --- a/mission/devices/devicedefinitions/BpxBatteryDefinitions.h +++ b/mission/devices/devicedefinitions/BpxBatteryDefinitions.h @@ -10,7 +10,7 @@ namespace BpxBattery { -enum HkPoolIds { +enum LocalPoolIds { CHARGE_CURRENT = 0, DISCHARGE_CURRENT = 1, HEATER_CURRENT = 2, @@ -20,10 +20,12 @@ enum HkPoolIds { BATT_TEMP_3 = 6, BATT_TEMP_4 = 7, REBOOT_COUNTER = 8, - BOOTCAUSE = 9 -}; + BOOTCAUSE = 9, -enum CfgPoolIds { BATTERY_HEATER_MODE = 0, BATTHEAT_LOW_LIMIT = 1, BATTHEAT_HIGH_LIMIT = 2 }; + BATTERY_HEATER_MODE = 10, + BATTHEAT_LOW_LIMIT = 11, + BATTHEAT_HIGH_LIMIT = 12 +}; static constexpr DeviceCommandId_t GET_HK = 0; static constexpr DeviceCommandId_t PING = 1; @@ -170,33 +172,33 @@ class BpxBatteryHk : public StaticLocalDataSet { //! Charge current in mA lp_var_t chargeCurrent = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::CHARGE_CURRENT, this); + lp_var_t(sid.objectId, BpxBattery::CHARGE_CURRENT, this); //! Discharge current in mA lp_var_t dischargeCurrent = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::DISCHARGE_CURRENT, this); + lp_var_t(sid.objectId, BpxBattery::DISCHARGE_CURRENT, this); //! Heater current in mA lp_var_t heaterCurrent = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::HEATER_CURRENT, this); + lp_var_t(sid.objectId, BpxBattery::HEATER_CURRENT, this); //! Battery voltage in mV lp_var_t battVoltage = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::BATT_VOLTAGE, this); + lp_var_t(sid.objectId, BpxBattery::BATT_VOLTAGE, this); //! Battery temperature 1 in degC lp_var_t battTemp1 = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_1, this); + lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_1, this); //! Battery temperature 2 in degC lp_var_t battTemp2 = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_2, this); + lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_2, this); //! Battery temperature 3 in degC lp_var_t battTemp3 = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_3, this); + lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_3, this); //! Battery temperature 4 in degC lp_var_t battTemp4 = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::BATT_TEMP_4, this); + lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_4, this); lp_var_t rebootCounter = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::REBOOT_COUNTER, this); + lp_var_t(sid.objectId, BpxBattery::REBOOT_COUNTER, this); lp_var_t bootcause = - lp_var_t(sid.objectId, BpxBattery::HkPoolIds::BOOTCAUSE, this); + lp_var_t(sid.objectId, BpxBattery::BOOTCAUSE, this); private: friend class BpxBatteryHandler; @@ -229,13 +231,13 @@ class BpxBatteryCfg : public StaticLocalDataSet { //! Mode for battheater [0=OFF,1=Auto] lp_var_t battheatermode = - lp_var_t(sid.objectId, BpxBattery::CfgPoolIds::BATTERY_HEATER_MODE, this); + lp_var_t(sid.objectId, BpxBattery::BATTERY_HEATER_MODE, this); //! Turn heater on at [degC] lp_var_t battheaterLow = - lp_var_t(sid.objectId, BpxBattery::CfgPoolIds::BATTHEAT_LOW_LIMIT, this); + lp_var_t(sid.objectId, BpxBattery::BATTHEAT_LOW_LIMIT, this); //! Turn heater off at [degC] lp_var_t battheaterHigh = - lp_var_t(sid.objectId, BpxBattery::CfgPoolIds::BATTHEAT_HIGH_LIMIT, this); + lp_var_t(sid.objectId, BpxBattery::BATTHEAT_HIGH_LIMIT, this); private: friend class BpxBatteryHandler; diff --git a/tmtc b/tmtc index 1702d895..890a20a0 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 1702d895761311d115c2e79b459b4a6d6843fc97 +Subproject commit 890a20a07895bc1d06ad49f281a107a042a5dd03