mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 13:21:23 +01:00
Correct place for checkAck() so ack pulse lenth is correct
This commit is contained in:
parent
3d7a9500cf
commit
0c9b2d962b
@ -135,8 +135,9 @@ bool DCCWaveform::interrupt1() {
|
||||
state = 0;
|
||||
break;
|
||||
}
|
||||
// ACK check is prog track only
|
||||
if (ackPending) checkAck();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -185,11 +186,6 @@ void DCCWaveform::interrupt2() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ACK check is prog track only and will only be checked if bits_sent=4 ...
|
||||
// This means only once per 9-bit-byte AND never at the same cycle as the
|
||||
// relatively expensive packet change code just above.
|
||||
if (ackPending && bits_sent==4) checkAck();
|
||||
}
|
||||
|
||||
|
||||
@ -266,7 +262,7 @@ void DCCWaveform::checkAck() {
|
||||
// detected trailing edge of pulse
|
||||
ackPulseDuration=micros()-ackPulseStart;
|
||||
|
||||
if (ackPulseDuration>1000 && ackPulseDuration<9000) {
|
||||
if (ackPulseDuration>3000 && ackPulseDuration<8500) {
|
||||
ackCheckDuration=millis()-ackCheckStart;
|
||||
ackDetected=true;
|
||||
ackPending=false;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define DCCWaveform_h
|
||||
|
||||
|
||||
const int POWER_SAMPLE_MAX = 300;
|
||||
const int POWER_SAMPLE_MAX = 1000; // XXX only until correct short detection on prog rail is implemented
|
||||
const int POWER_SAMPLE_ON_WAIT = 100;
|
||||
const int POWER_SAMPLE_OFF_WAIT = 1000;
|
||||
const int POWER_SAMPLE_OVERLOAD_WAIT = 4000;
|
||||
|
Loading…
Reference in New Issue
Block a user