File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Find out more at https://www.sensate.io
55
66# The Sensate Firmware for ESP32 currently uses the following Libraries:
77
8- - Arduino IDE ESP32 Base Library (https://github.com/espressif/arduino-esp32 v1.0.5-rc7 )
8+ - Arduino IDE ESP32 Base Library (https://github.com/espressif/arduino-esp32 v1.0.5)
99- ArduinoJson (https://github.com/bblanchon/ArduinoJson v5.13.5)
1010- Thingpulse SSD1306 (https://github.com/ThingPulse/esp8266-oled-ssd1306 v4.0.0)
1111- Soligen2010 fork of Adafruit_ADS1x15 (https://github.com/soligen2010/Adafruit_ADS1X15 ) v1.2.1
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ bool serverError = false;
6767
6868int registerRetry = 0 ;
6969int configRetry = 0 ;
70+ int postSensorDataRetry = 0 ;
7071int sensorCycle = 1 ;
7172
7273extern VisualisationHelper* vHelper;
@@ -1205,19 +1206,26 @@ boolean postSensorData(Data* data[], int dataCount)
12051206 httpClient.begin (urlString, testCertificate);
12061207 else
12071208 httpClient.begin (urlString);
1209+
1210+ Serial.print (" p" );
12081211
12091212 int httpCode = httpClient.PUT (" " );
12101213
12111214 if (httpCode == HTTP_CODE_UPGRADE_REQUIRED)
12121215 {
1216+ Serial.print (" u" );
1217+
12131218 httpClient.end ();
12141219 restart ();
12151220 return true ;
12161221 }
12171222 else if (httpCode == HTTP_CODE_OK)
12181223 {
1224+ Serial.print (" o" );
1225+
12191226 if (serverError || wasDisconnected)
12201227 {
1228+ postSensorDataRetry=0 ;
12211229 serverError = false ;
12221230 wasDisconnected = false ;
12231231 if (display!=NULL )
@@ -1252,6 +1260,8 @@ boolean postSensorData(Data* data[], int dataCount)
12521260 }
12531261 else
12541262 {
1263+ Serial.print (" e" );
1264+
12551265 if (display!=NULL )
12561266 {
12571267 wasDisconnected=true ;
@@ -1265,6 +1275,16 @@ boolean postSensorData(Data* data[], int dataCount)
12651275 Serial.println (WiFi.status ());
12661276
12671277 httpClient.end ();
1278+
1279+ postSensorDataRetry++;
1280+
1281+ if (postSensorDataRetry>=25 )
1282+ {
1283+ postSensorDataRetry=0 ;
1284+ restart ();
1285+ }
1286+
1287+ Serial.println (" Retry #" +String (postSensorDataRetry)+" , restart at 25" );
12681288 }
12691289 return false ;
12701290}
You can’t perform that action at this time.
0 commit comments