RTD Fix #345

Merged
muellerr merged 10 commits from meier/rtd-fix into develop 2023-01-20 12:27:18 +01:00
4 changed files with 21 additions and 6 deletions

View File

@ -22,6 +22,7 @@ list yields a list of all related PRs for each release.
- The ACS Controller Gyro Sets (raw and processed) and the MEKF dataset are diagnostics now. - The ACS Controller Gyro Sets (raw and processed) and the MEKF dataset are diagnostics now.
- Bumped FSFW for Service 11 improvement which includes size and CRC check for contained TC - Bumped FSFW for Service 11 improvement which includes size and CRC check for contained TC
- Syrlinks module now always included for both EM and FM - Syrlinks module now always included for both EM and FM
- RTD: Config is now written before each temperature request.
## Fixed ## Fixed

View File

@ -143,7 +143,7 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() {
auto result = returnvalue::OK; auto result = returnvalue::OK;
MutexGuard mg(readerMutex); MutexGuard mg(readerMutex);
if (mg.getLockResult() != returnvalue::OK) { if (mg.getLockResult() != returnvalue::OK) {
sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl; sif::warning << "Max31865RtdReader::periodicReadHandling: Mutex lock failed" << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
} }
// Now read the RTD values // Now read the RTD values
@ -154,6 +154,10 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() {
if (rtdIsActive(rtd->idx)) { if (rtdIsActive(rtd->idx)) {
uint16_t rtdVal = 0; uint16_t rtdVal = 0;
bool faultBitSet = false; bool faultBitSet = false;
result = writeCfgReg(rtd->spiCookie, BASE_CFG);
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "writeCfgReg");
}
result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet); result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
handleSpiError(rtd, result, "readRtdVal"); handleSpiError(rtd, result, "readRtdVal");
@ -282,7 +286,13 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
} }
break; break;
} }
case (EiveMax31855::RtdCommands::CFG): case (EiveMax31855::RtdCommands::CFG): {
ReturnValue_t result = writeCfgReg(rtdCookie->spiCookie, BASE_CFG);
if (result != returnvalue::OK) {
handleSpiError(rtdCookie, result, "writeCfgReg");
}
break;
}
default: { default: {
// TODO: Only implement if needed // TODO: Only implement if needed
break; break;

View File

@ -9,8 +9,12 @@ PdecConfig::~PdecConfig() {}
void PdecConfig::initialize() { void PdecConfig::initialize() {
uint32_t word = 0; uint32_t word = 0;
word |= (VERSION_ID << 30); word |= (VERSION_ID << 30);
// Setting the bypass flag and the control command flag should not have any
// implication on the operation of the PDEC IP Core
word |= (BYPASS_FLAG << 29); word |= (BYPASS_FLAG << 29);
word |= (CONTROL_COMMAND_FLAG << 28); word |= (CONTROL_COMMAND_FLAG << 28);
word |= (RESERVED_FIELD_A << 26); word |= (RESERVED_FIELD_A << 26);
word |= (SPACECRAFT_ID << 16); word |= (SPACECRAFT_ID << 16);
word |= (VIRTUAL_CHANNEL << 10); word |= (VIRTUAL_CHANNEL << 10);

View File

@ -69,7 +69,8 @@ ReturnValue_t Max31865EiveHandler::buildCommandFromCommand(DeviceCommandId_t dev
switch (cmdTyped) { switch (cmdTyped) {
case (EiveMax31855::RtdCommands::ON): case (EiveMax31855::RtdCommands::ON):
case (EiveMax31855::RtdCommands::ACTIVE): case (EiveMax31855::RtdCommands::ACTIVE):
case (EiveMax31855::RtdCommands::OFF): { case (EiveMax31855::RtdCommands::OFF):
case (EiveMax31855::RtdCommands::CFG): {
simpleCommand(cmdTyped); simpleCommand(cmdTyped);
break; break;
} }
@ -77,9 +78,6 @@ ReturnValue_t Max31865EiveHandler::buildCommandFromCommand(DeviceCommandId_t dev
case (EiveMax31855::RtdCommands::HIGH_TRESHOLD): { case (EiveMax31855::RtdCommands::HIGH_TRESHOLD): {
break; break;
} }
case (EiveMax31855::RtdCommands::CFG): {
break;
}
default: default:
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
} }
@ -100,6 +98,7 @@ void Max31865EiveHandler::simpleCommand(EiveMax31855::RtdCommands 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 (getMode() == _MODE_TO_NORMAL) { if (getMode() == _MODE_TO_NORMAL) {
if (state != InternalState::ACTIVE) { if (state != InternalState::ACTIVE) {
@ -117,6 +116,7 @@ void Max31865EiveHandler::fillCommandAndReplyMap() {
insertInCommandMap(EiveMax31855::RtdCommands::ON); insertInCommandMap(EiveMax31855::RtdCommands::ON);
insertInCommandMap(EiveMax31855::RtdCommands::ACTIVE); insertInCommandMap(EiveMax31855::RtdCommands::ACTIVE);
insertInCommandMap(EiveMax31855::RtdCommands::OFF); insertInCommandMap(EiveMax31855::RtdCommands::OFF);
insertInCommandMap(EiveMax31855::RtdCommands::CFG);
insertInReplyMap(EiveMax31855::RtdCommands::EXCHANGE_SET_ID, 200, &sensorDataset, 0, true); insertInReplyMap(EiveMax31855::RtdCommands::EXCHANGE_SET_ID, 200, &sensorDataset, 0, true);
} }