minor corrections
* fix some override problems bus_manager (canShow() must not be const!!!) * fixing some "comparing integer with different signedness" warnings
This commit is contained in:
@@ -351,9 +351,9 @@ void IRAM_ATTR_YN Segment::setPixelColorXY(int x, int y, uint32_t col) //WLEDMM:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int_fast16_t glen_ = groupLength(); // WLEDMM optimization
|
const uint_fast16_t glen_ = groupLength(); // WLEDMM optimization
|
||||||
const int_fast16_t wid_ = width();
|
const uint_fast16_t wid_ = width();
|
||||||
const int_fast16_t hei_ = height();
|
const uint_fast16_t hei_ = height();
|
||||||
|
|
||||||
x *= glen_; // expand to physical pixels
|
x *= glen_; // expand to physical pixels
|
||||||
y *= glen_; // expand to physical pixels
|
y *= glen_; // expand to physical pixels
|
||||||
|
|||||||
@@ -1413,12 +1413,12 @@ void __attribute__((hot)) Segment::fill(uint32_t c) {
|
|||||||
if (_bri_t < 255) scaled_col = color_fade(c, _bri_t);
|
if (_bri_t < 255) scaled_col = color_fade(c, _bri_t);
|
||||||
}
|
}
|
||||||
// fill 2D segment
|
// fill 2D segment
|
||||||
for(int y = 0; y < rows; y++) for (int x = 0; x < cols; x++) {
|
for(unsigned y = 0; y < rows; y++) for (unsigned x = 0; x < cols; x++) {
|
||||||
if (simpleSegment) setPixelColorXY_fast(x, y, c, scaled_col, cols, rows);
|
if (simpleSegment) setPixelColorXY_fast(x, y, c, scaled_col, cols, rows);
|
||||||
else setPixelColorXY_slow(x, y, c);
|
else setPixelColorXY_slow(x, y, c);
|
||||||
}
|
}
|
||||||
} else { // fill 1D strip
|
} else { // fill 1D strip
|
||||||
for (int x = 0; x < cols; x++) setPixelColor(x, c);
|
for (unsigned x = 0; x < cols; x++) setPixelColor(int(x), c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1471,8 +1471,8 @@ void __attribute__((hot)) Segment::fade_out(uint8_t rate) {
|
|||||||
int g2 = G(color2);
|
int g2 = G(color2);
|
||||||
int b2 = B(color2);
|
int b2 = B(color2);
|
||||||
|
|
||||||
for (int y = 0; y < rows; y++) for (int x = 0; x < cols; x++) {
|
for (unsigned y = 0; y < rows; y++) for (unsigned x = 0; x < cols; x++) {
|
||||||
uint32_t color = is2D() ? getPixelColorXY(x, y) : getPixelColor(x);
|
uint32_t color = is2D() ? getPixelColorXY(int(x), int(y)) : getPixelColor(int(x));
|
||||||
if (color == color2) continue; // WLEDMM speedup - pixel color = target color, so nothing to do
|
if (color == color2) continue; // WLEDMM speedup - pixel color = target color, so nothing to do
|
||||||
int w1 = W(color);
|
int w1 = W(color);
|
||||||
int r1 = R(color);
|
int r1 = R(color);
|
||||||
@@ -1492,8 +1492,8 @@ void __attribute__((hot)) Segment::fade_out(uint8_t rate) {
|
|||||||
uint32_t colorNew = RGBW32(r1 + rdelta, g1 + gdelta, b1 + bdelta, w1 + wdelta); // WLEDMM
|
uint32_t colorNew = RGBW32(r1 + rdelta, g1 + gdelta, b1 + bdelta, w1 + wdelta); // WLEDMM
|
||||||
|
|
||||||
if (colorNew != color) { // WLEDMM speedup - do not repaint the same color
|
if (colorNew != color) { // WLEDMM speedup - do not repaint the same color
|
||||||
if (is2D()) setPixelColorXY(x, y, colorNew);
|
if (is2D()) setPixelColorXY(int(x), int(y), colorNew);
|
||||||
else setPixelColor(x, colorNew);
|
else setPixelColor(int(x), colorNew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1507,11 +1507,11 @@ void __attribute__((hot)) Segment::fadeToBlackBy(uint8_t fadeBy) {
|
|||||||
|
|
||||||
// WLEDMM minor optimization
|
// WLEDMM minor optimization
|
||||||
if(is2D()) {
|
if(is2D()) {
|
||||||
for (int y = 0; y < rows; y++) for (int x = 0; x < cols; x++) {
|
for (unsigned y = 0; y < rows; y++) for (unsigned x = 0; x < cols; x++) {
|
||||||
uint32_t cc = getPixelColorXY(x,y); // WLEDMM avoid RGBW32 -> CRGB -> RGBW32 conversion
|
uint32_t cc = getPixelColorXY(int(x),int(y)); // WLEDMM avoid RGBW32 -> CRGB -> RGBW32 conversion
|
||||||
uint32_t cc2 = color_fade(cc, scaledown); // fade
|
uint32_t cc2 = color_fade(cc, scaledown); // fade
|
||||||
//if (cc2 != cc) // WLEDMM only re-paint if faded color is different - disabled - causes problem with text overlay
|
//if (cc2 != cc) // WLEDMM only re-paint if faded color is different - disabled - causes problem with text overlay
|
||||||
setPixelColorXY((uint16_t)x, (uint16_t)y, cc2);
|
setPixelColorXY(int(x), int(y), cc2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (uint_fast16_t x = 0; x < cols; x++) {
|
for (uint_fast16_t x = 0; x < cols; x++) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ struct BusConfig {
|
|||||||
else if (type > 47) nPins = 2;
|
else if (type > 47) nPins = 2;
|
||||||
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
|
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
|
||||||
else if (type >= TYPE_HUB75MATRIX && type <= (TYPE_HUB75MATRIX + 10)) nPins = 0;
|
else if (type >= TYPE_HUB75MATRIX && type <= (TYPE_HUB75MATRIX + 10)) nPins = 0;
|
||||||
for (uint8_t i = 0; i < nPins; i++) pins[i] = ppins[i];
|
for (uint8_t i = 0; i < min(unsigned(nPins),5U); i++) pins[i] = ppins[i]; //softhack007 fix for potential array out-of-bounds access
|
||||||
}
|
}
|
||||||
|
|
||||||
//validates start and length and extends total if needed
|
//validates start and length and extends total if needed
|
||||||
@@ -135,21 +135,21 @@ class Bus {
|
|||||||
virtual void setStatusPixel(uint32_t c) {}
|
virtual void setStatusPixel(uint32_t c) {}
|
||||||
virtual void setPixelColor(uint16_t pix, uint32_t c) = 0;
|
virtual void setPixelColor(uint16_t pix, uint32_t c) = 0;
|
||||||
virtual uint32_t getPixelColor(uint16_t pix) const { return 0; }
|
virtual uint32_t getPixelColor(uint16_t pix) const { return 0; }
|
||||||
virtual void setBrightness(uint8_t b, bool immediate=false) { _bri = b; };
|
virtual void setBrightness(uint8_t b, bool immediate=false) { _bri = b; }
|
||||||
virtual void cleanup() = 0;
|
virtual void cleanup() = 0;
|
||||||
virtual uint8_t getPins(uint8_t* pinArray) const { return 0; }
|
virtual uint8_t getPins(uint8_t* pinArray) const { return 0; }
|
||||||
virtual uint16_t getLength() const { return _len; }
|
virtual inline uint16_t getLength() const { return _len; }
|
||||||
virtual void setColorOrder() {}
|
virtual void setColorOrder() {}
|
||||||
virtual uint8_t getColorOrder() const { return COL_ORDER_RGB; }
|
virtual uint8_t getColorOrder() const { return COL_ORDER_RGB; }
|
||||||
virtual uint8_t skippedLeds() { return 0; }
|
virtual uint8_t skippedLeds() const { return 0; }
|
||||||
virtual uint16_t getFrequency() const { return 0U; }
|
virtual uint16_t getFrequency() const { return 0U; }
|
||||||
inline uint16_t getStart() const { return _start; }
|
inline uint16_t getStart() const { return _start; }
|
||||||
inline void setStart(uint16_t start) { _start = start; }
|
inline void setStart(uint16_t start) { _start = start; }
|
||||||
inline uint8_t getType() const { return _type; }
|
inline uint8_t getType() const { return _type; }
|
||||||
inline bool isOk() const { return _valid; }
|
inline bool isOk() const { return _valid; }
|
||||||
inline bool isOffRefreshRequired() const { return _needsRefresh; }
|
inline bool isOffRefreshRequired() const { return _needsRefresh; }
|
||||||
bool containsPixel(uint16_t pix) const { return pix >= _start && pix < _start+_len; }
|
//inline bool containsPixel(uint16_t pix) const { return pix >= _start && pix < _start+_len; } // WLEDMM not used, plus wrong - it does not consider skipped pixels
|
||||||
virtual uint16_t getMaxPixels() const { return MAX_LEDS_PER_BUS; };
|
virtual uint16_t getMaxPixels() const { return MAX_LEDS_PER_BUS; }
|
||||||
|
|
||||||
virtual bool hasRGB() const {
|
virtual bool hasRGB() const {
|
||||||
if ((_type >= TYPE_WS2812_1CH && _type <= TYPE_WS2812_WWA) || _type == TYPE_ANALOG_1CH || _type == TYPE_ANALOG_2CH || _type == TYPE_ONOFF) return false;
|
if ((_type >= TYPE_WS2812_1CH && _type <= TYPE_WS2812_WWA) || _type == TYPE_ANALOG_1CH || _type == TYPE_ANALOG_2CH || _type == TYPE_ONOFF) return false;
|
||||||
@@ -207,7 +207,7 @@ class BusDigital : public Bus {
|
|||||||
|
|
||||||
inline void show();
|
inline void show();
|
||||||
|
|
||||||
bool canShow() const;
|
bool canShow() override;
|
||||||
|
|
||||||
void setBrightness(uint8_t b, bool immediate);
|
void setBrightness(uint8_t b, bool immediate);
|
||||||
|
|
||||||
@@ -215,13 +215,13 @@ class BusDigital : public Bus {
|
|||||||
|
|
||||||
void setPixelColor(uint16_t pix, uint32_t c);
|
void setPixelColor(uint16_t pix, uint32_t c);
|
||||||
|
|
||||||
uint32_t getPixelColor(uint16_t pix) const;
|
uint32_t getPixelColor(uint16_t pix) const override;
|
||||||
|
|
||||||
uint8_t getColorOrder() const {
|
uint8_t getColorOrder() const {
|
||||||
return _colorOrder;
|
return _colorOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getLength() const {
|
uint16_t getLength() const override {
|
||||||
return _len - _skip;
|
return _len - _skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,11 +229,11 @@ class BusDigital : public Bus {
|
|||||||
|
|
||||||
void setColorOrder(uint8_t colorOrder);
|
void setColorOrder(uint8_t colorOrder);
|
||||||
|
|
||||||
uint8_t skippedLeds() const {
|
uint8_t skippedLeds() const override {
|
||||||
return _skip;
|
return _skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getFrequency() const { return _frequencykHz; }
|
uint16_t getFrequency() const override { return _frequencykHz; }
|
||||||
|
|
||||||
void reinit();
|
void reinit();
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ class BusPwm : public Bus {
|
|||||||
|
|
||||||
uint8_t getPins(uint8_t* pinArray) const;
|
uint8_t getPins(uint8_t* pinArray) const;
|
||||||
|
|
||||||
uint16_t getFrequency() const { return _frequency; }
|
uint16_t getFrequency() const override { return _frequency; }
|
||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
deallocatePins();
|
deallocatePins();
|
||||||
@@ -329,14 +329,14 @@ class BusNetwork : public Bus {
|
|||||||
|
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
bool canShow() const {
|
bool canShow() override {
|
||||||
// this should be a return value from UDP routine if it is still sending data out
|
// this should be a return value from UDP routine if it is still sending data out
|
||||||
return !_broadcastLock;
|
return !_broadcastLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getPins(uint8_t* pinArray) const;
|
uint8_t getPins(uint8_t* pinArray) const;
|
||||||
|
|
||||||
uint16_t getLength() const {
|
uint16_t getLength() const override {
|
||||||
return _len;
|
return _len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user