display computed pH in status when LSV sweep completes

This commit is contained in:
jess 2026-04-02 19:34:58 -07:00
parent 1441c5ec42
commit c0a0904a44
2 changed files with 18 additions and 2 deletions

View File

@ -174,7 +174,14 @@ final class AppState {
if !lsvManualPeaks {
lsvPeaks = detectLsvPeaks(lsvPoints)
}
status = "LSV complete: \(lsvPoints.count) points"
var st = "LSV complete: \(lsvPoints.count) points"
if let s = phSlope, let o = phOffset, abs(s) > 1e-6 {
if let peak = detectQhqPeak(lsvPoints) {
let ph = (Double(peak) - o) / s
st += String(format: " | pH=%.2f", ph)
}
}
status = st
case .ampStart(let vHold):
ampPoints.removeAll()

View File

@ -660,7 +660,16 @@ impl App {
if !self.lsv_manual_peaks {
self.lsv_peaks = crate::lsv_analysis::detect_peaks(&self.lsv_points);
}
self.status = format!("LSV complete: {} points", self.lsv_points.len());
let mut st = format!("LSV complete: {} points", self.lsv_points.len());
if let (Some(s), Some(o)) = (self.ph_slope, self.ph_offset) {
if let Some(peak) = crate::lsv_analysis::detect_qhq_peak(&self.lsv_points) {
if s.abs() > 1e-6 {
let ph = (peak - o) / s;
write!(st, " | pH={:.2}", ph).ok();
}
}
}
self.status = st;
}
EisMessage::AmpStart { v_hold } => {
self.amp_points.clear();