v1.12.0 #269
@ -15,6 +15,7 @@
|
|||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||||
#include "mission/utility/InitMission.h"
|
#include "mission/utility/InitMission.h"
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
||||||
"ACS_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
"ACS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||||
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
||||||
@ -138,26 +139,42 @@ void initmission::initTasks() {
|
|||||||
initmission::printAddObjectError("RW_ASS", objects::RW_ASS);
|
initmission::printAddObjectError("RW_ASS", objects::RW_ASS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_SUS_BOARD_ASS == 1
|
#if OBSW_ADD_SUS_BOARD_ASS == 1
|
||||||
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
|
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
|
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PeriodicTaskIF* tcsTask = factory->createPeriodicTask(
|
||||||
|
"TCS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
|
std::array<object_id_t, EiveMax31855::NUM_RTDS> rtdIds = {
|
||||||
|
objects::RTD_0_IC3_PLOC_HEATSPREADER,
|
||||||
|
objects::RTD_1_IC4_PLOC_MISSIONBOARD,
|
||||||
|
objects::RTD_2_IC5_4K_CAMERA,
|
||||||
|
objects::RTD_3_IC6_DAC_HEATSPREADER,
|
||||||
|
objects::RTD_4_IC7_STARTRACKER,
|
||||||
|
objects::RTD_5_IC8_RW1_MX_MY,
|
||||||
|
objects::RTD_6_IC9_DRO,
|
||||||
|
objects::RTD_7_IC10_SCEX,
|
||||||
|
objects::RTD_8_IC11_X8,
|
||||||
|
objects::RTD_9_IC12_HPA,
|
||||||
|
objects::RTD_10_IC13_PL_TX,
|
||||||
|
objects::RTD_11_IC14_MPA,
|
||||||
|
objects::RTD_12_IC15_ACU,
|
||||||
|
objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
|
||||||
|
objects::RTD_14_IC17_TCS_BOARD,
|
||||||
|
objects::RTD_15_IC18_IMTQ,
|
||||||
|
};
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
#if OBSW_ADD_RTD_DEVICES == 1
|
||||||
result = sysTask->addComponent(objects::TCS_BOARD_ASS);
|
for (const auto& rtd : rtdIds) {
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
tcsTask->addComponent(rtd, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
|
tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
tcsTask->addComponent(rtd, DeviceHandlerIF::GET_WRITE);
|
||||||
|
tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_READ);
|
||||||
|
tcsTask->addComponent(rtd, DeviceHandlerIF::GET_READ);
|
||||||
}
|
}
|
||||||
auto* rtdReader = ObjectManager::instance()->get<DeviceCommunicationIF>(objects::SPI_RTD_COM_IF);
|
#endif /* OBSW_ADD_RTD_DEVICES */
|
||||||
if (rtdReader != nullptr) {
|
|
||||||
result = sysTask->addComponent(objects::SPI_RTD_COM_IF);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("SPI_RTD_COM_IF", objects::SPI_RTD_COM_IF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
|
|
||||||
|
|
||||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||||
// because it is a non-essential background task
|
// because it is a non-essential background task
|
||||||
@ -254,12 +271,9 @@ void initmission::initTasks() {
|
|||||||
strHelperTask->startTask();
|
strHelperTask->startTask();
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
|
||||||
acsTask->startTask();
|
acsTask->startTask();
|
||||||
#endif
|
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
|
||||||
sysTask->startTask();
|
sysTask->startTask();
|
||||||
#endif
|
tcsTask->startTask();
|
||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
supvHelperTask->startTask();
|
supvHelperTask->startTask();
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 4841d5d92d721383e92b521b584c7d0e62c9873d
|
Subproject commit dba08fed7a00187ba204f46bc40424f7b87f3aea
|
@ -313,7 +313,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
|||||||
rtds[idx] = typedHandler;
|
rtds[idx] = typedHandler;
|
||||||
typedHandler->setDeviceInfo(idx, rtdInfos[idx].second);
|
typedHandler->setDeviceInfo(idx, rtdInfos[idx].second);
|
||||||
#if OBSW_DEBUG_RTD == 1
|
#if OBSW_DEBUG_RTD == 1
|
||||||
// typedHandler->setDebugMode(true);
|
typedHandler->setDebugMode(true, 5);
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_TEST_RTD == 1
|
#if OBSW_TEST_RTD == 1
|
||||||
typedHandler->setInstantNormal(true);
|
typedHandler->setInstantNormal(true);
|
||||||
|
@ -49,16 +49,15 @@ bool Max31865RtdReader::periodicInitHandling() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool someRtdOn = false;
|
|
||||||
for (auto& rtd : rtds) {
|
for (auto& rtd : rtds) {
|
||||||
if (rtd == nullptr) {
|
if (rtd == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((rtd->on or rtd->active) and not rtd->configured) {
|
if ((rtd->on or rtd->active) and not rtd->configured) {
|
||||||
if (rtd->cd.hasTimedOut()) {
|
if (rtd->cd.hasTimedOut()) {
|
||||||
uint8_t cfg =
|
uint8_t cfg = (Bias::OFF << CfgBitPos::BIAS_SEL) |
|
||||||
(Bias::OFF << CfgBitPos::BIAS_SEL) | (Wires::FOUR_WIRE << CfgBitPos::WIRE_SEL) |
|
(Wires::FOUR_WIRE << CfgBitPos::WIRE_SEL) |
|
||||||
(ConvMode::NORM_OFF << CfgBitPos::CONV_MODE) | (1 << CfgBitPos::FAULTY_STATUS_CLEAR);
|
(ConvMode::NORM_OFF << CfgBitPos::CONV_MODE);
|
||||||
result = writeCfgReg(rtd->spiCookie, cfg);
|
result = writeCfgReg(rtd->spiCookie, cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
handleSpiError(rtd, result, "writeCfgReg");
|
handleSpiError(rtd, result, "writeCfgReg");
|
||||||
@ -84,14 +83,14 @@ bool Max31865RtdReader::periodicInitHandling() {
|
|||||||
handleSpiError(rtd, result, "clearFaultStatus");
|
handleSpiError(rtd, result, "clearFaultStatus");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
someRtdOn = true;
|
|
||||||
rtd->configured = true;
|
rtd->configured = true;
|
||||||
|
rtd->db.configured = true;
|
||||||
|
if (rtd->active) {
|
||||||
|
rtd->db.active = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (not someRtdOn) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool someRtdUsable = false;
|
bool someRtdUsable = false;
|
||||||
for (auto& rtd : rtds) {
|
for (auto& rtd : rtds) {
|
||||||
if (rtd == nullptr) {
|
if (rtd == nullptr) {
|
||||||
@ -126,6 +125,10 @@ void Max31865RtdReader::periodicReadReqHandling() {
|
|||||||
}
|
}
|
||||||
currentCfg |= (1 << CfgBitPos::ONE_SHOT);
|
currentCfg |= (1 << CfgBitPos::ONE_SHOT);
|
||||||
result = writeCfgReg(rtd->spiCookie, currentCfg);
|
result = writeCfgReg(rtd->spiCookie, currentCfg);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
handleSpiError(rtd, result, "writeCfgReg");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +157,7 @@ void Max31865RtdReader::periodicReadHandling() {
|
|||||||
if (faultBitSet) {
|
if (faultBitSet) {
|
||||||
rtd->db.faultBitSet = faultBitSet;
|
rtd->db.faultBitSet = faultBitSet;
|
||||||
}
|
}
|
||||||
rtd->db.rtdVal = rtdVal;
|
rtd->db.adcCode = rtdVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto& rtd : rtds) {
|
for (auto& rtd : rtds) {
|
||||||
@ -182,6 +185,10 @@ ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
|
|||||||
throw std::invalid_argument("Invalid RTD index");
|
throw std::invalid_argument("Invalid RTD index");
|
||||||
}
|
}
|
||||||
rtds[rtdCookie->idx] = rtdCookie;
|
rtds[rtdCookie->idx] = rtdCookie;
|
||||||
|
MutexGuard mg(readerMutex);
|
||||||
|
if (dbLen == 0) {
|
||||||
|
dbLen = rtdCookie->db.getSerializedSize();
|
||||||
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,14 +306,13 @@ ReturnValue_t Max31865RtdReader::readReceivedMessage(CookieIF* cookie, uint8_t**
|
|||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
*buffer = reinterpret_cast<uint8_t*>(rtdCookie->exchangeBuf.data());
|
*buffer = reinterpret_cast<uint8_t*>(rtdCookie->exchangeBuf.data());
|
||||||
*size = rtdCookie->db.getSerializedSize();
|
*size = serLen;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::writeCfgReg(SpiCookie* cookie, uint8_t cfg) {
|
ReturnValue_t Max31865RtdReader::writeCfgReg(SpiCookie* cookie, uint8_t cfg) {
|
||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
uint8_t cmd = cfg;
|
return writeNToReg(cookie, CONFIG, 1, &cfg, nullptr);
|
||||||
return writeNToReg(cookie, CONFIG, 1, &cmd, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::writeBiasSel(MAX31865::Bias bias, SpiCookie* cookie) {
|
ReturnValue_t Max31865RtdReader::writeBiasSel(MAX31865::Bias bias, SpiCookie* cookie) {
|
||||||
@ -388,7 +394,7 @@ ReturnValue_t Max31865RtdReader::writeNToReg(SpiCookie* cookie, uint8_t reg, siz
|
|||||||
for (size_t idx = 0; idx < n; idx++) {
|
for (size_t idx = 0; idx < n; idx++) {
|
||||||
cmdBuf[idx + 1] = cmd[idx];
|
cmdBuf[idx + 1] = cmd[idx];
|
||||||
}
|
}
|
||||||
return comIF->sendMessage(cookie, cmd, 2);
|
return comIF->sendMessage(cookie, cmdBuf.data(), n + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::readRtdVal(SpiCookie* cookie, uint16_t& val, bool& faultBitSet) {
|
ReturnValue_t Max31865RtdReader::readRtdVal(SpiCookie* cookie, uint16_t& val, bool& faultBitSet) {
|
||||||
@ -416,18 +422,19 @@ ReturnValue_t Max31865RtdReader::readNFromReg(SpiCookie* cookie, uint8_t reg, si
|
|||||||
reg &= ~WRITE_BIT;
|
reg &= ~WRITE_BIT;
|
||||||
cmdBuf[0] = reg;
|
cmdBuf[0] = reg;
|
||||||
std::memset(cmdBuf.data() + 1, 0, n);
|
std::memset(cmdBuf.data() + 1, 0, n);
|
||||||
ReturnValue_t result = comIF->sendMessage(cookie, cmdBuf.data(), n);
|
ReturnValue_t result = comIF->sendMessage(cookie, cmdBuf.data(), n + 1);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
uint8_t* replyPtr = replyBuf.data();
|
|
||||||
size_t dummyLen = 0;
|
size_t dummyLen = 0;
|
||||||
|
uint8_t* replyPtr = nullptr;
|
||||||
result = comIF->readReceivedMessage(cookie, &replyPtr, &dummyLen);
|
result = comIF->readReceivedMessage(cookie, &replyPtr, &dummyLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (reply != nullptr) {
|
if (reply != nullptr) {
|
||||||
*reply = replyBuf.data() + 1;
|
*reply = replyPtr + 1;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class Max31865RtdReader : public SystemObject,
|
|||||||
private:
|
private:
|
||||||
std::vector<Max31865ReaderCookie*> rtds;
|
std::vector<Max31865ReaderCookie*> rtds;
|
||||||
std::array<uint8_t, 4> cmdBuf = {};
|
std::array<uint8_t, 4> cmdBuf = {};
|
||||||
std::array<uint8_t, 4> replyBuf = {};
|
size_t dbLen = 0;
|
||||||
MutexIF* readerMutex;
|
MutexIF* readerMutex;
|
||||||
|
|
||||||
void rtdMainLoop();
|
void rtdMainLoop();
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
|
|
||||||
|
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||||
|
|
||||||
#ifndef RPI_TEST_ADIS16507
|
#ifndef RPI_TEST_ADIS16507
|
||||||
#define RPI_TEST_ADIS16507 0
|
#define RPI_TEST_ADIS16507 0
|
||||||
#endif
|
#endif
|
||||||
@ -62,6 +64,7 @@ ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
||||||
uint32_t length = thisSequence->getPeriodMs();
|
uint32_t length = thisSequence->getPeriodMs();
|
||||||
static_cast<void>(length);
|
static_cast<void>(length);
|
||||||
|
thisSequence->addSlot(objects::SPI_RTD_COM_IF, length * 0.0, 0);
|
||||||
#if OBSW_ADD_PL_PCDU == 1
|
#if OBSW_ADD_PL_PCDU == 1
|
||||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||||
@ -73,140 +76,26 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
|
||||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
|
||||||
|
|
||||||
#if OBSW_ADD_TMP_DEVICES == 1
|
#if OBSW_ADD_TMP_DEVICES == 1
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
|
||||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.2,
|
|
||||||
DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.2,
|
|
||||||
DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.2,
|
|
||||||
DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.2,
|
|
||||||
DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
|
||||||
|
|
||||||
#if OBSW_ADD_TMP_DEVICES == 1
|
#if OBSW_ADD_TMP_DEVICES == 1
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
|
||||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.4,
|
|
||||||
DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.4,
|
|
||||||
DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.4,
|
|
||||||
DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.4,
|
|
||||||
DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
|
||||||
|
|
||||||
#if OBSW_ADD_TMP_DEVICES == 1
|
#if OBSW_ADD_TMP_DEVICES == 1
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
|
||||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.6,
|
|
||||||
DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.6,
|
|
||||||
DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.6,
|
|
||||||
DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.6,
|
|
||||||
DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.6, DeviceHandlerIF::SEND_READ);
|
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
|
||||||
|
|
||||||
#if OBSW_ADD_TMP_DEVICES == 1
|
#if OBSW_ADD_TMP_DEVICES == 1
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
|
||||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.8,
|
|
||||||
DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.8,
|
|
||||||
DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.8,
|
|
||||||
DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.8,
|
|
||||||
DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
|
||||||
|
|
||||||
#if OBSW_ADD_RAD_SENSORS == 1
|
#if OBSW_ADD_RAD_SENSORS == 1
|
||||||
/* Radiation sensor */
|
/* Radiation sensor */
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
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),
|
||||||
sensorDataset(this, EiveMax31855::RtdCommands::EXCHANGE_SET_ID) {}
|
sensorDataset(this, EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
||||||
|
debugDivider(5) {
|
||||||
|
structLen = exchangeStruct.getSerializedSize();
|
||||||
|
}
|
||||||
|
|
||||||
void Max31865EiveHandler::doStartUp() {
|
void Max31865EiveHandler::doStartUp() {
|
||||||
if (state == InternalState::NONE or state == InternalState::INACTIVE) {
|
if (state == InternalState::NONE or state == InternalState::INACTIVE) {
|
||||||
@ -86,21 +89,18 @@ void Max31865EiveHandler::setInstantNormal(bool instantNormal) {
|
|||||||
this->instantNormal = instantNormal;
|
this->instantNormal = instantNormal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Max31865EiveHandler::setDebugMode(bool enable, uint32_t divider) {
|
||||||
|
this->debugMode = enable;
|
||||||
|
debugDivider.setDivider(divider);
|
||||||
|
}
|
||||||
|
|
||||||
void Max31865EiveHandler::simpleCommand(EiveMax31855::RtdCommands cmd) {
|
void Max31865EiveHandler::simpleCommand(EiveMax31855::RtdCommands cmd) {
|
||||||
cmdBuf[0] = static_cast<uint8_t>(cmd);
|
cmdBuf[0] = static_cast<uint8_t>(cmd);
|
||||||
rawPacket = cmdBuf.data();
|
rawPacket = cmdBuf.data();
|
||||||
rawPacketLen = 1;
|
rawPacketLen = 1;
|
||||||
}
|
}
|
||||||
void Max31865EiveHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
void Max31865EiveHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||||
if (mode == _MODE_TO_NORMAL) {
|
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
|
||||||
state = InternalState::ACTIVE;
|
|
||||||
transitionOk = false;
|
|
||||||
if (transitionOk) {
|
|
||||||
setMode(MODE_NORMAL);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Max31865EiveHandler::fillCommandAndReplyMap() {
|
void Max31865EiveHandler::fillCommandAndReplyMap() {
|
||||||
@ -112,20 +112,42 @@ void Max31865EiveHandler::fillCommandAndReplyMap() {
|
|||||||
|
|
||||||
ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
if (remainingSize != exchangeStruct.getSerializedSize()) {
|
if (remainingSize != structLen) {
|
||||||
sif::error << "Invalid reply from RTD reader detected, reply size " << remainingSize
|
sif::error << "Invalid reply from RTD reader detected, reply size " << remainingSize
|
||||||
<< "not equal to exchange struct size" << exchangeStruct.getSerializedSize()
|
<< " not equal to exchange struct size " << structLen << std::endl;
|
||||||
<< std::endl;
|
return DeviceHandlerIF::INVALID_DATA;
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
}
|
||||||
*foundId = EiveMax31855::RtdCommands::EXCHANGE_SET_ID;
|
*foundId = EiveMax31855::RtdCommands::EXCHANGE_SET_ID;
|
||||||
*foundLen = remainingSize;
|
*foundLen = remainingSize;
|
||||||
sif::info << "Max31865EiveHandler::scanForReply: Reply size " << remainingSize << std::endl;
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t* packet) {
|
const uint8_t* packet) {
|
||||||
|
size_t deserTmp = structLen;
|
||||||
|
auto result = exchangeStruct.deSerialize(&packet, &deserTmp, SerializeIF::Endianness::MACHINE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (mode == _MODE_START_UP) {
|
||||||
|
if (exchangeStruct.active and state == InternalState::ACTIVE) {
|
||||||
|
transitionOk = true;
|
||||||
|
}
|
||||||
|
if (exchangeStruct.configured and state == InternalState::ON) {
|
||||||
|
transitionOk = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Calculate resistance
|
||||||
|
float rtdValue = exchangeStruct.adcCode * EiveMax31855::RTD_RREF_PT1000 / INT16_MAX;
|
||||||
|
// calculate approximation
|
||||||
|
float approxTemp = exchangeStruct.adcCode / 32.0 - 256.0;
|
||||||
|
|
||||||
|
if (debugMode) {
|
||||||
|
if (debugDivider.checkAndIncrement()) {
|
||||||
|
sif::info << "Max31865: " << std::setw(20) << std::left << locString << std::right
|
||||||
|
<< " | R[Ohm] " << rtdValue << " Ohms | Approx T[C]: " << approxTemp << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +170,7 @@ void Max31865EiveHandler::setDeviceInfo(uint8_t idx_, std::string location_) {
|
|||||||
|
|
||||||
ReturnValue_t Max31865EiveHandler::initialize() {
|
ReturnValue_t Max31865EiveHandler::initialize() {
|
||||||
auto result = DeviceHandlerBase::initialize();
|
auto result = DeviceHandlerBase::initialize();
|
||||||
if(result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return updatePeriodicReply(true, EiveMax31855::RtdCommands::EXCHANGE_SET_ID);
|
return updatePeriodicReply(true, EiveMax31855::RtdCommands::EXCHANGE_SET_ID);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define MISSION_DEVICES_MAX31865EIVEHANDLER_H_
|
#define MISSION_DEVICES_MAX31865EIVEHANDLER_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
|
|
||||||
#include "devicedefinitions/Max31865Definitions.h"
|
#include "devicedefinitions/Max31865Definitions.h"
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ class Max31865EiveHandler : public DeviceHandlerBase {
|
|||||||
public:
|
public:
|
||||||
Max31865EiveHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie);
|
Max31865EiveHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie);
|
||||||
void setInstantNormal(bool instantNormal);
|
void setInstantNormal(bool instantNormal);
|
||||||
|
void setDebugMode(bool enable, uint32_t divider);
|
||||||
void setDeviceInfo(uint8_t idx, std::string location);
|
void setDeviceInfo(uint8_t idx, std::string location);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -33,8 +35,11 @@ class Max31865EiveHandler : public DeviceHandlerBase {
|
|||||||
uint8_t idx = 0;
|
uint8_t idx = 0;
|
||||||
std::string locString = "Unknown";
|
std::string locString = "Unknown";
|
||||||
EiveMax31855::ReadOutStruct exchangeStruct;
|
EiveMax31855::ReadOutStruct exchangeStruct;
|
||||||
|
bool debugMode = false;
|
||||||
|
size_t structLen = 0;
|
||||||
bool instantNormal = false;
|
bool instantNormal = false;
|
||||||
MAX31865::Max31865Set sensorDataset;
|
MAX31865::Max31865Set sensorDataset;
|
||||||
|
PeriodicOperationDivider debugDivider;
|
||||||
enum class InternalState { NONE, ON, ACTIVE, INACTIVE } state = InternalState::NONE;
|
enum class InternalState { NONE, ON, ACTIVE, INACTIVE } state = InternalState::NONE;
|
||||||
bool transitionOk = false;
|
bool transitionOk = false;
|
||||||
};
|
};
|
||||||
|
@ -394,9 +394,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
// RTD value consists of last seven bits of the LSB reply byte and
|
// RTD value consists of last seven bits of the LSB reply byte and
|
||||||
// the MSB reply byte
|
// the MSB reply byte
|
||||||
uint16_t adcCode = ((packet[1] << 8) | packet[2]) >> 1;
|
uint16_t adcCode = ((packet[1] << 8) | packet[2]) >> 1;
|
||||||
// do something with rtd value, will propably be stored in
|
// Calculate resistance
|
||||||
// dataset.
|
float rtdValue = adcCode * EiveMax31855::RTD_RREF_PT1000 / INT16_MAX;
|
||||||
float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX;
|
|
||||||
// calculate approximation
|
// calculate approximation
|
||||||
float approxTemp = adcCode / 32.0 - 256.0;
|
float approxTemp = adcCode / 32.0 - 256.0;
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ class Max31865PT1000Handler : public DeviceHandlerBase {
|
|||||||
static constexpr uint16_t HIGH_THRESHOLD = 11298; // = 100 C
|
static constexpr uint16_t HIGH_THRESHOLD = 11298; // = 100 C
|
||||||
static constexpr uint16_t LOW_THRESHOLD = 4902; // = -100 C
|
static constexpr uint16_t LOW_THRESHOLD = 4902; // = -100 C
|
||||||
|
|
||||||
static constexpr float RTD_RREF_PT1000 = 4020.0; //!< Ohm
|
|
||||||
static constexpr float RTD_RESISTANCE0_PT1000 = 1000.0; //!< Ohm
|
static constexpr float RTD_RESISTANCE0_PT1000 = 1000.0; //!< Ohm
|
||||||
protected:
|
protected:
|
||||||
// DeviceHandlerBase abstract function implementation
|
// DeviceHandlerBase abstract function implementation
|
||||||
|
@ -14,7 +14,7 @@ enum Wires : unsigned int { TWO_WIRE = 0, THREE_WIRE = 1, FOUR_WIRE = 0 };
|
|||||||
|
|
||||||
enum ConvMode : unsigned int { NORM_OFF = 0, AUTO = 1 };
|
enum ConvMode : unsigned int { NORM_OFF = 0, AUTO = 1 };
|
||||||
|
|
||||||
enum Bias : unsigned int { ON = 0, OFF = 1 };
|
enum Bias : unsigned int { OFF = 0, ON = 1 };
|
||||||
|
|
||||||
enum FilterSel : unsigned int { FIFTY_HERTZ = 1, SIXTY_HERTZ = 0 };
|
enum FilterSel : unsigned int { FIFTY_HERTZ = 1, SIXTY_HERTZ = 0 };
|
||||||
|
|
||||||
@ -85,6 +85,7 @@ class Max31865Set : public StaticLocalDataSet<4> {
|
|||||||
|
|
||||||
namespace EiveMax31855 {
|
namespace EiveMax31855 {
|
||||||
|
|
||||||
|
static constexpr float RTD_RREF_PT1000 = 4020.0; //!< Ohm
|
||||||
static constexpr uint8_t NUM_RTDS = 16;
|
static constexpr uint8_t NUM_RTDS = 16;
|
||||||
|
|
||||||
enum RtdCommands : DeviceCommandId_t {
|
enum RtdCommands : DeviceCommandId_t {
|
||||||
@ -104,24 +105,28 @@ class ReadOutStruct : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
ReadOutStruct(bool active, uint32_t spiErrCnt, bool faultBitSet, uint8_t faultVal,
|
ReadOutStruct(bool active, uint32_t spiErrCnt, bool faultBitSet, uint8_t faultVal,
|
||||||
uint16_t rtdVal)
|
uint16_t rtdVal)
|
||||||
: active(active),
|
: active(active),
|
||||||
rtdVal(rtdVal),
|
adcCode(rtdVal),
|
||||||
faultBitSet(faultBitSet),
|
faultBitSet(faultBitSet),
|
||||||
faultValue(faultVal),
|
faultValue(faultVal),
|
||||||
spiErrorCount(spiErrCnt) {
|
spiErrorCount(spiErrCnt) {
|
||||||
setLinks();
|
setLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! RTD was set on and is configured, but is not periodically polled
|
||||||
|
SerializeElement<bool> configured = false;
|
||||||
|
//! RTD is active and polled periodically
|
||||||
SerializeElement<bool> active = false;
|
SerializeElement<bool> active = false;
|
||||||
SerializeElement<uint16_t> rtdVal = 0;
|
SerializeElement<uint16_t> adcCode = 0;
|
||||||
SerializeElement<bool> faultBitSet = false;
|
SerializeElement<bool> faultBitSet = false;
|
||||||
SerializeElement<uint8_t> faultValue = 0;
|
SerializeElement<uint8_t> faultValue = 0;
|
||||||
SerializeElement<uint32_t> spiErrorCount = 0;
|
SerializeElement<uint32_t> spiErrorCount = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setLinks() {
|
void setLinks() {
|
||||||
setStart(&active);
|
setStart(&configured);
|
||||||
active.setNext(&rtdVal);
|
configured.setNext(&active);
|
||||||
rtdVal.setNext(&faultBitSet);
|
active.setNext(&adcCode);
|
||||||
|
adcCode.setNext(&faultBitSet);
|
||||||
faultBitSet.setNext(&faultValue);
|
faultBitSet.setNext(&faultValue);
|
||||||
faultValue.setNext(&spiErrorCount);
|
faultValue.setNext(&spiErrorCount);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user