fix: add STRT invalid detction, ach server passes config for get events,
This commit is contained in:
@@ -483,9 +483,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Build time axis (ms)
|
||||
const times = Array.from({ length: decoded }, (_, i) =>
|
||||
((i - pretrig) / sr * 1000).toFixed(2)
|
||||
// Clip to total_samples to exclude zero-padding the device appends beyond
|
||||
// the configured record window. total = pretrig + post_trig (e.g. 256+3072=3328).
|
||||
// decoded may be larger (e.g. 4495) due to trailing zero-padded bulk-stream frames.
|
||||
const displayCount = (total > 0 && total < decoded) ? total : decoded;
|
||||
|
||||
// Build time axis in seconds (matching Blastware event report layout).
|
||||
const times = Array.from({ length: displayCount }, (_, i) =>
|
||||
((i - pretrig) / sr).toFixed(3)
|
||||
);
|
||||
|
||||
// Show charts area
|
||||
@@ -517,11 +522,16 @@
|
||||
const isGeo = ch !== 'Mic';
|
||||
let plotSamples, peakLabel, yUnit, tooltipFmt, tickFmt;
|
||||
|
||||
// Clip channel samples to displayCount (same as time axis)
|
||||
const clippedSamples = samples.length > displayCount
|
||||
? samples.slice(0, displayCount)
|
||||
: samples;
|
||||
|
||||
if (isGeo) {
|
||||
// Geo channels: counts × (range / 32767) → in/s
|
||||
// Scale factor for the waveform shape (may need calibration per unit)
|
||||
const scale = geoRange / 32767;
|
||||
plotSamples = samples.map(c => c * scale);
|
||||
plotSamples = clippedSamples.map(c => c * scale);
|
||||
|
||||
// Use the device-computed 0C record peak for the label (authoritative).
|
||||
// The raw-sample-computed peak can be inflated by frame-boundary artifacts.
|
||||
@@ -535,11 +545,11 @@
|
||||
tickFmt = v => v.toFixed(4);
|
||||
} else {
|
||||
// Mic: derive psi/count scale from the 0C peak value, display as psi; show dBL in header
|
||||
const peakCounts = Math.max(...samples.map(Math.abs));
|
||||
const peakCounts = Math.max(...clippedSamples.map(Math.abs));
|
||||
const micScale = (micPeakPsi !== null && peakCounts > 0)
|
||||
? Math.abs(micPeakPsi) / peakCounts
|
||||
: 1.0;
|
||||
plotSamples = samples.map(c => c * micScale);
|
||||
plotSamples = clippedSamples.map(c => c * micScale);
|
||||
const peakPsi = Math.max(...plotSamples.map(Math.abs));
|
||||
const peakDbl = peakPsi > 0 ? 20 * Math.log10(peakPsi / DBL_REF_PSI) : -Infinity;
|
||||
peakLabel = `${peakDbl.toFixed(1)} dBL (${peakPsi.toExponential(3)} psi)`;
|
||||
@@ -597,7 +607,7 @@
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
callbacks: {
|
||||
title: items => `t = ${items[0].label} ms`,
|
||||
title: items => `t = ${items[0].label} s`,
|
||||
label: item => tooltipFmt(item.raw),
|
||||
},
|
||||
},
|
||||
@@ -609,7 +619,7 @@
|
||||
color: '#484f58',
|
||||
maxTicksLimit: 10,
|
||||
maxRotation: 0,
|
||||
callback: (val, i) => renderTimes[i] + ' ms',
|
||||
callback: (val, i) => renderTimes[i] + ' s',
|
||||
},
|
||||
grid: { color: '#21262d' },
|
||||
},
|
||||
@@ -647,7 +657,7 @@
|
||||
const xAxis = chart.scales.x;
|
||||
const yAxis = chart.scales.y;
|
||||
|
||||
// Find index of t=0
|
||||
// Find index of the trigger point (t ≥ 0.000 s)
|
||||
const zeroIdx = renderTimes.findIndex(t => parseFloat(t) >= 0);
|
||||
if (zeroIdx < 0) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user