feat: add device family to separate s3 and s4 events.

This commit is contained in:
2026-05-20 06:15:50 +00:00
parent 3265ad6fa3
commit e95ac692ee
6 changed files with 76 additions and 14 deletions
+14 -11
View File
@@ -2392,11 +2392,9 @@ async function loadHistory() {
<td class="td-dim">${(() => {
const m = ev.mic_ppv == null ? null : Number(ev.mic_ppv);
if (m == null || !isFinite(m) || m <= 0) return '—';
// BW (.AB0*/.N00) stores mic_ppv as psi → convert to dBL.
// Thor IDF (.IDFH/.IDFW) already stores dBL → display directly.
const fn = (ev.blastware_filename || '').toUpperCase();
const isThor = fn.endsWith('.IDFH') || fn.endsWith('.IDFW');
if (isThor) return m.toFixed(1) + ' dBL';
// Series III (MiniMate Plus / BW) stores mic_ppv as psi → convert.
// Series IV (Micromate / Thor) already stores dB(L) → display direct.
if (ev.device_family === 'series4') return m.toFixed(1) + ' dBL';
return (20 * Math.log10(m / DBL_REF)).toFixed(1) + ' dBL';
})()}</td>
<td class="td-text">${ev.project ?? '—'}</td>
@@ -2464,13 +2462,18 @@ function _renderSidecar(data) {
const n = Number(v);
return isFinite(n) ? n.toFixed(5) + ' in/s' : String(v);
};
// Map sidecar source.kind → device family (Series IV ingest path is
// "idf-import"; everything else is Series III today). The events-list
// table uses ev.device_family from the DB row, but sidecars don't carry
// that column — source.kind is the equivalent signal here.
const family = ((src.kind || '') === 'idf-import') ? 'series4' : 'series3';
const fmtMic = v => {
if (v == null) return '—';
const n = Number(v);
if (!isFinite(n) || n <= 0) return '—';
// Source-aware: Thor IDF imports store mic as dB(L); BW imports store
// it as psi. `src` is in the outer scope from _renderSidecar().
if ((src.kind || '') === 'idf-import') return `${n.toFixed(1)} dBL`;
// Series IV (Micromate / Thor) stores mic as dB(L); Series III (BW)
// stores it as psi and we render both for cross-reference.
if (family === 'series4') return `${n.toFixed(1)} dBL`;
const dbl = 20 * Math.log10(n / DBL_REF);
return `${dbl.toFixed(1)} dBL (${n.toExponential(2)} psi)`;
};
@@ -2767,9 +2770,9 @@ document.getElementById('api-base').value = window.location.origin;
<div class="sc-section">
<h4>Source / files</h4>
<dl class="sc-grid">
<dt>BW filename</dt> <dd id="sc-f-bw"></dd>
<dt>BW filesize</dt> <dd id="sc-f-bwsize"></dd>
<dt>BW sha256</dt> <dd id="sc-f-sha"></dd>
<dt id="sc-l-bw">Event file</dt> <dd id="sc-f-bw"></dd>
<dt id="sc-l-bwsize">File size</dt> <dd id="sc-f-bwsize"></dd>
<dt id="sc-l-sha">File sha256</dt> <dd id="sc-f-sha"></dd>
<dt>Source kind</dt> <dd id="sc-f-src"></dd>
<dt>Captured at</dt> <dd id="sc-f-cap"></dd>
</dl>