From 64cae263333121cf59b1f2faaa97148e0f3b9e88 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Mon, 18 Apr 2022 16:46:13 +0100 Subject: [PATCH] Allow negative route ids. --- WiThrottle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WiThrottle.cpp b/WiThrottle.cpp index 29a8c3a..60bdf7d 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -255,11 +255,14 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) { int WiThrottle::getInt(byte * cmd) { int i=0; + bool negate=cmd[0]=='-'; + if (negate) cmd++; while (cmd[0]>='0' && cmd[0]<='9') { i=i*10 + (cmd[0]-'0'); cmd++; } - return i; + if (negate) i=0-i; + return i ; } int WiThrottle::getLocoId(byte * cmd) {