Skip to content

Commit b460d0f

Browse files
embedded-creationsLouis BeaudoinAircoookie
authored
Fix Warnings (wled#1744)
* Remove -w (Suppress all warnings, including those which GNU CPP issues by default.) and add back in -Wall (Turn on all optional warnings which are desirable for normal code.) from build_flags * Fixes warning: suggest parentheses around '+' in operand of '&' [-Wparentheses] * Fixes warning: "CONFIG_LITTLEFS_FOR_IDF_3_2" redefined * Fixes warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] * Fixes warning: enumeration value 'onoff' not handled in switch [-Wswitch] * Fixes warning: "ntohl" redefined, warning: "ntohs" redefined, warning: "htonl" redefined, warning: "htons" redefined - Original fix: blynkkk/blynk-library@858f8f4 * Fixes warning: unused variable 'mainSeg' [-Wunused-variable] * Fixes warning: unused variable 'start' [-Wunused-variable] * (untested!) Fixes warning: operation on '...' may be undefined [-Wsequence-point] * Fixes warning: unused variable * Fixes warning: unused variable and warning: narrowing conversion * Fixes warning: unused variable * Fixes warning: unused variable * (untested!) Fixes warning: statement has no effect [-Wunused-value] * Fixes warning: control reaches end of non-void function * Fixes warning: unused variable * Fixes warning: left operand of comma operator has no effect * Fixes warning: no return statement in function returning non-void * (untested!) Fixes warning: ISO C++ forbids converting a string constant to 'char*' and fixes warning: unused variable 'nPins' * Fixes warning: deleting array 'dmxData' * Fixes warning: unused variable * Remove all warning suppression buildflags Co-authored-by: Louis Beaudoin <[email protected]> Co-authored-by: Aircoookie <[email protected]>
1 parent 746a8ba commit b460d0f

File tree

18 files changed

+28
-45
lines changed

18 files changed

+28
-45
lines changed

platformio.ini

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT
9595
# This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m).
9696
# ------------------------------------------------------------------------------
9797
build_flags =
98-
-Wno-switch
99-
-Wno-deprecated-declarations
100-
-Wno-write-strings
101-
-Wno-unused-variable
102-
-Wno-unused-value
103-
-Wno-sign-compare
104-
-Wno-unused-but-set-variable
105-
-Wno-return-type
106-
-Wno-sequence-point
107-
-Wno-narrowing
10898
-DMQTT_MAX_PACKET_SIZE=1024
10999
-DSECURE_CLIENT=SECURE_CLIENT_BEARSSL
110100
-DBEARSSL_SSL_BASIC
@@ -121,9 +111,6 @@ build_flags =
121111
; -D USERMOD_SENSORSTOMQTT
122112

123113
build_unflags =
124-
-Wall
125-
-Wreorder
126-
-Wdeprecated-declarations
127114

128115
# enables all features for travis CI
129116
build_flags_all_features =
@@ -159,7 +146,7 @@ build_flags =
159146
-DMIMETYPE_MINIMAL
160147

161148
[esp32]
162-
build_flags = -w -g
149+
build_flags = -g
163150
-DARDUINO_ARCH_ESP32
164151
-DCONFIG_LITTLEFS_FOR_IDF_3_2
165152

wled00/FX.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,9 +1568,9 @@ uint16_t WS2812FX::mode_oscillate(void)
15681568

15691569
if (SEGENV.call == 0)
15701570
{
1571-
oscillators[0] = {SEGLEN/4, SEGLEN/8, 1, 1};
1572-
oscillators[1] = {SEGLEN/4*3, SEGLEN/8, 1, 2};
1573-
oscillators[2] = {SEGLEN/4*2, SEGLEN/8, -1, 1};
1571+
oscillators[0] = {(int16_t)(SEGLEN/4), (int8_t)(SEGLEN/8), 1, 1};
1572+
oscillators[1] = {(int16_t)(SEGLEN/4*3), (int8_t)(SEGLEN/8), 1, 2};
1573+
oscillators[2] = {(int16_t)(SEGLEN/4*2), (int8_t)(SEGLEN/8), -1, 1};
15741574
}
15751575

