Skip to content

Commit 2c69c5e

Browse files
committed
fixed compiler warnings, removed unused stuff
1 parent 81708d2 commit 2c69c5e

File tree

6 files changed

+55
-62
lines changed

6 files changed

+55
-62
lines changed

platformio.ini

-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ upload_speed = 115200
137137
# ------------------------------------------------------------------------------
138138
lib_compat_mode = strict
139139
lib_deps =
140-
;fastled/FastLED @ 3.6.0
141140
IRremoteESP8266 @ 2.8.2
142141
makuna/NeoPixelBus @ 2.8.3
143142
#https://github.com./makuna/NeoPixelBus.git#CoreShaderBeta
@@ -225,7 +224,6 @@ lib_deps_compat =
225224
ESPAsyncTCP @ 1.2.2
226225
ESPAsyncUDP
227226
ESP8266PWM
228-
;fastled/FastLED @ 3.6.0
229227
IRremoteESP8266 @ 2.8.2
230228
makuna/NeoPixelBus @ 2.7.9
231229
https://github.com./blazoncek/QuickESPNow.git#optional-debug

usermods/usermod_rotary_brightness_color/usermod_rotary_brightness_color.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ class RotaryEncoderBrightnessColor : public Usermod
9696
fastled_col.red = colPri[0];
9797
fastled_col.green = colPri[1];
9898
fastled_col.blue = colPri[2];
99-
prim_hsv = rgb2hsv_approximate(fastled_col);
99+
prim_hsv = rgb2hsv(fastled_col);
100100
new_val = (int16_t)prim_hsv.h + fadeAmount;
101101
if (new_val > 255)
102102
new_val -= 255; // roll-over if bigger than 255
103103
if (new_val < 0)
104104
new_val += 255; // roll-over if smaller than 0
105105
prim_hsv.h = (byte)new_val;
106-
hsv2rgb_rainbow(prim_hsv, fastled_col);
106+
fastled_col = prim_hsv ;
107107
colPri[0] = fastled_col.red;
108108
colPri[1] = fastled_col.green;
109109
colPri[2] = fastled_col.blue;
@@ -121,14 +121,14 @@ class RotaryEncoderBrightnessColor : public Usermod
121121
fastled_col.red = colPri[0];
122122
fastled_col.green = colPri[1];
123123
fastled_col.blue = colPri[2];
124-
prim_hsv = rgb2hsv_approximate(fastled_col);
124+
prim_hsv = rgb2hsv(fastled_col);
125125
new_val = (int16_t)prim_hsv.h - fadeAmount;
126126
if (new_val > 255)
127127
new_val -= 255; // roll-over if bigger than 255
128128
if (new_val < 0)
129129
new_val += 255; // roll-over if smaller than 0
130130
prim_hsv.h = (byte)new_val;
131-
hsv2rgb_rainbow(prim_hsv, fastled_col);
131+
fastled_col = prim_hsv;
132132
colPri[0] = fastled_col.red;
133133
colPri[1] = fastled_col.green;
134134
colPri[2] = fastled_col.blue;

wled00/FX.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -4922,7 +4922,6 @@ uint16_t mode_2DColoredBursts() { // By: ldirko https://editor.so
49224922
byte dy = lerp8by8(x2, y2, rate);
49234923
//SEGMENT.setPixelColorXY(dx, dy, grad ? color_fade(color, (255-rate), true) : color); // use addPixelColorXY for different look
49244924
SEGMENT.addPixelColorXY(dx, dy, color); // use setPixelColorXY for different look
4925-
color_fade(color, (255-rate), true);
49264925
if (grad) SEGMENT.fadePixelColorXY(dx, dy, rate);
49274926
}
49284927

