diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 8b1d22d2d6..5274805baa 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,5 @@ github: [Aircoookie] custom: ['https://paypal.me/Aircoookie'] + +github: [blazoncek] +custom: ['https://paypal.me/blazoncek'] diff --git a/.gitignore b/.gitignore index 02e648b88b..bb02e36ef2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .pioenvs .piolibdeps .vscode -!.vscode/extensions.json /wled00/Release /wled00/extLibs /platformio_override.ini @@ -15,3 +14,7 @@ node_modules .idea .direnv +wled-update.sh +esp01-update.sh +/wled00/LittleFS +replace_fs.py \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 080e70d08b..0f0d7401df 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,10 +1,7 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ] +} diff --git a/package-lock.json b/package-lock.json index dce0faf421..ce4caa8e7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "wled", - "version": "0.13.2", + "version": "0.14.0-b0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b2ffbb3692..1e31f689c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wled", - "version": "0.13.2", + "version": "0.14.0-b0", "description": "Tools for WLED project", "main": "tools/cdata.js", "directories": { diff --git a/platformio.ini b/platformio.ini index dbbe06d88c..78b5d8e5ee 100644 --- a/platformio.ini +++ b/platformio.ini @@ -55,14 +55,14 @@ extra_configs = arduino_core_2_6_3 = espressif8266@2.3.3 arduino_core_2_7_4 = espressif8266@2.6.2 arduino_core_3_0_0 = espressif8266@3.0.0 -arduino_core_3_0_2 = espressif8266@3.2.0 +arduino_core_3_2_0 = espressif8266@3.2.0 # Development platforms arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/stage # Platform to use for ESP8266 -platform_wled_default = ${common.arduino_core_2_7_4} +platform_wled_default = ${common.arduino_core_3_2_0} # We use 2.7.4.7 for all, includes PWM flicker fix and Wstring optimization platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7 platformio/toolchain-xtensa @ ~2.40802.200502 @@ -162,11 +162,12 @@ lib_compat_mode = strict lib_deps = fastled/FastLED @ 3.5.0 IRremoteESP8266 @ 2.8.2 - https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.4 + https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.5 #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line #TFT_eSPI #For use SSD1306 OLED display uncomment following - #U8g2@~2.27.2 + #U8g2@~2.28.8 + #U8g2@~2.32.10 #For Dallas sensor uncomment following 2 lines #OneWire@~2.3.5 #milesburton/DallasTemperature@^3.9.0 @@ -183,8 +184,8 @@ build_flags = -DESP8266 -DFP_IN_IROM ;-Wno-deprecated-declarations - -Wno-register - -Wno-misleading-indentation + ;-Wno-register + ;-Wno-misleading-indentation ; NONOSDK22x_190703 = 2.2.2-dev(38a443e) -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 ; lwIP 2 - Higher Bandwidth no Features diff --git a/tools/WLED_ESP32-wrover_4MB.csv b/tools/WLED_ESP32-wrover_4MB.csv new file mode 100644 index 0000000000..a179a89d0e --- /dev/null +++ b/tools/WLED_ESP32-wrover_4MB.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x180000, +app1, app, ota_1, 0x190000,0x180000, +spiffs, data, spiffs, 0x310000,0xF0000, diff --git a/tools/cdata.js b/tools/cdata.js index 15455a4284..d01c3e35f7 100644 --- a/tools/cdata.js +++ b/tools/cdata.js @@ -16,20 +16,31 @@ */ const fs = require("fs"); +const inliner = require("inliner"); +const zlib = require("zlib"); +const CleanCSS = require("clean-css"); +const MinifyHTML = require("html-minifier-terser").minify; const packageJson = require("../package.json"); /** * */ -function hexdump(buffer) { +function hexdump(buffer,isHex=false) { let lines = []; - for (let i = 0; i < buffer.length; i += 16) { - let block = buffer.slice(i, i + 16); // cut buffer into blocks of 16 + for (let i = 0; i < buffer.length; i +=(isHex?32:16)) { + var block; let hexArray = []; - - for (let value of block) { - hexArray.push("0x" + value.toString(16).padStart(2, "0")); + if (isHex) { + block = buffer.slice(i, i + 32) + for (let j = 0; j < block.length; j +=2 ) { + hexArray.push("0x" + block.slice(j,j+2)) + } + } else { + block = buffer.slice(i, i + 16); // cut buffer into blocks of 16 + for (let value of block) { + hexArray.push("0x" + value.toString(16).padStart(2, "0")); + } } let hexString = hexArray.join(", "); @@ -40,9 +51,6 @@ function hexdump(buffer) { return lines.join(",\n"); } -const inliner = require("inliner"); -const zlib = require("zlib"); - function strReplace(str, search, replacement) { return str.split(search).join(replacement); } @@ -56,16 +64,52 @@ function adoptVersionAndRepo(html) { html = strReplace(html, "https://github.com/atuline/WLED", repoUrl); html = strReplace(html, "https://github.com/Aircoookie/WLED", repoUrl); } - let version = packageJson.version; if (version) { html = strReplace(html, "##VERSION##", version); } - return html; } -function writeHtmlGzipped(sourceFile, resultFile) { +function filter(str, type) { + str = adoptVersionAndRepo(str); + if (type === undefined) { + return str; + } else if (type == "css-minify") { + return new CleanCSS({}).minify(str).styles; + } else if (type == "js-minify") { + return MinifyHTML('', { + collapseWhitespace: true, + minifyJS: true, + continueOnParseError: false, + removeComments: true, + }).replace(/<[\/]*script>/g,''); + } else if (type == "html-minify") { + return MinifyHTML(str, { + collapseWhitespace: true, + maxLineLength: 80, + minifyCSS: true, + minifyJS: true, + continueOnParseError: false, + removeComments: true, + }); + } else if (type == "html-minify-ui") { + return MinifyHTML(str, { + collapseWhitespace: true, + conservativeCollapse: true, + maxLineLength: 80, + minifyCSS: true, + minifyJS: true, + continueOnParseError: false, + removeComments: true, + }); + } else { + console.warn("Unknown filter: " + type); + return str; + } +} + +function writeHtmlGzipped(sourceFile, resultFile, page) { console.info("Reading " + sourceFile); new inliner(sourceFile, function (error, html) { console.info("Inlined " + html.length + " characters"); @@ -95,8 +139,8 @@ function writeHtmlGzipped(sourceFile, resultFile) { */ // Autogenerated from ${sourceFile}, do not edit!! -const uint16_t PAGE_index_L = ${result.length}; -const uint8_t PAGE_index[] PROGMEM = { +const uint16_t PAGE_${page}_L = ${result.length}; +const uint8_t PAGE_${page}[] PROGMEM = { ${array} }; `; @@ -106,41 +150,6 @@ ${array} }); } -const CleanCSS = require("clean-css"); -const MinifyHTML = require("html-minifier-terser").minify; - -function filter(str, type) { - str = adoptVersionAndRepo(str); - - if (type === undefined) { - return str; - } else if (type == "css-minify") { - return new CleanCSS({}).minify(str).styles; - } else if (type == "html-minify") { - return MinifyHTML(str, { - collapseWhitespace: true, - maxLineLength: 80, - minifyCSS: true, - minifyJS: true, - continueOnParseError: false, - removeComments: true, - }); - } else if (type == "html-minify-ui") { - return MinifyHTML(str, { - collapseWhitespace: true, - conservativeCollapse: true, - maxLineLength: 80, - minifyCSS: true, - minifyJS: true, - continueOnParseError: false, - removeComments: true, - }); - } else { - console.warn("Unknown filter: " + type); - return str; - } -} - function specToChunk(srcDir, s) { if (s.method == "plaintext") { const buf = fs.readFileSync(srcDir + "/" + s.file); @@ -153,6 +162,21 @@ const char ${s.name}[] PROGMEM = R"${s.prepend || ""}${filter(str, s.filter)}${ `; return s.mangle ? s.mangle(chunk) : chunk; + } else if (s.method == "gzip") { + const buf = fs.readFileSync(srcDir + "/" + s.file); + var str = buf.toString('utf-8'); + if (s.mangle) str = s.mangle(str); + const zip = zlib.gzipSync(filter(str, s.filter), { level: zlib.constants.Z_BEST_COMPRESSION }); + const result = hexdump(zip.toString('hex'), true); + const chunk = ` +// Autogenerated from ${srcDir}/${s.file}, do not edit!! +const uint16_t ${s.name}_length = ${zip.length}; +const uint8_t ${s.name}[] PROGMEM = { +${result} +}; + +`; + return chunk; } else if (s.method == "binary") { const buf = fs.readFileSync(srcDir + "/" + s.file); const result = hexdump(buf); @@ -164,7 +188,7 @@ ${result} }; `; - return s.mangle ? s.mangle(chunk) : chunk; + return chunk; } else { console.warn("Unknown method: " + s.method); return undefined; @@ -194,160 +218,111 @@ function writeChunks(srcDir, specs, resultFile) { fs.writeFileSync(resultFile, src); } -writeHtmlGzipped("wled00/data/index.htm", "wled00/html_ui.h"); - +writeHtmlGzipped("wled00/data/index.htm", "wled00/html_ui.h", 'index'); +writeHtmlGzipped("wled00/data/simple.htm", "wled00/html_simple.h", 'simple'); +/* +writeChunks( + "wled00/data", + [ + { + file: "simple.css", + name: "PAGE_simpleCss", + method: "gzip", + filter: "css-minify", + }, + { + file: "simple.js", + name: "PAGE_simpleJs", + method: "gzip", + filter: "js-minify", + }, + { + file: "simple.htm", + name: "PAGE_simple", + method: "gzip", + filter: "html-minify-ui", + } + ], + "wled00/html_simplex.h" +); +*/ writeChunks( "wled00/data", [ { file: "style.css", name: "PAGE_settingsCss", - prepend: "=====()=====", - method: "plaintext", + method: "gzip", filter: "css-minify", + mangle: (str) => + str + .replace("%%","%") }, { file: "settings.htm", name: "PAGE_settings", - prepend: "=====(", - append: ")=====", - method: "plaintext", + method: "gzip", filter: "html-minify", - mangle: (str) => - str - .replace("%", "%%") - .replace(/Usermods\<\/button\>\<\/form\>/gms, "Usermods\<\/button\>\<\/form\>%DMXMENU%"), }, { file: "settings_wifi.htm", name: "PAGE_settings_wifi", - prepend: "=====(", - append: ")=====", - method: "plaintext", + method: "gzip", filter: "html-minify", - mangle: (str) => - str - .replace(/\/gms, "") - .replace(/\
- +