More buffer time #433

Merged
muellerr merged 5 commits from bugfix_imtq_timing into develop 2023-03-06 11:33:40 +01:00
Showing only changes of commit 4fa5aa6b84 - Show all commits

View File

@ -28,7 +28,8 @@ ReturnValue_t ImtqPollingTask::performOperation(uint8_t operationCode) {
// Stopwatch watch; // Stopwatch watch;
switch (currentRequest) { switch (currentRequest) {
case imtq::RequestType::MEASURE_NO_ACTUATION: { case imtq::RequestType::MEASURE_NO_ACTUATION: {
//Stopwatch watch; // Measured to take 24 ms for debug and release builds.
// Stopwatch watch;
handleMeasureStep(); handleMeasureStep();
break; break;
} }
@ -131,18 +132,12 @@ void ImtqPollingTask::handleMeasureStep() {
if (i2cCmdExecMeasure(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) { if (i2cCmdExecMeasure(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
return; return;
} }
bool mgmMeasurementTooOld = false;
// See p.39 of the iMTQ user manual. If the NEW bit of the STAT bitfield is not set, we probably // See p.39 of the iMTQ user manual. If the NEW bit of the STAT bitfield is not set, we probably
// have old data. Which can be really bad for ACS. And everything. // have old data. Which can be really bad for ACS. And everything.
if ((replyPtr[2] >> 7) == 0) { if ((replyPtr[2] >> 7) == 0) {
sif::error << "IMTQ: MGM measurement too old" << std::endl;
TaskFactory::delayTask(2);
if (i2cCmdExecMeasure(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
return;
}
if ((replyPtr[2] >> 7) == 0) {
sif::error << "IMTQ: MGM measurement still too old" << std::endl;
replyPtr[0] = false; replyPtr[0] = false;
} mgmMeasurementTooOld = true;
} }
cmdBuf[0] = imtq::CC::GET_ENG_HK_DATA; cmdBuf[0] = imtq::CC::GET_ENG_HK_DATA;
@ -154,7 +149,9 @@ void ImtqPollingTask::handleMeasureStep() {
if (i2cCmdExecMeasure(imtq::CC::GET_CAL_MTM_MEASUREMENT) != returnvalue::OK) { if (i2cCmdExecMeasure(imtq::CC::GET_CAL_MTM_MEASUREMENT) != returnvalue::OK) {
return; return;
} }
// sif::debug << "measure done" << std::endl; if(mgmMeasurementTooOld) {
sif::error << "IMTQ: MGM measurement too old" << std::endl;
}
return; return;
} }
@ -191,26 +188,22 @@ void ImtqPollingTask::handleActuateStep() {
if (i2cCmdExecActuate(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) { if (i2cCmdExecActuate(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
return; return;
} }
bool measurementWasTooOld = false;
// See p.39 of the iMTQ user manual. If the NEW bit of the STAT bitfield is not set, we probably // See p.39 of the iMTQ user manual. If the NEW bit of the STAT bitfield is not set, we probably
// have old data. Which can be really bad for ACS. And everything. // have old data. Which can be really bad for ACS. And everything.
if ((replyPtr[2] >> 7) == 0) { if ((replyPtr[2] >> 7) == 0) {
sif::error << "IMTQ: MGM measurement too old" << std::endl; measurementWasTooOld = true;
TaskFactory::delayTask(2);
cmdBuf[0] = imtq::CC::GET_RAW_MTM_MEASUREMENT;
if (i2cCmdExecActuate(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
return;
}
if ((replyPtr[2] >> 7) == 0) {
sif::error << "IMTQ: MGM measurement still too old" << std::endl;
replyPtr[0] = false; replyPtr[0] = false;
} }
}
cmdBuf[0] = imtq::CC::GET_ENG_HK_DATA; cmdBuf[0] = imtq::CC::GET_ENG_HK_DATA;
if (i2cCmdExecActuate(imtq::CC::GET_ENG_HK_DATA) != returnvalue::OK) { if (i2cCmdExecActuate(imtq::CC::GET_ENG_HK_DATA) != returnvalue::OK) {
return; return;
} }
// sif::debug << "measure with torque done" << std::endl;
if(measurementWasTooOld) {
sif::error << "IMTQ: MGM measurement too old" << std::endl;
}
return; return;
} }