Fix a few warnings

This commit is contained in:
cschwinne 2021-01-16 21:40:04 +01:00
parent 99dbd9e649
commit d02bf37167
6 changed files with 12 additions and 19 deletions

View File

@ -841,7 +841,6 @@ class WS2812FX {
void handle_palette(void);
bool
shouldStartBus = false,
_useRgbw = false,
_skipFirstMode,
_triggered;

View File

@ -62,7 +62,7 @@ void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
}
uint8_t pins[] = {2};
busses->add(supportWhite? TYPE_SK6812_RGBW : TYPE_WS2812_RGB, pins, countPixels);
busses->add(supportWhite? TYPE_SK6812_RGBW : TYPE_WS2812_RGB, pins, 0, countPixels, COL_ORDER_GRB);
_segments[0].start = 0;
_segments[0].stop = _length;
@ -418,18 +418,6 @@ void WS2812FX::setBrightness(uint8_t b) {
{
_segments[i].setOption(SEG_OPTION_FREEZE, false);
}
#if LEDPIN == LED_BUILTIN
shouldStartBus = true;
#endif
} else {
#if LEDPIN == LED_BUILTIN
if (shouldStartBus) {
shouldStartBus = false;
const uint8_t ty = _useRgbw ? 2 : 1;
//TODO add re-init method for any bus type that uses GPIO2 on ESP8266 here
//bus->Begin((NeoPixelType)ty, _lengthRaw);
}
#endif
}
if (SEGENV.next_time > millis() + 22 && millis() - _lastShow > MIN_SHOW_DELAY) show();//apply brightness change immediately if no refresh soon
}

View File

@ -22,7 +22,7 @@ class Bus {
virtual void setPixelColor(uint16_t pix, uint32_t c) {};
virtual void setBrightness(uint8_t b) { _bri = b; };
virtual void setBrightness(uint8_t b) {};
virtual uint32_t getPixelColor(uint16_t pix) { return 0; };
@ -96,6 +96,9 @@ class BusDigital : public Bus {
}
void setBrightness(uint8_t b) {
//Fix for turning off onboard LED breaking bus
if (_bri == 0 && b > 0 && (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN)) PolyBus::begin(_busPtr, _iType);
_bri = b;
PolyBus::setBrightness(_busPtr, _iType, b);
}
@ -207,6 +210,10 @@ class BusPwm : public Bus {
}
}
void setBrightness(uint8_t b) {
_bri = b;
}
void cleanup() {
deallocatePins();
}

View File

@ -266,7 +266,6 @@ class PolyBus {
};
static void* create(uint8_t busType, uint8_t* pins, uint16_t len) {
void* busPtr = nullptr;
//delete busPtr; //TODO this needs type handling or destructor isn't called
switch (busType) {
case I_NONE: break;
#ifdef ESP8266
@ -658,7 +657,7 @@ class PolyBus {
}
};
static uint32_t getPixelColor(void* busPtr, uint8_t busType, uint16_t pix, uint8_t co) {
RgbwColor col;
RgbwColor col(0,0,0,0);
switch (busType) {
case I_NONE: break;
#ifdef ESP8266

View File

@ -587,7 +587,7 @@ void serveJson(AsyncWebServerRequest* request)
bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient)
{
AsyncWebSocketClient * wsc;
AsyncWebSocketClient * wsc = nullptr;
if (!request) { //not HTTP, use Websockets
#ifdef WLED_ENABLE_WEBSOCKETS
wsc = ws.client(wsClient);

View File

@ -110,7 +110,7 @@ void publishMqtt()
char s[10];
char subuf[38];
sprintf(s, "%ld", bri);
sprintf(s, "%u", bri);
strcpy(subuf, mqttDeviceTopic);
strcat(subuf, "/g");
mqtt->publish(subuf, 0, true, s);