Thermal controller and temperature bugfixes #266

Merged
muellerr merged 40 commits from meier/thermal-bugfixes into develop 2022-06-20 09:43:04 +02:00
Showing only changes of commit b1c20b22c8 - Show all commits

View File

@ -497,6 +497,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read Q7S temperature" << std::endl; sif::warning << "ThermalController: Failed to read Q7S temperature" << std::endl;
deviceTemperatures.q7s.setValid(false); deviceTemperatures.q7s.setValid(false);
deviceTemperatures.q7s = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.q7s = tempQ7s; deviceTemperatures.q7s = tempQ7s;
@ -506,11 +507,13 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl; sif::warning << "ThermalController: Failed to commit" << std::endl;
} }
lp_var_t<float> battTemp1 = lp_var_t<float>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_1); lp_var_t<float> battTemp1 = lp_var_t<float>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_1);
result = battTemp1.read(); result = battTemp1.read();
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read battery temperature 1" << std::endl; sif::warning << "ThermalController: Failed to read battery temperature 1" << std::endl;
deviceTemperatures.batteryTemp1.setValid(false); deviceTemperatures.batteryTemp1.setValid(false);
deviceTemperatures.batteryTemp1 = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.batteryTemp1 = battTemp1; deviceTemperatures.batteryTemp1 = battTemp1;
@ -525,6 +528,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read battery temperature 2" << std::endl; sif::warning << "ThermalController: Failed to read battery temperature 2" << std::endl;
deviceTemperatures.batteryTemp2.setValid(false); deviceTemperatures.batteryTemp2.setValid(false);
deviceTemperatures.batteryTemp2 = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.batteryTemp2 = battTemp2; deviceTemperatures.batteryTemp2 = battTemp2;
@ -539,6 +543,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read battery temperature 3" << std::endl; sif::warning << "ThermalController: Failed to read battery temperature 3" << std::endl;
deviceTemperatures.batteryTemp3.setValid(false); deviceTemperatures.batteryTemp3.setValid(false);
deviceTemperatures.batteryTemp3 = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.batteryTemp3 = battTemp3; deviceTemperatures.batteryTemp3 = battTemp3;
@ -553,6 +558,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read battery temperature 4" << std::endl; sif::warning << "ThermalController: Failed to read battery temperature 4" << std::endl;
deviceTemperatures.batteryTemp4.setValid(false); deviceTemperatures.batteryTemp4.setValid(false);
deviceTemperatures.batteryTemp4 = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.batteryTemp4 = battTemp4; deviceTemperatures.batteryTemp4 = battTemp4;
@ -567,6 +573,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 1 temperature" << std::endl; sif::warning << "ThermalController: Failed to read reaction wheel 1 temperature" << std::endl;
deviceTemperatures.rw1.setValid(false); deviceTemperatures.rw1.setValid(false);
deviceTemperatures.rw1 = static_cast<int32_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.rw1.setValid(tempRw1.isValid()); deviceTemperatures.rw1.setValid(tempRw1.isValid());
@ -581,6 +588,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 2 temperature" << std::endl; sif::warning << "ThermalController: Failed to read reaction wheel 2 temperature" << std::endl;
deviceTemperatures.rw2.setValid(false); deviceTemperatures.rw2.setValid(false);
deviceTemperatures.rw2 = static_cast<int32_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.rw2.setValid(tempRw2.isValid()); deviceTemperatures.rw2.setValid(tempRw2.isValid());
@ -595,6 +603,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 3 temperature" << std::endl; sif::warning << "ThermalController: Failed to read reaction wheel 3 temperature" << std::endl;
deviceTemperatures.rw3.setValid(false); deviceTemperatures.rw3.setValid(false);
deviceTemperatures.rw3 = static_cast<int32_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.rw3.setValid(tempRw3.isValid()); deviceTemperatures.rw3.setValid(tempRw3.isValid());
@ -609,6 +618,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 4 temperature" << std::endl; sif::warning << "ThermalController: Failed to read reaction wheel 4 temperature" << std::endl;
deviceTemperatures.rw4.setValid(false); deviceTemperatures.rw4.setValid(false);
deviceTemperatures.rw4 = static_cast<int32_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.rw4.setValid(tempRw4.isValid()); deviceTemperatures.rw4.setValid(tempRw4.isValid());
@ -624,6 +634,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read startracker temperature" << std::endl; sif::warning << "ThermalController: Failed to read startracker temperature" << std::endl;
deviceTemperatures.startracker.setValid(false); deviceTemperatures.startracker.setValid(false);
deviceTemperatures.startracker = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.startracker.setValid(tempStartracker.isValid()); deviceTemperatures.startracker.setValid(tempStartracker.isValid());
@ -639,6 +650,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature" << std::endl; sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature" << std::endl;
deviceTemperatures.syrlinksPowerAmplifier.setValid(false); deviceTemperatures.syrlinksPowerAmplifier.setValid(false);
deviceTemperatures.syrlinksPowerAmplifier = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.syrlinksPowerAmplifier.setValid(tempSyrlinksPowerAmplifier.isValid()); deviceTemperatures.syrlinksPowerAmplifier.setValid(tempSyrlinksPowerAmplifier.isValid());
@ -654,6 +666,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature" << std::endl; sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature" << std::endl;
deviceTemperatures.syrlinksBasebandBoard.setValid(false); deviceTemperatures.syrlinksBasebandBoard.setValid(false);
deviceTemperatures.syrlinksBasebandBoard = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.syrlinksBasebandBoard.setValid(tempSyrlinksBasebandBoard.isValid()); deviceTemperatures.syrlinksBasebandBoard.setValid(tempSyrlinksBasebandBoard.isValid());
@ -669,6 +682,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read MGT temperature" << std::endl; sif::warning << "ThermalController: Failed to read MGT temperature" << std::endl;
deviceTemperatures.mgt.setValid(false); deviceTemperatures.mgt.setValid(false);
deviceTemperatures.mgt = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.mgt.setValid(tempMgt.isValid()); deviceTemperatures.mgt.setValid(tempMgt.isValid());
@ -684,6 +698,9 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read ACU temperatures" << std::endl; sif::warning << "ThermalController: Failed to read ACU temperatures" << std::endl;
deviceTemperatures.acu.setValid(false); 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 { else {
deviceTemperatures.acu.setValid(tempAcu.isValid()); deviceTemperatures.acu.setValid(tempAcu.isValid());
@ -699,6 +716,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read PDU1 temperature" << std::endl; sif::warning << "ThermalController: Failed to read PDU1 temperature" << std::endl;
deviceTemperatures.pdu1.setValid(false); deviceTemperatures.pdu1.setValid(false);
deviceTemperatures.pdu1 = static_cast<int16_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.pdu1.setValid(tempPdu1.isValid()); deviceTemperatures.pdu1.setValid(tempPdu1.isValid());
@ -714,6 +732,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read PDU2 temperature" << std::endl; sif::warning << "ThermalController: Failed to read PDU2 temperature" << std::endl;
deviceTemperatures.pdu2.setValid(false); deviceTemperatures.pdu2.setValid(false);
deviceTemperatures.pdu2 = static_cast<int16_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.pdu2.setValid(tempPdu1.isValid()); deviceTemperatures.pdu2.setValid(tempPdu1.isValid());
@ -729,6 +748,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read P60 dock temperature 1" << std::endl; sif::warning << "ThermalController: Failed to read P60 dock temperature 1" << std::endl;
deviceTemperatures.temp1P60dock.setValid(false); deviceTemperatures.temp1P60dock.setValid(false);
deviceTemperatures.temp1P60dock = static_cast<int16_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.temp1P60dock.setValid(temp1P60dock.isValid()); deviceTemperatures.temp1P60dock.setValid(temp1P60dock.isValid());
@ -744,6 +764,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read P60 dock temperature 2" << std::endl; sif::warning << "ThermalController: Failed to read P60 dock temperature 2" << std::endl;
deviceTemperatures.temp2P60dock.setValid(false); deviceTemperatures.temp2P60dock.setValid(false);
deviceTemperatures.temp2P60dock = static_cast<int16_t>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.temp2P60dock.setValid(temp2P60dock.isValid()); deviceTemperatures.temp2P60dock.setValid(temp2P60dock.isValid());
@ -759,6 +780,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read gyro 0 temperature" << std::endl; sif::warning << "ThermalController: Failed to read gyro 0 temperature" << std::endl;
deviceTemperatures.gyro0SideA.setValid(false); deviceTemperatures.gyro0SideA.setValid(false);
deviceTemperatures.gyro0SideA = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.gyro0SideA.setValid(tempGyro0.isValid()); deviceTemperatures.gyro0SideA.setValid(tempGyro0.isValid());
@ -774,6 +796,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read gyro 1 temperature" << std::endl; sif::warning << "ThermalController: Failed to read gyro 1 temperature" << std::endl;
deviceTemperatures.gyro1SideA.setValid(false); deviceTemperatures.gyro1SideA.setValid(false);
deviceTemperatures.gyro1SideA = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.gyro1SideA.setValid(tempGyro1.isValid()); deviceTemperatures.gyro1SideA.setValid(tempGyro1.isValid());
@ -789,6 +812,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read gyro 2 temperature" << std::endl; sif::warning << "ThermalController: Failed to read gyro 2 temperature" << std::endl;
deviceTemperatures.gyro2SideB.setValid(false); deviceTemperatures.gyro2SideB.setValid(false);
deviceTemperatures.gyro2SideB = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.gyro2SideB.setValid(tempGyro2.isValid()); deviceTemperatures.gyro2SideB.setValid(tempGyro2.isValid());
@ -804,6 +828,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read gyro 3 temperature" << std::endl; sif::warning << "ThermalController: Failed to read gyro 3 temperature" << std::endl;
deviceTemperatures.gyro3SideB.setValid(false); deviceTemperatures.gyro3SideB.setValid(false);
deviceTemperatures.gyro3SideB = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.gyro3SideB.setValid(tempGyro3.isValid()); deviceTemperatures.gyro3SideB.setValid(tempGyro3.isValid());
@ -819,6 +844,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read MGM 0 temperature" << std::endl; sif::warning << "ThermalController: Failed to read MGM 0 temperature" << std::endl;
deviceTemperatures.mgm0SideA.setValid(false); deviceTemperatures.mgm0SideA.setValid(false);
deviceTemperatures.mgm0SideA = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.mgm0SideA.setValid(tempMgm0.isValid()); deviceTemperatures.mgm0SideA.setValid(tempMgm0.isValid());
@ -834,6 +860,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read MGM 2 temperature" << std::endl; sif::warning << "ThermalController: Failed to read MGM 2 temperature" << std::endl;
deviceTemperatures.mgm2SideB.setValid(false); deviceTemperatures.mgm2SideB.setValid(false);
deviceTemperatures.mgm2SideB = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.mgm2SideB.setValid(tempMgm2.isValid()); deviceTemperatures.mgm2SideB.setValid(tempMgm2.isValid());
@ -849,6 +876,7 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to read payload PCDU ADC temperature" << std::endl; sif::warning << "ThermalController: Failed to read payload PCDU ADC temperature" << std::endl;
deviceTemperatures.adcPayloadPcdu.setValid(false); deviceTemperatures.adcPayloadPcdu.setValid(false);
deviceTemperatures.adcPayloadPcdu = static_cast<float>(INVALID_TEMPERATURE);
} }
else { else {
deviceTemperatures.adcPayloadPcdu.setValid(tempAdcPayloadPcdu.isValid()); deviceTemperatures.adcPayloadPcdu.setValid(tempAdcPayloadPcdu.isValid());