diff --git a/WiThrottle.cpp b/WiThrottle.cpp index 22502f4..b72cc43 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -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); 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")); - StringFormatter::send(stream,F("*10\n")); + StringFormatter::send(stream,F("*%d\n"),HEARTBEAT_TIMEOUT/2); break; case 1: // second call... send the turnout table if we have one callState++; @@ -148,7 +148,7 @@ void WiThrottle::parse(Print & stream, byte * cmdx) { } break; 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; case 'M': // multithrottle multithrottle(stream, cmd); diff --git a/WiThrottle.h b/WiThrottle.h index b0f29f9..1e64a29 100644 --- a/WiThrottle.h +++ b/WiThrottle.h @@ -36,7 +36,7 @@ class WiThrottle { ~WiThrottle(); 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 int getInt(byte * cmd); static int getLocoId(byte * cmd);