From 6fadd18827e33d09044e1df35843745af7e11053 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 24 Jul 2020 17:29:48 +0100 Subject: [PATCH] Allow left/right turnout labels WiThrottle TPL assist --- WiThrottle.cpp | 6 +++++- WiThrottle.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/WiThrottle.cpp b/WiThrottle.cpp index b65d890..6c39e54 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -50,6 +50,7 @@ if (myLocos[loco].throttle==THROTTLECHAR && (CAB<0 || myLocos[loco].cab==CAB)) WiThrottle * WiThrottle::firstThrottle=NULL; +bool WiThrottle::annotateLeftRight=false; WiThrottle* WiThrottle::getThrottle( int wifiClient) { for (WiThrottle* wt=firstThrottle; wt!=NULL ; wt=wt->nextThrottle) @@ -99,7 +100,10 @@ void WiThrottle::parse(Print & stream, byte * cmdx) { switch (callState) { case 0: // first call in callState++; - StringFormatter::send(stream,F("VN2.0\nHTDCC++EX\nRL0\nPPA%x\nPTT]\\[Turnouts}|{Turnout]\\[Closed}|{2]\\[Thrown}|{4\n*10\n"), + StringFormatter::send(stream,F("VN2.0\nHTDCC++EX\nRL0\nPPA%x\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")); + StringFormatter::send(stream,F("*10\n"), DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON); break; case 1: // second call... send the turnout table if we have one diff --git a/WiThrottle.h b/WiThrottle.h index d039c8d..b0f29f9 100644 --- a/WiThrottle.h +++ b/WiThrottle.h @@ -30,7 +30,7 @@ class WiThrottle { static void loop(); void parse(Print & stream, byte * cmd); static WiThrottle* getThrottle( int wifiClient); - + static bool annotateLeftRight; private: WiThrottle( int wifiClientId); ~WiThrottle();