Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- group: ClassicESP
boards: "esp32 esp32s2 esp32-eth01 esp8266"
cache_extra: ""
- group: CustomBoards
boards: "esp32-GLEDOPTO_GL_C_616WL esp32-GLEDOPTO_GL_C_615WL esp32-DOMRAEM_WLE_ADM esp32-IOTORERO_ETHERNET"
cache_extra: ""
- group: Pico
boards: "pico pico2"
cache_extra: ""
Expand Down
53 changes: 27 additions & 26 deletions 3RD_PARTY_LICENSES
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
==============================================
HyperSerialPico
==============================================

MIT License

Copyright (c) 2023-2026 awawa-dev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

==============================================
HyperSerialEsp8266
==============================================

MIT License

Copyright (c) 2020-2025 awawa-dev
Copyright (c) 2020-2026 awawa-dev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -379,31 +405,6 @@ apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

==============================================
fastled/FastLED
==============================================

The MIT License (MIT)

Copyright (c) 2013 FastLED

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

==============================================
picocss/pico
==============================================
Expand Down
31 changes: 31 additions & 0 deletions data/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,34 @@ details summary[role="button"]:focus {
color: #111111;
font-weight: bold;
}

.segmentElement {
border: 1px solid #405000;
padding: 1rem;
margin-bottom: 1rem;
border-radius: var(--pico-border-radius);
}

.delSegmentBtn {
width: auto;
padding: 0.25rem 1rem;
margin-bottom: 0;
background-color: #EAB308 !important;
border-color: #EAB308 !important;
color: #111111 !important;
}

.addSegmentBtn {
display: none;
margin-top: 1rem;
background-color: #2e7d32 !important;
border-color: #2e7d32 !important;
color: #fff !important;
}

.powerRelay {
border: 1px solid #000090;
padding: 1rem;
margin-bottom: 1rem;
border-radius: var(--pico-border-radius);
}
139 changes: 119 additions & 20 deletions data/gpio.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,29 @@ function setupPinValidator() {
"ESP32-S3": { gpio: [1,2,4,5,6,7,8,10,16,17,18,48], spi: {5:4} }, // GPIO48 = built-in WS2812B
"ESP32-C3": { gpio: [0,1,2,3,4,5,6,7,8,10,20,21], spi: {7:6} }, // GPIO08 = built-in WS2812B
"ESP8266": { gpio: [2], spi: {13:14} },
"ESP32": { gpio: null, spi: {23:18} },
"ESP32-S2": { gpio: null, spi: {35:36} },
"ESP32": { gpio: [2,4,5,12,13,14,15,16,17,18,19,21,23,25,26,27,32,33], spi: {23:18} },
"ESP32-S2": { gpio: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,21,33,34,35,36,37,38,39,40,41,42,45], spi: {35:36} },
"ESP32-ETH01": { gpio: [2,4], spi: {2:4} },
"ESP32-C2": { gpio: [0,1,2,3,4,5,6,7,10], spi: {7:6} },
"ESP32-C5": { gpio: [0,1,2,3,4,5,6,7,8,10,11,27], spi: {7:6} }, // GPIO27 = built-in WS2812B
"RP2040": { gpio: null, spi: {19:18} },
"RP2350": { gpio: null, spi: {19:18} }
"RP2350": { gpio: null, spi: {19:18} },
"esp32-GLEDOPTO_GL_C_616WL": { gpio: [16, 2, 12, 14], spi: {16:2} },
"esp32-GLEDOPTO_GL_C_615WL": { gpio: [16, 2], spi: {16:2} },
"esp32-DOMRAEM_WLE_ADM": { gpio: [ 16, 2, 17, 18], spi: {16:2} },
"esp32-IOTORERO_ETHERNET": { gpio: [ 5, 16, 4, 12], spi: {5:16} }
};

const arch = (typeof cfgDeviceArchitecture !== 'undefined') ? cfgDeviceArchitecture : "";
const els = { type: document.getElementById('ledType'), clkLabel: document.getElementById('clockPinLabel') };
const els = { type: document.getElementById('ledType'), addSegBtn: document.getElementById('addSegmentBtn'), segContainer: document.getElementById('segmentContainer') };

