diff --git a/platformio.ini b/platformio.ini index 6532f467..19c18bab 100644 --- a/platformio.ini +++ b/platformio.ini @@ -95,16 +95,6 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT # This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m). # ------------------------------------------------------------------------------ build_flags = - -Wno-switch - -Wno-deprecated-declarations - -Wno-write-strings - -Wno-unused-variable - -Wno-unused-value - -Wno-sign-compare - -Wno-unused-but-set-variable - -Wno-return-type - -Wno-sequence-point - -Wno-narrowing -DMQTT_MAX_PACKET_SIZE=1024 -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL -DBEARSSL_SSL_BASIC @@ -121,9 +111,6 @@ build_flags = ; -D USERMOD_SENSORSTOMQTT build_unflags = - -Wall - -Wreorder - -Wdeprecated-declarations # enables all features for travis CI build_flags_all_features = @@ -159,7 +146,7 @@ build_flags = -DMIMETYPE_MINIMAL [esp32] -build_flags = -w -g +build_flags = -g -DARDUINO_ARCH_ESP32 -DCONFIG_LITTLEFS_FOR_IDF_3_2 @@ -197,7 +184,7 @@ lib_deps = AsyncTCP @ 1.0.3 IRremoteESP8266 @ 2.7.3 https://github.com/lorol/LITTLEFS.git - https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.0 + https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.2 #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line #TFT_eSPI #For use SSD1306 OLED display uncomment following diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 3fdfcff1..1f855399 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -545,7 +545,7 @@ uint16_t WS2812FX::dissolve(uint32_t color) { } } - if (SEGENV.call > (255 - SEGMENT.speed) + 15) + if (SEGENV.call > (255 - SEGMENT.speed) + 15U) { SEGENV.aux0 = !SEGENV.aux0; SEGENV.call = 0; @@ -1034,7 +1034,7 @@ uint16_t WS2812FX::mode_running_random(void) { } SEGENV.step++; - if (SEGENV.step > ((255-SEGMENT.intensity) >> 4)) + if (SEGENV.step > (uint8_t)((255-SEGMENT.intensity) >> 4)) { SEGENV.step = 0; } @@ -1568,9 +1568,9 @@ uint16_t WS2812FX::mode_oscillate(void) if (SEGENV.call == 0) { - oscillators[0] = {SEGLEN/4, SEGLEN/8, 1, 1}; - oscillators[1] = {SEGLEN/4*3, SEGLEN/8, 1, 2}; - oscillators[2] = {SEGLEN/4*2, SEGLEN/8, -1, 1}; + oscillators[0] = {(int16_t)(SEGLEN/4), (int8_t)(SEGLEN/8), 1, 1}; + oscillators[1] = {(int16_t)(SEGLEN/4*3), (int8_t)(SEGLEN/8), 1, 2}; + oscillators[2] = {(int16_t)(SEGLEN/4*2), (int8_t)(SEGLEN/8), -1, 1}; } uint32_t cycleTime = 20 + (2 * (uint32_t)(255 - SEGMENT.speed)); @@ -1919,7 +1919,6 @@ uint16_t WS2812FX::mode_noise16_2() for (uint16_t i = 0; i < SEGLEN; i++) { uint16_t shift_x = SEGENV.step >> 6; // x as a function of time - uint16_t shift_y = SEGENV.step/42; uint32_t real_x = (i + shift_x) * scale; // calculate the coordinates within the noise field @@ -3198,8 +3197,8 @@ uint16_t WS2812FX::mode_plasma(void) { uint8_t thatPhase = beatsin8(7,-64,64); for (int i = 0; i < SEGLEN; i++) { // For each of the LED's in the strand, set color & brightness based on a wave as follows: - uint8_t colorIndex = cubicwave8((i*(1+ 3*(SEGMENT.speed >> 5)))+(thisPhase) & 0xFF)/2 // factor=23 // Create a wave and add a phase change and add another wave with its own phase change. - + cos8((i*(1+ 2*(SEGMENT.speed >> 5)))+(thatPhase) & 0xFF)/2; // factor=15 // Hey, you can even change the frequencies if you wish. + uint8_t colorIndex = cubicwave8(((i*(1+ 3*(SEGMENT.speed >> 5)))+(thisPhase)) & 0xFF)/2 // factor=23 // Create a wave and add a phase change and add another wave with its own phase change. + + cos8(((i*(1+ 2*(SEGMENT.speed >> 5)))+(thatPhase)) & 0xFF)/2; // factor=15 // Hey, you can even change the frequencies if you wish. uint8_t thisBright = qsub8(colorIndex, beatsin8(6,0, (255 - SEGMENT.intensity)|0x01 )); CRGB color = ColorFromPalette(currentPalette, colorIndex, thisBright, LINEARBLEND); setPixelColor(i, color.red, color.green, color.blue); diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 75157d7d..215df6c4 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -381,7 +381,6 @@ uint8_t WS2812FX::getPaletteCount() bool WS2812FX::setEffectConfig(uint8_t m, uint8_t s, uint8_t in, uint8_t p) { - uint8_t mainSeg = getMainSegmentId(); Segment& seg = _segments[getMainSegmentId()]; uint8_t modePrev = seg.mode, speedPrev = seg.speed, intensityPrev = seg.intensity, palettePrev = seg.palette; diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index ee8482c0..a3d690dc 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -448,7 +448,6 @@ void serializeConfig() { JsonArray hw_led_ins = hw_led.createNestedArray("ins"); - uint16_t start = 0; for (uint8_t s = 0; s < busses.getNumBusses(); s++) { Bus *bus = busses.getBus(s); if (!bus || bus->getLength()==0) break; diff --git a/wled00/e131.cpp b/wled00/e131.cpp index 58d63779..9ca092a9 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -35,7 +35,8 @@ void handleDDPPacket(e131_packet_t* p) { realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP); for (uint16_t i = start; i < stop; i++) { - setRealtimePixel(i, data[c++], data[c++], data[c++], 0); + setRealtimePixel(i, data[c], data[c+1], data[c+2], 0); + c+=3; } bool push = p->flags & DDP_PUSH_FLAG; @@ -187,11 +188,13 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsPerLed; if (!is4Chan) { for (uint16_t i = previousLeds; i < ledsTotal; i++) { - setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], 0); + setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], 0); + dmxOffset+=3; } } else { for (uint16_t i = previousLeds; i < ledsTotal; i++) { - setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]); + setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], e131_data[dmxOffset+3]); + dmxOffset+=4; } } break; diff --git a/wled00/file.cpp b/wled00/file.cpp index c6e8c413..e3aac3ae 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -33,8 +33,10 @@ File f; //wrapper to find out how long closing takes void closeFile() { - DEBUGFS_PRINT(F("Close -> ")); - uint32_t s = millis(); + #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; @@ -53,7 +55,6 @@ bool bufferedFind(const char *target, bool fromStart = true) { size_t targetLen = strlen(target); size_t index = 0; - byte c; uint16_t bufsize = 0, count = 0; byte buf[FS_BUFSIZE]; if (fromStart) f.seek(0); diff --git a/wled00/json.cpp b/wled00/json.cpp index fdd4accd..4b4714ac 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -134,7 +134,7 @@ void deserializeSegment(JsonObject elem, byte it) if (sz == 0 && sz > 4) break; int rgbw[] = {0,0,0,0}; - byte cp = copyArray(icol, rgbw); + copyArray(icol, rgbw); if (set < 2) stop = start + 1; for (uint16_t i = start; i < stop; i++) { @@ -200,8 +200,8 @@ bool deserializeState(JsonObject root) receiveNotifications = udpn[F("recv")] | receiveNotifications; bool noNotification = udpn[F("nn")]; //send no notification just for this request - unsigned long timein = root[F("time")] | -1; - if (timein != -1) { + unsigned long timein = root[F("time")] | UINT32_MAX; + if (timein != UINT32_MAX) { if (millis() - ntpLastSyncTime > 50000000L) setTime(timein); if (presetsModifiedTime == 0) presetsModifiedTime = timein; } diff --git a/wled00/lx_parser.cpp b/wled00/lx_parser.cpp index 806bd74a..526f10d5 100644 --- a/wled00/lx_parser.cpp +++ b/wled00/lx_parser.cpp @@ -23,10 +23,9 @@ bool parseLx(int lxValue, byte rgbw[4]) ok = true; float tmpBri = floor((lxValue - 200000000) / 10000); ; uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000); - float temp = 0; 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/async-mqtt-client/AsyncMqttClient.cpp b/wled00/src/dependencies/async-mqtt-client/AsyncMqttClient.cpp index f62e1ef4..d0c44cb6 100644 --- a/wled00/src/dependencies/async-mqtt-client/AsyncMqttClient.cpp +++ b/wled00/src/dependencies/async-mqtt-client/AsyncMqttClient.cpp @@ -37,10 +37,10 @@ AsyncMqttClient::AsyncMqttClient() _client.onPoll([](void* obj, AsyncClient* c) { (static_cast(obj))->_onPoll(c); }, this); #ifdef ESP32 - sprintf(_generatedClientId, "esp32%06x", ESP.getEfuseMac()); + sprintf(_generatedClientId, "esp32%06x", (uint32_t)ESP.getEfuseMac()); _xSemaphore = xSemaphoreCreateMutex(); #elif defined(ESP8266) - sprintf(_generatedClientId, "esp8266%06x", ESP.getChipId()); + sprintf(_generatedClientId, "esp8266%06x", (uint32_t)ESP.getChipId()); #endif _clientId = _generatedClientId; diff --git a/wled00/src/dependencies/blynk/Blynk/BlynkProtocolDefs.h b/wled00/src/dependencies/blynk/Blynk/BlynkProtocolDefs.h index 56e6abae..d294a626 100644 --- a/wled00/src/dependencies/blynk/Blynk/BlynkProtocolDefs.h +++ b/wled00/src/dependencies/blynk/Blynk/BlynkProtocolDefs.h @@ -93,7 +93,9 @@ struct BlynkHeader } BLYNK_ATTR_PACKED; -#if !defined(htons) && (defined(ARDUINO) || defined(ESP8266) || defined(PARTICLE) || defined(__MBED__)) +#if defined(ESP32) + #include +#elif !defined(htons) && (defined(ARDUINO) || defined(ESP8266) || defined(PARTICLE) || defined(__MBED__)) #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) ) #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \ diff --git a/wled00/src/dependencies/blynk/BlynkSimpleEsp.h b/wled00/src/dependencies/blynk/BlynkSimpleEsp.h index 6697686f..ee4d374b 100644 --- a/wled00/src/dependencies/blynk/BlynkSimpleEsp.h +++ b/wled00/src/dependencies/blynk/BlynkSimpleEsp.h @@ -45,8 +45,7 @@ public: } BLYNK_LOG1(BLYNK_F("Connected to WiFi")); - IPAddress myip = WiFi.localIP(); - BLYNK_LOG_IP("IP: ", myip); + BLYNK_LOG_IP("IP: ", WiFi.localIP()); } void config(const char* auth, diff --git a/wled00/src/dependencies/dmx/ESPDMX.cpp b/wled00/src/dependencies/dmx/ESPDMX.cpp index f3ece1c8..6ad1268e 100644 --- a/wled00/src/dependencies/dmx/ESPDMX.cpp +++ b/wled00/src/dependencies/dmx/ESPDMX.cpp @@ -77,10 +77,9 @@ void DMXESPSerial::write(int Channel, uint8_t value) { } void DMXESPSerial::end() { - delete dmxData; chanSize = 0; Serial1.end(); - dmxStarted == false; + dmxStarted = false; } void DMXESPSerial::update() { diff --git a/wled00/src/dependencies/espalexa/Espalexa.h b/wled00/src/dependencies/espalexa/Espalexa.h index 0ec4e2e5..5e7dc837 100644 --- a/wled00/src/dependencies/espalexa/Espalexa.h +++ b/wled00/src/dependencies/espalexa/Espalexa.h @@ -101,8 +101,8 @@ private: case EspalexaDeviceType::whitespectrum: return PSTR("Color temperature light"); case EspalexaDeviceType::color: return PSTR("Color light"); case EspalexaDeviceType::extendedcolor: return PSTR("Extended color light"); + default: return ""; } - return ""; } const char* modelidString(EspalexaDeviceType t) @@ -113,8 +113,8 @@ private: case EspalexaDeviceType::whitespectrum: return "LWT010"; case EspalexaDeviceType::color: return "LST001"; case EspalexaDeviceType::extendedcolor: return "LCT015"; + default: return ""; } - return ""; } void encodeLightId(uint8_t idx, char* out) diff --git a/wled00/src/dependencies/espalexa/EspalexaDevice.cpp b/wled00/src/dependencies/espalexa/EspalexaDevice.cpp index 8bdd780d..d7d0920f 100644 --- a/wled00/src/dependencies/espalexa/EspalexaDevice.cpp +++ b/wled00/src/dependencies/espalexa/EspalexaDevice.cpp @@ -112,7 +112,6 @@ uint32_t EspalexaDevice::getRGB() { if (_rgb != 0) return _rgb; //color has not changed byte rgb[4]{0, 0, 0, 0}; - float r, g, b, w; if (_mode == EspalexaColorMode::none) return 0; 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/um_manager.cpp b/wled00/um_manager.cpp index 51fcd0ec..4d07226e 100644 --- a/wled00/um_manager.cpp +++ b/wled00/um_manager.cpp @@ -32,6 +32,7 @@ bool UsermodManager::add(Usermod* um) if (numMods >= WLED_MAX_USERMODS || um == nullptr) return false; ums[numMods] = um; numMods++; + return true; } byte UsermodManager::getModCount() {return numMods;} \ No newline at end of file diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 94a34fa1..0cb6b85d 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -136,8 +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: @@ -292,7 +294,6 @@ void WLED::setup() DEBUG_PRINT("esp8266 "); DEBUG_PRINTLN(ESP.getCoreVersion()); #endif - int heapPreAlloc = ESP.getFreeHeap(); DEBUG_PRINT("heap "); DEBUG_PRINTLN(ESP.getFreeHeap()); registerUsermods(); diff --git a/wled00/wled.h b/wled00/wled.h index 202b9da7..b6e8cfff 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -65,7 +65,9 @@ #include #include //#include "SPIFFS.h" - #define CONFIG_LITTLEFS_FOR_IDF_3_2 + #ifndef CONFIG_LITTLEFS_FOR_IDF_3_2 + #define CONFIG_LITTLEFS_FOR_IDF_3_2 + #endif #include #endif @@ -310,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((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); @@ -473,14 +475,14 @@ WLED_GLOBAL int16_t currentPlaylist _INIT(0); // realtime WLED_GLOBAL byte realtimeMode _INIT(REALTIME_MODE_INACTIVE); WLED_GLOBAL byte realtimeOverride _INIT(REALTIME_OVERRIDE_NONE); -WLED_GLOBAL IPAddress realtimeIP _INIT((0, 0, 0, 0)); +WLED_GLOBAL IPAddress realtimeIP _INIT_N(((0, 0, 0, 0)));; WLED_GLOBAL unsigned long realtimeTimeout _INIT(0); 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 diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index cae23c9d..2ae24a53 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -245,7 +245,7 @@ bool handleIfNoneMatchCacheHeader(AsyncWebServerRequest* request) return false; } -bool setStaticContentCacheHeaders(AsyncWebServerResponse *response) +void setStaticContentCacheHeaders(AsyncWebServerResponse *response) { response->addHeader(F("Cache-Control"),"max-age=2592000"); response->addHeader(F("ETag"), String(VERSION)); diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 8e987d3c..11a0cb48 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -309,7 +309,7 @@ void getSettingsJS(byte subPage, char* dest) sappend('v',SET_F("LA"),strip.milliampsPerLed); if (strip.currentMilliamps) { - sappends('m',SET_F("(\"pow\")[0]"),""); + sappends('m',SET_F("(\"pow\")[0]"),(char*)""); olen -= 2; //delete "; oappendi(strip.currentMilliamps); oappend(SET_F("mA\";"));