 }
 
 void loop () {
-  // gradually improve the estimate each time reception succeeds
-  if (estimateWithWatchdog() && window >= 32)
-    window /= 2;
+  if (estimateWithWatchdog()) {
+    // gradually narrow down the window whenever reception succeeds
+    if (window >= 32)
+      window /= 2;
+    missed = 0;
+  } else {
+    // but widen the window again if reception fails for too long
+    if (window <= 512 && ++missed % 10 == 0)
+      window *= 4; // increase window x4 at every 10 packets missed
+  }
 }

  } while (!isDesiredPacket());

  int offset = window - (diff - lowEstimate);
  estimate = diff & ~0x0F; // truncate down to a 16 ms multiple

  Serial.print(" ok at "); Serial.print(diff);
  Serial.print(", window = "); Serial.print(window);

  return rf12_recvDone() && rf12_crc == 0 && rf12_hdr == SEND_ID;
}

// since the watchdog timer is inaccurate, we must estimate
static bool estimateWithWatchdog () {
  // first wait indefinitely for a packet to come in
  while (!isDesiredPacket())
