Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W5500/SPI Ethernet Support (T-ETH-Lite-S3) #129

Draft
wants to merge 279 commits into
base: mdev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
279 commits
Select commit Hold shift + click to select a range
bbb82e2
Testing a build fix
troyhacks Apr 19, 2024
2d2d300
Testing build fixes for IDF below 4.0.0
troyhacks Apr 19, 2024
8d54d6a
Testing build fixes
troyhacks Apr 19, 2024
16c782c
Testing build fixes
troyhacks Apr 19, 2024
f51290c
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Apr 19, 2024
b000c6d
Merge branch 'MoonModules:mdev' into W5500+Art-Net_Improvements
troyhacks Apr 19, 2024
b7acc6a
Merge branch 'W5500+Art-Net_Improvements' into W5500_Support
troyhacks Apr 19, 2024
df2d327
Revert "Merge branch 'W5500+Art-Net_Improvements' into W5500_Support"
troyhacks Apr 19, 2024
67f7b0c
Don't use ETHClass2 on S3 unless WLED_USE_ETHERNET
troyhacks Apr 19, 2024
1c835b0
Don't use TroyHacksAsyncUDP on S3 unless WLED_USE_ETHERNET
troyhacks Apr 19, 2024
e4fa27a
Squashed commit of the following:
troyhacks Apr 20, 2024
8b55557
Squashed commit of the following:
troyhacks Apr 20, 2024
1aa2ea1
Conditional Art-Net Universe Remapping
troyhacks Apr 20, 2024
07eb649
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Apr 22, 2024
32b10ed
Merge branch 'MoonModules:mdev' into W5500+Art-Net
troyhacks Apr 22, 2024
e0f611e
Source address doesn't work on ETHClass2
troyhacks Apr 22, 2024
193b346
MAX_LEDS_PER_BUS for BusNetwork follows setting
troyhacks Apr 22, 2024
8b4db83
Settings for larger Art-Net displays
troyhacks Apr 22, 2024
46c1e87
Just some Art-Net config for my hardware
troyhacks Apr 23, 2024
e83c743
heap_caps_get_largest_free_block can be glitchy on 4v
troyhacks Apr 26, 2024
db6251b
FFT is ESP-DSP
troyhacks Apr 29, 2024
163a80b
Minor tidy
troyhacks Apr 30, 2024
496ead0
Merge branch 'MoonModules:mdev' into W5500+Art-Net
troyhacks May 6, 2024
43cc44d
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks May 6, 2024
e5f0fc7
HPF/LPF turn on/off with h/l
troyhacks May 6, 2024
6cf6e63
Merge branch 'MoonModules:mdev' into W5500+Art-Net
troyhacks May 7, 2024
f9d5919
More quick filter tools
troyhacks May 7, 2024
5c8aced
Merge branch 'W5500+Art-Net' of https://github.com/troyhacks/WLED int…
troyhacks May 7, 2024
b4f4309
Filter improvements
troyhacks May 8, 2024
fa9bd15
Merge branch 'MoonModules:mdev' into W5500+Art-Net
troyhacks May 8, 2024
7d7bf86
Tuning bin calculation temporarily
troyhacks May 8, 2024
9a8f674
Merge branch 'W5500+Art-Net' of https://github.com/troyhacks/WLED int…
troyhacks May 8, 2024
55c4a5e
Filter mods
troyhacks May 8, 2024
05912d6
Merge branch 'MoonModules:mdev' into W5500+Art-Net
troyhacks May 8, 2024
b732939
Merge branch 'MoonModules:mdev' into W5500+Art-Net
troyhacks May 8, 2024
4121865
Filter improvements
troyhacks May 8, 2024
7206e50
Merge branch 'W5500+Art-Net' of https://github.com/troyhacks/WLED int…
troyhacks May 8, 2024
45b04a0
Starting onboard pink analysis
troyhacks May 9, 2024
f937d7d
Fixed brightness preview - fixes weird preview
troyhacks Apr 28, 2024
a6820c6
Temporary "mic" profile calibration routine
troyhacks May 9, 2024
91f9a5b
Comments
troyhacks May 9, 2024
830b7b3
UM_AUDIOREACTIVE_USE_ESPDSP_FFT build flag added
troyhacks May 9, 2024
55d9ab3
heap Cap Dump Test
troyhacks May 10, 2024
f37f796
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks May 21, 2024
1babd3d
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks May 22, 2024
a50c85e
ifdef corrections
troyhacks May 23, 2024
a61604f
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks May 24, 2024
b1b3ce9
Merge branch 'W5500_Support' into W5500+Art-Net
troyhacks May 24, 2024
58c394b
Merge pull request #5 from troyhacks/W5500+Art-Net
troyhacks May 24, 2024
c0091fb
Moved define during merge
troyhacks May 24, 2024
1a78d0c
Don't include ESP-DSP unless required and supported
troyhacks May 25, 2024
bb52e18
protecting from v3 builds
troyhacks May 25, 2024
462391b
fixes for non-ESP-DSP builds
troyhacks May 25, 2024
42f1997
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jun 3, 2024
c27b992
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jun 5, 2024
a0e0148
Notch (actually peak) filter by default
troyhacks Jun 5, 2024
df4fa38
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jun 6, 2024
7bf93a7
Minor fixes, comments, and improvements
troyhacks Jun 19, 2024
1d96d0f
SETTINGS_STACK_BUF_SIZE fixes
troyhacks Jun 19, 2024
6cc69a5
Better logic for SETTINGS_STACK_BUF_SIZE
troyhacks Jun 19, 2024
36be32e
customMappingTable & ledsrgb to PSRAM if available
troyhacks Jun 19, 2024
027bd64
Sure, use the dangerous optimizatrion!
troyhacks Jun 20, 2024
ea6b908
Show MAC address on Ethernert init
troyhacks Jun 20, 2024
67e785a
Minor speedups
troyhacks Jun 21, 2024
7142961
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jun 24, 2024
b2354dc
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jun 25, 2024
f2cb3a4
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jun 26, 2024
3603a33
Art-Net send optimization
troyhacks Jun 26, 2024
951d5b7
minor tweak
troyhacks Jun 26, 2024
c3d6661
small optimization for Art-Net brightness
troyhacks Jun 26, 2024
db51517
Save a few operations
troyhacks Jun 26, 2024
1caa227
Network debug fix
troyhacks Jun 26, 2024
301a278
Build fixes for non-ESP32 boards
troyhacks Jun 26, 2024
d5e9563
Better PSRAM ifdefs
troyhacks Jun 26, 2024
c1dfa7f
Art-Net TURBO Charge
troyhacks Jun 28, 2024
695d2e5
Merge branch 'mdev' into W5500_Support
troyhacks Jul 3, 2024
8442a2d
Post-merge fixes
troyhacks Jul 3, 2024
ba5fcd8
PSRAM and some cleanup
troyhacks Jul 5, 2024
0035c01
Art-Net timer improvements
troyhacks Jul 5, 2024
89dbb8c
Merge branch 'mdev' into W5500_Support
troyhacks Jul 8, 2024
0fba4d5
S3 SIMD speedup and other fixes
troyhacks Jul 8, 2024
f9f5491
Comments fixed
troyhacks Jul 8, 2024
b010032
Art-Net reconfigure fixes (hack)
troyhacks Jul 8, 2024
bac54ed
Comments and minor compiler warning fixes
troyhacks Jul 10, 2024
6b8ee29
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 11, 2024
a3c9433
Merge branch 'mdev' into W5500_Support
troyhacks Jul 13, 2024
c260161
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 13, 2024
ca56dc4
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 15, 2024
66aa74d
Faster by not calculating white
troyhacks Jul 15, 2024
55117b3
Minor compiler warning fix
troyhacks Jul 15, 2024
084902e
PSRAM Packet Buffer Option
troyhacks Jul 16, 2024
b83abd8
Back to more portable calloc
troyhacks Jul 16, 2024
82566cd
PSRAM for UDP packet buffer conditional
troyhacks Jul 16, 2024
6422bc4
2D Bar and Corner expand fixes. PSRAM conditional for effect data war…
troyhacks Jul 16, 2024
446c2ee
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 16, 2024
0501e74
Merge branch 'mdev' into W5500_Support
troyhacks Jul 16, 2024
aacf76e
post-merge fix
troyhacks Jul 16, 2024
346a273
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 16, 2024
4e8f890
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 16, 2024
77940b8
Merge branch 'mdev' into W5500_Support
troyhacks Jul 17, 2024
0f6cb47
Art-Net speed calculation fix
troyhacks Jul 17, 2024
e98b9bf
Merge branch 'mdev' into W5500_Support
troyhacks Jul 21, 2024
f1e8d31
Fix broken BusNetwork init
troyhacks Jul 21, 2024
f035f30
Fix minior sprintf warning in Toki
troyhacks Jul 21, 2024
ff5f6d9
Minor sprintf warnings fixed
troyhacks Jul 21, 2024
9961a58
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 22, 2024
27fa988
Revert "Fix minior sprintf warning in Toki"
troyhacks Jul 22, 2024
b57c403
Revert "Minor sprintf warnings fixed"
troyhacks Jul 22, 2024
0fcca70
Ignore S3 Assembly file
troyhacks Jul 22, 2024
e116b1c
CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072
troyhacks Jul 22, 2024
e4776c6
Exclude S3 aassembly
troyhacks Jul 22, 2024
a116b42
Again trying to exclude s3_simd.S
troyhacks Jul 22, 2024
f2bf47f
Again trying to exclude s3_simd.S
troyhacks Jul 22, 2024
d77f715
CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072 in more places
troyhacks Jul 22, 2024
4c58444
Now bring back s3_simd.S on S3?
troyhacks Jul 22, 2024
3d5e4bf
Only calculate brightness if not 255
troyhacks Jul 22, 2024
09fcd0b
Properly omit S3 Assembly
troyhacks Jul 22, 2024
24911e7
Again with the soure filter
troyhacks Jul 22, 2024
da3987c
Again with the source filter
troyhacks Jul 22, 2024
2175804
Again with the source filter
troyhacks Jul 22, 2024
97bbada
Bugfix for non-W5500 Ethernet
troyhacks Jul 22, 2024
6debf1f
Bugfix for global brightness on non-S3 devices
troyhacks Jul 22, 2024
f8c7b25
Removed testing code
troyhacks Jul 22, 2024
7366dde
Flew too close to the sun with some optimizations
troyhacks Jul 24, 2024
479c724
IFDEF fix for AudioReactive on non-ESP32 lineage
troyhacks Jul 24, 2024
0f867f0
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 25, 2024
ad4728c
Art-Net faster with on-device RAM instead of PSRAM
troyhacks Jul 25, 2024
a73306f
ESP.getFlashChipMode() broken on 2.0.17 and .16 and .15. Temp remove
troyhacks Jul 25, 2024
2c7fc78
Comments and personal config
troyhacks Jul 25, 2024
04c6407
Ethernet status clarification
troyhacks Jul 27, 2024
8550825
Comments and code cleanup
troyhacks Jul 27, 2024
8f03348
Comments updated
troyhacks Jul 27, 2024
563c12d
Minor newline removal
troyhacks Jul 27, 2024
fd1826c
Better ethernet messages and disable mDNS when on ethernet
troyhacks Jul 27, 2024
66034a3
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 28, 2024
d7a4abe
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Jul 31, 2024
0c289fe
ETH_PHY_IP101 fix for Espressif Ethernet Kit
troyhacks Jul 31, 2024
fe33f69
tests
troyhacks Aug 1, 2024
3c9b22a
tests
troyhacks Aug 1, 2024
74d87c8
Merge branch 'W5500_Support' of https://github.com/troyhacks/WLED int…
troyhacks Aug 1, 2024
6af4ffa
Default Art-Net 44 FPS "speed limit" & ArtNetSync option
troyhacks Aug 5, 2024
ed6db5e
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 5, 2024
084304c
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 5, 2024
0f07888
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 6, 2024
d67056d
More accurate Art-Net Speed Limiter
troyhacks Aug 6, 2024
25ffc4c
Merge branch 'mdev' into W5500_Support
troyhacks Aug 6, 2024
2e70886
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 6, 2024
72220f0
Art-Net comments
troyhacks Aug 7, 2024
4539e1b
RGBW BusNetwork::getPixelColor fix
troyhacks Aug 7, 2024
21b348b
Test PIO script to download FS from ESP32 as backup
troyhacks Aug 8, 2024
a68d23b
Merge branch 'mdev' into W5500_Support
troyhacks Aug 9, 2024
3269c34
Clear and consistent Art-Net compile flags
troyhacks Aug 9, 2024
dc88b26
Experimental non-standard Art-Net sync
troyhacks Aug 12, 2024
02ad212
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 12, 2024
70d5543
2D Audio Reactive Paintbrush Effect
troyhacks Aug 13, 2024
1e3e369
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 13, 2024
cd1b974
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 14, 2024
5ea2010
Addded the MoonModules ☾ to Paintbrush FX
troyhacks Aug 15, 2024
84d67b9
Added Art-Net RGBW and color order for Art-Net
troyhacks Aug 16, 2024
53fd482
Minor tweaks to MDNS and Art-Net
troyhacks Aug 17, 2024
b548fa5
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 17, 2024
87cb673
Minor updates to Paintbrush
troyhacks Aug 17, 2024
81ce350
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 17, 2024
07a76d3
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 17, 2024
b77f9e0
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 17, 2024
8e81d41
Allow up to 12288 LEDs in the UI
troyhacks Aug 19, 2024
d3b284b
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 19, 2024
1f91de4
Art-Net comments, small unneeded packet adjustment removed.
troyhacks Aug 20, 2024
88857aa
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Aug 21, 2024
00e41ac
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Sep 5, 2024
19da911
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Sep 9, 2024
05dcc67
Use "R" on serial console to reboot
troyhacks Sep 9, 2024
47093e1
HUB75 PSRAM Buffers
troyhacks Sep 9, 2024
75dada5
PSRAM hacks
troyhacks Sep 10, 2024
8050162
Don't use GPIO0 on ESP32-S3 with HUB75 or it might keep board in down…
troyhacks Sep 12, 2024
dfcb61e
Various Misc
troyhacks Sep 14, 2024
57612e0
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Sep 14, 2024
f3a7f10
Testing heap_caps_calloc_prefer
troyhacks Sep 15, 2024
1615553
Merge branch 'W5500_Support' of https://github.com/troyhacks/WLED int…
troyhacks Sep 15, 2024
e352889
Testing heap_caps_[mc]alloc_prefer over more complex logic
troyhacks Sep 15, 2024
7499df0
WLEDMM_NO_MAP_RESET for Dom.
troyhacks Sep 16, 2024
04b00e3
Fixed no map reset
troyhacks Sep 16, 2024
dd42ba0
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Sep 16, 2024
55ba423
fix art-net buffer size typo
troyhacks Sep 16, 2024
0a3aff3
MOAR LEDS
troyhacks Sep 17, 2024
d48006a
experimental: stress testing optimized color routines from DeDeHai
softhack007 Sep 30, 2024
07b9f48
Minor pin shuffling for ease of wiring
troyhacks Oct 1, 2024
4dd0178
Merge branch 'mdev' into W5500_Support
troyhacks Oct 2, 2024
3987f91
Fix support for my 4-panel virtual HUB75 display
troyhacks Oct 2, 2024
12ef60e
Moving personal pins around to allow easy W5500 hookup
troyhacks Oct 3, 2024
13b623c
Merge branch 'mdev' into W5500_Support
troyhacks Oct 7, 2024
2e64f2f
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Oct 8, 2024
41001a3
Fix for CRGB to uint32_t conversion
troyhacks Oct 9, 2024
11f21aa
Revert "Fix for CRGB to uint32_t conversion"
troyhacks Oct 10, 2024
c5891ff
Raise max HUB75 panels to 6
troyhacks Oct 16, 2024
40c5228
Define check to disable UDP listeners
troyhacks Oct 16, 2024
2e55474
Merge pull request #171 from Brandon502/mdev
softhack007 Oct 17, 2024
a4c5c71
Merge branch 'mdev' into W5500_Support
troyhacks Oct 21, 2024
2e01757
Merge branch 'mdev' into W5500_Support
troyhacks Oct 26, 2024
f69a280
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Oct 29, 2024
3fe5050
Start of S3 vector code, proper
troyhacks Oct 29, 2024
63cc755
Merging some newer code
troyhacks Oct 29, 2024
d457159
MAX_LEDS = MAX 16-bit
troyhacks Oct 29, 2024
be4ea0d
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Oct 30, 2024
b157f88
Still living dangerously.
troyhacks Oct 30, 2024
919d783
Using heap_caps_calloc_prefer
troyhacks Oct 30, 2024
fa876d6
Merge branch 'mdev' into W5500_Support
troyhacks Oct 31, 2024
82dcb68
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Nov 6, 2024
001abf1
Proper Art-Net Settings
troyhacks Nov 7, 2024
484cb33
New Art-Net tidy
troyhacks Nov 7, 2024
604c8ea
Post-merge fixes
troyhacks Nov 7, 2024
22ab168
Art-Net sane defaults if using an old config without the new values
troyhacks Nov 7, 2024
81df0c8
better assembly comments
troyhacks Nov 7, 2024
bb6bddc
Disable S3 assembly function define
troyhacks Nov 7, 2024
a1b7b90
Merge branch 'mdev' into W5500_Support
troyhacks Nov 10, 2024
670ad16
Merge branch 'mdev' into W5500_Support
troyhacks Nov 14, 2024
9e4bbb1
Merge branch 'mdev' into W5500_Support
troyhacks Nov 17, 2024
9889784
Art-Net v2 code review changes
troyhacks Nov 17, 2024
eeb92b2
Merge fix
troyhacks Nov 18, 2024
488738e
Merge branch 'mdev' into W5500_Support
troyhacks Nov 19, 2024
1573e0d
Post-merge fixes
troyhacks Nov 19, 2024
dd8008d
PSRAM logic for non-ESP32
troyhacks Nov 19, 2024
aa5c311
esp_restart() changed to ESP.restart()
troyhacks Nov 19, 2024
307ea13
Logic for non-ESP boards without Ethernet
troyhacks Nov 19, 2024
fb6a43b
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Nov 21, 2024
1d1aa5d
Simpler "Always PSRAM"
troyhacks Nov 21, 2024
73c3392
Simpler "Always PSRAM"
troyhacks Nov 21, 2024
f7ada82
HUB75 cleanup and multiple panels
troyhacks Nov 22, 2024
59414e4
More PSRAM simplifications
troyhacks Nov 22, 2024
1a58a5b
Simpler "Always PSRAM"
troyhacks Nov 22, 2024
afafd94
Simpler "Always PSRAM"
troyhacks Nov 22, 2024
a4b8ad5
New Art-Net code
troyhacks Nov 22, 2024
6ecf009
Simpler "Always PSRAM"
troyhacks Nov 22, 2024
1f8d552
Simpler "Always PSRAM"
troyhacks Nov 23, 2024
9c203f8
Art-Net build fix for non-ESP32
troyhacks Nov 23, 2024
2ba53f9
Make IP clickable via serial monitor
troyhacks Nov 23, 2024
db7b2a7
WLED_NO_SERIAL_WAIT for wehn you need immediate startups
troyhacks Nov 26, 2024
56f6296
Stop hiding the color picker when live preview/GFX is toggled
troyhacks Nov 26, 2024
4201dfe
Merge branch 'mdev' into W5500_Support
troyhacks Nov 26, 2024
fcc42bc
Don't reconnect hue if it's disabled
troyhacks Nov 26, 2024
2328a66
Smaller ESP-DSP code include
troyhacks Nov 26, 2024
4204abe
Simpler "Always PSRAM"
troyhacks Nov 26, 2024
5df0565
Free up OPI PSRAM pins if PSRAM not working - different magic
troyhacks Nov 26, 2024
4929f75
Fixes for non-ESP32 boards
troyhacks Nov 26, 2024
42a8889
Fixes for non-ESP32 boards
troyhacks Nov 26, 2024
db0c249
Fixes for non-ESP32 boards
troyhacks Nov 26, 2024
79a99d5
Fixes for non-ESP32 boards
troyhacks Nov 26, 2024
e1b7bbb
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Nov 28, 2024
4eb9553
Merge branch 'MoonModules:mdev' into W5500_Support
troyhacks Dec 2, 2024
c13f709
Merge branch 'mdev' into W5500_Support
troyhacks Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 285 additions & 0 deletions pio-scripts/download_fs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
# Written by Maximilian Gerhardt <[email protected]>
# 29th December 2020
# and Christian Baars, Johann Obermeier
# 2023 / 2024
# License: Apache
# Expanded from functionality provided by PlatformIO's espressif32 and espressif8266 platforms, credited below.
# This script provides functions to download the filesystem (LittleFS) from a running ESP32 / ESP8266
# over the serial bootloader using esptool.py, and mklittlefs for extracting.
# run by either using the VSCode task "Custom" -> "Download Filesystem"
# or by doing 'pio run -t downloadfs' (with optional '-e <environment>') from the commandline.
# output will be saved, by default, in the "unpacked_fs" of the project.
# this folder can be changed by writing 'custom_unpack_dir = some_other_dir' in the corresponding platformio.ini
# environment.
import re
import sys
from os.path import isfile, join
from enum import Enum
import os
import subprocess
import shutil

