fix: timing flash + couleur idle LED + diagnostic auto-brightness
🚀 Deploy — JH Photomaton / 🔍 Vérification (push) Has been cancelled
🚀 Deploy — JH Photomaton / 🍓 Deploy sur le Pi (push) Has been cancelled

This commit is contained in:
2026-07-20 19:06:16 +02:00
parent f192ffc92f
commit 19557b20fb
10 changed files with 247 additions and 37 deletions
+41
View File
@@ -394,6 +394,16 @@ select.field {
<p id="auto-brightness-status" style="font-size:.78rem; color:var(--text-muted); margin-top:.5rem;">
&#x23F3; Chargement…
</p>
<div style="display:flex; gap:.5rem; align-items:center; margin-top:.5rem; flex-wrap:wrap;">
<button class="btn btn-ghost btn-sm" onclick="measureAmbient()" id="btn-measure-lux">
&#x1F4F7; Tester la mesure
</button>
<span id="lux-status" style="font-size:.8rem; color:var(--text-muted);"></span>
</div>
<div id="lux-info" style="font-size:.78rem; margin-top:.4rem; color:var(--text-muted); display:none;">
Luminosité mesurée : <strong id="lux-val"></strong> / 255 &nbsp;&nbsp;
<span id="lux-desc"></span>
</div>
</div>
</div>
</div>
@@ -875,6 +885,37 @@ async function loadFlashConfig() {
} catch(e) { console.warn('loadFlashConfig:', e); }
}
async function measureAmbient() {
const btn = document.getElementById('btn-measure-lux');
const status = document.getElementById('lux-status');
const info = document.getElementById('lux-info');
btn.disabled = true;
status.textContent = '⏳ Mesure en cours…';
status.style.color = 'var(--text-muted)';
try {
const r = await api('POST', '/api/leds/measure-ambient');
if (r.ok) {
document.getElementById('lux-val').textContent = r.ambient_lux;
document.getElementById('lux-desc').textContent = r.description;
info.style.display = '';
status.textContent = '✅ Mesure réussie';
status.style.color = '#4caf50';
showToast(`✅ Luminosité : ${r.ambient_lux}${r.description}`, 'success');
} else {
status.textContent = '❌ ' + (r.error || 'Erreur inconnue');
status.style.color = '#e05050';
showToast('❌ Mesure impossible : ' + r.error, 'error');
}
} catch(e) {
status.textContent = '❌ Liveview inaccessible';
status.style.color = '#e05050';
showToast('❌ Liveview inaccessible (endpoint 404). Vérifiez que photobooth-app est démarré.', 'error');
} finally {
btn.disabled = false;
setTimeout(() => { status.textContent = ''; }, 6000);
}
}
async function setAutoBrightness(enabled) {
try {
await api('PUT', `/api/leds/auto-brightness?enabled=${enabled}`);