bugfix for some negative temperature conversions
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Jakob Meier 2022-06-10 10:39:43 +02:00
parent f72dfa255d
commit 17d17dce06
17 changed files with 65 additions and 47 deletions

View File

@ -165,6 +165,7 @@ if (setTimeDuringStartup) {
break;
}
} else {
uartIsolatorSwitch.pullHigh();
setMode(_MODE_TO_ON);
}
}
@ -891,14 +892,11 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
switch (result) {
case SupvReturnValuesIF::RECEIVED_ACK_FAILURE: {
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::debug << "PlocSupervisorHandler: Received Ack failure report with status code: 0x"
<< std::hex << ack.getStatusCode() << std::endl;
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
DeviceCommandId_t commandId = getPendingCommand();
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(SUPV_ACK_FAILURE, commandId, static_cast<uint32_t>(ack.getStatusCode()));
}
printAckFailureInfo(ack.getStatusCode(), commandId);
sendFailureReport(supv::ACK_REPORT, SupvReturnValuesIF::RECEIVED_ACK_FAILURE);
disableAllReplies();
nextReplyId = supv::NONE;
@ -1948,3 +1946,17 @@ void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) {
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
disableExeReportReply();
}
void PlocSupervisorHandler::printAckFailureInfo(uint16_t statusCode, DeviceCommandId_t commandId) {
sif::warning << "PlocSupervisorHandler: Received Ack failure report with status code: 0x"
<< std::hex << statusCode << std::endl;
switch(commandId) {
case(supv::SET_TIME_REF): {
sif::info << "PlocSupervisoHandler: Setting time failed. Make sure the OBC has a valid time"
<< std::endl;
break;
}
default:
break;
}
}

View File

@ -95,7 +95,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
static const uint32_t BOOT_TIMEOUT = 2000;
enum class StartupState : uint8_t { OFF, BOOTING, SET_TIME, SET_TIME_EXECUTING, ON };
bool setTimeDuringStartup = false;
bool setTimeDuringStartup = true;
StartupState startupState = StartupState::OFF;
@ -371,6 +371,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
void handleExecutionSuccessReport(const uint8_t* data);
void handleExecutionFailureReport(uint16_t statusCode);
void printAckFailureInfo(uint16_t statusCode, DeviceCommandId_t commandId);
};
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */

View File

