fix: default to flatline when no live waveform data is received (enable with demo=true)
This commit is contained in:
@@ -255,6 +255,7 @@ const params = new URLSearchParams(location.search);
|
||||
const MRN = params.get('mrn') || '';
|
||||
const isMinimal = params.get('minimal') === 'true' || params.get('view') === 'minimal';
|
||||
const DEVICE_PARAM = params.get('device') || '';
|
||||
const isDemo = params.get('demo') === 'true' || params.get('synth') === 'true';
|
||||
|
||||
if (isMinimal) document.body.classList.add('minimal-mode');
|
||||
|
||||
@@ -346,7 +347,19 @@ class WaveformTrack {
|
||||
this.drawBuf[(this.sweepPos + e) % w] = null;
|
||||
}
|
||||
|
||||
const yNorm = this.queue.length > 0 ? this.queue.shift() : this._synth();
|
||||
let yNorm;
|
||||
if (this.queue.length > 0) {
|
||||
yNorm = this.queue.shift();
|
||||
} else if (isDemo) {
|
||||
yNorm = this._synth();
|
||||
} else {
|
||||
// Flatline baseline based on mode
|
||||
if (this.mode === 'pleth') {
|
||||
yNorm = 0.85; // flatline at bottom for pleth
|
||||
} else {
|
||||
yNorm = 0.5; // center flatline for ecg/resp
|
||||
}
|
||||
}
|
||||
this.drawBuf[this.sweepPos] = yNorm;
|
||||
this.sweepPos = (this.sweepPos + 1) % w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user