diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 3338b9e8..389469c3 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -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(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; + } +} diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index f46b1ea7..9946a1d5 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -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_ */ diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index b6cbec74..6bf8aa34 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -163,10 +163,10 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_STAR_TRACKER, new PoolEntry({0.0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_POWER_AMPLIFIER, - new PoolEntry({0})); + new PoolEntry({0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_BASEBAND_BOARD, - new PoolEntry({0})); - localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGT, new PoolEntry({0})); + new PoolEntry({0})); + localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGT, new PoolEntry({0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ACU, new PoolEntry({0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU1, new PoolEntry({0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU2, new PoolEntry({0})); @@ -645,8 +645,8 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t tempSyrlinksPowerAmplifier = - lp_var_t(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER); + lp_var_t tempSyrlinksPowerAmplifier = + lp_var_t(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 tempSyrlinksBasebandBoard = - lp_var_t(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD); + lp_var_t tempSyrlinksBasebandBoard = + lp_var_t(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 tempMgt = - lp_var_t(objects::IMTQ_HANDLER, IMTQ::MCU_TEMPERATURE); + lp_var_t tempMgt = + lp_var_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(INVALID_TEMPERATURE); + deviceTemperatures.mgt = static_cast(INVALID_TEMPERATURE); } else { deviceTemperatures.mgt.setValid(tempMgt.isValid()); diff --git a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h index 57f768eb..b6f2c9af 100644 --- a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h @@ -136,11 +136,11 @@ class DeviceTemperatures : public StaticLocalDataSet rw3 = lp_var_t(sid.objectId, PoolIds::TEMP_RW3, this); lp_var_t rw4 = lp_var_t(sid.objectId, PoolIds::TEMP_RW4, this); lp_var_t startracker = lp_var_t(sid.objectId, PoolIds::TEMP_STAR_TRACKER, this); - lp_var_t syrlinksPowerAmplifier = - lp_var_t(sid.objectId, PoolIds::TEMP_SYRLINKS_POWER_AMPLIFIER, this); - lp_var_t syrlinksBasebandBoard = - lp_var_t(sid.objectId, PoolIds::TEMP_SYRLINKS_BASEBAND_BOARD, this); - lp_var_t mgt = lp_var_t(sid.objectId, PoolIds::TEMP_MGT, this); + lp_var_t syrlinksPowerAmplifier = + lp_var_t(sid.objectId, PoolIds::TEMP_SYRLINKS_POWER_AMPLIFIER, this); + lp_var_t syrlinksBasebandBoard = + lp_var_t(sid.objectId, PoolIds::TEMP_SYRLINKS_BASEBAND_BOARD, this); + lp_var_t mgt = lp_var_t(sid.objectId, PoolIds::TEMP_MGT, this); lp_vec_t acu = lp_vec_t(sid.objectId, PoolIds::TEMP_ACU, this); lp_var_t pdu1 = lp_var_t(sid.objectId, PoolIds::TEMP_PDU1, this); lp_var_t pdu2 = lp_var_t(sid.objectId, PoolIds::TEMP_PDU2, this); diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index fca445d1..b37d4997 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -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((packet[dataOffset] << 8) | packet[dataOffset + 1]) * 0.1; dataOffset += 4; } diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 275a9678..233aab4c 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -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(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1; dataOffset += 4; for (uint8_t idx = 0; idx < 3; idx++) { diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index 2c9f5956..137e7df3 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -325,10 +325,10 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat localDataPoolMap.emplace(IMTQ::COIL_X_CURRENT, new PoolEntry({0})); localDataPoolMap.emplace(IMTQ::COIL_Y_CURRENT, new PoolEntry({0})); localDataPoolMap.emplace(IMTQ::COIL_Z_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(IMTQ::COIL_X_TEMPERATURE, new PoolEntry({0})); - localDataPoolMap.emplace(IMTQ::COIL_Y_TEMPERATURE, new PoolEntry({0})); - localDataPoolMap.emplace(IMTQ::COIL_Z_TEMPERATURE, new PoolEntry({0})); - localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(IMTQ::COIL_X_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(IMTQ::COIL_Y_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(IMTQ::COIL_Z_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry({0})); /** Entries of calibrated MTM measurement dataset */ localDataPoolMap.emplace(IMTQ::MTM_CAL_X, new PoolEntry({0})); diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 646604da..53c7e9e8 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -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(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1; dataOffset += 4; - coreHk.temperature2 = (*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1; + coreHk.temperature2 = static_cast(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1; dataOffset += 4; auxHk.bootcause = *(packet + dataOffset) << 24 | diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index f2694476..d94e9197 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -2,6 +2,7 @@ #include #include #include +#include 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; diff --git a/mission/devices/SyrlinksHkHandler.cpp b/mission/devices/SyrlinksHkHandler.cpp index f9369cf2..20d72995 100644 --- a/mission/devices/SyrlinksHkHandler.cpp +++ b/mission/devices/SyrlinksHkHandler.cpp @@ -618,8 +618,8 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo localDataPoolMap.emplace(syrlinks::TX_STATUS, new PoolEntry({0})); localDataPoolMap.emplace(syrlinks::TX_WAVEFORM, new PoolEntry({0})); localDataPoolMap.emplace(syrlinks::TX_AGC_VALUE, new PoolEntry({0})); - localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry({0})); - localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry({0})); + localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry({0})); + localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry({0})); poolManager.subscribeForPeriodicPacket(txDataset.getSid(), false, 5.0, true); poolManager.subscribeForPeriodicPacket(rxDataset.getSid(), false, 5.0, true); diff --git a/mission/devices/devicedefinitions/GomSpacePackets.h b/mission/devices/devicedefinitions/GomSpacePackets.h index e6736255..9cb25e0c 100644 --- a/mission/devices/devicedefinitions/GomSpacePackets.h +++ b/mission/devices/devicedefinitions/GomSpacePackets.h @@ -334,8 +334,8 @@ class Pdu2FullTableReply : public SerialLinkedListAdapter { /** * @brief This class helps to unpack information from an action message - * to set a parameter in gomspace devices. The action message can be - * for example received from the PUS Service 8. + * to set a parameter in gomspace devices. The action message can be + * for example received from the PUS Service 8. */ class SetParamMessageUnpacker : public SerialLinkedListAdapter { public: diff --git a/mission/devices/devicedefinitions/IMTQHandlerDefinitions.h b/mission/devices/devicedefinitions/IMTQHandlerDefinitions.h index 69a3d048..ff3fbf49 100644 --- a/mission/devices/devicedefinitions/IMTQHandlerDefinitions.h +++ b/mission/devices/devicedefinitions/IMTQHandlerDefinitions.h @@ -391,10 +391,10 @@ class EngHkDataset : public StaticLocalDataSet { lp_var_t coilYCurrentmA = lp_var_t(sid.objectId, COIL_Y_CURRENT, this); lp_var_t coilZCurrentmA = lp_var_t(sid.objectId, COIL_Z_CURRENT, this); /** All temperatures in [�C] */ - lp_var_t coilXTemperature = lp_var_t(sid.objectId, COIL_X_TEMPERATURE, this); - lp_var_t coilYTemperature = lp_var_t(sid.objectId, COIL_Y_TEMPERATURE, this); - lp_var_t coilZTemperature = lp_var_t(sid.objectId, COIL_Z_TEMPERATURE, this); - lp_var_t mcuTemperature = lp_var_t(sid.objectId, MCU_TEMPERATURE, this); + lp_var_t coilXTemperature = lp_var_t(sid.objectId, COIL_X_TEMPERATURE, this); + lp_var_t coilYTemperature = lp_var_t(sid.objectId, COIL_Y_TEMPERATURE, this); + lp_var_t coilZTemperature = lp_var_t(sid.objectId, COIL_Z_TEMPERATURE, this); + lp_var_t mcuTemperature = lp_var_t(sid.objectId, MCU_TEMPERATURE, this); }; /** diff --git a/mission/devices/devicedefinitions/SyrlinksDefinitions.h b/mission/devices/devicedefinitions/SyrlinksDefinitions.h index 7e3b6a20..d4291367 100644 --- a/mission/devices/devicedefinitions/SyrlinksDefinitions.h +++ b/mission/devices/devicedefinitions/SyrlinksDefinitions.h @@ -110,10 +110,10 @@ class TemperatureSet : public StaticLocalDataSet { TemperatureSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {} - lp_var_t temperaturePowerAmplifier = - lp_var_t(sid.objectId, TEMP_POWER_AMPLIFIER, this); - lp_var_t temperatureBasebandBoard = - lp_var_t(sid.objectId, TEMP_BASEBAND_BOARD, this); + lp_var_t temperaturePowerAmplifier = + lp_var_t(sid.objectId, TEMP_POWER_AMPLIFIER, this); + lp_var_t temperatureBasebandBoard = + lp_var_t(sid.objectId, TEMP_BASEBAND_BOARD, this); }; } // namespace syrlinks diff --git a/mission/devices/max1227.cpp b/mission/devices/max1227.cpp index f89e161e..027b60f6 100644 --- a/mission/devices/max1227.cpp +++ b/mission/devices/max1227.cpp @@ -25,4 +25,7 @@ void max1227::prepareExternallyClockedTemperatureRead(uint8_t *spiBuf, size_t &s sz += 25; } -float max1227::getTemperature(int16_t temp) { return static_cast(temp) * 0.125; } +float max1227::getTemperature(uint16_t raw) { + float temp = static_cast((-2048 * (raw >> 11)) + (raw & 0x7FF)) * 0.125; + return temp; +} diff --git a/mission/devices/max1227.h b/mission/devices/max1227.h index fc317b39..a9c1e53b 100644 --- a/mission/devices/max1227.h +++ b/mission/devices/max1227.h @@ -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 diff --git a/scripts/q7s-port-local.sh b/scripts/q7s-port-local.sh index 593569cc..0a9cc7ee 100755 --- a/scripts/q7s-port-local.sh +++ b/scripts/q7s-port-local.sh @@ -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 diff --git a/tmtc b/tmtc index 58ed46e1..bfc9b17f 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 58ed46e110db362ff50f2b44737c8a7dd7027971 +Subproject commit bfc9b17f100152bc82524b4dffabf88e8a43ef32