wled00/colors.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -738,29 +738,29 @@ void fill_solid_RGB(CRGB* colors, uint32_t num, const CRGB& c1) {
738738
// fill CRGB array with a color gradient
739739
void fill_gradient_RGB(CRGB* colors, uint32_t startpos, CRGB startcolor, uint32_t endpos, CRGB endcolor) {
740740
if(endpos < startpos) { // if the points are in the wrong order, flip them
741-
uint32_t t = endpos;
741+
unsigned t = endpos;
742742
CRGB tc = endcolor;
743743
endcolor = startcolor;
744744
endpos = startpos;
745745
startpos = t;
746746
startcolor = tc;
747747
}
748-
int32_t rdistance = endcolor.r - startcolor.r;
749-
int32_t gdistance = endcolor.g - startcolor.g;
750-
int32_t bdistance = endcolor.b - startcolor.b;
748+
int rdistance = endcolor.r - startcolor.r;
749+
int gdistance = endcolor.g - startcolor.g;
750+
int bdistance = endcolor.b - startcolor.b;
751751

752-
int32_t divisor = endpos - startpos;
752+
int divisor = endpos - startpos;
753753
divisor = divisor == 0 ? 1 : divisor; // prevent division by zero
754754

755-
int32_t rdelta = (rdistance << 16) / divisor;
756-
int32_t gdelta = (gdistance << 16) / divisor;
757-
int32_t bdelta = (bdistance << 16) / divisor;
755+
int rdelta = (rdistance << 16) / divisor;
756+
int gdelta = (gdistance << 16) / divisor;
757+
int bdelta = (bdistance << 16) / divisor;
758758

759-
int32_t rshifted = startcolor.r << 16;
760-
int32_t gshifted = startcolor.g << 16;
761-
int32_t bshifted = startcolor.b << 16;
759+
int rshifted = startcolor.r << 16;
760+
int gshifted = startcolor.g << 16;
761+
int bshifted = startcolor.b << 16;
762762

763-
for (int32_t i = startpos; i <= endpos; i++) {
763+
for (unsigned i = startpos; i <= endpos; i++) {
764764
colors[i] = CRGB(rshifted >> 16, gshifted >> 16, bshifted >> 16);
765765
rshifted += rdelta;
766766
gshifted += gdelta;

wled00/colors.h

+38-42
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@ uint8_t qsub8(uint8_t i, uint8_t j);
2222
int8_t abs8(int8_t i);
2323

2424
typedef uint32_t TProgmemRGBPalette16[16];
25-
typedef uint8_t TDynamicRGBGradientPalette_byte; ///< Byte of an RGB gradient entry, stored in dynamic (heap) memory
26-
typedef const TDynamicRGBGradientPalette_byte *TDynamicRGBGradientPalette_bytes; ///< Pointer to bytes of an RGB gradient, stored in dynamic (heap) memory
27-
typedef TDynamicRGBGradientPalette_bytes TDynamicRGBGradientPalettePtr; ///< Alias of ::TDynamicRGBGradientPalette_bytes
25+
typedef uint8_t TDynamicRGBGradientPalette_byte; // Byte of an RGB gradient entry, stored in dynamic (heap) memory
26+
typedef const TDynamicRGBGradientPalette_byte *TDynamicRGBGradientPalette_bytes; // Pointer to bytes of an RGB gradient, stored in dynamic (heap) memory
27+
typedef TDynamicRGBGradientPalette_bytes TDynamicRGBGradientPalettePtr; // Alias of ::TDynamicRGBGradientPalette_bytes
2828
typedef const uint8_t TProgmemRGBGradientPalette_byte;
2929
typedef const TProgmemRGBGradientPalette_byte *TProgmemRGBGradientPalette_bytes;
3030
typedef TProgmemRGBGradientPalette_bytes TProgmemRGBGradientPalettePtr;
3131

32-
/// Color interpolation options for palette
32+
// color interpolation options for palette
3333
typedef enum {
34-
NOBLEND=0, ///< No interpolation between palette entries
35-
LINEARBLEND=1, ///< Linear interpolation between palette entries, with wrap-around from end to the beginning again
36-
LINEARBLEND_NOWRAP=2 ///< Linear interpolation between palette entries, but no wrap-around
34+
NOBLEND=0, // No interpolation between palette entries
35+
LINEARBLEND=1, // Linear interpolation between palette entries, with wrap-around from end to the beginning again
36+
LINEARBLEND_NOWRAP=2 // Linear interpolation between palette entries, but no wrap-around
3737
} TBlendType;
3838

3939
typedef union {
4040
struct {
41-
uint8_t index; ///< index of the color entry in the gradient
42-
uint8_t r; ///< CRGB::red channel value of the color entry
43-
uint8_t g; ///< CRGB::green channel value of the color entry
44-
uint8_t b; ///< CRGB::blue channel value of the color entry
41+
uint8_t index; // index of the color entry in the gradient
42+
uint8_t r;
43+
uint8_t g;
44+
uint8_t b;
4545
};
46-
uint32_t dword; ///< values as a packed 32-bit double word
47-
uint8_t bytes[4]; ///< values as an array
46+
uint32_t dword; // values packed as 32-bit
47+
uint8_t bytes[4]; // values as an array
4848
} TRGBGradientPaletteEntryUnion;
4949

5050
// similar to NeoPixelBus NeoGammaTableMethod but allows dynamic changes (superseded by NPB::NeoGammaDynamicTableMethod)
@@ -122,11 +122,11 @@ struct CHSV {
122122
return raw[x];
123123
}
124124

125-
// Default constructor
126-
// @warning Default values are UNITIALIZED!
125+
// default constructor
126+
// @warning default values are UNITIALIZED!
127127
inline CHSV() __attribute__((always_inline)) = default;
128128

129-
///Allow construction from hue, saturation, and value
129+
// allow construction from hue, saturation, and value
130130
inline CHSV(uint8_t ih, uint8_t is, uint8_t iv) __attribute__((always_inline))
131131
: h(ih), s(is), v(iv) { }
132132

@@ -194,12 +194,12 @@ struct CRGB {
194194
hsv2rgb_rainbow(hue<<8, sat, val, raw, false); return *this;
195195
}
196196

197-
// Allow assignment from just a hue, sat and val are set to max
197+
// allow assignment from just a hue, sat and val are set to max
198198
inline CRGB& setHue (uint8_t hue) __attribute__((always_inline)) {
199199
hsv2rgb_rainbow(hue<<8, 255, 255, raw, false); return *this;
200200
}
201201

202-
/// Allow assignment from HSV color
202+
// allow assignment from HSV color
203203
inline CRGB& operator= (const CHSV& rhs) __attribute__((always_inline)) {
204204
hsv2rgb_rainbow(rhs.h<<8, rhs.s, rhs.v, raw, false); return *this;
205205
}
@@ -214,23 +214,22 @@ struct CRGB {
214214
return *this;
215215
}
216216

217-
/// allow assignment from red, green, and blue
217+
// allow assignment from red, green, and blue
218218
inline CRGB& setRGB (uint8_t nr, uint8_t ng, uint8_t nb) __attribute__((always_inline)) {
219219
r = nr;
220220
g = ng;
221221
b = nb;
222222
return *this;
223223
}
224224

225-
/// Allow assignment from 32-bit (really 24-bit) 0xRRGGBB color code
225+
// allow assignment from 32-bit (really 24-bit) 0xRRGGBB color code
226226
inline CRGB& setColorCode (uint32_t colorcode) __attribute__((always_inline)) {
227227
r = R(colorcode);
228228
g = G(colorcode);
229229
b = B(colorcode);
230230
return *this;
231231
}
232232

233-
234233
// add one CRGB to another, saturating at 0xFF for each channel
235234
inline CRGB& operator+= (const CRGB& rhs) {
236235
r = qadd8(r, rhs.r);
@@ -344,7 +343,7 @@ struct CRGB {
344343
return *this;
345344
}
346345

347-
/// Return a CRGB object that is a scaled down version of this object
346+
// return a CRGB object that is a scaled down version of this object
348347
inline CRGB scale8(uint8_t scaledown) const {
349348
CRGB out = *this;
350349
uint32_t scale_fixed = scaledown + 1;
@@ -354,7 +353,7 @@ struct CRGB {
354353
return out;
355354
}
356355

357-
/// Return a CRGB object that is a scaled down version of this object
356+
// return a CRGB object that is a scaled down version of this object
358357
inline CRGB scale8(const CRGB& scaledown) const {
359358
CRGB out;
360359
out.r = ::scale8(r, scaledown.r);
@@ -363,8 +362,7 @@ struct CRGB {
363362
return out;
364363
}
365364

366-
/// fadeToBlackBy is a synonym for nscale8(), as a fade instead of a scale
367-
/// @param fadefactor the amount to fade, sent to nscale8() as (255 - fadefactor)
365+
// fadeToBlackBy is a synonym for nscale8(), as a fade instead of a scale
368366
inline CRGB& fadeToBlackBy(uint8_t fadefactor) {
369367
uint32_t scale_fixed = 256 - fadefactor;
370368
r = (((uint32_t)r) * scale_fixed) >> 8;
@@ -373,44 +371,42 @@ struct CRGB {
373371
return *this;
374372
}
375373

376-
/// "or" operator brings each channel up to the higher of the two values
374+
// "or" operator brings each channel up to the higher of the two values
377375
inline CRGB& operator|=(const CRGB& rhs) {
378376
if (rhs.r > r) r = rhs.r;
379377
if (rhs.g > g) g = rhs.g;
380378
if (rhs.b > b) b = rhs.b;
381379
return *this;
382380
}
383381

384-
/// @copydoc operator|=
385382
inline CRGB& operator|=(uint8_t d) {
386383
if (d > r) r = d;
387384
if (d > g) g = d;
388385
if (d > b) b = d;
389386
return *this;
390387
}
391388

392-
/// "and" operator brings each channel down to the lower of the two values
389+
// "and" operator brings each channel down to the lower of the two values
393390
inline CRGB& operator&=(const CRGB& rhs) {
394391
if (rhs.r < r) r = rhs.r;
395392
if (rhs.g < g) g = rhs.g;
396393
if (rhs.b < b) b = rhs.b;
397394
return *this;
398395
}
399396

400-
/// @copydoc operator&=
401397
inline CRGB& operator&=(uint8_t d) {
402398
if (d < r) r = d;
403399
if (d < g) g = d;
404400
if (d < b) b = d;
405401
return *this;
406402
}
407403

408-
/// This allows testing a CRGB for zero-ness
404+
// this allows testing a CRGB for zero-ness
409405
inline explicit operator bool() const __attribute__((always_inline)) {
410406
return r || g || b;
411407
}
412408

413-
/// Converts a CRGB to a 32-bit color with white = 0
409+
// converts a CRGB to a 32-bit color with white = 0
414410
inline explicit operator uint32_t() const {
415411
return (uint32_t{r} << 16) |
416412
(uint32_t{g} << 8) |
@@ -662,7 +658,7 @@ class CRGBPalette16 {
662658
const uint8_t* p = (const uint8_t*)(&(this->entries[0]));
663659
const uint8_t* q = (const uint8_t*)(&(rhs.entries[0]));
664660
if (p == q) return true;
665-
for (int i = 0; i < (sizeof(entries)); ++i) {
661+
for (unsigned i = 0; i < (sizeof(entries)); ++i) {
666662
if (*p != *q) return false;
667663
++p;
668664
++q;
@@ -736,24 +732,24 @@ class CRGBPalette16 {
736732
TRGBGradientPaletteEntryUnion u;
737733

738734
// Count entries
739-
uint32_t count = 0;
735+
int count = 0;
740736
do {
741737
u.dword = *(const uint32_t*)(progent + count);
742738
++count;
743739
} while (u.index != 255);
744740

745-
int32_t lastSlotUsed = -1;
741+
int lastSlotUsed = -1;
746742

747743
u.dword = *(const uint32_t*)(progent);
748744
CRGB rgbstart(u.r, u.g, u.b);
749745

750-
uint32_t indexstart = 0;
751-
uint32_t istart8 = 0;
752-
uint32_t iend8 = 0;
746+
int indexstart = 0;
747+
int istart8 = 0;
748+
int iend8 = 0;
753749
while (indexstart < 255) {
754750
++progent;
755751
u.dword = *(const uint32_t*)(progent);
756-
uint32_t indexend = u.index;
752+
int indexend = u.index;
757753
CRGB rgbend(u.r, u.g, u.b);
758754
istart8 = indexstart / 16;
759755
iend8 = indexend / 16;
@@ -779,20 +775,20 @@ class CRGBPalette16 {
779775
TRGBGradientPaletteEntryUnion u;
780776

781777
// Count entries
782-
uint16_t count = 0;
778+
unsigned count = 0;
783779
do {
784780
u = *(ent + count);
785781
++count;
786782
} while (u.index != 255);
787783

788-
int8_t lastSlotUsed = -1;
784+
int lastSlotUsed = -1;
789785

790786
u = *ent;
791787
CRGB rgbstart(u.r, u.g, u.b);
792788

793789
int indexstart = 0;
794-
uint8_t istart8 = 0;
795-
uint8_t iend8 = 0;
790+
int istart8 = 0;
791+
int iend8 = 0;
796792
while (indexstart < 255) {
797793
++ent;
798794
u = *ent;

wled00/wled.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ using PSRAMDynamicJsonDocument = BasicJsonDocument<PSRAM_Allocator>;
184184

185185
#define FASTLED_INTERNAL //remove annoying pragma messages
186186
#define USE_GET_MILLISECOND_TIMER
187-
//#include "FastLED.h" //TODO:remove
187+
188188
#include "const.h"
189189
#include "colors.h"
190190
#include "fcn_declare.h"

0 commit comments

Comments
 (0)