diff --git a/include/main.h b/include/main.h index 0239bdb..63ecc57 100644 --- a/include/main.h +++ b/include/main.h @@ -5,7 +5,8 @@ #include #include "secrets.h" #include "settings.h" - + #include + #include Settings settings; #ifdef WIFI @@ -21,7 +22,6 @@ #include #include "ESPAsyncWebServer.h" #include "SPIFFS.h" - #include #include #ifdef WEB_SERIAL_DEBUG #include diff --git a/src/main.cpp b/src/main.cpp index e0385aa..2e0d71f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,7 @@ const unsigned long displayDelay = 1000; // Delay in milliseconds after which th const unsigned long wifiRebootTimeout = 20000; // Delay before reboot after disconnect unsigned int bitCount = 0; // Variable to keep track of the bit count unsigned int maxReaderWaitTime = 9000; // Variable to timeout reader after too long of no data. +HTTPClient http; #ifdef LOCAL_ACL void localAcl(String cardID) { @@ -168,18 +169,11 @@ void handleData1Interrupt() { } #ifdef TINANCE2_BACKEND - #include - - - // Function to send the authentication request to the endpoint - #include // Include the ArduinoJson library - class Tinance2HttpClient { public: Tinance2HttpClient() {} std::pair sendHttpRequest(String url, String method, String payload) { - HTTPClient http; if (!http.begin(url)) { #ifdef SERIAL_DEBUG @@ -360,6 +354,9 @@ void handleData1Interrupt() { void setup() { + // allow reuse (if server supports it) + http.setReuse(true); + #if defined SERIAL_DEBUG || defined SERIAL_ACL Serial.begin(9600); #endif