v1.12.0 #269

Merged
muellerr merged 493 commits from develop into main 2022-07-04 11:19:05 +02:00
2 changed files with 148 additions and 4 deletions
Showing only changes of commit 2f8f5ce79b - Show all commits

View File

@ -1,9 +1,28 @@
#include "ThermalController.h" #include "ThermalController.h"
#include <fsfw/datapool/PoolReadGuard.h>
#include <objects/systemObjectList.h>
ThermalController::ThermalController(object_id_t objectId, object_id_t parentId) ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
: ExtendedControllerBase(objectId, parentId), : ExtendedControllerBase(objectId, parentId),
sensorTemperatures(this), sensorTemperatures(this),
componentTemperatures(this) {} componentTemperatures(this),
max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER),
max31865Set1(objects::RTD_1_IC4_PLOC_MISSIONBOARD),
max31865Set2(objects::RTD_2_IC5_4K_CAMERA),
max31865Set3(objects::RTD_3_IC6_DAC_HEATSPREADER),
max31865Set4(objects::RTD_4_IC7_STARTRACKER),
max31865Set5(objects::RTD_5_IC8_RW1_MX_MY),
max31865Set6(objects::RTD_6_IC9_DRO),
max31865Set7(objects::RTD_7_IC10_SCEX),
max31865Set8(objects::RTD_8_IC11_X8),
max31865Set9(objects::RTD_9_IC12_HPA),
max31865Set10(objects::RTD_10_IC13_PL_TX),
max31865Set11(objects::RTD_11_IC14_MPA),
max31865Set12(objects::RTD_12_IC15_ACU),
max31865Set13(objects::RTD_13_IC16_PLPCDU_HEATSPREADER),
max31865Set14(objects::RTD_14_IC17_TCS_BOARD),
max31865Set15(objects::RTD_15_IC18_IMTQ) {}
ReturnValue_t ThermalController::initialize() { ReturnValue_t ThermalController::initialize() {
auto result = ExtendedControllerBase::initialize(); auto result = ExtendedControllerBase::initialize();
@ -14,17 +33,21 @@ ReturnValue_t ThermalController::initialize() {
ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) { ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
return RETURN_FAILED; return RETURN_FAILED;
} }
void ThermalController::performControlOperation() { void ThermalController::performControlOperation() {
ReturnValue_t result = sensorTemperatures.read(); ReturnValue_t result = sensorTemperatures.read();
if (result != RETURN_OK) { if (result != RETURN_OK) {
return; return;
} }
copySensors();
result = componentTemperatures.read(); result = componentTemperatures.read();
if (result != RETURN_OK) { if (result != RETURN_OK) {
return; return;
} }
sensorTemperatures.sensor_ploc_heatspreader = /*sensorTemperatures.sensor_ploc_heatspreader =
((int)sensorTemperatures.sensor_ploc_heatspreader.value + 1) % 100; ((int)sensorTemperatures.sensor_ploc_heatspreader.value + 1) % 100;
sensorTemperatures.sensor_ploc_missionboard = sensorTemperatures.sensor_ploc_missionboard =
((int)sensorTemperatures.sensor_ploc_missionboard.value + 2) % 100; ((int)sensorTemperatures.sensor_ploc_missionboard.value + 2) % 100;
@ -45,7 +68,7 @@ void ThermalController::performControlOperation() {
((int)sensorTemperatures.sensor_plpcdu_heatspreader.value + 10) % 100; ((int)sensorTemperatures.sensor_plpcdu_heatspreader.value + 10) % 100;
sensorTemperatures.sensor_tcs_board = ((int)sensorTemperatures.sensor_tcs_board.value + 10) % 100; sensorTemperatures.sensor_tcs_board = ((int)sensorTemperatures.sensor_tcs_board.value + 10) % 100;
sensorTemperatures.sensor_magnettorquer = sensorTemperatures.sensor_magnettorquer =
((int)sensorTemperatures.sensor_magnettorquer.value + 10) % 100; ((int)sensorTemperatures.sensor_magnettorquer.value + 10) % 100;*/
sensorTemperatures.commit(); sensorTemperatures.commit();
componentTemperatures.commit(); componentTemperatures.commit();
@ -107,3 +130,103 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode
} }
return RETURN_OK; return RETURN_OK;
} }
void ThermalController::copySensors() {
PoolReadGuard pg0(&max31865Set0);
if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_ploc_heatspreader.value = max31865Set0.temperatureCelcius.value;
sensorTemperatures.sensor_ploc_heatspreader.setValid(max31865Set0.temperatureCelcius.isValid());
}
PoolReadGuard pg1(&max31865Set1);
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_ploc_missionboard.value = max31865Set1.temperatureCelcius.value;
sensorTemperatures.sensor_ploc_missionboard.setValid(max31865Set1.temperatureCelcius.isValid());
}
PoolReadGuard pg2(&max31865Set2);
if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_4k_camera.value = max31865Set2.temperatureCelcius.value;
sensorTemperatures.sensor_4k_camera.setValid(max31865Set2.temperatureCelcius.isValid());
}
PoolReadGuard pg3(&max31865Set3);
if (pg3.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_dac_heatspreader.value = max31865Set3.temperatureCelcius.value;
sensorTemperatures.sensor_dac_heatspreader.setValid(max31865Set3.temperatureCelcius.isValid());
}
PoolReadGuard pg4(&max31865Set4);
if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_startracker.value = max31865Set4.temperatureCelcius.value;
sensorTemperatures.sensor_startracker.setValid(max31865Set4.temperatureCelcius.isValid());
}
PoolReadGuard pg5(&max31865Set5);
if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_rw1.value = max31865Set5.temperatureCelcius.value;
sensorTemperatures.sensor_rw1.setValid(max31865Set5.temperatureCelcius.isValid());
}
PoolReadGuard pg6(&max31865Set6);
if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_dro.value = max31865Set6.temperatureCelcius.value;
sensorTemperatures.sensor_dro.setValid(max31865Set6.temperatureCelcius.isValid());
}
PoolReadGuard pg7(&max31865Set7);
if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_scex.value = max31865Set7.temperatureCelcius.value;
sensorTemperatures.sensor_scex.setValid(max31865Set7.temperatureCelcius.isValid());
}
PoolReadGuard pg8(&max31865Set8);
if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_x8.value = max31865Set8.temperatureCelcius.value;
sensorTemperatures.sensor_x8.setValid(max31865Set8.temperatureCelcius.isValid());
}
PoolReadGuard pg9(&max31865Set9);
if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_hpa.value = max31865Set9.temperatureCelcius.value;
sensorTemperatures.sensor_hpa.setValid(max31865Set9.temperatureCelcius.isValid());
}
PoolReadGuard pg10(&max31865Set10);
if (pg10.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_tx_modul.value = max31865Set10.temperatureCelcius.value;
sensorTemperatures.sensor_tx_modul.setValid(max31865Set10.temperatureCelcius.isValid());
}
PoolReadGuard pg11(&max31865Set11);
if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_mpa.value = max31865Set11.temperatureCelcius.value;
sensorTemperatures.sensor_mpa.setValid(max31865Set11.temperatureCelcius.isValid());
}
PoolReadGuard pg12(&max31865Set12);
if (pg12.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_acu.value = max31865Set12.temperatureCelcius.value;
sensorTemperatures.sensor_acu.setValid(max31865Set12.temperatureCelcius.isValid());
}
PoolReadGuard pg13(&max31865Set13);
if (pg13.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_plpcdu_heatspreader.value = max31865Set13.temperatureCelcius.value;
sensorTemperatures.sensor_plpcdu_heatspreader.setValid(
max31865Set13.temperatureCelcius.isValid());
}
PoolReadGuard pg14(&max31865Set14);
if (pg14.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_tcs_board.value = max31865Set14.temperatureCelcius.value;
sensorTemperatures.sensor_tcs_board.setValid(max31865Set14.temperatureCelcius.isValid());
}
PoolReadGuard pg15(&max31865Set15);
if (pg15.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_magnettorquer.value = max31865Set15.temperatureCelcius.value;
sensorTemperatures.sensor_magnettorquer.setValid(max31865Set15.temperatureCelcius.isValid());
}
}

