Added a tuning timeout for better recovery.

This commit is contained in:
Rolf Ahrenberg 2015-08-16 01:10:52 +03:00
parent 49e2dd1fc1
commit 0f370aa36a
2 changed files with 7 additions and 0 deletions

View File

@ -94,6 +94,7 @@ void cSatipTuner::Action(void)
bool lastIdleStatus = false;
cTimeMs idleCheck(eIdleCheckTimeoutMs);
cTimeMs tuning(eTuningTimeoutMs);
reConnectM.Set(eConnectTimeoutMs);
// Do the thread loop
while (Running()) {
@ -110,6 +111,7 @@ void cSatipTuner::Action(void)
case tsSet:
debug4("%s: tsSet [device %d]", __PRETTY_FUNCTION__, deviceIdM);
if (Connect()) {
tuning.Set(eTuningTimeoutMs);
RequestState(tsTuned, smInternal);
UpdatePids(true);
}
@ -132,6 +134,10 @@ void cSatipTuner::Action(void)
if (hasLockM)
RequestState(tsLocked, smInternal);
}
else if (tuning.TimedOut()) {
error("Tuning timeout - retuning [device %d]", deviceIdM);
RequestState(tsSet, smInternal);
}
break;
case tsLocked:
debug4("%s: tsLocked [device %d]", __PRETTY_FUNCTION__, deviceIdM);

View File

@ -84,6 +84,7 @@ private:
ePidUpdateIntervalMs = 250, // in milliseconds
eConnectTimeoutMs = 5000, // in milliseconds
eIdleCheckTimeoutMs = 15000, // in milliseconds
eTuningTimeoutMs = 20000, // in milliseconds
eMinKeepAliveIntervalMs = 30000 // in milliseconds
};
enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };