mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
ACK pulse durations
Refer @haba
This commit is contained in:
parent
dc33acf7d4
commit
a2636b1296
|
@ -277,7 +277,7 @@ void DCCWaveform::checkAck() {
|
|||
|
||||
lastCurrent=Hardware::getCurrentRaw(false);
|
||||
if (lastCurrent > ackMaxCurrent) ackMaxCurrent=lastCurrent;
|
||||
// An ACK is a pulse lasting between 4.5 and 8.5 mSecs (refer @haba)
|
||||
// An ACK is a pulse lasting between MIN_ACK_PULSE_DURATION and MAX_ACK_PULSE_DURATION uSecs (refer @haba)
|
||||
|
||||
if (lastCurrent>ackThreshold) {
|
||||
if (ackPulseStart==0) ackPulseStart=micros(); // leading edge of pulse detected
|
||||
|
@ -290,7 +290,7 @@ void DCCWaveform::checkAck() {
|
|||
// detected trailing edge of pulse
|
||||
ackPulseDuration=micros()-ackPulseStart;
|
||||
|
||||
if (ackPulseDuration>1000 && ackPulseDuration<9000) {
|
||||
if (ackPulseDuration>=MIN_ACK_PULSE_DURATION && ackPulseDuration<=MAX_ACK_PULSE_DURATION) {
|
||||
ackCheckDuration=millis()-ackCheckStart;
|
||||
ackDetected=true;
|
||||
ackPending=false;
|
||||
|
|
|
@ -24,7 +24,9 @@ const int POWER_SAMPLE_ON_WAIT = 100;
|
|||
const int POWER_SAMPLE_OFF_WAIT = 1000;
|
||||
const int POWER_SAMPLE_OVERLOAD_WAIT = 4000;
|
||||
|
||||
|
||||
const int MIN_ACK_PULSE_DURATION = 3000;
|
||||
const int MAX_ACK_PULSE_DURATION = 8500;
|
||||
|
||||
|
||||
const int PREAMBLE_BITS_MAIN = 20;
|
||||
const int PREAMBLE_BITS_PROG = 22;
|
||||
|
|
Loading…
Reference in New Issue
Block a user