From 6b725ccc6025d9e3e4ab3238f689fe9c7513bcea Mon Sep 17 00:00:00 2001 From: "Hans R. Tanner" Date: Fri, 4 Nov 2022 20:39:05 -0400 Subject: [PATCH] test --- DCCWaveform.cpp | 7 +++---- MotorDrivers.h | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index b2d9b5b..6dd8fe8 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -295,13 +295,10 @@ void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repea void DCCWaveform::setAckBaseline() { if (isMainTrack) return; + pinMode(7, OUTPUT); int baseline=motorDriver->getCurrentRaw(); for (int i = 0; i < 32; i++) -<<<<<<< Updated upstream baseline = max(baseline, motorDriver->getCurrentRaw()); -======= - baseline=max(baseline, motorDriver->getCurrentRaw()); ->>>>>>> Stashed changes 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), @@ -365,7 +362,9 @@ void DCCWaveform::checkAck() { return; } + digitalWrite(7, !digitalRead(7)); int current=motorDriver->getCurrentRaw(); + digitalWrite(7, current > ackThreshold); numAckSamples++; if (current > ackMaxCurrent) ackMaxCurrent=current; // An ACK is a pulse lasting between minAckPulseDuration and maxAckPulseDuration uSecs (refer @haba) diff --git a/MotorDrivers.h b/MotorDrivers.h index 7513855..6a9c8ee 100644 --- a/MotorDrivers.h +++ b/MotorDrivers.h @@ -47,8 +47,8 @@ // // Arduino standard Motor Shield #define STANDARD_MOTOR_SHIELD F("STANDARD_MOTOR_SHIELD"), \ - new MotorDriver(3, 12, UNUSED_PIN, UNUSED_PIN, A0, 41.54, 5000, UNUSED_PIN), \ - new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 41.54, 5000, UNUSED_PIN) + new MotorDriver(3, 12, UNUSED_PIN, UNUSED_PIN, A0, 65.54, 7000, UNUSED_PIN), \ + new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 65.54, 7000, UNUSED_PIN) // Pololu Motor Shield #define POLOLU_MOTOR_SHIELD F("POLOLU_MOTOR_SHIELD"), \