From b722c618bdfb034ba9c33bb39367b140b578abdc Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sun, 21 Aug 2022 20:50:24 +0200 Subject: [PATCH] Fixes in NodeStruct & bus manager. --- wled00/NodeStruct.h | 1 - wled00/bus_manager.h | 42 +++++++++++++++++------------------------- wled00/wled.h | 4 ++-- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/wled00/NodeStruct.h b/wled00/NodeStruct.h index a0fd2f63..bc95d1e8 100644 --- a/wled00/NodeStruct.h +++ b/wled00/NodeStruct.h @@ -19,7 +19,6 @@ struct NodeStruct { String nodeName; IPAddress ip; - uint8_t unit; uint8_t age; uint8_t nodeType; uint32_t build; diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 405c402a..a5c88daf 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -134,7 +134,12 @@ struct ColorOrderMap { //parent class of BusDigital, BusPwm, and BusNetwork class Bus { public: - Bus(uint8_t type, uint16_t start, uint8_t aw) { + Bus(uint8_t type, uint16_t start, uint8_t aw) + : _bri(255) + , _len(1) + , _valid(false) + , _needsRefresh(false) + { _type = type; _start = start; _autoWhiteMode = Bus::isRgbw(_type) ? aw : RGBW_MODE_MANUAL_ONLY; @@ -142,13 +147,13 @@ class Bus { virtual ~Bus() {} //throw the bus under the bus - virtual void show() {} + virtual void show() = 0; virtual bool canShow() { return true; } virtual void setStatusPixel(uint32_t c) {} - virtual void setPixelColor(uint16_t pix, uint32_t c) {} + virtual void setPixelColor(uint16_t pix, uint32_t c) = 0; virtual uint32_t getPixelColor(uint16_t pix) { return 0; } - virtual void setBrightness(uint8_t b) {} - virtual void cleanup() {} + virtual void setBrightness(uint8_t b) { _bri = b; }; + virtual void cleanup() = 0; virtual uint8_t getPins(uint8_t* pinArray) { return 0; } virtual uint16_t getLength() { return _len; } virtual void setColorOrder() {} @@ -195,12 +200,12 @@ class Bus { bool reversed = false; protected: - uint8_t _type = TYPE_NONE; - uint8_t _bri = 255; - uint16_t _start = 0; - uint16_t _len = 1; - bool _valid = false; - bool _needsRefresh = false; + uint8_t _type; + uint8_t _bri; + uint16_t _start; + uint16_t _len; + bool _valid; + bool _needsRefresh; uint8_t _autoWhiteMode; static uint8_t _gAWM; // definition in FX_fcn.cpp static int16_t _cct; // definition in FX_fcn.cpp @@ -262,7 +267,7 @@ class BusDigital : public Bus { if (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN) PolyBus::begin(_busPtr, _iType, _pins); } #endif - _bri = b; + Bus::setBrightness(b); PolyBus::setBrightness(_busPtr, _iType, b); } @@ -448,10 +453,6 @@ class BusPwm : public Bus { } } - inline void setBrightness(uint8_t b) { - _bri = b; - } - uint8_t getPins(uint8_t* pinArray) { if (!_valid) return 0; uint8_t numPins = NUM_PWM_PINS(_type); @@ -531,10 +532,6 @@ class BusOnOff : public Bus { digitalWrite(_pin, reversed ? !(bool)_data : (bool)_data); } - inline void setBrightness(uint8_t b) { - _bri = b; - } - uint8_t getPins(uint8_t* pinArray) { if (!_valid) return 0; pinArray[0] = _pin; @@ -623,10 +620,6 @@ class BusNetwork : public Bus { return !_broadcastLock; } - inline void setBrightness(uint8_t b) { - _bri = b; - } - uint8_t getPins(uint8_t* pinArray) { for (uint8_t i = 0; i < 4; i++) { pinArray[i] = _client[i]; @@ -655,7 +648,6 @@ class BusNetwork : public Bus { private: IPAddress _client; - uint8_t _bri = 255; uint8_t _UDPtype; uint8_t _UDPchannels; bool _rgbw; diff --git a/wled00/wled.h b/wled00/wled.h index bff5b49a..ade76c86 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2208191 +#define VERSION 2208211 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG @@ -27,7 +27,7 @@ //#define WLED_DISABLE_ALEXA // saves 11kb //#define WLED_DISABLE_BLYNK // saves 6kb //#define WLED_DISABLE_HUESYNC // saves 4kb -//#define WLED_DISABLE_INFRARED // there is no pin left for this on ESP8266-01, saves 12kb +//#define WLED_DISABLE_INFRARED // saves 12kb #ifndef WLED_DISABLE_MQTT #define WLED_ENABLE_MQTT // saves 12kb #endif