Import("env")
platform = env.PioPlatform()
board = env.BoardConfig()
mcu = board.get("build.mcu", "esp32")


class FSType(Enum):
LITTLEFS="littlefs"
FATFS="fatfs"

class FSInfo:
def __init__(self, fs_type, start, length, page_size, block_size):
self.fs_type = fs_type
self.start = start
self.length = length
self.page_size = page_size
self.block_size = block_size
def __repr__(self):
return f"FS type {self.fs_type} Start {hex(self.start)} Len {self.length} Page size {self.page_size} Block size {self.block_size}"
# extract command supposed to be implemented by subclasses
def get_extract_cmd(self, input_file, output_dir):
raise NotImplementedError()

class FS_Info(FSInfo):
def __init__(self, start, length, page_size, block_size):
self.tool = env["MKFSTOOL"]
self.tool = join(platform.get_package_dir("tool-mklittlefs"), self.tool)
super().__init__(FSType.LITTLEFS, start, length, page_size, block_size)
def __repr__(self):
return f"{self.fs_type} Start {hex(self.start)} Len {hex(self.length)} Page size {hex(self.page_size)} Block size {hex(self.block_size)}"
def get_extract_cmd(self, input_file, output_dir):
return f'"{self.tool}" -b {self.block_size} -s {self.length} -p {self.page_size} --unpack "{output_dir}" "{input_file}"'

