Fix a few warnings
This commit is contained in:
parent
99dbd9e649
commit
d02bf37167
@ -841,7 +841,6 @@ class WS2812FX {
|
|||||||
void handle_palette(void);
|
void handle_palette(void);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
shouldStartBus = false,
|
|
||||||
_useRgbw = false,
|
_useRgbw = false,
|
||||||
_skipFirstMode,
|
_skipFirstMode,
|
||||||
_triggered;
|
_triggered;
|
||||||
|
@ -62,7 +62,7 @@ void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t pins[] = {2};
|
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].start = 0;
|
||||||
_segments[0].stop = _length;
|
_segments[0].stop = _length;
|
||||||
@ -418,18 +418,6 @@ void WS2812FX::setBrightness(uint8_t b) {
|
|||||||
{
|
{
|
||||||
_segments[i].setOption(SEG_OPTION_FREEZE, false);
|
_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
|
if (SEGENV.next_time > millis() + 22 && millis() - _lastShow > MIN_SHOW_DELAY) show();//apply brightness change immediately if no refresh soon
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class Bus {
|
|||||||
|
|
||||||
virtual void setPixelColor(uint16_t pix, uint32_t c) {};
|
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; };
|
virtual uint32_t getPixelColor(uint16_t pix) { return 0; };
|
||||||
|
|
||||||
@ -96,6 +96,9 @@ class BusDigital : public Bus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setBrightness(uint8_t b) {
|
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);
|
PolyBus::setBrightness(_busPtr, _iType, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +210,10 @@ class BusPwm : public Bus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setBrightness(uint8_t b) {
|
||||||
|
_bri = b;
|
||||||
|
}
|
||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
deallocatePins();
|
deallocatePins();
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,6 @@ class PolyBus {
|
|||||||
};
|
};
|
||||||
static void* create(uint8_t busType, uint8_t* pins, uint16_t len) {
|
static void* create(uint8_t busType, uint8_t* pins, uint16_t len) {
|
||||||
void* busPtr = nullptr;
|
void* busPtr = nullptr;
|
||||||
//delete busPtr; //TODO this needs type handling or destructor isn't called
|
|
||||||
switch (busType) {
|
switch (busType) {
|
||||||
case I_NONE: break;
|
case I_NONE: break;
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@ -658,7 +657,7 @@ class PolyBus {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
static uint32_t getPixelColor(void* busPtr, uint8_t busType, uint16_t pix, uint8_t co) {
|
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) {
|
switch (busType) {
|
||||||
case I_NONE: break;
|
case I_NONE: break;
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
|
@ -587,7 +587,7 @@ void serveJson(AsyncWebServerRequest* request)
|
|||||||
|
|
||||||
bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient)
|
bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient)
|
||||||
{
|
{
|
||||||
AsyncWebSocketClient * wsc;
|
AsyncWebSocketClient * wsc = nullptr;
|
||||||
if (!request) { //not HTTP, use Websockets
|
if (!request) { //not HTTP, use Websockets
|
||||||
#ifdef WLED_ENABLE_WEBSOCKETS
|
#ifdef WLED_ENABLE_WEBSOCKETS
|
||||||
wsc = ws.client(wsClient);
|
wsc = ws.client(wsClient);
|
||||||
|
@ -110,7 +110,7 @@ void publishMqtt()
|
|||||||
char s[10];
|
char s[10];
|
||||||
char subuf[38];
|
char subuf[38];
|
||||||
|
|
||||||
sprintf(s, "%ld", bri);
|
sprintf(s, "%u", bri);
|
||||||
strcpy(subuf, mqttDeviceTopic);
|
strcpy(subuf, mqttDeviceTopic);
|
||||||
strcat(subuf, "/g");
|
strcat(subuf, "/g");
|
||||||
mqtt->publish(subuf, 0, true, s);
|
mqtt->publish(subuf, 0, true, s);
|
||||||
|
Loading…
Reference in New Issue
Block a user