feat(ui-lvgl): screenshots (side + top button), lock screen always times out

- Side button held + top button saves the screen, popups and toasts included,
  to /sdcard/screenshots/scr_NNNN.bmp (24-bit BMP). The flush callbacks copy
  one forced full re-render into a PSRAM buffer. A white flash and a toast
  confirm it. The side button's mute now fires on release, so holding it a
  little long before the top button doesn't also mute. In the sim, the page's
  Screenshot button downloads the file.
- The lock screen goes dark after 30 s even with auto-off at Never (a boot
  PIN, a pocket wake-up, a message), and sooner if auto-off is shorter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-28 16:03:48 +02:00
co-authored by Claude Opus 5.5
parent cf9ffc29b0
commit 2765ac6d8b
4 changed files with 125 additions and 3 deletions
+18
View File
@@ -67,6 +67,7 @@
<div class="row">
<button id="btn-L">User (back; hold: mute)</button>
<button id="wake-L">Wake (screen off / on)</button>
<button id="shot-L">Screenshot (User held + Wake)</button>
<button id="reset-L">Reset L2</button>
</div>
</div>
@@ -283,6 +284,23 @@
btnDownAt = 0;
});
document.getElementById('wake-L').addEventListener('click', () => L && L.call('sim_wake_button', null));
// The device's own screenshot (the button combo), then the newest file
// from its /sdcard/screenshots handed to the browser as a download.
document.getElementById('shot-L').addEventListener('click', async () => {
if (!L) return;
L.call('sim_screenshot', null);
await sleep(300);
const FS = L.mod.FS, dir = '/sdcard/screenshots';
let names = [];
try { names = FS.readdir(dir).filter(n => n.endsWith('.bmp')).sort(); } catch (e) {}
if (!names.length) { log('screenshot: nothing saved'); return; }
const name = names[names.length - 1];
const a = document.createElement('a');
a.href = URL.createObjectURL(new Blob([FS.readFile(dir + '/' + name)], { type: 'image/bmp' }));
a.download = name;
a.click();
log('screenshot: ' + name);
});
document.getElementById('reset-L').addEventListener('click', () => bootL());
document.getElementById('advert').addEventListener('click', advertBoth);
document.getElementById('peer-dm').addEventListener('click', () => {