# SPIFFS helpers copied from ESP32, https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py
# Copyright 2014-present PlatformIO <[email protected]>
# Licensed under the Apache License, Version 2.0 (the "License");

def _parse_size(value):
if isinstance(value, int):
return value
elif value.isdigit():
return int(value)
elif value.startswith("0x"):
return int(value, 16)
elif value[-1].upper() in ("K", "M"):
base = 1024 if value[-1].upper() == "K" else 1024 * 1024
return int(value[:-1]) * base
return value

## FS helpers for ESP8266
# copied from https://github.com/platformio/platform-espressif8266/blob/develop/builder/main.py
# Copyright 2014-present PlatformIO <[email protected]>
# Licensed under the Apache License, Version 2.0 (the "License");

def _parse_ld_sizes(ldscript_path):
assert ldscript_path
result = {}
# get flash size from LD script path
match = re.search(r"\.flash\.(\d+[mk]).*\.ld", ldscript_path)
if match:
result['flash_size'] = _parse_size(match.group(1))

appsize_re = re.compile(
r"irom0_0_seg\s*:.+len\s*=\s*(0x[\da-f]+)", flags=re.I)
filesystem_re = re.compile(
r"PROVIDE\s*\(\s*_%s_(\w+)\s*=\s*(0x[\da-f]+)\s*\)" % "FS"
if "arduino" in env.subst("$PIOFRAMEWORK")
else "SPIFFS",
flags=re.I,
)
with open(ldscript_path) as fp:
for line in fp.readlines():
line = line.strip()
if not line or line.startswith("/*"):
continue
match = appsize_re.search(line)
if match:
result['app_size'] = _parse_size(match.group(1))
continue
match = filesystem_re.search(line)
if match:
result['fs_%s' % match.group(1)] = _parse_size(
match.group(2))
return result