@ -163,10 +163,10 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_STAR_TRACKER,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_POWER_AMPLIFIER,
new PoolEntry<uint16_t>({0}));
new PoolEntry<float>({0}));
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_BASEBAND_BOARD,
new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGT, new PoolEntry<uint16_t>({0}));
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}));
@ -645,8 +645,8 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<uint16_t> tempSyrlinksPowerAmplifier =
lp_var_t<uint16_t>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER);
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;
@ -661,8 +661,8 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<uint16_t> tempSyrlinksBasebandBoard =
lp_var_t<uint16_t>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
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;
@ -677,13 +677,13 @@ void ThermalController::copyDevices() {
if (result != RETURN_OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<uint16_t> tempMgt =
lp_var_t<uint16_t>(objects::IMTQ_HANDLER, IMTQ::MCU_TEMPERATURE);
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<float>(INVALID_TEMPERATURE);
deviceTemperatures.mgt = static_cast<int16_t>(INVALID_TEMPERATURE);
}
else {
deviceTemperatures.mgt.setValid(tempMgt.isValid());

View File

@ -136,11 +136,11 @@ class DeviceTemperatures : public StaticLocalDataSet<ENTRIES_DEVICE_TEMPERATURE_
lp_var_t<int32_t> rw3 = lp_var_t<int32_t>(sid.objectId, PoolIds::TEMP_RW3, this);
lp_var_t<int32_t> rw4 = lp_var_t<int32_t>(sid.objectId, PoolIds::TEMP_RW4, this);
lp_var_t<float> startracker = lp_var_t<float>(sid.objectId, PoolIds::TEMP_STAR_TRACKER, this);
lp_var_t<uint16_t> syrlinksPowerAmplifier =
lp_var_t<uint16_t>(sid.objectId, PoolIds::TEMP_SYRLINKS_POWER_AMPLIFIER, this);
lp_var_t<uint16_t> syrlinksBasebandBoard =
lp_var_t<uint16_t>(sid.objectId, PoolIds::TEMP_SYRLINKS_BASEBAND_BOARD, this);
lp_var_t<uint16_t> mgt = lp_var_t<uint16_t>(sid.objectId, PoolIds::TEMP_MGT, this);
lp_var_t<float> syrlinksPowerAmplifier =
lp_var_t<float>(sid.objectId, PoolIds::TEMP_SYRLINKS_POWER_AMPLIFIER, this);
lp_var_t<float> syrlinksBasebandBoard =
lp_var_t<float>(sid.objectId, PoolIds::TEMP_SYRLINKS_BASEBAND_BOARD, this);
lp_var_t<int16_t> mgt = lp_var_t<int16_t>(sid.objectId, PoolIds::TEMP_MGT, this);
lp_vec_t<float, 3> acu = lp_vec_t<float, 3>(sid.objectId, PoolIds::TEMP_ACU, this);
lp_var_t<float> pdu1 = lp_var_t<float>(sid.objectId, PoolIds::TEMP_PDU1, this);
lp_var_t<float> pdu2 = lp_var_t<float>(sid.objectId, PoolIds::TEMP_PDU2, this);

View File

@ -75,7 +75,7 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
dataOffset += 4;
for (size_t idx = 0; idx < 3; idx++) {
coreHk.temperatures[idx] = ((packet[dataOffset] << 8) | packet[dataOffset + 1]) * 0.1;
coreHk.temperatures[idx] = static_cast<int16_t>((packet[dataOffset] << 8) | packet[dataOffset + 1]) * 0.1;
dataOffset += 4;
}

View File

@ -472,7 +472,7 @@ ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU
dataOffset += 4;
auxHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
coreHk.temperature = (*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
coreHk.temperature = static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
dataOffset += 4;
for (uint8_t idx = 0; idx < 3; idx++) {

View File

@ -325,10 +325,10 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat
localDataPoolMap.emplace(IMTQ::COIL_X_CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(IMTQ::COIL_Y_CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(IMTQ::COIL_Z_CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(IMTQ::COIL_X_TEMPERATURE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(IMTQ::COIL_Y_TEMPERATURE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(IMTQ::COIL_Z_TEMPERATURE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(IMTQ::COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(IMTQ::COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(IMTQ::COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<int16_t>({0}));
/** Entries of calibrated MTM measurement dataset */
localDataPoolMap.emplace(IMTQ::MTM_CAL_X, new PoolEntry<int32_t>({0}));

View File

@ -57,9 +57,9 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
dataOffset += 3;
}
coreHk.temperature1 = (*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
coreHk.temperature1 = static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
dataOffset += 4;
coreHk.temperature2 = (*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
coreHk.temperature2 = static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
dataOffset += 4;
auxHk.bootcause = *(packet + dataOffset) << 24 |

View File

@ -2,6 +2,7 @@
#include <devices/gpioIds.h>
#include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/RadiationSensorHandler.h>
#include <mission/devices/max1227.h>
RadiationSensorHandler::RadiationSensorHandler(object_id_t objectId, object_id_t comIF,
CookieIF *comCookie, GpioIF *gpioIF)
@ -155,8 +156,8 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
case RAD_SENSOR::READ_CONVERSIONS: {
uint8_t offset = 0;
PoolReadGuard readSet(&dataset);
int16_t tempRaw = ((packet[offset] & 0x0f) << 8) | packet[offset + 1];
dataset.temperatureCelcius = tempRaw * 0.125;
uint16_t tempRaw = ((packet[offset] & 0x0f) << 8) | packet[offset + 1];
dataset.temperatureCelcius = max1227::getTemperature(tempRaw);
offset += 2;
dataset.ain0 = (*(packet + offset) << 8) | *(packet + offset + 1);
offset += 2;

View File

@ -618,8 +618,8 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo
localDataPoolMap.emplace(syrlinks::TX_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(syrlinks::TX_WAVEFORM, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(syrlinks::TX_AGC_VALUE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry<float>({0}));
localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry<float>({0}));
poolManager.subscribeForPeriodicPacket(txDataset.getSid(), false, 5.0, true);
poolManager.subscribeForPeriodicPacket(rxDataset.getSid(), false, 5.0, true);

View File

@ -391,10 +391,10 @@ class EngHkDataset : public StaticLocalDataSet<ENG_HK_SET_POOL_ENTRIES> {
lp_var_t<float> coilYCurrentmA = lp_var_t<float>(sid.objectId, COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrentmA = lp_var_t<float>(sid.objectId, COIL_Z_CURRENT, this);
/** All temperatures in [<5B>C] */
lp_var_t<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId, COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId, COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId, COIL_Z_TEMPERATURE, this);
lp_var_t<uint16_t> mcuTemperature = lp_var_t<uint16_t>(sid.objectId, MCU_TEMPERATURE, this);
lp_var_t<int16_t> coilXTemperature = lp_var_t<int16_t>(sid.objectId, COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature = lp_var_t<int16_t>(sid.objectId, COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature = lp_var_t<int16_t>(sid.objectId, COIL_Z_TEMPERATURE, this);
lp_var_t<int16_t> mcuTemperature = lp_var_t<int16_t>(sid.objectId, MCU_TEMPERATURE, this);
};
/**

View File

@ -110,10 +110,10 @@ class TemperatureSet : public StaticLocalDataSet<TEMPERATURE_SET_SIZE> {
TemperatureSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {}
lp_var_t<uint16_t> temperaturePowerAmplifier =
lp_var_t<uint16_t>(sid.objectId, TEMP_POWER_AMPLIFIER, this);
lp_var_t<uint16_t> temperatureBasebandBoard =
lp_var_t<uint16_t>(sid.objectId, TEMP_BASEBAND_BOARD, this);
lp_var_t<float> temperaturePowerAmplifier =
lp_var_t<float>(sid.objectId, TEMP_POWER_AMPLIFIER, this);
lp_var_t<float> temperatureBasebandBoard =
lp_var_t<float>(sid.objectId, TEMP_BASEBAND_BOARD, this);
};
} // namespace syrlinks

View File

@ -25,4 +25,7 @@ void max1227::prepareExternallyClockedTemperatureRead(uint8_t *spiBuf, size_t &s
sz += 25;
}
float max1227::getTemperature(int16_t temp) { return static_cast<float>(temp) * 0.125; }
float max1227::getTemperature(uint16_t raw) {
float temp = static_cast<float>((-2048 * (raw >> 11)) + (raw & 0x7FF)) * 0.125;
return temp;
}

View File

@ -77,7 +77,7 @@ void prepareExternallyClockedRead0ToN(uint8_t* spiBuf, uint8_t n, size_t& sz);
*/
void prepareExternallyClockedTemperatureRead(uint8_t* spiBuf, size_t& sz);
float getTemperature(int16_t temp);
float getTemperature(uint16_t raw);
} // namespace max1227

View File

@ -1,7 +1,7 @@
#!/bin/bash
echo "Setting up all Q7S ports"
echo "-L 1534:192.168.155.55:1534 for connection to the TCF agent on the FM"
echo "-L 1536:192.168.155.55:7301 for TMTC commanding using the TCP/IP IF on the FM"
echo "-L 1534:localhost:1534 root@192.168.155.55 for connection to the TCF agent on the FM"
echo "-L 1560:localhost:7301 root@192.168.155.55 for TMTC commanding using the TCP/IP IF on the FM"
ssh -L 1534:localhost:1534 root@192.168.155.55

2
tmtc

@ -1 +1 @@
Subproject commit 58ed46e110db362ff50f2b44737c8a7dd7027971
Subproject commit bfc9b17f100152bc82524b4dffabf88e8a43ef32