Skip to content

Commit

Permalink
isMoving() bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
peteGSX committed Nov 2, 2024
1 parent f784c88 commit 24d6042
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ All objects are contained within linked lists and can be access via for loops:
// route methods are available here
}
for (Turntable* turntable=dccexProtocol.roster->getFirst(); turntable; turntable=turntable->getNext()) {
for (Turntable* turntable=dccexProtocol.turntables->getFirst(); turntable; turntable=turntable->getNext()) {
// turntable methods are available here
for (TurntableIndex* ttIndex=turntable->getFirstIndex(); ttIndex; ttIndex=ttIndex->getNextIndex()) {
// turntable index methods are available here
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=DCCEXProtocol
version=0.0.16
version=0.0.17
author=Peter Cole, Peter Akers <[email protected]>
maintainer=Peter Cole, Peter Akers <[email protected]>
sentence=DCC-EX Native Protocol implementation
Expand Down
6 changes: 3 additions & 3 deletions src/DCCEXProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,17 +1106,17 @@ void DCCEXProtocol::_processTurntableIndexEntry() { // <jP id index angle "[desc
}

void DCCEXProtocol::_processTurntableBroadcast() { // <I id position moving>
// console->println(F("processTurntableAction(): "));
// _console->println(F("_processTurntableBroadcast(): "));
int id = DCCEXInbound::getNumber(0);
int newIndex = DCCEXInbound::getNumber(1);
bool moving = DCCEXInbound::getNumber(2);
Turntable *tt = getTurntableById(id);
if (tt && tt->getIndex() != newIndex) {
if (tt) {
tt->setIndex(newIndex);
tt->setMoving(moving);
}
_delegate->receivedTurntableAction(id, newIndex, moving);
// console->println(F("processTurntableAction(): end"));
// _console->println(F("processTurntableAction(): end"));
}

// Track management methods
Expand Down
2 changes: 2 additions & 0 deletions src/DCCEXProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
/*
Version information:
0.0.17 - Fix typo in turntable example
- Fix bug where the turntable isMoving() method always returned true
0.0.16 - add public sendCommand method
0.0.15 - any acquired loco is now retained in the roster
0.0.14 - add getNumberSupportedLocos() used for the fake heartbeat
Expand Down
2 changes: 1 addition & 1 deletion src/DCCEXTurntables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "DCCEXTurntables.h"
#include <Arduino.h>


// class TurntableIndex

TurntableIndex *TurntableIndex::_first = nullptr;
Expand Down Expand Up @@ -62,6 +61,7 @@ Turntable::Turntable(int id) {
_index = 0;
_numberOfIndexes = 0;
_name = nullptr;
_isMoving = false;
_firstIndex = nullptr;
_indexCount = 0;
_next = nullptr;
Expand Down

0 comments on commit 24d6042

Please sign in to comment.