def esp8266_fetch_fs_size(env):
ldsizes = _parse_ld_sizes(env.GetActualLDScript())
for key in ldsizes:
if key.startswith("fs_"):
env[key.upper()] = ldsizes[key]

assert all([
k in env
for k in ["FS_START", "FS_END", "FS_PAGE", "FS_BLOCK"]
])

# esptool flash starts from 0
for k in ("FS_START", "FS_END"):
_value = 0
if env[k] < 0x40300000:
_value = env[k] & 0xFFFFF
elif env[k] < 0x411FB000:
_value = env[k] & 0xFFFFFF
_value -= 0x200000 # correction
else:
_value = env[k] & 0xFFFFFF
_value += 0xE00000 # correction

env[k] = _value

## Script interface functions
def parse_partition_table(content):
entries = [e for e in content.split(b'\xaaP') if len(e) > 0]
#print("Partition data:")
for entry in entries:
type = entry[1]
if type in [0x82,0x83]: # SPIFFS or LITTLEFS
offset = int.from_bytes(entry[2:5], byteorder='little', signed=False)
size = int.from_bytes(entry[6:9], byteorder='little', signed=False)
print("type:",hex(type))
print("address:",hex(offset))
print("size:",hex(size))
env["FS_START"] = offset
env["FS_SIZE"] = size
env["FS_PAGE"] = int("0x100", 16)
env["FS_BLOCK"] = int("0x1000", 16)

