diff options
author | Steven <steven.vasilogianis@gmail.com> | 2021-10-06 01:03:11 -0400 |
---|---|---|
committer | Steven <steven.vasilogianis@gmail.com> | 2021-10-06 01:03:11 -0400 |
commit | c153fc0d8bf2f2e57b75bfde81539305f6fa0c50 (patch) | |
tree | f6cb79f7ac94d5b7caff67ff4a61f61221ea9608 | |
parent | 1b959372194555d2b9f65a4c2cb8ced7bcf26b08 (diff) |
ota.h fix: use strlen instead of sizeof
-rw-r--r-- | ota.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -20,6 +20,7 @@ | |||
20 | #ifndef ota_h | 20 | #ifndef ota_h |
21 | #define ota_h | 21 | #define ota_h |
22 | // needed include files | 22 | // needed include files |
23 | #include <cstring> | ||
23 | #include <ESP8266WiFi.h> | 24 | #include <ESP8266WiFi.h> |
24 | #include <ESP8266mDNS.h> | 25 | #include <ESP8266mDNS.h> |
25 | #include <WiFiUdp.h> | 26 | #include <WiFiUdp.h> |
@@ -32,9 +33,8 @@ | |||
32 | // Establish WiFi connection | 33 | // Establish WiFi connection |
33 | // ================================================================== | 34 | // ================================================================== |
34 | void setupWifi(char hostname[]) { | 35 | void setupWifi(char hostname[]) { |
35 | int i = 0; | ||
36 | WiFi.mode(WIFI_STA); | 36 | WiFi.mode(WIFI_STA); |
37 | if (sizeof(hostname) > 0) { | 37 | if (strlen(hostname) > 0) { |
38 | WiFi.hostname(hostname); | 38 | WiFi.hostname(hostname); |
39 | } | 39 | } |
40 | if (Serial) {Serial.println("Connecting ");} | 40 | if (Serial) {Serial.println("Connecting ");} |
@@ -60,7 +60,7 @@ void setupOTA(char hostname[]) { | |||
60 | // ArduinoOTA.setPort(8266); | 60 | // ArduinoOTA.setPort(8266); |
61 | 61 | ||
62 | // Hostname defaults to esp8266-[ChipID] | 62 | // Hostname defaults to esp8266-[ChipID] |
63 | if (sizeof(hostname) > 0) { | 63 | if (strlen(hostname) > 0) { |
64 | ArduinoOTA.setHostname(hostname); | 64 | ArduinoOTA.setHostname(hostname); |
65 | } | 65 | } |
66 | 66 | ||