Skip to content

Commit

Permalink
Added ability to add multiple busses as compile time defaults using t…
Browse files Browse the repository at this point in the history
…he esp32_multistrip usermod define syntax
  • Loading branch information
Aircoookie committed Apr 15, 2021
1 parent f3b84f1 commit 01dd41b
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 679 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### 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

- Reduced memory usage by 540b by switching to a different trigonometric approximation
Expand Down
36 changes: 33 additions & 3 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@
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)
void WS2812FX::finalizeInit(uint16_t countPixels, bool skipFirst)
{
Expand All @@ -57,9 +79,17 @@ void WS2812FX::finalizeInit(uint16_t countPixels, bool skipFirst)

//if busses failed to load, add default (FS issue...)
if (busses.getNumBusses() == 0) {
uint8_t defPin[] = {LEDPIN};
BusConfig defCfg = BusConfig(TYPE_WS2812_RGB, defPin, 0, _lengthRaw, COL_ORDER_GRB);
busses.add(defCfg);
const uint8_t defDataPins[NUM_STRIPS] = {DATA_PINS};
const uint16_t defCounts[NUM_STRIPS] = {PIXEL_COUNTS};
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();
Expand Down
4 changes: 4 additions & 0 deletions wled00/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,8 @@
#endif
#endif

#ifndef DEFAULT_LED_COUNT
#define DEFAULT_LED_COUNT 30
#endif

#endif
2 changes: 1 addition & 1 deletion wled00/data/settings_sec.htm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h2>Security & Update setup</h2>
<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>
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!
<h3>Software Update</h3>
<button type="button" onclick="U()">Manual OTA Update</button><br>
Expand Down
2 changes: 1 addition & 1 deletion wled00/html_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
<br>Deny access to WiFi settings if locked: <input type="checkbox" name="OW">
<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!
<h3>Software Update</h3><button type="button" onclick="U()">Manual OTA Update
</button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About
Expand Down
1,347 changes: 677 additions & 670 deletions wled00/html_ui.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// 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
//#define WLED_USE_MY_CONFIG
Expand Down Expand Up @@ -228,9 +228,9 @@ WLED_GLOBAL bool noWifiSleep _INIT(false); // disabling
#endif

// LED CONFIG
WLED_GLOBAL uint16_t ledCount _INIT(30); // overcurrent prevented by ABL
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 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 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 colSec[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) secondary color
Expand Down

0 comments on commit 01dd41b

Please sign in to comment.