 
 
     
-    sim808_clean_buffer(gprsBuffer,32);       
-  }  
+//    sim808_clean_buffer(gprsBuffer,32);       
+//  }  
 
 
 }

  }*/
  
   /******************************************************
   * GPS Configuration
   ******************************************************/
  //GNSS power control
  sim808_check_with_cmd("AT+CGNSPWR=1","OK\r\n",CMD); 

  if(sim808.readable()) {
    sim808_read_buffer(gprsBuffer,64,DEFAULT_TIMEOUT);
    //Serial.print(gprsBuffer);
  }
  if(currentRadioSig <= 7) {
       Serial.println("NOGPRSsig");
       sim808_send_cmd("AT+CDNSGIP=\"ardugps.hopto.org\"\r\n");
       previousRadioSig = currentRadioSig;                
       return NO_GPRS_SIGNAL;            //error of weak signal or DNS failed                     
  }else{                                 //radio signal > 7
    if(previousRadioSig > 7){            //signal still good
      previousRadioSig = currentRadioSig;                
    }else {                              //signal recovered
      error = InitGPRS();
      previousRadioSig = currentRadioSig;
      if(error > 0) {                    //initGPRS failed
        Serial.print("GPRSfail: ");
        Serial.println(error);
        return error;        
      } 
      Serial.println("GprsInitOK");       
    }            
  }
  

    
  //get the local ip number
  //GPRS.println("AT+CIFSR");
  sim808_send_cmd("AT+CIFSR\r\n");
  delay(50);  
  sim808_send_cmd("AT+CDNSGIP=\"ardugps.hopto.org\"\r\n");
  delay(50);
  
  //start a connection to TCP to URL and port 
  if (prot == TCP){
    if(!SendCIPSTART(TCP)){            //TCP protocol
      return START_GPRS_TCP_FAIL;      //"AT+CIPSTART => FAIL"; 
    } 
  }else {                              //UDP protocol
    if(!SendCIPSTART(UDP)){
      return START_GPRS_UDP_FAIL;      //"AT+CIPSTART => FAIL"; 
    }
  }
  