def get_partition_table():
esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py")
upload_port = join(env.get("UPLOAD_PORT", "none"))
download_speed = join(str(board.get("download.speed", "115200")))
if "none" in upload_port:
env.AutodetectUploadPort()
upload_port = join(env.get("UPLOAD_PORT", "none"))
fs_file = join(env["PROJECT_DIR"], "partition_table_from_flash.bin")
esptoolpy_flags = [
"--chip", mcu,
"--port", upload_port,
"--baud", download_speed,
"--before", "default_reset",
"--after", "hard_reset",
"read_flash",
"0x8000",
"0x1000",
fs_file
]
esptoolpy_cmd = [env["PYTHONEXE"], esptoolpy] + esptoolpy_flags
try:
returncode = subprocess.call(esptoolpy_cmd, shell=False)
except subprocess.CalledProcessError as exc:
print("Downloading failed with " + str(exc))
with open(fs_file, mode="rb") as file:
content = file.read()
parse_partition_table(content)

def get_fs_type_start_and_length():
platform = env["PIOPLATFORM"]
if platform == "espressif32":
print(f"Retrieving filesystem info for {mcu}.")
get_partition_table()
print("FS_START: " + hex(env["FS_START"]))
print("FS_SIZE: " + hex(env["FS_SIZE"]))
print("FS_PAGE: " + hex(env["FS_PAGE"]))
print("FS_BLOCK: " + hex(env["FS_BLOCK"]))
return FS_Info(env["FS_START"], env["FS_SIZE"], env["FS_PAGE"], env["FS_BLOCK"])
elif platform == "espressif8266":
print("Retrieving filesystem info for ESP8266.")
filesystem = board.get("build.filesystem", "littlefs")
if filesystem not in ("littlefs"):
print("Unrecognized board_build.filesystem option '" + str(filesystem) + "'.")
env.Exit(1)
# fetching sizes is the same for all filesystems
esp8266_fetch_fs_size(env)
#print("FS_START: " + hex(env["FS_START"]))
#print("FS_SIZE: " + hex(env["FS_END"] - env["FS_START"]))
#print("FS_PAGE: " + hex(env["FS_PAGE"]))
#print("FS_BLOCK: " + hex(env["FS_BLOCK"]))
if filesystem == "littlefs":
print("Recognized LittleFS filesystem.")
return FS_Info(env["FS_START"], env["FS_END"] - env["FS_START"], env["FS_PAGE"], env["FS_BLOCK"])
else:
print("Unrecongized configuration.")
pass