if (!els.type || !els.clkLabel) {
console.warn("LED Validator: Missing required DOM elements (ledType/clockPinLabel)");
if (!els.type || !els.addSegBtn || !els.segContainer) {
console.warn("LED Validator: Missing required DOM elements (ledType/addSegBtn/segContainer)");
return;
}

els.clkLabel.setAttribute('aria-live', 'polite');

const setField = (name, opts) => {
const old = document.getElementsByName(name)[0];
const setField = (wrapper, name, opts) => {
const old = wrapper.querySelector(`select[name="${name}"]`);
if (!old) return null;

const isSel = (opts != null);
Expand All @@ -49,26 +51,123 @@ function setupPinValidator() {
}

old.replaceWith(el);
el.addEventListener('change', updateUI);

if (wasFocused) el.focus();
return el;
};

function updateUI() {
function setupSegments() {
const isSpi = els.type.value == "2";
const cfg = hardwareLimits[arch];
const basePins = cfg ? (isSpi ? Object.keys(cfg.spi).map(Number) : cfg.gpio) : null;
const allUsedPins = cfgSegments.map(s => parseInt(s.data, 10));

let validPins = cfg ? (isSpi ? Object.keys(cfg.spi).map(Number) : cfg.gpio) : null;
const dataPinEditor = setField('dataPin', validPins);
els.segContainer.innerHTML = '';

const autoClk = (cfg && cfg.spi) ? (cfg.spi[dataPinEditor.value] ?? null) : null;
const clockPinEditor = setField('clockPin', ((autoClk !== null) ? [autoClk] : null));
cfgSegments.some((segment, i) => {
const wrapper = document.createElement('div');
wrapper.id = `segment_${i}`;
wrapper.className = 'segmentElement';

wrapper.innerHTML = `
<div class="grid">
<label>Data Pin (GPIO)
<select name="dataPin${i}" required>
<option value="${segment.data}">GPIO ${segment.data}</option>
</select>
</label>

${isSpi ? `
<label aria-live="polite">Clock Pin (GPIO)
<select name="clockPin${i}">
<option value="${segment.clock}">GPIO ${segment.clock}</option>
</select>
</label>
` : ''}

${(cfgSegmentSupported && !isSpi && (i > 0)) ? `
<label class="segment-start-label" aria-live="polite">Segment Start
<input type="number" name="startIndex${i}" required min="0" value="${segment.startIndex}">
</label>
` : ''}
</div>

${(i > 0) ? `
<div style="text-align: right; margin-top: 0.5rem;">
<button type="button" class="delSegmentBtn outline" data-index="${i}">
- Remove segment
</button>
</div>
` : ''}
`;

els.segContainer.appendChild(wrapper);

const availablePins = (i > 0 && (arch == "RP2040" || arch == "RP2350")) ? [ Math.min((parseInt(cfgSegments[0].data, 10) + i), 22) || i ] :
(basePins ? basePins.filter(p => !allUsedPins.includes(p) || p === parseInt(segment.data, 10)) : null);
const dataPinEditor = setField(wrapper, `dataPin${i}`, availablePins);
cfgSegments[i].data = dataPinEditor?.value || cfgSegments[i].data;
dataPinEditor.onchange = () => {
cfgSegments[i].data = parseInt(dataPinEditor.value, 10);
setupSegments();
};

els.clkLabel.style.display = isSpi ? 'block' : 'none';
clockPinEditor.disabled = !isSpi;
if (cfgSegmentSupported && !isSpi) {
const startIndex = wrapper.querySelector(`input[name="startIndex${i}"]`);
if (startIndex) {
startIndex.oninput = (e) => cfgSegments[i].startIndex = parseInt(e.target.value, 10) || 0;
}
}

if (isSpi) {
const autoClk = (cfg && cfg.spi && dataPinEditor.value != null) ? (cfg.spi[dataPinEditor.value] ?? null) : null;
const clockPinEditor = setField(wrapper, `clockPin${i}`, ((autoClk !== null) ? [autoClk] : null));
cfgSegments[i].clock = clockPinEditor?.value || cfgSegments[i].clock;
clockPinEditor.onchange = () => cfgSegments[i].clock = parseInt(clockPinEditor.value, 10);
}

return !cfgSegmentSupported || isSpi;
});

if (cfgSegmentSupported) {
const delButtons = els.segContainer.querySelectorAll('.delSegmentBtn');
delButtons.forEach(btn => {
btn.onclick = () => {
const idx = parseInt(btn.getAttribute('data-index'), 10);
cfgSegments.splice(idx, 1);
setupSegments();
};
});
}

if (cfgSegmentSupported && !isSpi) {
els.addSegBtn.style.display = 'block';
els.addSegBtn.onclick = () => {
if (cfgSegments.length >= cfgSegmentSupported) return;

const currentUsed = cfgSegments.map(s => parseInt(s.data, 10));
const freePin = basePins ? basePins.find(p => !currentUsed.includes(p)) : 0;

const numLeds = parseInt(document.querySelector('input[name="numLeds"]')?.value, 10) || -1;
let nextStart = 0;
if (cfgSegments.length > 0 && numLeds > 0) {
nextStart = Math.floor((cfgSegments.at(-1).startIndex + numLeds) / 2);
}

cfgSegments.push({
data: (freePin !== undefined) ? freePin : 0,
clock: 0,
startIndex: nextStart
});
setupSegments();
};
}
else {
els.addSegBtn.style.display = 'none';
els.addSegBtn.onclick = null;
}
}

els.type.onchange = updateUI;
updateUI();
els.type.onchange = setupSegments;
setupSegments();
};
Loading