Changed ability to add multiple busses as compile time defaults,

using the esp32_multistrip usermod define syntax.
This commit is contained in:
Blaz Kristan 2021-04-15 22:19:58 +02:00
commit dcc7ba8f93
6 changed files with 39 additions and 23 deletions

View File

@ -2,6 +2,10 @@
### Builds after release 0.12.0 ### Builds after release 0.12.0
#### Build 2104150
- Added ability to add multiple busses as compile time defaults using the esp32_multistrip usermod define syntax
#### Build 2104141 #### Build 2104141
- Reduced memory usage by 540b by switching to a different trigonometric approximation - Reduced memory usage by 540b by switching to a different trigonometric approximation

View File

@ -43,6 +43,23 @@
19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25]} 19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25]}
*/ */
//factory defaults LED setup (for multistrip boards)
//#define PIXEL_COUNTS 30, 30, 30, 30
//#define DATA_PINS 16, 1, 3, 4
//#define DEFAULT_LED_TYPE TYPE_WS2812_RGB
#ifndef PIXEL_COUNTS
#define PIXEL_COUNTS 30
#endif
#ifndef DATA_PINS
#define DATA_PINS LEDPIN
#endif
#ifndef DEFAULT_LED_TYPE
#define DEFAULT_LED_TYPE TYPE_WS2812_RGB
#endif
//do not call this method from system context (network callback) //do not call this method from system context (network callback)
void WS2812FX::finalizeInit(void) void WS2812FX::finalizeInit(void)
{ {
@ -51,24 +68,19 @@ void WS2812FX::finalizeInit(void)
//if busses failed to load, add default (fresh install, FS issue, ...) //if busses failed to load, add default (fresh install, FS issue, ...)
if (busses.getNumBusses() == 0) { if (busses.getNumBusses() == 0) {
uint8_t defPin[] = {LEDPIN}; const uint8_t defDataPins[] = {DATA_PINS};
BusConfig defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false); const uint16_t defCounts[] = {PIXEL_COUNTS};
const uint8_t defDataPinsNo = ((sizeof defDataPins) / (sizeof defDataPins[0]));
const uint8_t defCountsNo = ((sizeof defCounts) / (sizeof defCounts[0]));
uint16_t prevLen = 0;
for (uint8_t i = 0; i < defDataPinsNo; i++) {
uint8_t defPin[] = {defDataPins[i]};
uint16_t start = prevLen;
uint16_t count = (i < defCountsNo) ? defCounts[i] : defCounts[i>0?i-1:0];
prevLen += count;
BusConfig defCfg = BusConfig(DEFAULT_LED_TYPE, defPin, start, count, COL_ORDER_GRB);
busses.add(defCfg); busses.add(defCfg);
#ifdef LEDPIN1 }
defPin[0] = {LEDPIN1};
defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false);
busses.add(defCfg);
#endif
#ifdef LEDPIN2
defPin[0] = {LEDPIN2};
defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false);
busses.add(defCfg);
#endif
#ifdef LEDPIN3
defPin[0] = {LEDPIN3};
defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, 30, COL_ORDER_GRB, false, false);
busses.add(defCfg);
#endif
} }
deserializeMap(); deserializeMap();
@ -81,6 +93,7 @@ void WS2812FX::finalizeInit(void)
isRgbw |= bus->isRgbw(); isRgbw |= bus->isRgbw();
_length += bus->getLength(); _length += bus->getLength();
} }
ledCount = _length; // or we can use busses.getTotalLength()
/* /*
//make segment 0 cover the entire strip //make segment 0 cover the entire strip
_segments[0].start = 0; _segments[0].start = 0;

View File

@ -41,7 +41,7 @@
<i>Settings on this page are only changable if OTA lock is disabled!</i><br> <i>Settings on this page are only changable if OTA lock is disabled!</i><br>
Deny access to WiFi settings if locked: <input type="checkbox" name="OW"><br><br> Deny access to WiFi settings if locked: <input type="checkbox" name="OW"><br><br>
Factory reset: <input type="checkbox" name="RS"><br> Factory reset: <input type="checkbox" name="RS"><br>
All EEPROM content (settings) will be erased.<br><br> All settings and presets will be erased.<br><br>
HTTP traffic is unencrypted. An attacker in the same network can intercept form data! HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
<h3>Software Update</h3> <h3>Software Update</h3>
<button type="button" onclick="U()">Manual OTA Update</button><br> <button type="button" onclick="U()">Manual OTA Update</button><br>

View File

@ -376,7 +376,7 @@ Disable OTA when not in use, otherwise an attacker can reflash device software!
</b><br><i>Settings on this page are only changable if OTA lock is disabled!</i> </b><br><i>Settings on this page are only changable if OTA lock is disabled!</i>
<br>Deny access to WiFi settings if locked: <input type="checkbox" name="OW"> <br>Deny access to WiFi settings if locked: <input type="checkbox" name="OW">
<br><br>Factory reset: <input type="checkbox" name="RS"><br> <br><br>Factory reset: <input type="checkbox" name="RS"><br>
All EEPROM content (settings) will be erased.<br><br> All settings and presets will be erased.<br><br>
HTTP traffic is unencrypted. An attacker in the same network can intercept form data! HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
<h3>Software Update</h3><button type="button" onclick="U()">Manual OTA Update <h3>Software Update</h3><button type="button" onclick="U()">Manual OTA Update
</button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About </button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About

View File

@ -85,7 +85,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
strip.isRgbw = false; strip.isRgbw = false;
// uint8_t skip = request->hasArg(F("SL")) ? LED_SKIP_AMOUNT : 0;
uint8_t colorOrder, type, skip; uint8_t colorOrder, type, skip;
uint16_t length, start; uint16_t length, start;
uint8_t pins[5] = {255, 255, 255, 255, 255}; uint8_t pins[5] = {255, 255, 255, 255, 255};

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2104141 #define VERSION 2104150
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG
@ -228,7 +228,7 @@ WLED_GLOBAL bool noWifiSleep _INIT(false); // disabling
#endif #endif
// LED CONFIG // LED CONFIG
WLED_GLOBAL uint16_t ledCount _INIT(30); // overcurrent prevented by ABL WLED_GLOBAL uint16_t ledCount _INIT(0); // overcurrent prevented by ABL (filled in cfg.cpp, set.cpp or FX_fcn.cpp)
WLED_GLOBAL bool turnOnAtBoot _INIT(true); // turn on LEDs at power-up WLED_GLOBAL bool turnOnAtBoot _INIT(true); // turn on LEDs at power-up
WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load after power-up WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load after power-up