       mqttClient.disconnect();
     }*/
     wifistatus = LWiFi.status();
+    
     if (wifistatus!=LWIFI_STATUS_DISABLED && failedCounter>3){
         Serial.println("before LWiFi.end()...");
         LWiFi.end();

          //mqttClient.disconnect();
          // close the file:
          myFile.close();
        
          Drv.remove((char*)LOG_FILENAME);
          Serial.println("\nUpload complete, log file removed");
          logRecordCnt=0;
      } // if (myFile) 
    } // if(Drv.exists((char*)LOG_FILENAME))

                if(Record!="@"){
                  Record.toCharArray(msg, Record.length()+1);
                  Serial.println(msg);
                  if(checkWifiConnected()==1){
                    mqttPublishRoutine(0);
                    
                    LastPostTime = currentTime;
  
                    //mqttClient.publish(mqttTopic, msg);
                    //sent the same msg to partner which may monitor this topic, current work around
                    //these delay msg may cause problem to partner, not send it now.
                    //mqttClient.publish(mqttTopicSelf, msg);
                    Serial.print(".");
                    dotCnt++;
                    if((dotCnt % 1) ==0){
                      Serial.println(".");
                    }
                  }else{
                    upload_fail=1; 
                    break; 
                  }
                  
                }