View File

@ -3,6 +3,7 @@
#include <fsfw/controller/ExtendedControllerBase.h> #include <fsfw/controller/ExtendedControllerBase.h>
#include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h> #include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
class ThermalController : public ExtendedControllerBase { class ThermalController : public ExtendedControllerBase {
public: public:
@ -10,6 +11,7 @@ class ThermalController : public ExtendedControllerBase {
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
protected: protected:
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override; virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override;
virtual void performControlOperation() override; virtual void performControlOperation() override;
@ -21,9 +23,28 @@ class ThermalController : public ExtendedControllerBase {
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override; uint32_t* msToReachTheMode) override;
private: private:
thermalControllerDefinitions::SensorTemperatures sensorTemperatures; thermalControllerDefinitions::SensorTemperatures sensorTemperatures;
thermalControllerDefinitions::ComponentTemperatures componentTemperatures; thermalControllerDefinitions::ComponentTemperatures componentTemperatures;
Max31865Definitions::Max31865Set max31865Set0;
Max31865Definitions::Max31865Set max31865Set1;
Max31865Definitions::Max31865Set max31865Set2;
Max31865Definitions::Max31865Set max31865Set3;
Max31865Definitions::Max31865Set max31865Set4;
Max31865Definitions::Max31865Set max31865Set5;
Max31865Definitions::Max31865Set max31865Set6;
Max31865Definitions::Max31865Set max31865Set7;
Max31865Definitions::Max31865Set max31865Set8;
Max31865Definitions::Max31865Set max31865Set9;
Max31865Definitions::Max31865Set max31865Set10;
Max31865Definitions::Max31865Set max31865Set11;
Max31865Definitions::Max31865Set max31865Set12;
Max31865Definitions::Max31865Set max31865Set13;
Max31865Definitions::Max31865Set max31865Set14;
Max31865Definitions::Max31865Set max31865Set15;
void copySensors();
}; };
#endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */ #endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */