From 9282d6a72f6f031be16a9871a20d49f148d40c90 Mon Sep 17 00:00:00 2001 From: "Hans R. Tanner" Date: Tue, 1 Nov 2022 21:03:22 -0400 Subject: [PATCH] Update DCCWaveform.cpp --- DCCWaveform.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index 7b1062f..8be571f 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -296,6 +296,8 @@ void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repea void DCCWaveform::setAckBaseline() { if (isMainTrack) return; int baseline=motorDriver->getCurrentRaw(); + for (int i = 0; i < 32; i++) + baseline = max(baseline, motorDriver->getCurrentRaw()); ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA); if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"), baseline,motorDriver->raw2mA(baseline),