Fix esp8266 build issue

This commit is contained in:
samuelbles07
2024-11-21 01:26:05 +07:00
parent aad12fc868
commit 3ca2d1d208

View File

@ -124,6 +124,14 @@ bool AgApiClient::postToServer(String data) {
} }
String uri = apiRoot + "/sensors/airgradient:" + ag->deviceId() + "/measures"; String uri = apiRoot + "/sensors/airgradient:" + ag->deviceId() + "/measures";
#ifdef ESP8266
HTTPClient client;
WiFiClient wifiClient;
if (client.begin(wifiClient, uri) == false) {
getConfigFailed = true;
return false;
}
#else
HTTPClient client; HTTPClient client;
client.setTimeout(timeoutMs); client.setTimeout(timeoutMs);
if (apiRootChanged) { if (apiRootChanged) {
@ -141,6 +149,7 @@ bool AgApiClient::postToServer(String data) {
return false; return false;
} }
} }
#endif
client.addHeader("content-type", "application/json"); client.addHeader("content-type", "application/json");
int retCode = client.POST(data); int retCode = client.POST(data);
client.end(); client.end();