feat: slider pre-flash advance (0-3s) dans settings UI
🚀 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-21 00:02:12 +02:00
parent 1419600969
commit 35233c0a43
2 changed files with 62 additions and 0 deletions
+32
View File
@@ -466,6 +466,19 @@ select.field {
<button class="btn btn-ghost btn-sm" onclick="setFlashPreset(255,220,120,0.25,2)">Blanc neutre</button>
<button class="btn btn-ghost btn-sm" onclick="setFlashPreset(255,180,40,0.35,2)">Ambre</button>
</div>
<div style="margin-top:1rem; padding-top:.75rem; border-top:1px solid var(--border);">
<label style="font-size:.82rem; color:var(--text-muted)">⏱ Déclencher le flash
<strong id="pre-flash-val">0.5</strong> s avant la fin du countdown</label>
<input type="range" id="pre-flash-advance" min="0" max="3" step="0.1" value="0.5"
oninput="document.getElementById('pre-flash-val').textContent=parseFloat(this.value).toFixed(1)"
style="width:100%; margin-top:.4rem">
<div style="display:flex; justify-content:space-between; font-size:.72rem; color:var(--text-muted)">
<span>0 s (au moment de la capture)</span><span>3 s (très en avance)</span>
</div>
<button class="btn btn-primary btn-sm" style="margin-top:.5rem" onclick="savePreFlash()">&#x1F4BE; Sauvegarder</button>
<span id="pre-flash-status" style="font-size:.82rem; color:var(--text-muted); margin-left:.5rem"></span>
</div>
</div>
</div>
@@ -883,6 +896,25 @@ async function loadFlashConfig() {
document.getElementById('flash-count').value = cap.flashes;
}
} catch(e) { console.warn('loadFlashConfig:', e); }
// Charger le timing pre-flash
try {
const t = await api('GET', '/api/leds/flash-timing');
const v = t.pre_flash_advance ?? 0.5;
document.getElementById('pre-flash-advance').value = v;
document.getElementById('pre-flash-val').textContent = v.toFixed(1);
} catch(e) { console.warn('loadFlashTiming:', e); }
}
async function savePreFlash() {
const v = parseFloat(document.getElementById('pre-flash-advance').value);
const status = document.getElementById('pre-flash-status');
try {
await api('PUT', `/api/leds/flash-timing?pre_flash_advance=${v}`);
status.textContent = `✅ Sauvegardé (${v.toFixed(1)} s)`;
setTimeout(() => status.textContent = '', 3000);
} catch(e) {
status.textContent = '❌ Erreur';
}
}
async function measureAmbient() {