diff --git a/dashboard/js/onboard.js b/dashboard/js/onboard.js index d83c2cb..dbc3fee 100644 --- a/dashboard/js/onboard.js +++ b/dashboard/js/onboard.js @@ -362,17 +362,60 @@ return html; } + var BOOTLOADER_SVG = + ''; + + function renderBootloaderHelp(retryCount) { + var escalated = retryCount >= 2; + return '
' + (escalated ? '⚠ Still not working?' : 'Device not in download mode') + '
' + + (escalated + ? 'Try a different USB cable (data cables only, not charge-only). If using a USB hub, connect directly to your computer.
' + : 'Hold BOOT, press & release RST, then release BOOT.
') + + BOOTLOADER_SVG + + 'The wizard will now flash the Spaxel firmware onto your ESP32-S3. This takes about 45-90 seconds.
' + + 'The wizard will flash the Spaxel firmware onto your ESP32-S3. This takes about 45–90 seconds.
' + + 'Before clicking Start Flashing, put the board in download mode:
' + + '✓ Firmware flashed successfully!
'; - saveState(); - setTimeout(function () { goToStep(state.currentStepIndex + 1); }, 1500); - }); + installBtn.addEventListener('flash-success', function () { + document.getElementById('flash-progress').style.display = 'none'; + container.innerHTML = '✓ Firmware flashed successfully!
'; + container.style.display = 'block'; + saveState(); + setTimeout(function () { goToStep(state.currentStepIndex + 1); }, 1500); + }); - installBtn.addEventListener('flash-error', function () { - document.getElementById('flash-progress').style.display = 'none'; - var errEl = document.getElementById('flash-error'); - errEl.style.display = 'block'; - errEl.textContent = - 'The connection was interrupted. Check the USB cable is not loose and try again.'; - document.getElementById('flash-container').style.display = 'block'; - }); + installBtn.addEventListener('flash-error', function () { + flashRetryCount++; + document.getElementById('flash-progress').style.display = 'none'; + container.style.display = 'block'; + var recovery = document.getElementById('flash-recovery'); + recovery.style.display = 'block'; + recovery.innerHTML = renderBootloaderHelp(flashRetryCount); + // Rebuild the button so it can be clicked again + mountInstallButton(); + }); + } + mountInstallButton(); return { cleanup: function () { } }; }