electronicsguy / ESP8266

ESP8266 Projects
242 stars 183 forks source link

HTTPSRedirect.h taking 4 sec delay to upload data on spread sheet #40

Closed DKAagri closed 7 years ago

DKAagri commented 7 years ago

http post and sending data to google spreadsheet .my code is communicating with google scripts over Hello, currently i am observing a delay of about 3 - 4 seconds in data reception on google spreadsheet . Need data in less then 1 sec to upload on spread sheet .

electronicsguy commented 7 years ago

There is a delay put it within the loop() to make sure you don't trip the watchdog timer. A smaller delay will eventually make it crash. You could experiment reducing the delay, but I doubt if it's going to work with less than 1sec.

DKAagri commented 7 years ago

I already remove that delay() from loop()... some time i am getting data within 2 sec and some time 4 sec sec in google spread sheet .

extra time taking by below mention code in loop()--

if (!flag){ // free_heap_before = ESP.getFreeHeap(); // free_stack_before = cont_get_free_stack(&g_cont); client = new HTTPSRedirect(httpsPort); flag = true; client->setPrintResponseBody(true); client->setContentTypeHeader("application/json"); }

is it mandatory to call above code each time in loop.? i have less knowledge about this code and how to deal with this.. is there any possibility to run this code once to establish the connection b/w spread sheet ?

electronicsguy commented 7 years ago

It doesn't run each time. The code within the if() statement doesn't run if a valid client object is connected. Hence, the 'flag' variable. If it has gotten disconnected, then you have to re-establish the connection before you can send any data. There's no way to avoid this.