1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 10:06:13 +01:00
This commit is contained in:
Hans R. Tanner 2022-11-04 20:39:05 -04:00
parent fe6fe09ac8
commit 6b725ccc60
2 changed files with 5 additions and 6 deletions

View File

@ -295,13 +295,10 @@ void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repea
void DCCWaveform::setAckBaseline() { void DCCWaveform::setAckBaseline() {
if (isMainTrack) return; if (isMainTrack) return;
pinMode(7, OUTPUT);
int baseline=motorDriver->getCurrentRaw(); int baseline=motorDriver->getCurrentRaw();
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
<<<<<<< Updated upstream
baseline = max(baseline, motorDriver->getCurrentRaw()); baseline = max(baseline, motorDriver->getCurrentRaw());
=======
baseline=max(baseline, motorDriver->getCurrentRaw());
>>>>>>> Stashed changes
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),
@ -365,7 +362,9 @@ void DCCWaveform::checkAck() {
return; return;
} }
digitalWrite(7, !digitalRead(7));
int current=motorDriver->getCurrentRaw(); int current=motorDriver->getCurrentRaw();
digitalWrite(7, current > ackThreshold);
numAckSamples++; numAckSamples++;
if (current > ackMaxCurrent) ackMaxCurrent=current; if (current > ackMaxCurrent) ackMaxCurrent=current;
// An ACK is a pulse lasting between minAckPulseDuration and maxAckPulseDuration uSecs (refer @haba) // An ACK is a pulse lasting between minAckPulseDuration and maxAckPulseDuration uSecs (refer @haba)

View File

@ -47,8 +47,8 @@
// //
// Arduino standard Motor Shield // Arduino standard Motor Shield
#define STANDARD_MOTOR_SHIELD F("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(3, 12, UNUSED_PIN, UNUSED_PIN, A0, 65.54, 7000, UNUSED_PIN), \
new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 41.54, 5000, UNUSED_PIN) new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 65.54, 7000, UNUSED_PIN)
// Pololu Motor Shield // Pololu Motor Shield
#define POLOLU_MOTOR_SHIELD F("POLOLU_MOTOR_SHIELD"), \ #define POLOLU_MOTOR_SHIELD F("POLOLU_MOTOR_SHIELD"), \