diff --git a/src/app/app.ino b/src/app/app.ino index af7094b..ad9abde 100644 --- a/src/app/app.ino +++ b/src/app/app.ino @@ -226,12 +226,14 @@ void gotIpFunc(const WiFiEventStationModeGotIP &event) void lostConnectionFunc(const WiFiEventStationModeDisconnected &event) { + (void)event; Serial.println("Lost connection, will try to reconnect ..."); } void insertIntoDB(void) { char buffer[100] = ""; + int result(0); //We get the values and put it in our dictionary sprintf(buffer ,"%u", p.id); postData("packetUID")->setString(buffer); @@ -257,18 +259,17 @@ void insertIntoDB(void) sprintf(buffer, "%f", p.htuTemp); postData("htu_tmp")->setString(buffer); - if(DBHost.sendHttpQuery(HttpClient::HttpRequestMethod::POST, NULL, &postData)) + if((result = DBHost.sendHttpQuery(HttpClient::HttpRequestMethod::POST, NULL, &postData)) == 0) { Serial.println("Data posted successfully"); HttpClient::HTTP_CODE response = DBHost.isReplyAvailable(2000); Serial.printf("Got response code : %u\n", response); - DBHost.stop(); } else { - Serial.println("Failed to post data"); - DBHost.stop(); + Serial.printf("Failed to post data : error(%d)\n", result); } + DBHost.stop(); } void debugStruct(DataPacket *p)