From 012590273fe65d18f32c4e9b3688c2c95abcaa37 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 10:04:41 +0100 Subject: [PATCH 1/2] add missing TMP1075 devs in TCS ctrl --- mission/controller/ThermalController.cpp | 65 ++++++++++++++----- mission/controller/ThermalController.h | 7 +- .../ThermalControllerDefinitions.h | 17 +++-- 3 files changed, 67 insertions(+), 22 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 603fb0e0..7e5ded8b 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -38,8 +38,11 @@ ThermalController::ThermalController(object_id_t objectId) EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set14(objects::RTD_14_IC17_TCS_BOARD, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set15(objects::RTD_15_IC18_IMTQ, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), - tmp1075Set1(objects::TMP1075_HANDLER_TCS_0), - tmp1075Set2(objects::TMP1075_HANDLER_TCS_1), + tmp1075SetTcs0(objects::TMP1075_HANDLER_TCS_0), + tmp1075SetTcs1(objects::TMP1075_HANDLER_TCS_1), + tmp1075SetPlPcdu0(objects::TMP1075_HANDLER_PLPCDU_0), + tmp1075SetPlPcdu1(objects::TMP1075_HANDLER_PLPCDU_1), + tmp1075SetIfBoard(objects::TMP1075_HANDLER_IF_BOARD), susSet0(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet1(objects::SUS_1_N_LOC_XBYFZM_PT_XB), susSet2(objects::SUS_2_N_LOC_XFYBZB_PT_YB), @@ -128,9 +131,9 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo new PoolEntry({14.0})); localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER, new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_1, + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_0, new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_2, + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_1, new PoolEntry({15.0})); localDataPoolMap.emplace(thermalControllerDefinitions::SUS_0_N_LOC_XFYFZM_PT_XF, @@ -415,23 +418,53 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg111(&tmp1075Set1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); - if (pg111.getReadResult() == returnvalue::OK) { - sensorTemperatures.sensor_tmp1075_1.value = tmp1075Set1.temperatureCelcius.value; - sensorTemperatures.sensor_tmp1075_1.setValid(tmp1075Set1.temperatureCelcius.isValid()); - if (not tmp1075Set1.temperatureCelcius.isValid()) { - sensorTemperatures.sensor_tmp1075_1.value = INVALID_TEMPERATURE; + PoolReadGuard pg(&tmp1075SetTcs0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075Tcs0.value = tmp1075SetTcs0.temperatureCelcius.value; + sensorTemperatures.tmp1075Tcs0.setValid(tmp1075SetTcs0.temperatureCelcius.isValid()); + if (not tmp1075SetTcs0.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075Tcs0.value = INVALID_TEMPERATURE; } } } { - PoolReadGuard pg112(&tmp1075Set2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); - if (pg112.getReadResult() == returnvalue::OK) { - sensorTemperatures.sensor_tmp1075_2.value = tmp1075Set2.temperatureCelcius.value; - sensorTemperatures.sensor_tmp1075_2.setValid(tmp1075Set2.temperatureCelcius.isValid()); - if (not tmp1075Set2.temperatureCelcius.isValid()) { - sensorTemperatures.sensor_tmp1075_2.value = INVALID_TEMPERATURE; + PoolReadGuard pg(&tmp1075SetTcs1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075Tcs1.value = tmp1075SetTcs1.temperatureCelcius.value; + sensorTemperatures.tmp1075Tcs1.setValid(tmp1075SetTcs1.temperatureCelcius.isValid()); + if (not tmp1075SetTcs1.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075Tcs1.value = INVALID_TEMPERATURE; + } + } + } + { + PoolReadGuard pg(&tmp1075SetPlPcdu0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075PlPcdu0.value = tmp1075SetPlPcdu0.temperatureCelcius.value; + sensorTemperatures.tmp1075PlPcdu0.setValid(tmp1075SetPlPcdu0.temperatureCelcius.isValid()); + if (not tmp1075SetPlPcdu0.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075PlPcdu0.value = INVALID_TEMPERATURE; + } + } + } + { + PoolReadGuard pg(&tmp1075SetPlPcdu1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075PlPcdu1.value = tmp1075SetPlPcdu1.temperatureCelcius.value; + sensorTemperatures.tmp1075PlPcdu1.setValid(tmp1075SetPlPcdu1.temperatureCelcius.isValid()); + if (not tmp1075SetPlPcdu1.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075PlPcdu1.value = INVALID_TEMPERATURE; + } + } + } + { + PoolReadGuard pg(&tmp1075SetIfBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075IfBrd.value = tmp1075SetIfBoard.temperatureCelcius.value; + sensorTemperatures.tmp1075IfBrd.setValid(tmp1075SetIfBoard.temperatureCelcius.isValid()); + if (not tmp1075SetIfBoard.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075IfBrd.value = INVALID_TEMPERATURE; } } } diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 76366d0c..9fabae71 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -55,8 +55,11 @@ class ThermalController : public ExtendedControllerBase { MAX31865::Max31865Set max31865Set13; MAX31865::Max31865Set max31865Set14; MAX31865::Max31865Set max31865Set15; - TMP1075::Tmp1075Dataset tmp1075Set1; - TMP1075::Tmp1075Dataset tmp1075Set2; + TMP1075::Tmp1075Dataset tmp1075SetTcs0; + TMP1075::Tmp1075Dataset tmp1075SetTcs1; + TMP1075::Tmp1075Dataset tmp1075SetPlPcdu0; + TMP1075::Tmp1075Dataset tmp1075SetPlPcdu1; + TMP1075::Tmp1075Dataset tmp1075SetIfBoard; // SUS SUS::SusDataset susSet0; diff --git a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h index c2824c58..6eaa28e4 100644 --- a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h @@ -30,8 +30,11 @@ enum PoolIds : lp_id_t { SENSOR_PLPCDU_HEATSPREADER, SENSOR_TCS_BOARD, SENSOR_MAGNETTORQUER, - SENSOR_TMP1075_1, - SENSOR_TMP1075_2, + SENSOR_TMP1075_TCS_0, + SENSOR_TMP1075_TCS_1, + SENSOR_TMP1075_PLPCDU_0, + SENSOR_TMP1075_PLPCDU_1, + SENSOR_TMP1075_IF_BOARD, SUS_0_N_LOC_XFYFZM_PT_XF, SUS_6_R_LOC_XFYBZM_PT_XF, @@ -111,8 +114,14 @@ class SensorTemperatures : public StaticLocalDataSet sensor_tcs_board = lp_var_t(sid.objectId, PoolIds::SENSOR_TCS_BOARD, this); lp_var_t sensor_magnettorquer = lp_var_t(sid.objectId, PoolIds::SENSOR_MAGNETTORQUER, this); - lp_var_t sensor_tmp1075_1 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_1, this); - lp_var_t sensor_tmp1075_2 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_2, this); + lp_var_t tmp1075Tcs0 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_TCS_0, this); + lp_var_t tmp1075Tcs1 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_TCS_1, this); + lp_var_t tmp1075PlPcdu0 = + lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_PLPCDU_0, this); + lp_var_t tmp1075PlPcdu1 = + lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_PLPCDU_1, this); + lp_var_t tmp1075IfBrd = + lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_IF_BOARD, this); }; /** From 876c2b36bfb4822938b1391bd07bea8e68a7f334 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 10:11:44 +0100 Subject: [PATCH 2/2] add missing tmp devs in ctrel map as well --- mission/controller/ThermalController.cpp | 9 +++++---- mission/controller/ThermalController.h | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 7e5ded8b..45f26f8b 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -131,10 +131,11 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo new PoolEntry({14.0})); localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER, new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_0, - new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_1, - new PoolEntry({15.0})); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_0, &tmp1075Tcs0); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_1, &tmp1075Tcs1); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_PLPCDU_0, &tmp1075PlPcdu0); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_PLPCDU_1, &tmp1075PlPcdu1); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_IF_BOARD, &tmp1075IfBrd); localDataPoolMap.emplace(thermalControllerDefinitions::SUS_0_N_LOC_XFYFZM_PT_XF, new PoolEntry({0.0})); diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 9fabae71..5071d811 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -78,6 +78,12 @@ class ThermalController : public ExtendedControllerBase { // Initial delay to make sure all pool variables have been initialized their owners Countdown initialCountdown = Countdown(DELAY); + PoolEntry tmp1075Tcs0 = PoolEntry(10.0); + PoolEntry tmp1075Tcs1 = PoolEntry(10.0); + PoolEntry tmp1075PlPcdu0 = PoolEntry(10.0); + PoolEntry tmp1075PlPcdu1 = PoolEntry(10.0); + PoolEntry tmp1075IfBrd = PoolEntry(10.0); + static constexpr dur_millis_t MUTEX_TIMEOUT = 50; void copySensors(); void copySus();