Move WiFiClient definition outside the board detection loop
This commit is contained in:
parent
9d36a75875
commit
3104324a30
|
|
@ -28,12 +28,12 @@ unsigned long lastStatusTime = 0;
|
||||||
void sendActionMessage(bool state) {
|
void sendActionMessage(bool state) {
|
||||||
if ( DEBUG ) Serial.println("Action button triggered");
|
if ( DEBUG ) Serial.println("Action button triggered");
|
||||||
String msgURL = actionURL + (state ? "true" : "false");
|
String msgURL = actionURL + (state ? "true" : "false");
|
||||||
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
if ( BOARD == "ESP32" ) {
|
if ( BOARD == "ESP32" ) {
|
||||||
msgURL = "http://" + hostAddress + ":" + String(hostPort) + msgURL;
|
msgURL = "http://" + hostAddress + ":" + String(hostPort) + msgURL;
|
||||||
http.begin(msgURL.c_str());
|
http.begin(msgURL.c_str());
|
||||||
} else {
|
} else {
|
||||||
WiFiClient client;
|
|
||||||
http.begin(client, hostAddress.c_str(), hostPort, msgURL.c_str());
|
http.begin(client, hostAddress.c_str(), hostPort, msgURL.c_str());
|
||||||
}
|
}
|
||||||
http.GET();
|
http.GET();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user