From cfc346abad78000fe1e880e960968c0faee6c44f Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sat, 27 Feb 2021 01:16:06 +0100 Subject: [PATCH] Fix warnings misc fixes --- wled00/file.cpp | 5 ++++- wled00/json.cpp | 1 + wled00/lx_parser.cpp | 2 +- wled00/src/dependencies/json/AsyncJson-v6.h | 2 +- wled00/wled.cpp | 4 ++++ wled00/wled.h | 6 +++--- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/wled00/file.cpp b/wled00/file.cpp index 352b6af9..e3aac3ae 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -33,7 +33,10 @@ File f; //wrapper to find out how long closing takes void closeFile() { - DEBUGFS_PRINT(F("Close -> ")); + #ifdef WLED_DEBUG_FS + DEBUGFS_PRINT(F("Close -> ")); + uint32_t s = millis(); + #endif f.close(); DEBUGFS_PRINTF("took %d ms\n", millis() - s); doCloseFile = false; diff --git a/wled00/json.cpp b/wled00/json.cpp index 94d880a4..3212b3b4 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -134,6 +134,7 @@ void deserializeSegment(JsonObject elem, byte it) if (sz == 0 && sz > 4) break; int rgbw[] = {0,0,0,0}; + copyArray(icol, rgbw); if (set < 2) stop = start + 1; for (uint16_t i = start; i < stop; i++) { diff --git a/wled00/lx_parser.cpp b/wled00/lx_parser.cpp index e51308c2..526f10d5 100644 --- a/wled00/lx_parser.cpp +++ b/wled00/lx_parser.cpp @@ -25,7 +25,7 @@ bool parseLx(int lxValue, byte rgbw[4]) uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000); tmpBri *= 2.55; - constrain(tmpBri, 0, 255); + tmpBri = constrain(tmpBri, 0, 255); colorKtoRGB(ct, rgbw); lxRed = rgbw[0]; lxGreen = rgbw[1]; lxBlue = rgbw[2]; diff --git a/wled00/src/dependencies/json/AsyncJson-v6.h b/wled00/src/dependencies/json/AsyncJson-v6.h index 7edab311..c1288d91 100644 --- a/wled00/src/dependencies/json/AsyncJson-v6.h +++ b/wled00/src/dependencies/json/AsyncJson-v6.h @@ -144,7 +144,7 @@ public: virtual void handleBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total) override final { if (_onRequest) { _contentLength = total; - if (total > 0 && request->_tempObject == NULL && total < _maxContentLength) { + if (total > 0 && request->_tempObject == NULL && (int)total < _maxContentLength) { request->_tempObject = malloc(total); } if (request->_tempObject != NULL) { diff --git a/wled00/wled.cpp b/wled00/wled.cpp index bedec844..dfbe6967 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -136,6 +136,10 @@ void prepareHostname(char* hostname) //handle Ethernet connection event void WiFiEvent(WiFiEvent_t event) { + #ifdef WLED_USE_ETHERNET + char hostname[25] = "wled-"; + #endif + switch (event) { #if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET) case SYSTEM_EVENT_ETH_START: diff --git a/wled00/wled.h b/wled00/wled.h index 678a4ca6..b6e8cfff 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -312,7 +312,7 @@ WLED_GLOBAL bool huePollingEnabled _INIT(false); // poll hue bridge fo WLED_GLOBAL uint16_t huePollIntervalMs _INIT(2500); // low values (< 1sec) may cause lag but offer quicker response WLED_GLOBAL char hueApiKey[47] _INIT("api"); // key token will be obtained from bridge WLED_GLOBAL byte huePollLightId _INIT(1); // ID of hue lamp to sync to. Find the ID in the hue app ("about" section) -WLED_GLOBAL IPAddress hueIP _INIT_N((( 0, 0, 0, 0))); // IP address of the bridge +WLED_GLOBAL IPAddress hueIP _INIT_N(((0, 0, 0, 0))); // IP address of the bridge WLED_GLOBAL bool hueApplyOnOff _INIT(true); WLED_GLOBAL bool hueApplyBri _INIT(true); WLED_GLOBAL bool hueApplyColor _INIT(true); @@ -481,8 +481,8 @@ WLED_GLOBAL uint8_t tpmPacketCount _INIT(0); WLED_GLOBAL uint16_t tpmPayloadFrameSize _INIT(0); // mqtt -WLED_GLOBAL long lastMqttReconnectAttempt _INIT(0); -WLED_GLOBAL long lastInterfaceUpdate _INIT(0); +WLED_GLOBAL unsigned long lastMqttReconnectAttempt _INIT(0); +WLED_GLOBAL unsigned long lastInterfaceUpdate _INIT(0); WLED_GLOBAL byte interfaceUpdateCallMode _INIT(NOTIFIER_CALL_MODE_INIT); WLED_GLOBAL char mqttStatusTopic[40] _INIT(""); // this must be global because of async handlers