1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 10:06:13 +01:00

Update DCCWaveform.cpp

This commit is contained in:
Hans R. Tanner 2022-11-01 21:03:22 -04:00
parent a95a4dded2
commit 9282d6a72f

View File

@ -296,6 +296,8 @@ void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repea
void DCCWaveform::setAckBaseline() { void DCCWaveform::setAckBaseline() {
if (isMainTrack) return; if (isMainTrack) return;
int baseline=motorDriver->getCurrentRaw(); int baseline=motorDriver->getCurrentRaw();
for (int i = 0; i < 32; i++)
baseline = max(baseline, motorDriver->getCurrentRaw());
ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA); ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA);
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"), if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"),
baseline,motorDriver->raw2mA(baseline), baseline,motorDriver->raw2mA(baseline),