Skip to content

Commit

Permalink
Multi-update
Browse files Browse the repository at this point in the history
- 0.15.0-b2
- WS2805 support (NeoPixelBus 2.7.9)
- generic PSRAM support (ESP32 rev.1 still needs compile fix)
- BREAKING: default LEDPIN 2 (due to PSRAM)
- PinManager optimisations
  • Loading branch information
blazoncek committed Mar 24, 2024
1 parent 85a51e6 commit 47f4468
Show file tree
Hide file tree
Showing 21 changed files with 193 additions and 171 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
## WLED changelog

#### Build 2403240
- v0.15.0-b2
- WS2805 support (RGB + WW + CW, 600kbps)
- Unified PSRAM use
- NeoPixelBus v2.7.9 (for future WS2805 support)
- Ubiquitous PSRAM mode for all variants of ESP32
- SSD1309_64 I2C Support for FLD Usermod (#3836 by @THATDONFC)
- Palette cycling fix (add support for `{"seg":[{"pal":"X~Y~"}]}` or `{"seg":[{"pal":"X~Yr"}]}`)
- FW1906 Support (#3810 by @deece and @Robert-github-com)
- ESPAsyncWebServer 2.2.0 (#3828 by @willmmiles)
- Bugfixes: #3843, #3844

#### Build 2403190
- limit max PWM frequency (fix incorrect PWM resolution)
- Segment UI bugfix
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wled",
"version": "0.15.0-b1",
"version": "0.15.0-b2",
"description": "Tools for WLED project",
"main": "tools/cdata.js",
"directories": {
Expand Down
12 changes: 4 additions & 8 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ platform_packages = platformio/framework-arduinoespressif8266
platformio/tool-esptoolpy #@ ~1.30000.0

## previous platform for 8266, in case of problems with the new one
## you'll need makuna/NeoPixelBus@ 2.6.9 for arduino_core_3_2_0, which does not support Ucs890x
;; platform_wled_default = ${common.arduino_core_3_2_0}
## you'll need makuna/NeoPixelBus@ 2.6.9 for arduino_core_3_0_2, which does not support Ucs890x
;; platform_wled_default = ${common.arduino_core_3_0_2}
;; platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7
;; platformio/toolchain-xtensa @ ~2.40802.200502
;; platformio/tool-esptool @ ~1.413.0
Expand Down Expand Up @@ -143,7 +143,7 @@ lib_compat_mode = strict
lib_deps =
fastled/FastLED @ 3.6.0
IRremoteESP8266 @ 2.8.2
makuna/NeoPixelBus @ 2.7.8
makuna/NeoPixelBus @ 2.7.9
https://github.com/Aircoookie/ESPAsyncWebServer.git @ ^2.2.0
# for I2C interface
;Wire
Expand Down Expand Up @@ -392,8 +392,7 @@ board_build.flash_mode = qio
board_build.partitions = ${esp32.default_partitions}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_WROVER
-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
-D WLED_USE_PSRAM
-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html
-D LEDPIN=25
lib_deps = ${esp32.lib_deps}

Expand Down Expand Up @@ -445,7 +444,6 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=
;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
; -D WLED_RELEASE_NAME=ESP32-S3_PSRAM
-D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used
lib_deps = ${esp32s3.lib_deps}
board_build.partitions = tools/WLED_ESP32_8MB.csv
board_build.f_flash = 80000000L
Expand All @@ -461,12 +459,10 @@ board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
;board_build.f_flash = 80000000L
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2
-DBOARD_HAS_PSRAM
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MSC_ON_BOOT=0
-DARDUINO_USB_DFU_ON_BOOT=0
-DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_USE_PSRAM
-D WLED_WATCHDOG_TIMEOUT=0

This comment has been minimized.

Copy link
@softhack007

softhack007 Mar 24, 2024

Collaborator

@blazoncek - maybe I overlooked something - this change means that Lolin -S2 builds will not use PSRAM any more?

This comment has been minimized.

Copy link
@blazoncek

blazoncek Mar 24, 2024

Author Collaborator

No. PSRAM is now enabled everywhere if it exists.

This comment has been minimized.

Copy link
@blazoncek

blazoncek Mar 25, 2024

Author Collaborator

I think I have to elaborate on this a bit.

Having psramFound() everywhere seems enough to distinguish if a device has SPI RAM/PSRAM present and is available to use. You have showed that original ESP32 lacks performance when accessing SPI RAM/PSRAM, while testing on newer chips S2 & S3 (oddly I was unable to find C3 with PSRAM) shows smaller performance degradation when using SPI RAM/PSRAM. Regardless, we no longer use SPI RAM/PSRAM for effect data as we need fastest access possible but SPI RAM/PSRAM can enhance UX in many ways so I decided to utilize it seamlessly everywhere in WLED where performance is not critical.

However! Original ESP32 with silicon revision <3 needs special compile flags to circumvent hardware issue when accessing SPI RAM/PSRAM while newer revisions do not. Other chips do not have any issues so I deemed it unnecessary to distinguish. I do own ESP32 rev.1 with PSRAM and intend to thoroughly test build with and without compiler fix, to be sure if a single binary will suffice (this was perhaps the reason for degraded performance) or we'd need two separate binaries for classic ESP32. Until this is confirmed I think it is mandatory to include ESP32_WROVER environment.

This comment has been minimized.

Copy link
@softhack007

softhack007 Mar 27, 2024

Collaborator

Thanks, makes sense for me 😃
Maybe there are no -C3 with PSRAM (yet) - I also have some of them but never saw any -C3 with PSRAM...

This comment has been minimized.

Copy link
@blazoncek

blazoncek Mar 27, 2024

Author Collaborator

I checked Espressif documentation - C3 does not support PSRAM.
Perhaps RISC architecture does not allow it.

-D CONFIG_ASYNC_TCP_USE_WDT=0
-D LEDPIN=16
Expand Down
5 changes: 2 additions & 3 deletions platformio_override.sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,8 @@ build_flags = ${common.build_flags_esp8266}
; set default color order of your led strip
; -D DEFAULT_LED_COLOR_ORDER=COL_ORDER_GRB
;
; use PSRAM if a device (ESP) has one
; -DBOARD_HAS_PSRAM
; -D WLED_USE_PSRAM
; use PSRAM on classic ESP32 rev.1 (rev.3 or above has no issues)
; -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
;
; configure I2C and SPI interface (for various hardware)
; -D I2CSDAPIN=33 # initialise interface
Expand Down
9 changes: 2 additions & 7 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,20 @@
/* Not used in all effects yet */
#define WLED_FPS 42
#define FRAMETIME_FIXED (1000/WLED_FPS)
//#define FRAMETIME _frametime
#define FRAMETIME strip.getFrameTime()

/* each segment uses 82 bytes of SRAM memory, so if you're application fails because of
insufficient memory, decreasing MAX_NUM_SEGMENTS may help */
#ifdef ESP8266
#define MAX_NUM_SEGMENTS 12
#define MAX_NUM_SEGMENTS 16
/* How much data bytes all segments combined may allocate */
#define MAX_SEGMENT_DATA 5120
#else
#ifndef MAX_NUM_SEGMENTS
#define MAX_NUM_SEGMENTS 32
#endif
#if defined(ARDUINO_ARCH_ESP32S2)
#if defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM)
#define MAX_SEGMENT_DATA MAX_NUM_SEGMENTS*1024 // 32k by default
#else
#define MAX_SEGMENT_DATA MAX_NUM_SEGMENTS*768 // 24k by default
#endif
#define MAX_SEGMENT_DATA MAX_NUM_SEGMENTS*768 // 24k by default (S2 is short on free RAM)
#else
#define MAX_SEGMENT_DATA MAX_NUM_SEGMENTS*1280 // 40k by default
#endif
Expand Down
6 changes: 6 additions & 0 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,12 @@ void WS2812FX::finalizeInit(void) {
uint16_t prevLen = 0;
for (int i = 0; i < defNumBusses && i < WLED_MAX_BUSSES+WLED_MIN_VIRTUAL_BUSSES; i++) {
uint8_t defPin[] = {defDataPins[i]};
// when booting without config (1st boot) we need to make sure GPIOs defined for LED output don't clash with hardware
// i.e. DEBUG (GPIO1), DMX (2), SPI RAM/FLASH (16&17 on ESP32-WROVER/PICO), etc
if (pinManager.isPinAllocated(defPin[0])) {
defPin[0] = 1; // start with GPIO1 and work upwards
while (pinManager.isPinAllocated(defPin[0]) && defPin[0] < WLED_NUM_PINS) defPin[0]++;
}
uint16_t start = prevLen;
uint16_t count = defCounts[(i < defNumCounts) ? i : defNumCounts -1];
prevLen += count;
Expand Down
14 changes: 8 additions & 6 deletions wled00/bus_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct BusConfig {
uint8_t skipAmount;
bool refreshReq;
uint8_t autoWhite;
uint8_t pins[5] = {LEDPIN, 255, 255, 255, 255};
uint8_t pins[5] = {255, 255, 255, 255, 255};
uint16_t frequency;
bool doubleBuffer;
uint8_t milliAmpsPerLed;
Expand All @@ -56,9 +56,9 @@ struct BusConfig {
refreshReq = (bool) GET_BIT(busType,7);
type = busType & 0x7F; // bit 7 may be/is hacked to include refresh info (1=refresh in off state, 0=no refresh)
size_t nPins = 1;
if (type >= TYPE_NET_DDP_RGB && type < 96) nPins = 4; //virtual network bus. 4 "pins" store IP address
else if (type > 47) nPins = 2;
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
if (IS_VIRTUAL(type)) nPins = 4; //virtual network bus. 4 "pins" store IP address
else if (IS_2PIN(type)) nPins = 2;
else if (IS_PWM(type)) nPins = NUM_PWM_PINS(type);
for (size_t i = 0; i < nPins; i++) pins[i] = ppins[i];
}

Expand Down Expand Up @@ -160,15 +160,17 @@ class Bus {
virtual bool hasWhite(void) { return Bus::hasWhite(_type); }
static bool hasWhite(uint8_t type) {
if ((type >= TYPE_WS2812_1CH && type <= TYPE_WS2812_WWA) ||
type == TYPE_SK6812_RGBW || type == TYPE_TM1814 || type == TYPE_UCS8904 || type == TYPE_FW1906) return true; // digital types with white channel
type == TYPE_SK6812_RGBW || type == TYPE_TM1814 || type == TYPE_UCS8904 ||
type == TYPE_FW1906 || type == TYPE_WS2805) return true; // digital types with white channel
if (type > TYPE_ONOFF && type <= TYPE_ANALOG_5CH && type != TYPE_ANALOG_3CH) return true; // analog types with white channel
if (type == TYPE_NET_DDP_RGBW || type == TYPE_NET_ARTNET_RGBW) return true; // network types with white channel
return false;
}
virtual bool hasCCT(void) { return Bus::hasCCT(_type); }
static bool hasCCT(uint8_t type) {
if (type == TYPE_WS2812_2CH_X3 || type == TYPE_WS2812_WWA ||
type == TYPE_ANALOG_2CH || type == TYPE_ANALOG_5CH || type == TYPE_FW1906) return true;
type == TYPE_ANALOG_2CH || type == TYPE_ANALOG_5CH ||
type == TYPE_FW1906 || type == TYPE_WS2805 ) return true;
return false;
}
static int16_t getCCT() { return _cct; }
Expand Down
Loading

0 comments on commit 47f4468

Please sign in to comment.