Skip to content

Commit

Permalink
fix a bug where the speeds were not being updated when changed on ano…
Browse files Browse the repository at this point in the history
…ther device
  • Loading branch information
flash62au committed Apr 1, 2024
1 parent d9a6d5e commit c2a5994
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=WiThrottleProtocol
version=1.1.14
version=1.1.15
author=David Zuhn <zoo@statebeltrailway.org>, Luca Dentella <luca@dentella.it>, Peter Akers <akersp62@gmail.com>
maintainer=Peter Akers <akersp62@gmail.com>
sentence=JMRI WiThrottle Protocol implementation
Expand Down
7 changes: 6 additions & 1 deletion src/WiThrottleProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,16 +846,21 @@ void WiThrottleProtocol::processRosterFunctionListEntries(char multiThrottle, co

void WiThrottleProtocol::processSpeed(char multiThrottle, const String& speedData) {
console->print("processSpeed(): "); console->println(multiThrottle);
int multiThrottleIndex = getMultiThrottleIndex(multiThrottle);

if (delegate && speedData.length() >= 2) {
String speedStr = speedData.substring(1);
int speed = speedStr.toInt();

if ((speed < MIN_SPEED) || (speed > MAX_SPEED)) {
if (speed < MIN_SPEED) {
speed = 0;
} else if (speed > MAX_SPEED) {
speed = MAX_SPEED;
}

currentSpeed[multiThrottleIndex] = speed;
if (multiThrottle == DEFAULT_MULTITHROTTLE) {
currentSpeed[multiThrottleIndex] = speed;
delegate->receivedSpeed(speed);
} else {
delegate->receivedSpeedMultiThrottle(multiThrottle, speed);
Expand Down
1 change: 1 addition & 0 deletions src/WiThrottleProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/*
Version information:
1.1.15 - fix a bug where the speeds were not being updated when changed on another device
1.1.14 - addition of 'sendCommand(String cmd);
1.1.13 - Bug fix for ESTOP
1.1.12 - Add support for broadcast messages and alerts
Expand Down

0 comments on commit c2a5994

Please sign in to comment.