Added ability to add multiple busses as compile time defaults using the esp32_multistrip usermod define syntax

This commit is contained in:
cschwinne 2021-04-15 10:55:22 +02:00
parent f3b84f1365
commit 01dd41bdbf
7 changed files with 724 additions and 679 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,28 @@
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
//#define NUM_STRIPS 4
//#define PIXEL_COUNTS 30, 30, 30, 30
//#define DATA_PINS 16, 1, 3, 4
//#define DEFAULT_LED_TYPE TYPE_WS2812_RGB
#if (!defined(NUM_STRIPS) || NUM_STRIPS < 1 || NUM_STRIPS > WLED_MAX_BUSSES)
#define NUM_STRIPS 1
#endif
#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(uint16_t countPixels, bool skipFirst) void WS2812FX::finalizeInit(uint16_t countPixels, bool skipFirst)
{ {
@ -57,9 +79,17 @@ void WS2812FX::finalizeInit(uint16_t countPixels, bool skipFirst)
//if busses failed to load, add default (FS issue...) //if busses failed to load, add default (FS issue...)
if (busses.getNumBusses() == 0) { if (busses.getNumBusses() == 0) {
uint8_t defPin[] = {LEDPIN}; const uint8_t defDataPins[NUM_STRIPS] = {DATA_PINS};
BusConfig defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, _lengthRaw, COL_ORDER_GRB); const uint16_t defCounts[NUM_STRIPS] = {PIXEL_COUNTS};
busses.add(defCfg); uint16_t prevLen = 0;
for (uint8_t i = 0; i < NUM_STRIPS; i++) {
uint8_t defPin[] = {defDataPins[i]};
uint16_t start = prevLen;
uint16_t count = (NUM_STRIPS > 1) ? defCounts[i] : _lengthRaw;
prevLen += count;
BusConfig defCfg = BusConfig(DEFAULT_LED_TYPE, defPin, start, count, COL_ORDER_GRB);
busses.add(defCfg);
}
} }
deserializeMap(); deserializeMap();

View File

@ -252,4 +252,8 @@
#endif #endif
#endif #endif
#ifndef DEFAULT_LED_COUNT
#define DEFAULT_LED_COUNT 30
#endif
#endif #endif

View File

@ -39,7 +39,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

@ -375,7 +375,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

File diff suppressed because it is too large Load Diff

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,9 +228,9 @@ 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(DEFAULT_LED_COUNT); // overcurrent prevented by ABL
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
WLED_GLOBAL byte col[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. col[] should be updated if you want to change the color. WLED_GLOBAL byte col[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. col[] should be updated if you want to change the color.
WLED_GLOBAL byte colSec[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) secondary color WLED_GLOBAL byte colSec[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) secondary color