Compare commits

...

9 Commits

Author SHA1 Message Date
Frank
ae37f4268c platformio.ini: short hashes => long hashes
short hashes can cause spurious build errors, and will not be supported any more in future platform version.
2025-12-01 20:26:22 +01:00
Frank
653e03921e Update repository URLs in package.json
fix outdated URL
2025-12-01 12:55:54 +01:00
Frank
a0eec81c8a allow different bootloader sizes for each MCU
not needed yet, but will make maintenance easier in the future, and avoid confusion.
2025-12-01 11:13:18 +01:00
Frank
9eda32b93a add bootloader offsets for -C3, S3, and some future MCU's 2025-12-01 11:11:10 +01:00
Frank
e1f5bbf895 avoid #define in generateDeviceFingerprint() 2025-12-01 11:11:09 +01:00
Will Tatam
5d4fdb171e Merge pull request #5138 from willmmiles/esp8266-dma-fix
Fix ESP8266 DMA off-by-one
2025-12-01 08:29:45 +00:00
Will Miles
4fa4bc8d4b Fix ESP8266 DMA off-by-one
Shim in https://github.com/Makuna/NeoPixelBus/pull/894 until approved by
upstream.  Fixes #4906 and #5136.
2025-11-30 22:10:33 -05:00
Damian Schneider
b5f13e4331 FIX for adafruit portal S3: remove extra flash section & use default WLED partitions (#5113)
* remove extra flash section, rename board file
* matrixportal: change partitions to standard 8MB

plus minor name adjustment (adding "for WLED")


Co-authored-by: Frank <91616163+softhack007@users.noreply.github.com>
2025-11-30 15:35:25 +01:00
Copilot
a897271a03 Convert PSRAM to MB in usage reporting (#5130)
* Initial plan

* Convert PSRAM from bytes to MB in usage reporting JavaScript

Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>

* Use 1024*1024 instead of magic number for bytes to MB conversion

Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
2025-11-28 18:15:58 +00:00
10 changed files with 167 additions and 27 deletions

View File

@@ -2,7 +2,7 @@
"build": { "build": {
"arduino":{ "arduino":{
"ldscript": "esp32s3_out.ld", "ldscript": "esp32s3_out.ld",
"partitions": "partitions-8MB-tinyuf2.csv" "partitions": "default_8MB.csv"
}, },
"core": "esp32", "core": "esp32",
"extra_flags": [ "extra_flags": [
@@ -43,16 +43,8 @@
"arduino", "arduino",
"espidf" "espidf"
], ],
"name": "Adafruit MatrixPortal ESP32-S3", "name": "Adafruit MatrixPortal ESP32-S3 for WLED",
"upload": { "upload": {
"arduino": {
"flash_extra_images": [
[
"0x410000",
"variants/adafruit_matrixportal_esp32s3/tinyuf2.bin"
]
]
},
"flash_size": "8MB", "flash_size": "8MB",
"maximum_ram_size": 327680, "maximum_ram_size": 327680,
"maximum_size": 8388608, "maximum_size": 8388608,

View File

@@ -0,0 +1,122 @@
/*-------------------------------------------------------------------------
NeoPixel library helper functions for Esp8266.
FIXED VERSION FROM https://github.com/Makuna/NeoPixelBus/pull/894
This library will overlay/shadow the base version from NeoPixelBus
Written by Michael C. Miller.
Thanks to g3gg0.de for porting the initial DMA support which lead to this.
Thanks to github/cnlohr for the original work on DMA support, which opend
all our minds to a better way (located at https://github.com/cnlohr/esp8266ws2812i2s).
I invest time and resources providing this open source code,
please support me by donating (see https://github.com/Makuna/NeoPixelBus)
-------------------------------------------------------------------------
This file is part of the Makuna/NeoPixelBus library.
NeoPixelBus is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
NeoPixelBus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with NeoPixel. If not, see
<http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
#pragma once
#ifdef ARDUINO_ARCH_ESP8266
#include "internal/methods/NeoEsp8266DmaMethod.h"
template<typename T_PATTERN> class NeoEsp8266Dma3StepEncodeFixed : public T_PATTERN
{
public:
const static size_t DmaBitsPerPixelBit = 3; // 3 step cadence, matches encoding
static size_t SpacingPixelSize(size_t sizePixel)
{
return sizePixel;
}
static void FillBuffers(uint8_t* i2sBuffer,
const uint8_t* data,
size_t sizeData,
[[maybe_unused]] size_t sizePixel)
{
const uint8_t SrcBitMask = 0x80;
const size_t BitsInSample = sizeof(uint32_t) * 8;
uint32_t* pDma = reinterpret_cast<uint32_t*>(i2sBuffer);
uint32_t dmaValue = 0;
uint8_t destBitsLeft = BitsInSample;
const uint8_t* pSrc = data;
const uint8_t* pEnd = pSrc + sizeData;
while (pSrc < pEnd)
{
uint8_t value = *(pSrc++);
for (uint8_t bitSrc = 0; bitSrc < 8; bitSrc++)
{
const uint16_t Bit = ((value & SrcBitMask) ? T_PATTERN::OneBit3Step : T_PATTERN::ZeroBit3Step);
if (destBitsLeft > 3)
{
destBitsLeft -= 3;
dmaValue |= Bit << destBitsLeft;
#if defined(NEO_DEBUG_DUMP_I2S_BUFFER)
NeoUtil::PrintBin<uint32_t>(dmaValue);
Serial.print(" < ");
Serial.println(destBitsLeft);
#endif
}
else if (destBitsLeft <= 3)
{
uint8_t bitSplit = (3 - destBitsLeft);
dmaValue |= Bit >> bitSplit;
#if defined(NEO_DEBUG_DUMP_I2S_BUFFER)
NeoUtil::PrintBin<uint32_t>(dmaValue);
Serial.print(" > ");
Serial.println(bitSplit);
#endif
// next dma value, store and reset
*(pDma++) = dmaValue;
dmaValue = 0;
destBitsLeft = BitsInSample - bitSplit;
if (bitSplit)
{
dmaValue |= Bit << destBitsLeft;
}
#if defined(NEO_DEBUG_DUMP_I2S_BUFFER)
NeoUtil::PrintBin<uint32_t>(dmaValue);
Serial.print(" v ");
Serial.println(bitSplit);
#endif
}
// Next
value <<= 1;
}
}
// store the remaining bits
if (destBitsLeft != BitsInSample) *pDma++ = dmaValue;
}
};
// Abuse explict specialization to overlay the methods
template<> class NeoEsp8266Dma3StepEncode<NeoEsp8266DmaNormalPattern> : public NeoEsp8266Dma3StepEncodeFixed<NeoEsp8266DmaNormalPattern> {};
template<> class NeoEsp8266Dma3StepEncode<NeoEsp8266DmaInvertedPattern> : public NeoEsp8266Dma3StepEncodeFixed<NeoEsp8266DmaInvertedPattern> {};
#endif

View File

@@ -0,0 +1,12 @@
{
"name": "NeoESP8266DMAFix",
"build": { "libArchive": false },
"platforms": ["espressif8266"],
"dependencies": [
{
"owner": "makuna",
"name": "NeoPixelBus",
"version": "2.8.3"
}
]
}

View File

@@ -14,14 +14,14 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/wled-dev/WLED.git" "url": "git+https://github.com/wled/WLED.git"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"bugs": { "bugs": {
"url": "https://github.com/wled-dev/WLED/issues" "url": "https://github.com/wled/WLED/issues"
}, },
"homepage": "https://github.com/wled-dev/WLED#readme", "homepage": "https://github.com/wled/WLED#readme",
"dependencies": { "dependencies": {
"clean-css": "^5.3.3", "clean-css": "^5.3.3",
"html-minifier-terser": "^7.2.0", "html-minifier-terser": "^7.2.0",
@@ -31,4 +31,4 @@
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=20.0.0"
} }
} }

View File

@@ -220,6 +220,7 @@ lib_deps =
ESPAsyncUDP ESPAsyncUDP
ESP8266PWM ESP8266PWM
${env.lib_deps} ${env.lib_deps}
NeoESP8266DMAFix
;; compatibilty flags - same as 0.14.0 which seems to work better on some 8266 boards. Not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 ;; compatibilty flags - same as 0.14.0 which seems to work better on some 8266 boards. Not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
build_flags_compat = build_flags_compat =
@@ -256,7 +257,7 @@ lib_deps_compat =
lib_deps = lib_deps =
esp32async/AsyncTCP @ 3.4.7 esp32async/AsyncTCP @ 3.4.7
bitbank2/AnimatedGIF@^1.4.7 bitbank2/AnimatedGIF@^1.4.7
https://github.com/Aircoookie/GifDecoder#bc3af18 https://github.com/Aircoookie/GifDecoder.git#bc3af189b6b1e06946569f6b4287f0b79a860f8e
build_flags = build_flags =
-D CONFIG_ASYNC_TCP_USE_WDT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_STACK_SIZE=8192 -D CONFIG_ASYNC_TCP_STACK_SIZE=8192
@@ -300,7 +301,7 @@ build_flags = -g
-D WLED_ENABLE_DMX_INPUT -D WLED_ENABLE_DMX_INPUT
lib_deps = lib_deps =
${esp32_all_variants.lib_deps} ${esp32_all_variants.lib_deps}
https://github.com/someweisguy/esp_dmx.git#47db25d https://github.com/someweisguy/esp_dmx.git#47db25d8c515e76fabcf5fc5ab0b786f98eeade0
${env.lib_deps} ${env.lib_deps}
[esp32s2] [esp32s2]

View File

@@ -580,7 +580,7 @@ build_flags = ${common.build_flags}
[env:adafruit_matrixportal_esp32s3] [env:adafruit_matrixportal_esp32s3]
; ESP32-S3 processor, 8 MB flash, 2 MB of PSRAM, dedicated driver pins for HUB75 ; ESP32-S3 processor, 8 MB flash, 2 MB of PSRAM, dedicated driver pins for HUB75
board = adafruit_matrixportal_esp32s3 board = adafruit_matrixportal_esp32s3_wled ; modified board definition: removed flash section that causes FS erase on upload
;; adafruit recommends to use arduino-esp32 2.0.14 ;; adafruit recommends to use arduino-esp32 2.0.14
;;platform = espressif32@ ~6.5.0 ;;platform = espressif32@ ~6.5.0
;;platform_packages = platformio/framework-arduinoespressif32 @ 3.20014.231204 ;; arduino-esp32 2.0.14 ;;platform_packages = platformio/framework-arduinoespressif32 @ 3.20014.231204 ;; arduino-esp32 2.0.14

View File

@@ -4,6 +4,9 @@
//#define NPB_CONF_4STEP_CADENCE //#define NPB_CONF_4STEP_CADENCE
#include "NeoPixelBus.h" #include "NeoPixelBus.h"
#ifdef ARDUINO_ARCH_ESP8266
#include <NeoEsp8266DmaMethodFix.h>
#endif
//Hardware SPI Pins //Hardware SPI Pins
#define P_8266_HS_MOSI 13 #define P_8266_HS_MOSI 13

View File

@@ -3443,7 +3443,7 @@ function reportUpgradeEvent(info, oldVersion) {
}; };
// Add optional fields if available // Add optional fields if available
if (infoData.psram !== undefined) upgradeData.psramSize = infoData.psram; if (infoData.psram !== undefined) upgradeData.psramSize = Math.round(infoData.psram / (1024 * 1024)); // convert bytes to MB
// Note: partitionSizes not currently available in /json/info endpoint // Note: partitionSizes not currently available in /json/info endpoint
// Make AJAX call to postUpgradeEvent API // Make AJAX call to postUpgradeEvent API

View File

@@ -12,7 +12,20 @@
#ifdef ESP32 #ifdef ESP32
constexpr size_t METADATA_OFFSET = 256; // ESP32: metadata appears after Espressif metadata constexpr size_t METADATA_OFFSET = 256; // ESP32: metadata appears after Espressif metadata
#define UPDATE_ERROR errorString #define UPDATE_ERROR errorString
const size_t BOOTLOADER_OFFSET = 0x1000;
// Bootloader is at fixed offset 0x1000 (4KB), 0x0000 (0KB), or 0x2000 (8KB), and is typically 32KB
// Bootloader offsets for different MCUs => see https://github.com/wled/WLED/issues/5064
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
constexpr size_t BOOTLOADER_OFFSET = 0x0000; // esp32-S3, esp32-C3 and (future support) esp32-c6
constexpr size_t BOOTLOADER_SIZE = 0x8000; // 32KB, typical bootloader size
#elif defined(CONFIG_IDF_TARGET_ESP32P4) || defined(CONFIG_IDF_TARGET_ESP32C5)
constexpr size_t BOOTLOADER_OFFSET = 0x2000; // (future support) esp32-P4 and esp32-C5
constexpr size_t BOOTLOADER_SIZE = 0x8000; // 32KB, typical bootloader size
#else
constexpr size_t BOOTLOADER_OFFSET = 0x1000; // esp32 and esp32-s2
constexpr size_t BOOTLOADER_SIZE = 0x8000; // 32KB, typical bootloader size
#endif
#elif defined(ESP8266) #elif defined(ESP8266)
constexpr size_t METADATA_OFFSET = 0x1000; // ESP8266: metadata appears at 4KB offset constexpr size_t METADATA_OFFSET = 0x1000; // ESP8266: metadata appears at 4KB offset
#define UPDATE_ERROR getErrorString #define UPDATE_ERROR getErrorString
@@ -280,9 +293,6 @@ static String bootloaderSHA256HexCache = "";
void calculateBootloaderSHA256() { void calculateBootloaderSHA256() {
if (!bootloaderSHA256HexCache.isEmpty()) return; if (!bootloaderSHA256HexCache.isEmpty()) return;
// Bootloader is at fixed offset 0x1000 (4KB) and is typically 32KB
const uint32_t bootloaderSize = 0x8000; // 32KB, typical bootloader size
// Calculate SHA256 // Calculate SHA256
uint8_t sha256[32]; uint8_t sha256[32];
mbedtls_sha256_context ctx; mbedtls_sha256_context ctx;
@@ -292,8 +302,8 @@ void calculateBootloaderSHA256() {
const size_t chunkSize = 256; const size_t chunkSize = 256;
uint8_t buffer[chunkSize]; uint8_t buffer[chunkSize];
for (uint32_t offset = 0; offset < bootloaderSize; offset += chunkSize) { for (uint32_t offset = 0; offset < BOOTLOADER_SIZE; offset += chunkSize) {
size_t readSize = min((size_t)(bootloaderSize - offset), chunkSize); size_t readSize = min((size_t)(BOOTLOADER_SIZE - offset), chunkSize);
if (esp_flash_read(NULL, buffer, BOOTLOADER_OFFSET + offset, readSize) == ESP_OK) { if (esp_flash_read(NULL, buffer, BOOTLOADER_OFFSET + offset, readSize) == ESP_OK) {
mbedtls_sha256_update(&ctx, buffer, readSize); mbedtls_sha256_update(&ctx, buffer, readSize);
} }

View File

@@ -1170,11 +1170,11 @@ String generateDeviceFingerprint() {
// mix in ADC calibration data: // mix in ADC calibration data:
esp_adc_cal_characteristics_t ch; esp_adc_cal_characteristics_t ch;
#if SOC_ADC_MAX_BITWIDTH == 13 // S2 has 13 bit ADC #if SOC_ADC_MAX_BITWIDTH == 13 // S2 has 13 bit ADC
#define BIT_WIDTH ADC_WIDTH_BIT_13 constexpr auto myBIT_WIDTH = ADC_WIDTH_BIT_13;
#else #else
#define BIT_WIDTH ADC_WIDTH_BIT_12 constexpr auto myBIT_WIDTH = ADC_WIDTH_BIT_12;
#endif #endif
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, BIT_WIDTH, 1100, &ch); esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, myBIT_WIDTH, 1100, &ch);
fp[0] ^= ch.coeff_a; fp[0] ^= ch.coeff_a;
fp[1] ^= ch.coeff_b; fp[1] ^= ch.coeff_b;
if (ch.low_curve) { if (ch.low_curve) {