     } else {
       Serial.println("Unknown failure from DHT22");
     }
-    return; // try again later.
+    return false; // try again later.
   }
 
   // Cached results are now available in dht22.humidity and dht22.temperature
+  return true;
 }
 
 /*

   updating the corresponding global variables and
   the time of the reading.

   If not enough time has passed since the last reading,
   the sensor will not be read and the values will not be changed.
*/
void readTemperatureAndHumidity() {
  long nowMs = millis();
  if (nowMs - whenSensedMs < TEMPERATURE_UPDATE_INTERVAL_MS) {
    return;   // not ready to be read yet.
  }
  whenSensedMs = nowMs;

  int result = dht22.read22(DHT22_DATA);

  if (result != DHTLIB_OK) {
    if (result == DHTLIB_ERROR_TIMEOUT) {
      Serial.println("Timeout waiting for DHT22");

    while (central.connected()) {  //XXX Not a good idea because connecting hangs all other Arduino functions (like reset and download)
      long nowMs = millis();
      if ((long)(nowMs - whenSensedMs) >= TEMPERATURE_UPDATE_INTERVAL_MS) {
        whenSensedMs = nowMs;
        if (readTemperatureAndHumidity()) {
          setBLETemperatureAndHumidity(dht22.temperature, dht22.humidity);
        }
      }
    }
    // Disconnected
