1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-25 05:31:24 +01:00

Withrottle Heartbeat

Dont allow millisecond delays to triigger heartbeat missed
This commit is contained in:
Asbelos 2020-07-30 15:31:31 +01:00
parent 3aff6230a2
commit 45863a043f
2 changed files with 3 additions and 3 deletions

View File

@ -103,7 +103,7 @@ void WiThrottle::parse(Print & stream, byte * cmdx) {
StringFormatter::send(stream,F("VN2.0\nHTDCC++EX\nRL0\nPPA%x\n"),DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON); StringFormatter::send(stream,F("VN2.0\nHTDCC++EX\nRL0\nPPA%x\n"),DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON);
if (annotateLeftRight) StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[Left}|{2]\\[Right}|{4\n")); if (annotateLeftRight) StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[Left}|{2]\\[Right}|{4\n"));
else StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[Closed}|{2]\\[Thrown}|{4\n")); else StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[Closed}|{2]\\[Thrown}|{4\n"));
StringFormatter::send(stream,F("*10\n")); StringFormatter::send(stream,F("*%d\n"),HEARTBEAT_TIMEOUT/2);
break; break;
case 1: // second call... send the turnout table if we have one case 1: // second call... send the turnout table if we have one
callState++; callState++;
@ -148,7 +148,7 @@ void WiThrottle::parse(Print & stream, byte * cmdx) {
} }
break; break;
case 'N': // Heartbeat (2) case 'N': // Heartbeat (2)
StringFormatter::send(stream, F("*10\n")); // 10 second timeout StringFormatter::send(stream, F("*%d\n"),HEARTBEAT_TIMEOUT/2); // 5 second timeout
break; break;
case 'M': // multithrottle case 'M': // multithrottle
multithrottle(stream, cmd); multithrottle(stream, cmd);

View File

@ -36,7 +36,7 @@ class WiThrottle {
~WiThrottle(); ~WiThrottle();
static const int MAX_MY_LOCO=10; static const int MAX_MY_LOCO=10;
static const int HEARTBEAT_TIMEOUT=10; static const int HEARTBEAT_TIMEOUT=10;// Timeout after 10 seconds, heartbeat at 5
static WiThrottle* firstThrottle; static WiThrottle* firstThrottle;
static int getInt(byte * cmd); static int getInt(byte * cmd);
static int getLocoId(byte * cmd); static int getLocoId(byte * cmd);