Skip to content

Commit

Permalink
Merge e49063c into d8f6e74
Browse files Browse the repository at this point in the history
  • Loading branch information
mattharris committed Feb 24, 2018
2 parents d8f6e74 + e49063c commit 9e91565
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion java/src/jmri/jmrix/ecos/EcosDccThrottle.java
Expand Up @@ -569,7 +569,18 @@ public void setIsForward(boolean forward) {
return;
}

String message = "set(" + this.objectNumber + ", dir[" + (forward ? 0 : 1) + "])";
String message;
if (this.speedSetting > 0.0f) {
// Need to send current speed as well as direction, otherwise
// speed will be set to zero on direction change
int speedValue = (int) ((127 - 1) * this.speedSetting); // -1 for rescale to avoid estop
if (speedValue > 128) {
speedValue = 126; // max possible speed
}
message = "set(" + this.objectNumber + ", dir[" + (forward ? 0 : 1) + "], speed[" + speedValue + "])";
} else {
message = "set(" + this.objectNumber + ", dir[" + (forward ? 0 : 1) + ")";
}
EcosMessage m = new EcosMessage(message);
tc.sendEcosMessage(m, this);
}
Expand Down

0 comments on commit 9e91565

Please sign in to comment.