fix: timing flash + couleur idle LED + diagnostic auto-brightness
This commit is contained in:
@@ -394,6 +394,16 @@ select.field {
|
||||
<p id="auto-brightness-status" style="font-size:.78rem; color:var(--text-muted); margin-top:.5rem;">
|
||||
⏳ 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">
|
||||
📷 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 →
|
||||
<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}`);
|
||||
|
||||
Reference in New Issue
Block a user