def download_fs(fs_info: FSInfo):
print(fs_info)
esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py")
upload_port = join(env.get("UPLOAD_PORT", "none"))
download_speed = join(str(board.get("download.speed", "115200")))
if "none" in upload_port:
env.AutodetectUploadPort()
upload_port = join(env.get("UPLOAD_PORT", "none"))
fs_file = join(env.subst("$BUILD_DIR"), f"downloaded_fs_{hex(fs_info.start)}_{hex(fs_info.length)}.bin")
esptoolpy_flags = [
"--chip", mcu,
"--port", upload_port,
"--baud", download_speed,
"--before", "default_reset",
"--after", "hard_reset",
"read_flash",
hex(fs_info.start),
hex(fs_info.length),
fs_file
]
esptoolpy_cmd = [env["PYTHONEXE"], esptoolpy] + esptoolpy_flags
print(esptoolpy_cmd)
print("Download filesystem image")
try:
returncode = subprocess.call(esptoolpy_cmd, shell=False)
return (True, fs_file)
except subprocess.CalledProcessError as exc:
print("Downloading failed with " + str(exc))
return (False, "")

def unpack_fs(fs_info: FSInfo, downloaded_file: str):
# by writing custom_unpack_dir = some_dir in the platformio.ini, one can
# control the unpack directory
unpack_dir = env.GetProjectOption("custom_unpack_dir", "unpacked_fs")
if not os.path.exists(downloaded_file):
print(f"ERROR: {downloaded_file} with filesystem not found, maybe download failed due to download_speed setting being too high.")
assert(0)
try:
if os.path.exists(unpack_dir):
shutil.rmtree(unpack_dir)
except Exception as exc:
print("Exception while attempting to remove the folder '" + str(unpack_dir) + "': " + str(exc))
if not os.path.exists(unpack_dir):
os.makedirs(unpack_dir)

