this snippet should recognize faulty sensors #592

Merged
meggert merged 2 commits from feature_add_way_for_max_handler_to_recognize_faulty_sensor into develop 2023-04-12 17:55:40 +02:00
3 changed files with 13 additions and 4 deletions
Showing only changes of commit e063a7148a - Show all commits

View File

@ -1,3 +1 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE CfdpHandler.cpp)
target_sources(
${LIB_EIVE_MISSION} PRIVATE CfdpHandler.cpp)

View File

@ -1,5 +1,4 @@
#include <fsfw/cfdp/CfdpDistributor.h> #include <fsfw/cfdp/CfdpDistributor.h>
#include <mission/cfdp/CfdpHandler.h>
#include <fsfw/cfdp/handler/RemoteConfigTableIF.h> #include <fsfw/cfdp/handler/RemoteConfigTableIF.h>
#include <fsfw/controller/ControllerBase.h> #include <fsfw/controller/ControllerBase.h>
#include <fsfw/controller/ExtendedControllerBase.h> #include <fsfw/controller/ExtendedControllerBase.h>
@ -23,6 +22,7 @@
#include <fsfw/tcdistribution/PusDistributor.h> #include <fsfw/tcdistribution/PusDistributor.h>
#include <fsfw/timemanager/CdsShortTimeStamper.h> #include <fsfw/timemanager/CdsShortTimeStamper.h>
#include <fsfw_hal/host/HostFilesystem.h> #include <fsfw_hal/host/HostFilesystem.h>
#include <mission/cfdp/CfdpHandler.h>
#include <mission/controller/ThermalController.h> #include <mission/controller/ThermalController.h>
#include <mission/genericFactory.h> #include <mission/genericFactory.h>
#include <mission/persistentTmStoreDefs.h> #include <mission/persistentTmStoreDefs.h>

View File

@ -1,6 +1,8 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/tcs/Max31865EiveHandler.h> #include <mission/tcs/Max31865EiveHandler.h>
#include "fsfw/thermal/tcsDefinitions.h"
Max31865EiveHandler::Max31865EiveHandler(object_id_t objectId, object_id_t comIF, Max31865EiveHandler::Max31865EiveHandler(object_id_t objectId, object_id_t comIF,
CookieIF* comCookie) CookieIF* comCookie)
: DeviceHandlerBase(objectId, comIF, comCookie, nullptr), : DeviceHandlerBase(objectId, comIF, comCookie, nullptr),
@ -152,6 +154,15 @@ ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id,
transitionOk = true; transitionOk = true;
return returnvalue::OK; return returnvalue::OK;
} }
// If the 15 received bits are all ones, this is considered a case where the device does not
// work because it does not drive the MISO line. This can happens if the sensor is broken
// or off.
if (exchangeStruct.adcCode == 0x7fff) {
PoolReadGuard pg(&sensorDataset);
sensorDataset.temperatureCelcius.setValid(false);
sensorDataset.temperatureCelcius = thermal::INVALID_TEMPERATURE;
return returnvalue::FAILED;
}
// Calculate resistance // Calculate resistance
float rtdValue = exchangeStruct.adcCode * EiveMax31855::RTD_RREF_PT1000 / INT16_MAX; float rtdValue = exchangeStruct.adcCode * EiveMax31855::RTD_RREF_PT1000 / INT16_MAX;