 
 void publishReadings()
 {
+    int res = 1;
+    int tries = 5;
+
     if ((millis() - lastT) > (CHTUPDPERIOD * 1000)) {
+        display_string_5x7(6,1,"Publishing");
         lastT = millis();
-        readAM2321();
-        char szEventInfo[64];
-        sprintf(szEventInfo, "field1=%.1f&field2=%.2f", temp, humi);
-        sendToThingSpeak(WRITEKEY,String(szEventInfo));
+        if (readOK == false) {
+            res = readAM2321();
+            while (res && (tries-- > 0)) {
+              delay(1000);
+              res = readAM2321();
+            }
+        }
+        if (!res || readOK) {
+            readOK = true;
+            char szEventInfo[64];
+            sprintf(szEventInfo, "field1=%.1f&field2=%.2f", temp, humi);
+            sendToThingSpeak(WRITEKEY,String(szEventInfo));
+        }
         Spark.sleep(CHTUPDPERIOD - 30);
     }
 }
 
 void backLightOn()
 {
+    display_string_5x7(6,1,"BL ON ");
+    detachInterrupt(BackLightTrigger);
     RGB.control(false);
     trigger = millis() + BACKLDUR;
     transfer_command_lcd(0xaf);//--turn on oled panel 

  DHT22.isrCallback();
}

void readAM2321() {
  int lt = millis();
  int result;

  detachInterrupt(BackLightTrigger);
    DHT22.acquire();
  while (DHT22.acquiring() && (millis() - lt < TIMEOUT))
    ;
  //delay(500);
  //DHT22.acquire();
  //while (DHT22.acquiring())


void backLightOff()
{
    display_string_5x7(6,1,"BL Off");
    RGB.control(true);
    RGB.color(0,0,0);
    //display_string_5x7(6,1,"DISP OFF");
    transfer_command_lcd(0xae);//--turn off oled panel 
    refresh=false;
    attachInterrupt(BackLightTrigger, backLightOn, RISING);
}


