diff --git a/.vscode/tasks.json b/.vscode/tasks.json index f46f002b40..881519c72b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,42 +1,57 @@ { - "version": "2.0.0", - "tasks": [ - { - "label": "Build: HTML and binary", - "dependsOn": [ - "Build: HTML only", - "Build: binary only" - ], - "dependsOrder": "sequence", - "problemMatcher": [ - "$platformio" - ] - }, - { - "type": "PlatformIO", - "label": "Build: binary only", - "task": "Build", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [ - "$platformio" - ], - "presentation": { - "panel": "shared" - } - }, - { - "type": "npm", - "script": "build", - "group": "build", - "problemMatcher": [], - "label": "Build: HTML only", - "detail": "npm run build", - "presentation": { - "panel": "shared" - } - } - ] + "version": "2.0.0", + "tasks": [ + { + "label": "Build: HTML and binary", + "dependsOn": [ + "Build: HTML only", + "Build: binary only" + ], + "dependsOrder": "sequence", + "problemMatcher": [ + "$platformio" + ] + }, + { + "type": "PlatformIO", + "label": "Build: binary only", + "task": "Build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [ + "$platformio" + ], + "presentation": { + "panel": "shared" + } + }, + { + "type": "npm", + "script": "build", + "group": "build", + "problemMatcher": [], + "label": "Build: HTML only", + "detail": "npm run build", + "presentation": { + "panel": "shared" + } + }, + { + "label": "Build: ESP32-S3 Custom", + "type": "shell", + "command": "pio", + "args": [ + "run", + "--environment", + "esp32-s3-devkitc-1-n16r8v" + ], + "isBackground": false, + "problemMatcher": [ + "$platformio" + ], + "group": "build" + } + ] } \ No newline at end of file diff --git a/AMD_WLED_S3_V1.0.code-workspace b/AMD_WLED_S3_V1.0.code-workspace new file mode 100644 index 0000000000..bab1b7f616 --- /dev/null +++ b/AMD_WLED_S3_V1.0.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": ".." + } + ], + "settings": {} +} \ No newline at end of file diff --git a/boards/esp32-s3-devkitc-1-n16r8v.json b/boards/esp32-s3-devkitc-1-n16r8v.json new file mode 100644 index 0000000000..a78be167a8 --- /dev/null +++ b/boards/esp32-s3-devkitc-1-n16r8v.json @@ -0,0 +1,51 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32s3_out.ld", + "partitions": "default_16MB.csv", + "memory_type": "qio_qspi" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ESP32S3_DEV", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_USB_CDC_ON_BOOT=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "esp32s3" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": [ + "esp-builtin" + ], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-S3-DevKitC-1-N16 (16 MB QD, No PSRAM)", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 921600 + }, + "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html", + "vendor": "Espressif" + } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 711514bb83..a98d4ab6fc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -26,7 +26,6 @@ default_envs = nodemcuv2 lolin_s2_mini esp32c3dev esp32c3dev_qio - esp32S3_wroom2 esp32s3dev_16MB_opi esp32s3dev_8MB_opi esp32s3_4M_qspi @@ -694,3 +693,18 @@ monitor_filters = esp32_exception_decoder board_build.flash_mode = dio custom_usermods = * ; Expands to all usermods in usermods folder board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat + +[env:esp32-s3-devkitc-1-n16r8v] +board = esp32-s3-devkitc-1-n16r8v +platform = ${esp32s3.platform} +platform_packages = ${esp32s3.platform_packages} +upload_speed = 921600 +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_16MB_opi_custom\" + -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 + -DBOARD_HAS_PSRAM +lib_deps = ${esp32s3.lib_deps} +board_build.partitions = ${esp32.extreme_partitions} +board_build.arduino.memory_type = qio_opi +board_build.flash_mode = qio +monitor_filters = esp32_exception_decoder diff --git a/tools/cdata.js b/tools/cdata.js index 759d24c2da..b16b160b0b 100644 --- a/tools/cdata.js +++ b/tools/cdata.js @@ -113,7 +113,7 @@ async function minify(str, type = "plain") { collapseBooleanAttributes: true, collapseInlineTagWhitespace: true, minifyCSS: true, - minifyJS: true, + minifyJS: false, removeAttributeQuotes: true, removeComments: true, sortAttributes: true, diff --git a/upload_log.txt b/upload_log.txt new file mode 100644 index 0000000000..870e1867e7 Binary files /dev/null and b/upload_log.txt differ diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 22f1987e93..5d848230b6 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -367,6 +367,6 @@ --> - + diff --git a/wled00/data/index.js b/wled00/data/index.js index 84b256183c..a00fc17ee2 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -43,16 +43,7 @@ var hol = [ [0, 0, 1, 1, "https://images.alphacoders.com/119/1198800.jpg"] // new year ]; -var cpick = new iro.ColorPicker("#picker", { - width: 260, - wheelLightness: false, - wheelAngle: 270, - wheelDirection: "clockwise", - layout: [{ - component: iro.ui.Wheel, - options: {} - }] -}); +var cpick; function handleVisibilityChange() {if (!d.hidden && new Date () - lastUpdate > 3000) requestJson();} function sCol(na, col) {d.documentElement.style.setProperty(na, col);} @@ -220,6 +211,22 @@ function getURL(path) { } function onLoad() { + try { + cpick = new iro.ColorPicker("#picker", { + width: 260, + wheelLightness: false, + wheelAngle: 270, + wheelDirection: "clockwise", + layout: [{ + component: iro.ui.Wheel, + options: {} + }] + }); + } catch (e) { + console.error("iro load error", e); + if (typeof showToast === "function") showToast("Color Picker Error: " + e, true); + } + let l = window.location; if (l.protocol == "file:") { loc = true; @@ -274,8 +281,10 @@ function onLoad() selectSlot(0); updateTablinks(0); handleLocationHash(); - cpick.on("input:end", () => {setColor(1);}); - cpick.on("color:change", () => {updatePSliders()}); + if (cpick) { + cpick.on("input:end", () => {setColor(1);}); + cpick.on("color:change", () => {updatePSliders()}); + } pmtLS = localStorage.getItem('wledPmt'); // Load initial data @@ -757,14 +766,20 @@ ${inforow("Environment",i.arch + " " + i.core + " (" + i.lwip + ")")} function populateSegments(s) { - var cn = ""; - let li = lastinfo; - segCount = 0; lowestUnused = 0; lSeg = 0; + try { + var cn = ""; + let li = lastinfo; + segCount = 0; lowestUnused = 0; lSeg = 0; - for (var inst of (s.seg||[])) { - segCount++; + let segs = s.seg; + if (!Array.isArray(segs)) segs = []; - let i = parseInt(inst.id); + for (var inst of segs) { + if (!inst) continue; + segCount++; + + let i = parseInt(inst.id); + if (isNaN(i)) continue; if (i == lowestUnused) lowestUnused = i+1; if (i > lSeg) lSeg = i; @@ -861,8 +876,8 @@ function populateSegments(s) `${isMSeg?'':'Offset'}`+ ``+ ``+ - ``+ - ``+ + ``+ + ``+ `${isMSeg?miXck+'
'+rvXck:''}`+ ``+ (isMSeg ? 'Start Y'+(cfg.comp.seglen?'Height':'Stop Y')+''+ @@ -904,6 +919,9 @@ function populateSegments(s) gId('segcont').innerHTML = cn; gId("segcont").classList.remove("hide"); + if (lowestUnused >= maxSeg) { + if (maxSeg == 0) maxSeg = 32; // fallback if maxSeg is 0 + } let noNewSegs = (lowestUnused >= maxSeg); resetUtil(noNewSegs); for (var i = 0; i <= lSeg; i++) { @@ -913,12 +931,12 @@ function populateSegments(s) gId(`segr${i}`).classList.add("hide"); } if (segCount < 2) { - gId(`segd${lSeg}`).classList.add("hide"); // hide delete if only one segment - if (parseInt(gId("seg0bri").value)==255) gId(`segp0`).classList.add("hide"); + if (gId(`segd${lSeg}`)) gId(`segd${lSeg}`).classList.add("hide"); // hide delete if only one segment + if (gId("seg0bri") && parseInt(gId("seg0bri").value)==255 && gId(`segp0`)) gId(`segp0`).classList.add("hide"); // hide segment controls if there is only one segment in simplified UI if (simplifiedUI) gId("segcont").classList.add("hide"); } - if (!isM && !noNewSegs && (cfg.comp.seglen?parseInt(gId(`seg${lSeg}s`).value):0)+parseInt(gId(`seg${lSeg}e`).value) 1) ? "block":"none"; // rsbtn parent if (Array.isArray(li.maps) && li.maps.length>1) { @@ -931,6 +949,10 @@ function populateSegments(s) gId("ledmap").classList.add('hide'); } tooltip("#Segments"); + } catch (e) { + console.error("Populate Segments Error", e); + showToast("Seg Error: " + e, true); + } } function populateEffects() @@ -1450,20 +1472,23 @@ function makeWS() { function readState(s,command=false) { - if (!s) return false; + try { + if (!s) return false; if (s.success) return true; // no data to process isOn = s.on; gId('sliderBri').value = s.bri; - nlA = s.nl.on; - nlDur = s.nl.dur; - nlTar = s.nl.tbri; - nlFade = s.nl.fade; - syncSend = s.udpn.send; + if (s.nl) { + nlA = s.nl.on; + nlDur = s.nl.dur; + nlTar = s.nl.tbri; + nlFade = s.nl.fade; + } + if (s.udpn) syncSend = s.udpn.send; if (s.pl<0) currentPreset = s.ps; else currentPreset = s.pl; - tr = s.transition; + tr = s.transition !== undefined ? s.transition : 7; gId('tt').value = tr/10; gId('bs').value = s.bs || 0; if (tr===0) gId('bsp').classList.add('hide') @@ -1473,7 +1498,10 @@ function readState(s,command=false) hasRGB = hasWhite = hasCCT = has2D = false; let i = {}; // determine light capabilities from selected segments - for (let seg of (s.seg||[])) { + let segs = s.seg; + if (!Array.isArray(segs)) segs = []; + for (let seg of segs) { + if (!seg) continue; let w = (seg.stop - seg.start); let h = seg.stopY ? (seg.stopY - seg.startY) : 1; let lc = seg.lc; @@ -1487,7 +1515,7 @@ function readState(s,command=false) } else if (isEmpty(i) && seg.id == s.mainseg) i = seg; // assign mainseg if no segments are selected } if (isEmpty(i)) { - showToast('No segments!', true); + showToast('No segments! Check LED Config.', true); updateUI(); return true; } else if (i.id == s.mainseg) { @@ -1560,6 +1588,10 @@ function readState(s,command=false) redrawPalPrev(); // if any color changed (random palette did at least) updateUI(); return true; + } catch (e) { + console.error("readState error:", e, s); + return false; + } } // control HTML elements for Slider and Color Control (original ported form WLED-SR) @@ -1872,7 +1904,7 @@ function makeSeg() if (isM) { ns = 0; } else { - if (xend < ledCount) ns = xend; + if (xend < ct) ns = xend; ct -= cfg.comp.seglen?ns:0; } } @@ -2274,8 +2306,8 @@ function setSeg(s) let eX = gId(`seg${s}e`); var start = parseInt(sX.value); var stop = parseInt(eX.value) + (cfg.comp.seglen?start:0); - if (startsX.max) {sX.value=sX.min; return;} // prevent out of bounds - if (stopeX.max) {eX.value=eX.max; return;} // prevent out of bounds + if (startsX.max) {sX.value=sX.min; return;} + if (stopeX.max) {eX.value=eX.max; return;} if ((cfg.comp.seglen && stop == 0) || (!cfg.comp.seglen && stop <= start)) {delSeg(s); return;} var obj = {"seg": {"id": s, "n": name, "start": start, "stop": stop}}; if (isM && start