cmd = fs_info.get_extract_cmd(downloaded_file, unpack_dir)
print("Unpack files from filesystem image")
try:
print(env["MKFSTOOL"])
print(platform.get_package_dir("tool-mklittlefs"))
print(cmd, unpack_dir);
returncode = subprocess.call(cmd, shell=True)
return (True, unpack_dir)
except subprocess.CalledProcessError as exc:
print("Unpacking filesystem failed with " + str(exc))
return (False, "")

def display_fs(extracted_dir):
# extract command already nicely lists all extracted files.
# no need to display that ourselves. just display a summary
file_count = sum([len(files) for r, d, files in os.walk(extracted_dir)])
print("Extracted " + str(file_count) + " file(s) from filesystem.")

def command_download_fs(*args, **kwargs):
info = get_fs_type_start_and_length()
download_ok, downloaded_file = download_fs(info)
unpack_ok, unpacked_dir = unpack_fs(info, downloaded_file)
if unpack_ok is True:
display_fs(unpacked_dir)


env.AddCustomTarget(
name="downloadfs",
dependencies=None,
actions=[
command_download_fs
],
title="Download Filesystem",
description="Downloads and displays files stored in the target ESP32/ESP8266"
)
19 changes: 12 additions & 7 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ build_flags = -g
-DARDUINO_ARCH_ESP32
#-DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
; -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072
#use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x
-D LOROL_LITTLEFS
; -D WLEDMM_TWOPATH ;; use I2S1 as the second bus --> ~15% faster on "V3" builds - may flicker a bit more
Expand Down Expand Up @@ -390,7 +391,8 @@ build_flagsV4 = -g
-DARDUINO_ARCH_ESP32 -DESP32
-DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
; -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072
; -D WLEDMM_TWOPATH ;; use I2S1 as the second bus --> slightly faster on some setups
; -D WLEDMM_SLOWPATH ;; don't use I2S for LED bus
; -DARDUINO_USB_CDC_ON_BOOT=0 ;; mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
Expand Down Expand Up @@ -420,7 +422,8 @@ build_flags = -g
-DARDUINO_ARCH_ESP32 -DESP32
#-DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
; -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
; -D WLEDMM_TWOPATH ;; use I2S1 as the second bus --> slightly faster on some setups
; -D WLEDMM_SLOWPATH ;; don't use I2S for LED bus
Expand All @@ -446,7 +449,8 @@ build_flags = -g
-DCONFIG_IDF_TARGET_ESP32S2=1
-DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE ;; WLEDMM
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=8614 ;; WLEDMM increase stack by 1Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
; -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=8614 ;; WLEDMM increase stack by 1Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
-DCO
-DARDUINO_USB_MODE=0 ;; this flag is mandatory for ESP32-S2 !
Expand All @@ -469,7 +473,8 @@ build_flags = -g
-DCONFIG_IDF_TARGET_ESP32C3=1
-DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE ;; WLEDMM
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
; -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072
-DCO
-DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
Expand All @@ -492,7 +497,8 @@ build_flags = -g
-DCONFIG_IDF_TARGET_ESP32S3=1
-DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE ;; WLEDMM
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
; -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=10072
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_DFU_ON_BOOT=0
-DCO
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
Expand All @@ -503,7 +509,6 @@ lib_deps =
;; makuna/NeoPixelBus @ 2.7.9 ;; experimental
${env.lib_deps}


# ------------------------------------------------------------------------------
# WLED BUILDS
# ------------------------------------------------------------------------------
Expand Down
Loading
Loading