From 9cc8843e15c7e19cf233dea5bdc60e38bb13083c Mon Sep 17 00:00:00 2001 From: mstevetodd Date: Sat, 1 Aug 2020 12:33:10 -0400 Subject: [PATCH] move ssid and password to config.h, restore timeout to full value (#5) * Update WiThrottle.cpp I don't believe the /2 is needed. The clients are already expected to provide a bit of extra time for the heartbeat to occur. EngineDriver targets 90% of the heartbeat. I believe WiThrottle does as well. * move ssid and password into config.h * Revert "move ssid and password into config.h" This reverts commit be96b44e88f8b07ac3193dc88ce219d17fa0b43a. * move ssid and password to config.h --- CVReader.ino | 2 +- Config.h | 4 +++- WiThrottle.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CVReader.ino b/CVReader.ino index bbb8189..144d07b 100644 --- a/CVReader.ino +++ b/CVReader.ino @@ -88,7 +88,7 @@ void setup() { // #ifdef WIFI Serial1.begin(115200); - WifiInterface::setup(Serial1, F("BTHub5-M6PT"), F("49de8d4862"),F("DCCEX"),F("CVReader"),3532); // (3532 is 0xDCC decimal... ) + WifiInterface::setup(Serial1, F(WIFI_CONNECT_TO_SSID), F(WIFI_CONNECT_PASSWORD),F("DCCEX"),F("CVReader"),3532); // (3532 is 0xDCC decimal... ) #endif // This is just for demonstration purposes diff --git a/Config.h b/Config.h index 9104890..1a495bc 100644 --- a/Config.h +++ b/Config.h @@ -1,8 +1,10 @@ #ifndef Config_h #define Config_h -// Define this if you have a WiFi board on Serial1 +// Define these if you have a WiFi board on Serial1 #define WIFI +#define WIFI_CONNECT_TO_SSID "RPi-JMRI" +#define WIFI_CONNECT_PASSWORD "rpI-jmri" // This hardware configuration would normally be setup using a bunch of #ifdefs. diff --git a/WiThrottle.cpp b/WiThrottle.cpp index fac390b..a5c4335 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -104,7 +104,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("*%d\n"),HEARTBEAT_TIMEOUT/2); + StringFormatter::send(stream,F("*%d\n"),HEARTBEAT_TIMEOUT); break; case 1: // second call... send the turnout table if we have one callState++; @@ -156,7 +156,7 @@ void WiThrottle::parse(Print & stream, byte * cmdx) { } break; case 'N': // Heartbeat (2) - StringFormatter::send(stream, F("*%d\n"),HEARTBEAT_TIMEOUT/2); // 5 second timeout + StringFormatter::send(stream, F("*%d\n"),HEARTBEAT_TIMEOUT); // 10 second timeout break; case 'M': // multithrottle multithrottle(stream, cmd);