15761576
uint32_t cycleTime = 20 + (2 * (uint32_t)(255 - SEGMENT.speed));
@@ -1919,7 +1919,6 @@ uint16_t WS2812FX::mode_noise16_2()
19191919
for (uint16_t i = 0; i < SEGLEN; i++) {
19201920

19211921
uint16_t shift_x = SEGENV.step >> 6; // x as a function of time
1922-
uint16_t shift_y = SEGENV.step/42;
19231922

19241923
uint32_t real_x = (i + shift_x) * scale; // calculate the coordinates within the noise field
19251924

@@ -3198,8 +3197,8 @@ uint16_t WS2812FX::mode_plasma(void) {
31983197
uint8_t thatPhase = beatsin8(7,-64,64);
31993198

32003199
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:
3201-
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.
3202-
+ cos8((i*(1+ 2*(SEGMENT.speed >> 5)))+(thatPhase) & 0xFF)/2; // factor=15 // Hey, you can even change the frequencies if you wish.
3200+
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.
3201+
+ cos8(((i*(1+ 2*(SEGMENT.speed >> 5)))+(thatPhase)) & 0xFF)/2; // factor=15 // Hey, you can even change the frequencies if you wish.
32033202
uint8_t thisBright = qsub8(colorIndex, beatsin8(6,0, (255 - SEGMENT.intensity)|0x01 ));
32043203
CRGB color = ColorFromPalette(currentPalette, colorIndex, thisBright, LINEARBLEND);
32053204
setPixelColor(i, color.red, color.green, color.blue);

wled00/FX_fcn.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ uint8_t WS2812FX::getPaletteCount()
380380

381381

382382
bool WS2812FX::setEffectConfig(uint8_t m, uint8_t s, uint8_t in, uint8_t p) {
383-
uint8_t mainSeg = getMainSegmentId();
384383
Segment& seg = _segments[getMainSegmentId()];
385384
uint8_t modePrev = seg.mode, speedPrev = seg.speed, intensityPrev = seg.intensity, palettePrev = seg.palette;
386385

wled00/cfg.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ void serializeConfig() {
446446

447447
JsonArray hw_led_ins = hw_led.createNestedArray("ins");
448448

449-
uint16_t start = 0;
450449
for (uint8_t s = 0; s < busses.getNumBusses(); s++) {
451450
Bus *bus = busses.getBus(s);
452451
if (!bus || bus->getLength()==0) break;

wled00/e131.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ void handleDDPPacket(e131_packet_t* p) {
3535
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP);
3636

3737
for (uint16_t i = start; i < stop; i++) {
38-
setRealtimePixel(i, data[c++], data[c++], data[c++], 0);
38+
setRealtimePixel(i, data[c], data[c+1], data[c+2], 0);
39+
c+=3;
3940
}
4041

4142
bool push = p->flags & DDP_PUSH_FLAG;
@@ -187,11 +188,13 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
187188
uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsPerLed;
188189
if (!is4Chan) {
189190
for (uint16_t i = previousLeds; i < ledsTotal; i++) {
190-
setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], 0);
191+
setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], 0);
192+
dmxOffset+=3;
191193
}
192194
} else {
193195
for (uint16_t i = previousLeds; i < ledsTotal; i++) {
194-
setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]);
196+
setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], e131_data[dmxOffset+3]);
197+
dmxOffset+=4;
195198
}
196199
}
197200
break;

wled00/file.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ File f;
3434
//wrapper to find out how long closing takes
3535
void closeFile() {
3636
DEBUGFS_PRINT(F("Close -> "));
37-
uint32_t s = millis();
3837
f.close();
3938
DEBUGFS_PRINTF("took %d ms\n", millis() - s);
4039
doCloseFile = false;
@@ -53,7 +52,6 @@ bool bufferedFind(const char *target, bool fromStart = true) {
5352
size_t targetLen = strlen(target);
5453

5554
size_t index = 0;
56-
byte c;
5755
uint16_t bufsize = 0, count = 0;
5856
byte buf[FS_BUFSIZE];
5957
if (fromStart) f.seek(0);

wled00/json.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ void deserializeSegment(JsonObject elem, byte it)
134134
if (sz == 0 && sz > 4) break;
135135

136136
int rgbw[] = {0,0,0,0};
137-
byte cp = copyArray(icol, rgbw);
138137

139138
if (set < 2) stop = start + 1;
140139
for (uint16_t i = start; i < stop; i++) {

wled00/lx_parser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ bool parseLx(int lxValue, byte rgbw[4])
2323
ok = true;
2424
float tmpBri = floor((lxValue - 200000000) / 10000); ;
2525
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);
26-
float temp = 0;
2726

2827
tmpBri *= 2.55;
2928
constrain(tmpBri, 0, 255);

wled00/src/dependencies/async-mqtt-client/AsyncMqttClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ AsyncMqttClient::AsyncMqttClient()
3737
_client.onPoll([](void* obj, AsyncClient* c) { (static_cast<AsyncMqttClient*>(obj))->_onPoll(c); }, this);
3838

3939
#ifdef ESP32
40-
sprintf(_generatedClientId, "esp32%06x", ESP.getEfuseMac());
40+
sprintf(_generatedClientId, "esp32%06x", (uint32_t)ESP.getEfuseMac());
4141
_xSemaphore = xSemaphoreCreateMutex();
4242
#elif defined(ESP8266)
43-
sprintf(_generatedClientId, "esp8266%06x", ESP.getChipId());
43+
sprintf(_generatedClientId, "esp8266%06x", (uint32_t)ESP.getChipId());
4444
#endif
4545
_clientId = _generatedClientId;
4646

wled00/src/dependencies/blynk/Blynk/BlynkProtocolDefs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ struct BlynkHeader
9393
}
9494
BLYNK_ATTR_PACKED;
9595

96-
#if !defined(htons) && (defined(ARDUINO) || defined(ESP8266) || defined(PARTICLE) || defined(__MBED__))
96+
#if defined(ESP32)
97+
#include <lwip/ip_addr.h>
98+
#elif !defined(htons) && (defined(ARDUINO) || defined(ESP8266) || defined(PARTICLE) || defined(__MBED__))
9799
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
98100
#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
99101
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \

0 commit comments

Comments
 (0)