Compare commits
	
		
			20 Commits
		
	
	
		
			power-ap
			...
			lto_size_o
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 0a3298cddc | ||
|   | d3f4326b1c | ||
|   | d3c401ed4e | ||
|   | 10d8cfde85 | ||
|   | 6f221852a2 | ||
|   | 6dc2c680c5 | ||
|   | 9a4b56db6e | ||
|   | 8180f2c742 | ||
|   | c600c6da63 | ||
|   | e789a18553 | ||
|   | 3f3c986932 | ||
|   | 3ccc5babc1 | ||
|   | 45cf90094a | ||
|   | ae1df20893 | ||
|   | 71148740d4 | ||
|   | 4ef583c844 | ||
|   | 16f61ea96d | ||
|   | 32f9616b6e | ||
|   | 1346eb4f76 | ||
|   | d4268ba070 | 
							
								
								
									
										119
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										119
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -54,9 +54,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@jridgewell/sourcemap-codec": { | ||||
|       "version": "1.4.15", | ||||
|       "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", | ||||
|       "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" | ||||
|       "version": "1.5.0", | ||||
|       "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", | ||||
|       "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" | ||||
|     }, | ||||
|     "node_modules/@jridgewell/trace-mapping": { | ||||
|       "version": "0.3.25", | ||||
| @@ -67,15 +67,10 @@ | ||||
|         "@jridgewell/sourcemap-codec": "^1.4.14" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/abbrev": { | ||||
|       "version": "1.1.1", | ||||
|       "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", | ||||
|       "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" | ||||
|     }, | ||||
|     "node_modules/acorn": { | ||||
|       "version": "8.11.3", | ||||
|       "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", | ||||
|       "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", | ||||
|       "version": "8.12.1", | ||||
|       "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", | ||||
|       "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", | ||||
|       "bin": { | ||||
|         "acorn": "bin/acorn" | ||||
|       }, | ||||
| @@ -190,9 +185,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/aws4": { | ||||
|       "version": "1.12.0", | ||||
|       "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", | ||||
|       "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" | ||||
|       "version": "1.13.2", | ||||
|       "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz", | ||||
|       "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==" | ||||
|     }, | ||||
|     "node_modules/balanced-match": { | ||||
|       "version": "1.0.2", | ||||
| @@ -233,11 +228,11 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/braces": { | ||||
|       "version": "3.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", | ||||
|       "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", | ||||
|       "version": "3.0.3", | ||||
|       "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", | ||||
|       "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", | ||||
|       "dependencies": { | ||||
|         "fill-range": "^7.0.1" | ||||
|         "fill-range": "^7.1.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=8" | ||||
| @@ -701,9 +696,9 @@ | ||||
|       "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" | ||||
|     }, | ||||
|     "node_modules/fill-range": { | ||||
|       "version": "7.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", | ||||
|       "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", | ||||
|       "version": "7.1.1", | ||||
|       "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", | ||||
|       "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", | ||||
|       "dependencies": { | ||||
|         "to-regex-range": "^5.0.1" | ||||
|       }, | ||||
| @@ -1281,17 +1276,6 @@ | ||||
|         "node": ">=0.10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/lru-cache": { | ||||
|       "version": "6.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", | ||||
|       "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", | ||||
|       "dependencies": { | ||||
|         "yallist": "^4.0.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=10" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/mime": { | ||||
|       "version": "1.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", | ||||
| @@ -1375,9 +1359,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/nodemon": { | ||||
|       "version": "3.1.0", | ||||
|       "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz", | ||||
|       "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==", | ||||
|       "version": "3.1.7", | ||||
|       "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.7.tgz", | ||||
|       "integrity": "sha512-hLj7fuMow6f0lbB0cD14Lz2xNjwsyruH251Pk4t/yIitCFJbmY1myuLlHm/q06aST4jg6EgAh74PIBBrRqpVAQ==", | ||||
|       "dependencies": { | ||||
|         "chokidar": "^3.5.2", | ||||
|         "debug": "^4", | ||||
| @@ -1402,11 +1386,11 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/nodemon/node_modules/debug": { | ||||
|       "version": "4.3.4", | ||||
|       "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", | ||||
|       "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", | ||||
|       "version": "4.3.7", | ||||
|       "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", | ||||
|       "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", | ||||
|       "dependencies": { | ||||
|         "ms": "2.1.2" | ||||
|         "ms": "^2.1.3" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=6.0" | ||||
| @@ -1418,9 +1402,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/nodemon/node_modules/ms": { | ||||
|       "version": "2.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", | ||||
|       "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | ||||
|       "version": "2.1.3", | ||||
|       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", | ||||
|       "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" | ||||
|     }, | ||||
|     "node_modules/nodemon/node_modules/supports-color": { | ||||
|       "version": "5.5.0", | ||||
| @@ -1433,20 +1417,6 @@ | ||||
|         "node": ">=4" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/nopt": { | ||||
|       "version": "1.0.10", | ||||
|       "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", | ||||
|       "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", | ||||
|       "dependencies": { | ||||
|         "abbrev": "1" | ||||
|       }, | ||||
|       "bin": { | ||||
|         "nopt": "bin/nopt.js" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": "*" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/normalize-path": { | ||||
|       "version": "3.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||
| @@ -1507,6 +1477,7 @@ | ||||
|       "version": "0.1.5", | ||||
|       "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", | ||||
|       "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", | ||||
|       "deprecated": "This package is no longer supported.", | ||||
|       "dependencies": { | ||||
|         "os-homedir": "^1.0.0", | ||||
|         "os-tmpdir": "^1.0.0" | ||||
| @@ -1620,6 +1591,7 @@ | ||||
|       "version": "1.5.1", | ||||
|       "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", | ||||
|       "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", | ||||
|       "deprecated": "You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.\n\n(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)", | ||||
|       "engines": { | ||||
|         "node": ">=0.6.0", | ||||
|         "teleport": ">=0.2.0" | ||||
| @@ -1826,12 +1798,9 @@ | ||||
|       "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" | ||||
|     }, | ||||
|     "node_modules/semver": { | ||||
|       "version": "7.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", | ||||
|       "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", | ||||
|       "dependencies": { | ||||
|         "lru-cache": "^6.0.0" | ||||
|       }, | ||||
|       "version": "7.6.3", | ||||
|       "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", | ||||
|       "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", | ||||
|       "bin": { | ||||
|         "semver": "bin/semver.js" | ||||
|       }, | ||||
| @@ -1993,9 +1962,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/terser": { | ||||
|       "version": "5.29.2", | ||||
|       "resolved": "https://registry.npmjs.org/terser/-/terser-5.29.2.tgz", | ||||
|       "integrity": "sha512-ZiGkhUBIM+7LwkNjXYJq8svgkd+QK3UUr0wJqY4MieaezBSAIPgbSPZyIx0idM6XWK5CMzSWa8MJIzmRcB8Caw==", | ||||
|       "version": "5.34.0", | ||||
|       "resolved": "https://registry.npmjs.org/terser/-/terser-5.34.0.tgz", | ||||
|       "integrity": "sha512-y5NUX+U9HhVsK/zihZwoq4r9dICLyV2jXGOriDAVOeKhq3LKVjgJbGO90FisozXLlJfvjHqgckGmJFBb9KYoWQ==", | ||||
|       "dependencies": { | ||||
|         "@jridgewell/source-map": "^0.3.3", | ||||
|         "acorn": "^8.8.2", | ||||
| @@ -2042,12 +2011,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/touch": { | ||||
|       "version": "3.1.0", | ||||
|       "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", | ||||
|       "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", | ||||
|       "dependencies": { | ||||
|         "nopt": "~1.0.10" | ||||
|       }, | ||||
|       "version": "3.1.1", | ||||
|       "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", | ||||
|       "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", | ||||
|       "bin": { | ||||
|         "nodetouch": "bin/nodetouch.js" | ||||
|       } | ||||
| @@ -2065,9 +2031,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tslib": { | ||||
|       "version": "2.6.2", | ||||
|       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", | ||||
|       "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" | ||||
|       "version": "2.7.0", | ||||
|       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", | ||||
|       "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" | ||||
|     }, | ||||
|     "node_modules/tunnel-agent": { | ||||
|       "version": "0.6.0", | ||||
| @@ -2229,11 +2195,6 @@ | ||||
|         "node": ">=0.10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/yallist": { | ||||
|       "version": "4.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", | ||||
|       "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" | ||||
|     }, | ||||
|     "node_modules/yargs": { | ||||
|       "version": "3.10.0", | ||||
|       "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", | ||||
|   | ||||
| @@ -26,6 +26,6 @@ | ||||
|     "clean-css": "^5.3.3", | ||||
|     "html-minifier-terser": "^7.2.0", | ||||
|     "inliner": "^1.13.1", | ||||
|     "nodemon": "^3.0.2" | ||||
|     "nodemon": "^3.1.7" | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -268,7 +268,7 @@ AR_lib_deps = kosme/arduinoFFT @ 2.0.1 | ||||
| ;; | ||||
| ;; please note that you can NOT update existing ESP32 installs with a "V4" build. Also updating by OTA will not work properly. | ||||
| ;; You need to completely erase your device (esptool erase_flash) first, then install the "V4" build from VSCode+platformio. | ||||
| platform = espressif32@ ~6.3.2 | ||||
| platform = espressif32@ ~6.6.0                                             ;; supports -flto | ||||
| platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0    ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) | ||||
| build_flags = -g | ||||
|   -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one | ||||
| @@ -281,7 +281,7 @@ lib_deps = | ||||
|  | ||||
| [esp32s2] | ||||
| ;; generic definitions for all ESP32-S2 boards | ||||
| platform = espressif32@ ~6.3.2 | ||||
| platform = espressif32@ ~6.6.0                                             ;; supports -flto | ||||
| platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0    ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) | ||||
| build_flags = -g | ||||
|   -DARDUINO_ARCH_ESP32 | ||||
| @@ -316,7 +316,7 @@ lib_deps = | ||||
|  | ||||
| [esp32s3] | ||||
| ;; generic definitions for all ESP32-S3 boards | ||||
| platform = espressif32@ ~6.3.2 | ||||
| platform = espressif32@ ~6.6.0                                             ;; supports -flto | ||||
| platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0    ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) | ||||
| build_flags = -g | ||||
|   -DESP32 | ||||
| @@ -424,7 +424,9 @@ board = esp32dev | ||||
| platform = ${esp32_idf_V4.platform} | ||||
| platform_packages = ${esp32_idf_V4.platform_packages} | ||||
| build_unflags = ${common.build_unflags} | ||||
|   -fno-lto | ||||
| build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=ESP32_8M #-D WLED_DISABLE_BROWNOUT_DET | ||||
|   -g3 -ggdb -flto=auto ;; enable size optimization by the linker - comment out when debugging. ("=4" just means "use 4 cores in parallel") | ||||
|   ${esp32.AR_build_flags} | ||||
| lib_deps = ${esp32_idf_V4.lib_deps} | ||||
|   ${esp32.AR_lib_deps} | ||||
| @@ -468,7 +470,9 @@ board_build.f_flash = 80000000L | ||||
| board_build.flash_mode = qio | ||||
| board_build.partitions = ${esp32.extended_partitions} | ||||
| build_unflags = ${common.build_unflags} | ||||
|   -fno-lto | ||||
| build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=ESP32_WROVER | ||||
|   -g3 -ggdb -flto=4 ;; enable size optimization by the linker - comment out when debugging. ("=4" just means "use 4 cores in parallel") | ||||
|   -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 DATA_PINS=25 | ||||
|   ${esp32.AR_build_flags} | ||||
| @@ -540,7 +544,9 @@ platform = ${esp32s3.platform} | ||||
| platform_packages = ${esp32s3.platform_packages} | ||||
| upload_speed = 921600 | ||||
| build_unflags = ${common.build_unflags} | ||||
|   -fno-lto | ||||
| build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=ESP32-S3_4M_qspi | ||||
|   -g3 -ggdb -flto=4 ;; enable size optimization by the linker - comment out when debugging. ("=4" just means "use 4 cores in parallel") | ||||
|   -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MODE=1      ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB") | ||||
|   -DBOARD_HAS_PSRAM | ||||
|   -DLOLIN_WIFI_FIX ; seems to work much better with this | ||||
| @@ -561,7 +567,9 @@ board_build.partitions = ${esp32.default_partitions} | ||||
| board_build.flash_mode = qio | ||||
| board_build.f_flash = 80000000L | ||||
| build_unflags = ${common.build_unflags} | ||||
|   -fno-lto | ||||
| build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2 | ||||
|   -g3 -ggdb -flto=4 ;; enable size optimization by the linker - comment out when debugging. ("=4" just means "use 4 cores in parallel") | ||||
|   -DARDUINO_USB_CDC_ON_BOOT=1 | ||||
|   -DARDUINO_USB_MSC_ON_BOOT=0 | ||||
|   -DARDUINO_USB_DFU_ON_BOOT=0 | ||||
|   | ||||
| @@ -4,19 +4,17 @@ | ||||
| # | ||||
| #    pip-compile | ||||
| # | ||||
| aiofiles==22.1.0 | ||||
|     # via platformio | ||||
| ajsonrpc==1.2.0 | ||||
|     # via platformio | ||||
| anyio==3.6.2 | ||||
| anyio==4.6.0 | ||||
|     # via starlette | ||||
| bottle==0.12.25 | ||||
| bottle==0.13.1 | ||||
|     # via platformio | ||||
| certifi==2023.7.22 | ||||
| certifi==2024.8.30 | ||||
|     # via requests | ||||
| charset-normalizer==3.1.0 | ||||
| charset-normalizer==3.3.2 | ||||
|     # via requests | ||||
| click==8.1.3 | ||||
| click==8.1.7 | ||||
|     # via | ||||
|     #   platformio | ||||
|     #   uvicorn | ||||
| @@ -28,35 +26,33 @@ h11==0.14.0 | ||||
|     # via | ||||
|     #   uvicorn | ||||
|     #   wsproto | ||||
| idna==3.7 | ||||
| idna==3.10 | ||||
|     # via | ||||
|     #   anyio | ||||
|     #   requests | ||||
| marshmallow==3.19.0 | ||||
| marshmallow==3.22.0 | ||||
|     # via platformio | ||||
| packaging==23.1 | ||||
| packaging==24.1 | ||||
|     # via marshmallow | ||||
| platformio==6.1.14 | ||||
| platformio==6.1.16 | ||||
|     # via -r requirements.in | ||||
| pyelftools==0.29 | ||||
| pyelftools==0.31 | ||||
|     # via platformio | ||||
| pyserial==3.5 | ||||
|     # via platformio | ||||
| requests==2.32.0 | ||||
| requests==2.32.3 | ||||
|     # via platformio | ||||
| semantic-version==2.10.0 | ||||
|     # via platformio | ||||
| sniffio==1.3.0 | ||||
| sniffio==1.3.1 | ||||
|     # via anyio | ||||
| starlette==0.23.1 | ||||
| starlette==0.39.1 | ||||
|     # via platformio | ||||
| tabulate==0.9.0 | ||||
|     # via platformio | ||||
| typing-extensions==4.11.0 | ||||
|     # via starlette | ||||
| urllib3==1.26.19 | ||||
| urllib3==2.2.3 | ||||
|     # via requests | ||||
| uvicorn==0.20.0 | ||||
| uvicorn==0.30.6 | ||||
|     # via platformio | ||||
| wsproto==1.2.0 | ||||
|     # via platformio | ||||
|   | ||||
							
								
								
									
										7
									
								
								tools/WLED_ESP32_4MB_512KB_FS.csv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								tools/WLED_ESP32_4MB_512KB_FS.csv
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| # Name,   Type, SubType, Offset,  Size, Flags | ||||
| nvs,      data, nvs,     0x9000,  0x5000, | ||||
| otadata,  data, ota,     0xe000,  0x2000, | ||||
| app0,     app,  ota_0,   0x10000, 0x1B0000, | ||||
| app1,     app,  ota_1,   0x1C0000,0x1B0000, | ||||
| spiffs,   data, spiffs,  0x370000,0x80000, | ||||
| coredump, data, coredump,,64K | ||||
| 
 | 
							
								
								
									
										17
									
								
								tools/all_xml.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								tools/all_xml.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| #!/bin/bash | ||||
| # Pull all settings pages for comparison | ||||
| HOST=$1 | ||||
| TGT_PATH=$2 | ||||
| CURL_ARGS="--compressed" | ||||
|  | ||||
| # Replicate one target many times | ||||
| function replicate() { | ||||
|   for i in {0..10} | ||||
|   do   | ||||
|     echo -n " http://${HOST}/settings.js?p=$i -o ${TGT_PATH}/$i.xml" | ||||
|   done | ||||
| } | ||||
| read -a TARGETS <<< $(replicate) | ||||
|  | ||||
| mkdir -p ${TGT_PATH} | ||||
| curl ${CURL_ARGS} ${TARGETS[@]} | ||||
| @@ -704,11 +704,14 @@ void Segment::wu_pixel(uint32_t x, uint32_t y, CRGB c) {      //awesome wu_pixel | ||||
|                    WU_WEIGHT(ix, yy), WU_WEIGHT(xx, yy)}; | ||||
|   // multiply the intensities by the colour, and saturating-add them to the pixels | ||||
|   for (int i = 0; i < 4; i++) { | ||||
|     CRGB led = getPixelColorXY((x >> 8) + (i & 1), (y >> 8) + ((i >> 1) & 1)); | ||||
|     int wu_x = (x >> 8) + (i & 1);        // precalculate x | ||||
|     int wu_y = (y >> 8) + ((i >> 1) & 1); // precalculate y | ||||
|     CRGB led = getPixelColorXY(wu_x, wu_y); | ||||
|     CRGB oldLed = led; | ||||
|     led.r = qadd8(led.r, c.r * wu[i] >> 8); | ||||
|     led.g = qadd8(led.g, c.g * wu[i] >> 8); | ||||
|     led.b = qadd8(led.b, c.b * wu[i] >> 8); | ||||
|     setPixelColorXY(int((x >> 8) + (i & 1)), int((y >> 8) + ((i >> 1) & 1)), led); | ||||
|     if (led != oldLed) setPixelColorXY(wu_x, wu_y, led); // don't repaint if same color | ||||
|   } | ||||
| } | ||||
| #undef WU_WEIGHT | ||||
|   | ||||
| @@ -1290,7 +1290,7 @@ void WS2812FX::finalizeInit() { | ||||
|       // if we have less counts than pins and they do not align, use last known count to set current count | ||||
|       unsigned count = defCounts[(i < defNumCounts) ? i : defNumCounts -1]; | ||||
|       // analog always has length 1 | ||||
|       if (Bus::isPWM(dataType)) count = 1; | ||||
|       if (Bus::isPWM(dataType) || Bus::isOnOff(dataType)) count = 1; | ||||
|       prevLen += count; | ||||
|       BusConfig defCfg = BusConfig(dataType, defPin, start, count, DEFAULT_LED_COLOR_ORDER, false, 0, RGBW_MODE_MANUAL_ONLY, 0, useGlobalLedBuffer); | ||||
|       if (BusManager::add(defCfg) == -1) break; | ||||
|   | ||||
| @@ -35,6 +35,7 @@ | ||||
| 	--sgp: "block"; | ||||
| 	--bmt: 0; | ||||
| 	--sti: 42px; | ||||
| 	--stp: 42px; | ||||
| } | ||||
|  | ||||
| html { | ||||
| @@ -468,7 +469,7 @@ button { | ||||
| 	padding: 4px 2px; | ||||
| 	position: relative; | ||||
| 	opacity: 1; | ||||
| 	transition: opacity .5s linear, height .25s, transform .25s; | ||||
| 	transition: opacity .25s linear, height .2s, transform .2s; | ||||
| } | ||||
|  | ||||
| .filter { | ||||
| @@ -1335,10 +1336,12 @@ TD .checkmark, TD .radiomark { | ||||
| 	top: 42px; | ||||
| } | ||||
|  | ||||
| #fxlist .lstI.selected, | ||||
| #pallist .lstI.selected { | ||||
| #fxlist .lstI.selected { | ||||
| 	top: calc(var(--sti) + 42px); | ||||
| } | ||||
| #pallist .lstI.selected { | ||||
| 	top: calc(var(--stp) + 42px); | ||||
| } | ||||
|  | ||||
| dialog::backdrop { | ||||
| 	backdrop-filter: blur(10px); | ||||
| @@ -1353,10 +1356,12 @@ dialog { | ||||
| 	color: var(--c-f); | ||||
| } | ||||
|  | ||||
| #fxlist .lstI.sticky, | ||||
| #pallist .lstI.sticky { | ||||
| #fxlist .lstI.sticky { | ||||
| 	top: var(--sti); | ||||
| } | ||||
| #pallist .lstI.sticky { | ||||
| 	top: var(--stp); | ||||
| } | ||||
|  | ||||
| /* list item content */ | ||||
| .lstIcontent { | ||||
|   | ||||
| @@ -2828,7 +2828,12 @@ function search(field, listId = null) { | ||||
| 	// restore default preset sorting if no search term is entered | ||||
| 	if (!search) { | ||||
| 		if (listId === 'pcont')   { populatePresets(); return; } | ||||
| 		if (listId === 'pallist') { populatePalettes(); return; } | ||||
| 		if (listId === 'pallist') { | ||||
| 			let id = parseInt(d.querySelector('#pallist input[name="palette"]:checked').value); // preserve selected palette | ||||
| 			populatePalettes(); | ||||
| 			updateSelectedPalette(id); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// clear filter if searching in fxlist | ||||
| @@ -2887,18 +2892,25 @@ function initFilters() { | ||||
|  | ||||
| function filterFocus(e) { | ||||
| 	const f = gId("filters"); | ||||
| 	if (e.type === "focus") f.classList.remove('fade');	// immediately show (still has transition) | ||||
| 	// compute sticky top (with delay for transition) | ||||
| 	setTimeout(() => { | ||||
| 		const sti = parseInt(getComputedStyle(d.documentElement).getPropertyValue('--sti')) + (e.type === "focus" ? 1 : -1) * f.offsetHeight; | ||||
| 		sCol('--sti', sti + "px"); | ||||
| 	}, 252); | ||||
| 	const c = !!f.querySelectorAll("input[type=checkbox]:checked").length; | ||||
| 	const h = f.offsetHeight; | ||||
| 	const sti = parseInt(getComputedStyle(d.documentElement).getPropertyValue('--sti')); | ||||
| 	if (e.type === "focus") { | ||||
| 		// compute sticky top (with delay for transition) | ||||
| 		if (!h) setTimeout(() => { | ||||
| 			sCol('--sti', (sti+f.offsetHeight) + "px"); // has an unpleasant consequence on palette offset | ||||
| 		}, 255); | ||||
| 		f.classList.remove('fade');	// immediately show (still has transition) | ||||
| 	} | ||||
| 	if (e.type === "blur") { | ||||
| 		setTimeout(() => { | ||||
| 			if (e.target === document.activeElement && document.hasFocus()) return; | ||||
| 			// do not hide if filter is active | ||||
| 			if (gId("filters").querySelectorAll("input[type=checkbox]:checked").length) return; | ||||
| 			f.classList.add('fade'); | ||||
| 			if (!c) { | ||||
| 				// compute sticky top | ||||
| 				sCol('--sti', (sti-h) + "px"); // has an unpleasant consequence on palette offset | ||||
| 				f.classList.add('fade'); | ||||
| 			} | ||||
| 		}, 255);	// wait with hiding | ||||
| 	} | ||||
| } | ||||
| @@ -2911,7 +2923,7 @@ function filterFx() { | ||||
| 	gId("fxlist").querySelectorAll('.lstI').forEach((listItem,i) => { | ||||
| 		const listItemName = listItem.querySelector('.lstIname').innerText; | ||||
| 		let hide = false; | ||||
| 		gId("filters").querySelectorAll("input[type=checkbox]").forEach((e) => { if (e.checked && !listItemName.includes(e.dataset.flt)) hide = true; }); | ||||
| 		gId("filters").querySelectorAll("input[type=checkbox]").forEach((e) => { if (e.checked && !listItemName.includes(e.dataset.flt)) hide = i>0 /*true*/; }); | ||||
| 		listItem.style.display = hide ? 'none' : ''; | ||||
| 	}); | ||||
| } | ||||
|   | ||||
| @@ -302,7 +302,7 @@ class Usermod { | ||||
|     virtual bool handleButton(uint8_t b) { return false; }                   // button overrides are possible here | ||||
|     virtual bool getUMData(um_data_t **data) { if (data) *data = nullptr; return false; }; // usermod data exchange [see examples for audio effects] | ||||
|     virtual void connected() {}                                              // called when WiFi is (re)connected | ||||
|     virtual void appendConfigData() {}                                       // helper function called from usermod settings page to add metadata for entry fields | ||||
|     virtual void appendConfigData(Print& settingsScript);                    // helper function called from usermod settings page to add metadata for entry fields | ||||
|     virtual void addToJsonState(JsonObject& obj) {}                          // add JSON objects for WLED state | ||||
|     virtual void addToJsonInfo(JsonObject& obj) {}                           // add JSON objects for UI Info page | ||||
|     virtual void readFromJsonState(JsonObject& obj) {}                       // process JSON messages received from web server | ||||
| @@ -314,6 +314,16 @@ class Usermod { | ||||
|     virtual void onUpdateBegin(bool) {}                                      // fired prior to and after unsuccessful firmware update | ||||
|     virtual void onStateChange(uint8_t mode) {}                              // fired upon WLED state change | ||||
|     virtual uint16_t getId() {return USERMOD_ID_UNSPECIFIED;} | ||||
|  | ||||
|   // API shims | ||||
|   private: | ||||
|     static Print* oappend_shim; | ||||
|     // old form of appendConfigData; called by default appendConfigData(Print&) with oappend_shim set up | ||||
|     // private so it is not accidentally invoked except via Usermod::appendConfigData(Print&) | ||||
|     virtual void appendConfigData() {}     | ||||
|   protected: | ||||
|     // Shim for oappend(), which used to exist in utils.cpp | ||||
|     template<typename T> static inline void oappend(const T& t) { oappend_shim->print(t); }; | ||||
| }; | ||||
|  | ||||
| class UsermodManager { | ||||
| @@ -328,7 +338,7 @@ class UsermodManager { | ||||
|     static bool getUMData(um_data_t **um_data, uint8_t mod_id = USERMOD_ID_RESERVED); // USERMOD_ID_RESERVED will poll all usermods | ||||
|     static void setup(); | ||||
|     static void connected(); | ||||
|     static void appendConfigData(); | ||||
|     static void appendConfigData(Print&); | ||||
|     static void addToJsonState(JsonObject& obj); | ||||
|     static void addToJsonInfo(JsonObject& obj); | ||||
|     static void readFromJsonState(JsonObject& obj); | ||||
| @@ -362,10 +372,11 @@ void parseNumber(const char* str, byte* val, byte minv=0, byte maxv=255); | ||||
| bool getVal(JsonVariant elem, byte* val, byte minv=0, byte maxv=255); | ||||
| bool getBoolVal(JsonVariant elem, bool dflt); | ||||
| bool updateVal(const char* req, const char* key, byte* val, byte minv=0, byte maxv=255); | ||||
| bool oappend(const char* txt); // append new c string to temp buffer efficiently | ||||
| bool oappendi(int i);          // append new number to temp buffer efficiently | ||||
| void sappend(char stype, const char* key, int val); | ||||
| void sappends(char stype, const char* key, char* val); | ||||
| size_t printSetFormCheckbox(Print& settingsScript, const char* key, int val); | ||||
| size_t printSetFormValue(Print& settingsScript, const char* key, int val); | ||||
| size_t printSetFormValue(Print& settingsScript, const char* key, const char* val); | ||||
| size_t printSetFormIndex(Print& settingsScript, const char* key, int index); | ||||
| size_t printSetClassElementHTML(Print& settingsScript, const char* key, const int index, const char* val); | ||||
| void prepareHostname(char* hostname); | ||||
| bool isAsterisksOnly(const char* str, byte maxLen); | ||||
| bool requestJSONBufferLock(uint8_t module=255); | ||||
| @@ -444,7 +455,7 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp | ||||
| void sendDataWs(AsyncWebSocketClient * client = nullptr); | ||||
|  | ||||
| //xml.cpp | ||||
| void XML_response(AsyncWebServerRequest *request, char* dest = nullptr); | ||||
| void getSettingsJS(byte subPage, char* dest); | ||||
| void XML_response(Print& dest); | ||||
| void getSettingsJS(byte subPage, Print& dest); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -433,7 +433,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){ | ||||
|   } | ||||
|   #endif | ||||
|   if(WLED_FS.exists(path) || WLED_FS.exists(path + ".gz")) { | ||||
|     request->send(WLED_FS, path, String(), request->hasArg(F("download"))); | ||||
|     request->send(request->beginResponse(WLED_FS, path, {}, request->hasArg(F("download")), {})); | ||||
|     return true; | ||||
|   } | ||||
|   return false; | ||||
|   | ||||
| @@ -124,6 +124,32 @@ static void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProp | ||||
|   payloadStr = nullptr; | ||||
| } | ||||
|  | ||||
| // Print adapter for flat buffers | ||||
| namespace {  | ||||
| class bufferPrint : public Print { | ||||
|   char* _buf; | ||||
|   size_t _size, _offset; | ||||
|   public: | ||||
|  | ||||
|   bufferPrint(char* buf, size_t size) : _buf(buf), _size(size), _offset(0) {}; | ||||
|  | ||||
|   size_t write(const uint8_t *buffer, size_t size) { | ||||
|     size = std::min(size, _size - _offset); | ||||
|     memcpy(_buf + _offset, buffer, size); | ||||
|     _offset += size; | ||||
|     return size; | ||||
|   } | ||||
|  | ||||
|   size_t write(uint8_t c) { | ||||
|     return this->write(&c, 1); | ||||
|   } | ||||
|  | ||||
|   char* data() const { return _buf; } | ||||
|   size_t size() const { return _offset; } | ||||
|   size_t capacity() const { return _size; } | ||||
| }; | ||||
| }; // anonymous namespace | ||||
|  | ||||
|  | ||||
| void publishMqtt() | ||||
| { | ||||
| @@ -148,11 +174,13 @@ void publishMqtt() | ||||
|   strcat_P(subuf, PSTR("/status")); | ||||
|   mqtt->publish(subuf, 0, true, "online");          // retain message for a LWT | ||||
|  | ||||
|   char apires[1024];                                // allocating 1024 bytes from stack can be risky | ||||
|   XML_response(nullptr, apires); | ||||
|   // TODO: use a DynamicBufferList.  Requires a list-read-capable MQTT client API. | ||||
|   DynamicBuffer buf(1024); | ||||
|   bufferPrint pbuf(buf.data(), buf.size()); | ||||
|   XML_response(pbuf); | ||||
|   strlcpy(subuf, mqttDeviceTopic, 33); | ||||
|   strcat_P(subuf, PSTR("/v")); | ||||
|   mqtt->publish(subuf, 0, retainMqttMsg, apires);   // optionally retain message (#2263) | ||||
|   mqtt->publish(subuf, 0, retainMqttMsg, buf.data(), pbuf.size());   // optionally retain message (#2263) | ||||
|   #endif | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1191,7 +1191,11 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply) | ||||
|  | ||||
|   // internal call, does not send XML response | ||||
|   pos = req.indexOf(F("IN")); | ||||
|   if (pos < 1) XML_response(request); | ||||
|   if (pos < 1) { | ||||
|     auto response = request->beginResponseStream("text/xml"); | ||||
|     XML_response(*response); | ||||
|     request->send(response); | ||||
|   } | ||||
|  | ||||
|   return true; | ||||
| } | ||||
|   | ||||
| @@ -974,10 +974,8 @@ void espNowReceiveCB(uint8_t* address, uint8_t* data, uint8_t len, signed int rs | ||||
|     DEBUG_PRINTLN(); | ||||
|   #endif | ||||
|  | ||||
| #ifndef WLED_DISABLE_ESPNOW | ||||
|   // usermods hook can override processing | ||||
|   if (UsermodManager::onEspNowMessage(address, data, len)) return; | ||||
| #endif | ||||
|  | ||||
|   // handle WiZ Mote data | ||||
|   if (data[0] == 0x91 || data[0] == 0x81 || data[0] == 0x80) { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ void UsermodManager::setup()             { for (unsigned i = 0; i < numMods; i++ | ||||
| void UsermodManager::connected()         { for (unsigned i = 0; i < numMods; i++) ums[i]->connected(); } | ||||
| void UsermodManager::loop()              { for (unsigned i = 0; i < numMods; i++) ums[i]->loop();  } | ||||
| void UsermodManager::handleOverlayDraw() { for (unsigned i = 0; i < numMods; i++) ums[i]->handleOverlayDraw(); } | ||||
| void UsermodManager::appendConfigData()  { for (unsigned i = 0; i < numMods; i++) ums[i]->appendConfigData(); } | ||||
| void UsermodManager::appendConfigData(Print& dest)  { for (unsigned i = 0; i < numMods; i++) ums[i]->appendConfigData(dest); } | ||||
| bool UsermodManager::handleButton(uint8_t b) { | ||||
|   bool overrideIO = false; | ||||
|   for (unsigned i = 0; i < numMods; i++) { | ||||
| @@ -71,3 +71,13 @@ bool UsermodManager::add(Usermod* um) | ||||
|  | ||||
| Usermod* UsermodManager::ums[WLED_MAX_USERMODS] = {nullptr}; | ||||
| byte UsermodManager::numMods = 0; | ||||
|  | ||||
| /* Usermod v2 interface shim for oappend */ | ||||
| Print* Usermod::oappend_shim = nullptr; | ||||
|  | ||||
| void Usermod::appendConfigData(Print& settingsScript) { | ||||
|   assert(!oappend_shim); | ||||
|   oappend_shim = &settingsScript; | ||||
|   this->appendConfigData(); | ||||
|   oappend_shim = nullptr; | ||||
| } | ||||
|   | ||||
| @@ -87,90 +87,30 @@ bool updateVal(const char* req, const char* key, byte* val, byte minv, byte maxv | ||||
|   return true; | ||||
| } | ||||
|  | ||||
|  | ||||
| //append a numeric setting to string buffer | ||||
| void sappend(char stype, const char* key, int val) | ||||
| { | ||||
|   char ds[] = "d.Sf."; | ||||
|  | ||||
|   switch(stype) | ||||
|   { | ||||
|     case 'c': //checkbox | ||||
|       oappend(ds); | ||||
|       oappend(key); | ||||
|       oappend(".checked="); | ||||
|       oappendi(val); | ||||
|       oappend(";"); | ||||
|       break; | ||||
|     case 'v': //numeric | ||||
|       oappend(ds); | ||||
|       oappend(key); | ||||
|       oappend(".value="); | ||||
|       oappendi(val); | ||||
|       oappend(";"); | ||||
|       break; | ||||
|     case 'i': //selectedIndex | ||||
|       oappend(ds); | ||||
|       oappend(key); | ||||
|       oappend(SET_F(".selectedIndex=")); | ||||
|       oappendi(val); | ||||
|       oappend(";"); | ||||
|       break; | ||||
|   } | ||||
| static size_t printSetFormInput(Print& settingsScript, const char* key, const char* selector, int value) { | ||||
|   return settingsScript.printf_P(PSTR("d.Sf.%s.%s=%d;"), key, selector, value); | ||||
| } | ||||
|  | ||||
|  | ||||
| //append a string setting to buffer | ||||
| void sappends(char stype, const char* key, char* val) | ||||
| { | ||||
|   switch(stype) | ||||
|   { | ||||
|     case 's': {//string (we can interpret val as char*) | ||||
|       String buf = val; | ||||
|       //convert "%" to "%%" to make EspAsyncWebServer happy | ||||
|       //buf.replace("%","%%"); | ||||
|       oappend("d.Sf."); | ||||
|       oappend(key); | ||||
|       oappend(".value=\""); | ||||
|       oappend(buf.c_str()); | ||||
|       oappend("\";"); | ||||
|       break;} | ||||
|     case 'm': //message | ||||
|       oappend(SET_F("d.getElementsByClassName")); | ||||
|       oappend(key); | ||||
|       oappend(SET_F(".innerHTML=\"")); | ||||
|       oappend(val); | ||||
|       oappend("\";"); | ||||
|       break; | ||||
|   } | ||||
| size_t printSetFormCheckbox(Print& settingsScript, const char* key, int val) { | ||||
|   return printSetFormInput(settingsScript, key, PSTR("checked"), val); | ||||
| } | ||||
| size_t printSetFormValue(Print& settingsScript, const char* key, int val) { | ||||
|   return printSetFormInput(settingsScript, key, PSTR("value"), val); | ||||
| } | ||||
| size_t printSetFormIndex(Print& settingsScript, const char* key, int index) { | ||||
|   return printSetFormInput(settingsScript, key, PSTR("selectedIndex"), index); | ||||
| } | ||||
|  | ||||
|  | ||||
| bool oappendi(int i) | ||||
| { | ||||
|   char s[12]; // 32bit signed number can have 10 digits plus - sign | ||||
|   sprintf(s, "%d", i); | ||||
|   return oappend(s); | ||||
| size_t printSetFormValue(Print& settingsScript, const char* key, const char* val) { | ||||
|   return settingsScript.printf_P(PSTR("d.Sf.%s.value=\"%s\";"),key,val); | ||||
| } | ||||
|  | ||||
|  | ||||
| bool oappend(const char* txt) | ||||
| { | ||||
|   unsigned len = strlen(txt); | ||||
|   if ((obuf == nullptr) || (olen + len >= SETTINGS_STACK_BUF_SIZE)) { // sanity checks | ||||
| #ifdef WLED_DEBUG | ||||
|     DEBUG_PRINT(F("oappend() buffer overflow. Cannot append ")); | ||||
|     DEBUG_PRINT(len); DEBUG_PRINT(F(" bytes \t\"")); | ||||
|     DEBUG_PRINT(txt); DEBUG_PRINTLN(F("\"")); | ||||
| #endif | ||||
|     return false;        // buffer full | ||||
|   } | ||||
|   strcpy(obuf + olen, txt); | ||||
|   olen += len; | ||||
|   return true; | ||||
| size_t printSetClassElementHTML(Print& settingsScript, const char* key, const int index, const char* val) { | ||||
|   return settingsScript.printf_P(PSTR("d.getElementsByClassName(\"%s\")[%d].innerHTML=\"%s\";"), key, index, val); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| void prepareHostname(char* hostname) | ||||
| { | ||||
|   sprintf_P(hostname, PSTR("wled-%*s"), 6, escapedMac.c_str() + 6); | ||||
|   | ||||
| @@ -839,10 +839,6 @@ WLED_GLOBAL time_t sunrise _INIT(0); | ||||
| WLED_GLOBAL time_t sunset _INIT(0); | ||||
| WLED_GLOBAL Toki toki _INIT(Toki()); | ||||
|  | ||||
| // Temp buffer | ||||
| WLED_GLOBAL char* obuf; | ||||
| WLED_GLOBAL uint16_t olen _INIT(0); | ||||
|  | ||||
| // General filesystem | ||||
| WLED_GLOBAL size_t fsBytesUsed _INIT(0); | ||||
| WLED_GLOBAL size_t fsBytesTotal _INIT(0); | ||||
|   | ||||
| @@ -520,27 +520,23 @@ void serveSettingsJS(AsyncWebServerRequest* request) | ||||
|     handleStaticContent(request, FPSTR(_common_js), 200, FPSTR(CONTENT_TYPE_JAVASCRIPT), JS_common, JS_common_length); | ||||
|     return; | ||||
|   } | ||||
|   char buf[SETTINGS_STACK_BUF_SIZE+37]; | ||||
|   buf[0] = 0; | ||||
|   byte subPage = request->arg(F("p")).toInt(); | ||||
|   if (subPage > 10) { | ||||
|     strcpy_P(buf, PSTR("alert('Settings for this request are not implemented.');")); | ||||
|     request->send(501, FPSTR(CONTENT_TYPE_JAVASCRIPT), buf); | ||||
|     request->send_P(501, FPSTR(CONTENT_TYPE_JAVASCRIPT), PSTR("alert('Settings for this request are not implemented.');")); | ||||
|     return; | ||||
|   } | ||||
|   if (subPage > 0 && !correctPIN && strlen(settingsPIN)>0) { | ||||
|     strcpy_P(buf, PSTR("alert('PIN incorrect.');")); | ||||
|     request->send(401, FPSTR(CONTENT_TYPE_JAVASCRIPT), buf); | ||||
|     request->send_P(401, FPSTR(CONTENT_TYPE_JAVASCRIPT), PSTR("alert('PIN incorrect.');")); | ||||
|     return; | ||||
|   } | ||||
|   strcat_P(buf,PSTR("function GetV(){var d=document;")); | ||||
|   getSettingsJS(subPage, buf+strlen(buf));  // this may overflow by 35bytes!!! | ||||
|   strcat_P(buf,PSTR("}")); | ||||
|    | ||||
|   AsyncWebServerResponse *response; | ||||
|   response = request->beginResponse(200, FPSTR(CONTENT_TYPE_JAVASCRIPT), buf); | ||||
|   AsyncResponseStream *response = request->beginResponseStream(FPSTR(CONTENT_TYPE_JAVASCRIPT)); | ||||
|   response->addHeader(F("Cache-Control"), F("no-store")); | ||||
|   response->addHeader(F("Expires"), F("0")); | ||||
|  | ||||
|   response->print(F("function GetV(){var d=document;")); | ||||
|   getSettingsJS(subPage, *response); | ||||
|   response->print(F("}")); | ||||
|   request->send(response); | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										725
									
								
								wled00/xml.cpp
									
									
									
									
									
								
							
							
						
						
									
										725
									
								
								wled00/xml.cpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user