879 lines
41 KiB
C++
879 lines
41 KiB
C++
#include "ThermalController.h"
|
|
|
|
#include <bsp_q7s/core/CoreDefinitions.h>
|
|
#include <fsfw/datapool/PoolReadGuard.h>
|
|
#include <fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h>
|
|
#include <linux/devices/devicedefinitions/StarTrackerDefinitions.h>
|
|
#include <mission/devices/devicedefinitions/BpxBatteryDefinitions.h>
|
|
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
|
#include <mission/devices/devicedefinitions/GyroADIS1650XDefinitions.h>
|
|
#include <mission/devices/devicedefinitions/GyroL3GD20Definitions.h>
|
|
#include <mission/devices/devicedefinitions/IMTQHandlerDefinitions.h>
|
|
#include <mission/devices/devicedefinitions/RwDefinitions.h>
|
|
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
|
|
#include <mission/devices/devicedefinitions/payloadPcduDefinitions.h>
|
|
#include <objects/systemObjectList.h>
|
|
|
|
ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
|
|
: ExtendedControllerBase(objectId, parentId),
|
|
sensorTemperatures(this),
|
|
susTemperatures(this),
|
|
deviceTemperatures(this),
|
|
max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER,
|
|
EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set1(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
|
|
EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set2(objects::RTD_2_IC5_4K_CAMERA, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set3(objects::RTD_3_IC6_DAC_HEATSPREADER, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set4(objects::RTD_4_IC7_STARTRACKER, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set5(objects::RTD_5_IC8_RW1_MX_MY, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set6(objects::RTD_6_IC9_DRO, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set7(objects::RTD_7_IC10_SCEX, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set8(objects::RTD_8_IC11_X8, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set9(objects::RTD_9_IC12_HPA, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set10(objects::RTD_10_IC13_PL_TX, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set11(objects::RTD_11_IC14_MPA, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set12(objects::RTD_12_IC15_ACU, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
|
max31865Set13(objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
|
|
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_1),
|
|
tmp1075Set2(objects::TMP1075_HANDLER_2),
|
|
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),
|
|
susSet3(objects::SUS_3_N_LOC_XFYBZF_PT_YF),
|
|
susSet4(objects::SUS_4_N_LOC_XMYFZF_PT_ZF),
|
|
susSet5(objects::SUS_5_N_LOC_XFYMZB_PT_ZB),
|
|
susSet6(objects::SUS_6_R_LOC_XFYBZM_PT_XF),
|
|
susSet7(objects::SUS_7_R_LOC_XBYBZM_PT_XB),
|
|
susSet8(objects::SUS_8_R_LOC_XBYBZB_PT_YB),
|
|
susSet9(objects::SUS_9_R_LOC_XBYBZB_PT_YF),
|
|
susSet10(objects::SUS_10_N_LOC_XMYBZF_PT_ZF),
|
|
susSet11(objects::SUS_11_R_LOC_XBYMZB_PT_ZB) {}
|
|
|
|
ReturnValue_t ThermalController::initialize() {
|
|
auto result = ExtendedControllerBase::initialize();
|
|
return result;
|
|
}
|
|
|
|
ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
|
|
return RETURN_FAILED;
|
|
}
|
|
|
|
void ThermalController::performControlOperation() {
|
|
switch (internalState) {
|
|
case InternalState::STARTUP: {
|
|
initialCountdown.resetTimer();
|
|
internalState = InternalState::INITIAL_DELAY;
|
|
return;
|
|
}
|
|
case InternalState::INITIAL_DELAY: {
|
|
if (initialCountdown.hasTimedOut()) {
|
|
internalState = InternalState::READY;
|
|
}
|
|
return;
|
|
}
|
|
case InternalState::READY: {
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
ReturnValue_t result = sensorTemperatures.read();
|
|
if (result == RETURN_OK) {
|
|
copySensors();
|
|
sensorTemperatures.commit();
|
|
}
|
|
|
|
result = susTemperatures.read();
|
|
if (result == RETURN_OK) {
|
|
copySus();
|
|
susTemperatures.commit();
|
|
}
|
|
|
|
result = deviceTemperatures.read();
|
|
if (result == RETURN_OK) {
|
|
copyDevices();
|
|
deviceTemperatures.commit();
|
|
}
|
|
}
|
|
|
|
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
|
LocalDataPoolManager& poolManager) {
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLOC_HEATSPREADER,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLOC_MISSIONBOARD,
|
|
new PoolEntry<float>({1.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_4K_CAMERA,
|
|
new PoolEntry<float>({2.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_DAC_HEATSPREADER,
|
|
new PoolEntry<float>({3.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_STARTRACKER,
|
|
new PoolEntry<float>({4.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_RW1, new PoolEntry<float>({5.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_DRO, new PoolEntry<float>({6.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_SCEX, new PoolEntry<float>({7.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_X8, new PoolEntry<float>({8.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_HPA, new PoolEntry<float>({9.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TX_MODUL,
|
|
new PoolEntry<float>({10.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MPA, new PoolEntry<float>({11.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_ACU, new PoolEntry<float>({12.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLPCDU_HEATSPREADER,
|
|
new PoolEntry<float>({13.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TCS_BOARD,
|
|
new PoolEntry<float>({14.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER,
|
|
new PoolEntry<float>({15.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_1,
|
|
new PoolEntry<float>({15.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_2,
|
|
new PoolEntry<float>({15.0}));
|
|
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_0_N_LOC_XFYFZM_PT_XF,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_6_R_LOC_XFYBZM_PT_XF,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_1_N_LOC_XBYFZM_PT_XB,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_7_R_LOC_XBYBZM_PT_XB,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_2_N_LOC_XFYBZB_PT_YB,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_8_R_LOC_XBYBZB_PT_YB,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_3_N_LOC_XFYBZF_PT_YF,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_9_R_LOC_XBYBZB_PT_YF,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_4_N_LOC_XMYFZF_PT_ZF,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_10_N_LOC_XMYBZF_PT_ZF,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_5_N_LOC_XFYMZB_PT_ZB,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_11_R_LOC_XBYMZB_PT_ZB,
|
|
new PoolEntry<float>({0.0}));
|
|
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::COMPONENT_RW, new PoolEntry<float>({0.0}));
|
|
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_Q7S, new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_1,
|
|
new PoolEntry<int16_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_2,
|
|
new PoolEntry<int16_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_3,
|
|
new PoolEntry<int16_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_4,
|
|
new PoolEntry<int16_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW1, new PoolEntry<int32_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW2, new PoolEntry<int32_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW3, new PoolEntry<int32_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW4, new PoolEntry<int32_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_STAR_TRACKER,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_POWER_AMPLIFIER,
|
|
new PoolEntry<float>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_BASEBAND_BOARD,
|
|
new PoolEntry<float>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGT, new PoolEntry<int16_t>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ACU, new PoolEntry<float>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU1, new PoolEntry<float>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU2, new PoolEntry<float>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_1_P60DOCK, new PoolEntry<float>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_2_P60DOCK, new PoolEntry<float>({0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_0_SIDE_A,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_1_SIDE_A,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_2_SIDE_B,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_3_SIDE_B,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGM_0_SIDE_A,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGM_2_SIDE_B,
|
|
new PoolEntry<float>({0.0}));
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ADC_PAYLOAD_PCDU,
|
|
new PoolEntry<float>({0.0}));
|
|
|
|
poolManager.subscribeForRegularPeriodicPacket(
|
|
subdp::RegularHkPeriodicParams(sensorTemperatures.getSid(), false, 10.0));
|
|
poolManager.subscribeForRegularPeriodicPacket(
|
|
subdp::RegularHkPeriodicParams(susTemperatures.getSid(), false, 10.0));
|
|
poolManager.subscribeForRegularPeriodicPacket(
|
|
subdp::RegularHkPeriodicParams(deviceTemperatures.getSid(), false, 10.0));
|
|
return RETURN_OK;
|
|
}
|
|
|
|
LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) {
|
|
switch (sid.ownerSetId) {
|
|
case thermalControllerDefinitions::SENSOR_TEMPERATURES:
|
|
return &sensorTemperatures;
|
|
case thermalControllerDefinitions::SUS_TEMPERATURES:
|
|
return &susTemperatures;
|
|
case thermalControllerDefinitions::DEVICE_TEMPERATURES:
|
|
return &deviceTemperatures;
|
|
default:
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode,
|
|
uint32_t* msToReachTheMode) {
|
|
if (submode != SUBMODE_NONE) {
|
|
return INVALID_SUBMODE;
|
|
}
|
|
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
|
return INVALID_MODE;
|
|
}
|
|
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());
|
|
if (not sensorTemperatures.sensor_ploc_heatspreader.isValid()) {
|
|
sensorTemperatures.sensor_ploc_heatspreader.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
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());
|
|
if (not sensorTemperatures.sensor_ploc_missionboard.isValid()) {
|
|
sensorTemperatures.sensor_ploc_missionboard.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
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());
|
|
if (not sensorTemperatures.sensor_4k_camera.isValid()) {
|
|
sensorTemperatures.sensor_4k_camera.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
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());
|
|
if (not sensorTemperatures.sensor_dac_heatspreader.isValid()) {
|
|
sensorTemperatures.sensor_dac_heatspreader.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg4(&max31865Set4);
|
|
if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_startracker.value = max31865Set4.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_startracker.setValid(max31865Set4.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_startracker.isValid()) {
|
|
sensorTemperatures.sensor_startracker.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg5(&max31865Set5);
|
|
if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_rw1.value = max31865Set5.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_rw1.setValid(max31865Set5.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_rw1.isValid()) {
|
|
sensorTemperatures.sensor_rw1.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg6(&max31865Set6);
|
|
if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_dro.value = max31865Set6.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_dro.setValid(max31865Set6.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_dro.isValid()) {
|
|
sensorTemperatures.sensor_dro.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg7(&max31865Set7);
|
|
if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_scex.value = max31865Set7.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_scex.setValid(max31865Set7.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_scex.isValid()) {
|
|
sensorTemperatures.sensor_scex.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg8(&max31865Set8);
|
|
if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_x8.value = max31865Set8.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_x8.setValid(max31865Set8.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_x8.isValid()) {
|
|
sensorTemperatures.sensor_x8.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg9(&max31865Set9);
|
|
if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_hpa.value = max31865Set9.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_hpa.setValid(max31865Set9.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_hpa.isValid()) {
|
|
sensorTemperatures.sensor_hpa.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
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());
|
|
if (not sensorTemperatures.sensor_tx_modul.isValid()) {
|
|
sensorTemperatures.sensor_tx_modul.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg11(&max31865Set11);
|
|
if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_mpa.value = max31865Set11.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_mpa.setValid(max31865Set11.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_mpa.isValid()) {
|
|
sensorTemperatures.sensor_mpa.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg12(&max31865Set12);
|
|
if (pg12.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_acu.value = max31865Set12.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_acu.setValid(max31865Set12.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_acu.isValid()) {
|
|
sensorTemperatures.sensor_acu.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
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());
|
|
if (not sensorTemperatures.sensor_plpcdu_heatspreader.isValid()) {
|
|
sensorTemperatures.sensor_plpcdu_heatspreader.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
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());
|
|
if (not sensorTemperatures.sensor_tcs_board.isValid()) {
|
|
sensorTemperatures.sensor_tcs_board.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg15(&max31865Set15);
|
|
if (pg15.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
sensorTemperatures.sensor_magnettorquer.value = max31865Set15.temperatureCelcius.value;
|
|
sensorTemperatures.sensor_magnettorquer.setValid(max31865Set15.temperatureCelcius.isValid());
|
|
if (not sensorTemperatures.sensor_magnettorquer.isValid()) {
|
|
sensorTemperatures.sensor_magnettorquer.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
PoolReadGuard pg111(&tmp1075Set1);
|
|
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_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 pg112(&tmp1075Set2);
|
|
if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_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;
|
|
}
|
|
}
|
|
}
|
|
|
|
void ThermalController::copySus() {
|
|
PoolReadGuard pg0(&susSet0);
|
|
if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.value = susSet0.temperatureCelcius.value;
|
|
susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.setValid(susSet0.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.isValid()) {
|
|
susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg1(&susSet1);
|
|
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_6_r_loc_xfybzm_pt_xf.value = susSet1.temperatureCelcius.value;
|
|
susTemperatures.sus_6_r_loc_xfybzm_pt_xf.setValid(susSet1.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_6_r_loc_xfybzm_pt_xf.isValid()) {
|
|
susTemperatures.sus_6_r_loc_xfybzm_pt_xf.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg2(&susSet2);
|
|
if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.value = susSet2.temperatureCelcius.value;
|
|
susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.setValid(susSet2.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.isValid()) {
|
|
susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg3(&susSet3);
|
|
if (pg3.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_7_r_loc_xbybzm_pt_xb.value = susSet3.temperatureCelcius.value;
|
|
susTemperatures.sus_7_r_loc_xbybzm_pt_xb.setValid(susSet3.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_7_r_loc_xbybzm_pt_xb.isValid()) {
|
|
susTemperatures.sus_7_r_loc_xbybzm_pt_xb.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg4(&susSet4);
|
|
if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_2_n_loc_xfybzb_pt_yb.value = susSet4.temperatureCelcius.value;
|
|
susTemperatures.sus_2_n_loc_xfybzb_pt_yb.setValid(susSet4.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_2_n_loc_xfybzb_pt_yb.isValid()) {
|
|
susTemperatures.sus_2_n_loc_xfybzb_pt_yb.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg5(&susSet5);
|
|
if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_8_r_loc_xbybzb_pt_yb.value = susSet5.temperatureCelcius.value;
|
|
susTemperatures.sus_8_r_loc_xbybzb_pt_yb.setValid(susSet5.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_8_r_loc_xbybzb_pt_yb.isValid()) {
|
|
susTemperatures.sus_8_r_loc_xbybzb_pt_yb.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg6(&susSet6);
|
|
if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_3_n_loc_xfybzf_pt_yf.value = susSet6.temperatureCelcius.value;
|
|
susTemperatures.sus_3_n_loc_xfybzf_pt_yf.setValid(susSet6.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_3_n_loc_xfybzf_pt_yf.isValid()) {
|
|
susTemperatures.sus_3_n_loc_xfybzf_pt_yf.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg7(&susSet7);
|
|
if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_9_r_loc_xbybzb_pt_yf.value = susSet7.temperatureCelcius.value;
|
|
susTemperatures.sus_9_r_loc_xbybzb_pt_yf.setValid(susSet7.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_9_r_loc_xbybzb_pt_yf.isValid()) {
|
|
susTemperatures.sus_9_r_loc_xbybzb_pt_yf.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg8(&susSet8);
|
|
if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.value = susSet8.temperatureCelcius.value;
|
|
susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.setValid(susSet8.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.isValid()) {
|
|
susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg9(&susSet9);
|
|
if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_10_n_loc_xmybzf_pt_zf.value = susSet9.temperatureCelcius.value;
|
|
susTemperatures.sus_10_n_loc_xmybzf_pt_zf.setValid(susSet9.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_10_n_loc_xmybzf_pt_zf.isValid()) {
|
|
susTemperatures.sus_10_n_loc_xmybzf_pt_zf.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg10(&susSet10);
|
|
if (pg10.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_5_n_loc_xfymzb_pt_zb.value = susSet10.temperatureCelcius.value;
|
|
susTemperatures.sus_5_n_loc_xfymzb_pt_zb.setValid(susSet10.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_5_n_loc_xfymzb_pt_zb.isValid()) {
|
|
susTemperatures.sus_5_n_loc_xfymzb_pt_zb.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
|
|
PoolReadGuard pg11(&susSet11);
|
|
if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
|
susTemperatures.sus_11_r_loc_xbymzb_pt_zb.value = susSet11.temperatureCelcius.value;
|
|
susTemperatures.sus_11_r_loc_xbymzb_pt_zb.setValid(susSet11.temperatureCelcius.isValid());
|
|
if (not susTemperatures.sus_11_r_loc_xbymzb_pt_zb.isValid()) {
|
|
susTemperatures.sus_11_r_loc_xbymzb_pt_zb.value = INVALID_TEMPERATURE;
|
|
}
|
|
}
|
|
}
|
|
|
|
void ThermalController::copyDevices() {
|
|
lp_var_t<float> tempQ7s = lp_var_t<float>(objects::CORE_CONTROLLER, core::PoolIds::TEMPERATURE);
|
|
ReturnValue_t result = tempQ7s.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read Q7S temperature" << std::endl;
|
|
deviceTemperatures.q7s.setValid(false);
|
|
deviceTemperatures.q7s = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.q7s = tempQ7s;
|
|
deviceTemperatures.q7s.setValid(tempQ7s.isValid());
|
|
}
|
|
result = tempQ7s.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int16_t> battTemp1 =
|
|
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_1);
|
|
result = battTemp1.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read battery temperature 1" << std::endl;
|
|
deviceTemperatures.batteryTemp1.setValid(false);
|
|
deviceTemperatures.batteryTemp1 = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.batteryTemp1 = battTemp1;
|
|
deviceTemperatures.batteryTemp1.setValid(battTemp1.isValid());
|
|
}
|
|
result = battTemp1.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int16_t> battTemp2 =
|
|
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_2);
|
|
result = battTemp2.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read battery temperature 2" << std::endl;
|
|
deviceTemperatures.batteryTemp2.setValid(false);
|
|
deviceTemperatures.batteryTemp2 = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.batteryTemp2 = battTemp2;
|
|
deviceTemperatures.batteryTemp2.setValid(battTemp2.isValid());
|
|
}
|
|
result = battTemp2.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int16_t> battTemp3 =
|
|
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_3);
|
|
result = battTemp3.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read battery temperature 3" << std::endl;
|
|
deviceTemperatures.batteryTemp3.setValid(false);
|
|
deviceTemperatures.batteryTemp3 = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.batteryTemp3 = battTemp3;
|
|
deviceTemperatures.batteryTemp3.setValid(battTemp3.isValid());
|
|
}
|
|
result = battTemp3.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int16_t> battTemp4 =
|
|
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_4);
|
|
result = battTemp4.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read battery temperature 4" << std::endl;
|
|
deviceTemperatures.batteryTemp4.setValid(false);
|
|
deviceTemperatures.batteryTemp4 = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.batteryTemp4 = battTemp4;
|
|
deviceTemperatures.batteryTemp4.setValid(battTemp4.isValid());
|
|
}
|
|
result = battTemp4.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int32_t> tempRw1 = lp_var_t<int32_t>(objects::RW1, RwDefinitions::TEMPERATURE_C);
|
|
result = tempRw1.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read reaction wheel 1 temperature" << std::endl;
|
|
deviceTemperatures.rw1.setValid(false);
|
|
deviceTemperatures.rw1 = static_cast<int32_t>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.rw1.setValid(tempRw1.isValid());
|
|
deviceTemperatures.rw1 = tempRw1;
|
|
}
|
|
result = tempRw1.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int32_t> tempRw2 = lp_var_t<int32_t>(objects::RW2, RwDefinitions::TEMPERATURE_C);
|
|
result = tempRw2.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read reaction wheel 2 temperature" << std::endl;
|
|
deviceTemperatures.rw2.setValid(false);
|
|
deviceTemperatures.rw2 = static_cast<int32_t>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.rw2.setValid(tempRw2.isValid());
|
|
deviceTemperatures.rw2 = tempRw2;
|
|
}
|
|
result = tempRw2.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int32_t> tempRw3 = lp_var_t<int32_t>(objects::RW3, RwDefinitions::TEMPERATURE_C);
|
|
result = tempRw3.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read reaction wheel 3 temperature" << std::endl;
|
|
deviceTemperatures.rw3.setValid(false);
|
|
deviceTemperatures.rw3 = static_cast<int32_t>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.rw3.setValid(tempRw3.isValid());
|
|
deviceTemperatures.rw3 = tempRw3;
|
|
}
|
|
result = tempRw3.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int32_t> tempRw4 = lp_var_t<int32_t>(objects::RW4, RwDefinitions::TEMPERATURE_C);
|
|
result = tempRw4.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read reaction wheel 4 temperature" << std::endl;
|
|
deviceTemperatures.rw4.setValid(false);
|
|
deviceTemperatures.rw4 = static_cast<int32_t>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.rw4.setValid(tempRw4.isValid());
|
|
deviceTemperatures.rw4 = tempRw4;
|
|
}
|
|
result = tempRw4.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempStartracker =
|
|
lp_var_t<float>(objects::STAR_TRACKER, startracker::MCU_TEMPERATURE);
|
|
result = tempStartracker.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read startracker temperature" << std::endl;
|
|
deviceTemperatures.startracker.setValid(false);
|
|
deviceTemperatures.startracker = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.startracker.setValid(tempStartracker.isValid());
|
|
deviceTemperatures.startracker = tempStartracker;
|
|
}
|
|
result = tempStartracker.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempSyrlinksPowerAmplifier =
|
|
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER);
|
|
result = tempSyrlinksPowerAmplifier.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature"
|
|
<< std::endl;
|
|
deviceTemperatures.syrlinksPowerAmplifier.setValid(false);
|
|
deviceTemperatures.syrlinksPowerAmplifier = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.syrlinksPowerAmplifier.setValid(tempSyrlinksPowerAmplifier.isValid());
|
|
deviceTemperatures.syrlinksPowerAmplifier = tempSyrlinksPowerAmplifier;
|
|
}
|
|
result = tempSyrlinksPowerAmplifier.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempSyrlinksBasebandBoard =
|
|
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
|
|
result = tempSyrlinksBasebandBoard.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature"
|
|
<< std::endl;
|
|
deviceTemperatures.syrlinksBasebandBoard.setValid(false);
|
|
deviceTemperatures.syrlinksBasebandBoard = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.syrlinksBasebandBoard.setValid(tempSyrlinksBasebandBoard.isValid());
|
|
deviceTemperatures.syrlinksBasebandBoard = tempSyrlinksBasebandBoard;
|
|
}
|
|
result = tempSyrlinksBasebandBoard.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<int16_t> tempMgt = lp_var_t<int16_t>(objects::IMTQ_HANDLER, IMTQ::MCU_TEMPERATURE);
|
|
result = tempMgt.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read MGT temperature" << std::endl;
|
|
deviceTemperatures.mgt.setValid(false);
|
|
deviceTemperatures.mgt = static_cast<int16_t>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.mgt.setValid(tempMgt.isValid());
|
|
deviceTemperatures.mgt = tempMgt;
|
|
}
|
|
result = tempMgt.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_vec_t<float, 3> tempAcu =
|
|
lp_vec_t<float, 3>(objects::ACU_HANDLER, P60System::pool::ACU_TEMPERATURES);
|
|
result = tempAcu.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read ACU temperatures" << std::endl;
|
|
deviceTemperatures.acu.setValid(false);
|
|
deviceTemperatures.acu[0] = static_cast<float>(INVALID_TEMPERATURE);
|
|
deviceTemperatures.acu[1] = static_cast<float>(INVALID_TEMPERATURE);
|
|
deviceTemperatures.acu[2] = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.acu.setValid(tempAcu.isValid());
|
|
deviceTemperatures.acu = tempAcu;
|
|
}
|
|
result = tempAcu.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempPdu1 =
|
|
lp_var_t<float>(objects::PDU1_HANDLER, P60System::pool::PDU_TEMPERATURE);
|
|
result = tempPdu1.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read PDU1 temperature" << std::endl;
|
|
deviceTemperatures.pdu1.setValid(false);
|
|
deviceTemperatures.pdu1 = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.pdu1.setValid(tempPdu1.isValid());
|
|
deviceTemperatures.pdu1 = tempPdu1;
|
|
}
|
|
result = tempPdu1.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempPdu2 =
|
|
lp_var_t<float>(objects::PDU2_HANDLER, P60System::pool::PDU_TEMPERATURE);
|
|
result = tempPdu2.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read PDU2 temperature" << std::endl;
|
|
deviceTemperatures.pdu2.setValid(false);
|
|
deviceTemperatures.pdu2 = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.pdu2.setValid(tempPdu1.isValid());
|
|
deviceTemperatures.pdu2 = tempPdu1;
|
|
}
|
|
result = tempPdu2.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> temp1P60dock =
|
|
lp_var_t<float>(objects::P60DOCK_HANDLER, P60System::pool::P60DOCK_TEMPERATURE_1);
|
|
result = temp1P60dock.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read P60 dock temperature 1" << std::endl;
|
|
deviceTemperatures.temp1P60dock.setValid(false);
|
|
deviceTemperatures.temp1P60dock = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.temp1P60dock.setValid(temp1P60dock.isValid());
|
|
deviceTemperatures.temp1P60dock = temp1P60dock;
|
|
}
|
|
result = temp1P60dock.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> temp2P60dock =
|
|
lp_var_t<float>(objects::P60DOCK_HANDLER, P60System::pool::P60DOCK_TEMPERATURE_2);
|
|
result = temp2P60dock.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read P60 dock temperature 2" << std::endl;
|
|
deviceTemperatures.temp2P60dock.setValid(false);
|
|
deviceTemperatures.temp2P60dock = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.temp2P60dock.setValid(temp2P60dock.isValid());
|
|
deviceTemperatures.temp2P60dock = temp2P60dock;
|
|
}
|
|
result = temp2P60dock.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempGyro0 = lp_var_t<float>(objects::GYRO_0_ADIS_HANDLER, ADIS1650X::TEMPERATURE);
|
|
result = tempGyro0.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read gyro 0 temperature" << std::endl;
|
|
deviceTemperatures.gyro0SideA.setValid(false);
|
|
deviceTemperatures.gyro0SideA = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.gyro0SideA.setValid(tempGyro0.isValid());
|
|
deviceTemperatures.gyro0SideA = tempGyro0;
|
|
}
|
|
result = tempGyro0.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempGyro1 = lp_var_t<float>(objects::GYRO_1_L3G_HANDLER, L3GD20H::TEMPERATURE);
|
|
result = tempGyro1.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read gyro 1 temperature" << std::endl;
|
|
deviceTemperatures.gyro1SideA.setValid(false);
|
|
deviceTemperatures.gyro1SideA = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.gyro1SideA.setValid(tempGyro1.isValid());
|
|
deviceTemperatures.gyro1SideA = tempGyro1;
|
|
}
|
|
result = tempGyro1.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempGyro2 = lp_var_t<float>(objects::GYRO_2_ADIS_HANDLER, ADIS1650X::TEMPERATURE);
|
|
result = tempGyro2.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read gyro 2 temperature" << std::endl;
|
|
deviceTemperatures.gyro2SideB.setValid(false);
|
|
deviceTemperatures.gyro2SideB = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.gyro2SideB.setValid(tempGyro2.isValid());
|
|
deviceTemperatures.gyro2SideB = tempGyro2;
|
|
}
|
|
result = tempGyro2.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempGyro3 = lp_var_t<float>(objects::GYRO_3_L3G_HANDLER, L3GD20H::TEMPERATURE);
|
|
result = tempGyro3.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read gyro 3 temperature" << std::endl;
|
|
deviceTemperatures.gyro3SideB.setValid(false);
|
|
deviceTemperatures.gyro3SideB = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.gyro3SideB.setValid(tempGyro3.isValid());
|
|
deviceTemperatures.gyro3SideB = tempGyro3;
|
|
}
|
|
result = tempGyro3.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempMgm0 =
|
|
lp_var_t<float>(objects::MGM_0_LIS3_HANDLER, MGMLIS3MDL::TEMPERATURE_CELCIUS);
|
|
result = tempMgm0.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read MGM 0 temperature" << std::endl;
|
|
deviceTemperatures.mgm0SideA.setValid(false);
|
|
deviceTemperatures.mgm0SideA = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.mgm0SideA.setValid(tempMgm0.isValid());
|
|
deviceTemperatures.mgm0SideA = tempMgm0;
|
|
}
|
|
result = tempMgm0.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempMgm2 =
|
|
lp_var_t<float>(objects::MGM_2_LIS3_HANDLER, MGMLIS3MDL::TEMPERATURE_CELCIUS);
|
|
result = tempMgm2.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read MGM 2 temperature" << std::endl;
|
|
deviceTemperatures.mgm2SideB.setValid(false);
|
|
deviceTemperatures.mgm2SideB = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.mgm2SideB.setValid(tempMgm2.isValid());
|
|
deviceTemperatures.mgm2SideB = tempMgm2;
|
|
}
|
|
result = tempMgm2.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
lp_var_t<float> tempAdcPayloadPcdu = lp_var_t<float>(objects::PLPCDU_HANDLER, plpcdu::TEMP);
|
|
result = tempAdcPayloadPcdu.read();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to read payload PCDU ADC temperature" << std::endl;
|
|
deviceTemperatures.adcPayloadPcdu.setValid(false);
|
|
deviceTemperatures.adcPayloadPcdu = static_cast<float>(INVALID_TEMPERATURE);
|
|
} else {
|
|
deviceTemperatures.adcPayloadPcdu.setValid(tempAdcPayloadPcdu.isValid());
|
|
deviceTemperatures.adcPayloadPcdu = tempAdcPayloadPcdu;
|
|
}
|
|
result = tempAdcPayloadPcdu.commit();
|
|
if (result != RETURN_OK) {
|
|
sif::warning << "ThermalController: Failed to commit" << std::endl;
|
|
}
|
|
}
|