Skip to content

Conversation

@rwf-rr
Copy link
Contributor

@rwf-rr rwf-rr commented Feb 4, 2025

Previously the change in count direction (Shift-Ctrl-Z) would not apply until a reset (Ctrl-Z) is done.

Now, the odometer will change immediately when its count direction is changed.

For example, you pass a switch and reset (Ctrl-Z) the odometer. Then you notice it counts up. Now, when you hit toggle-direction (Shift-Ctrl-Z), the counter will jump to the length of the train minus the distance already traveled between when the reset was done and when the count-direction was changed. When the counter reaches zero, your train has passed the switch.

See https://www.elvastower.com/forums/index.php?/topic/38587-odometer-count-updown-not-taking-effect-until-reset/.

I ended up doing some refactoring, as I had a hard time understanding the logic. Part of the complexity is that the odometer behaves different from a typical odometer. When doing a reverse move, the odometer can be used to count the distance as if it were a normal move.

Hence, the reset logic depends on the position of the reverser at the time of the reset. The reverser position at reset is preserved in the OdometerDirectionForward flag.

Previously the change would not apply until a reset is done.
Now the counter will be adjusted to match the proper reference point.
Copy link
Contributor

@cjakeman cjakeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Roger,

Your re-factor and extended comments will be very helpful.

Approved and merged.

Chris

@cjakeman cjakeman merged commit edb6a9c into openrails:master Feb 15, 2025
1 check passed
@rwf-rr rwf-rr deleted the odometer-change-up-down branch October 24, 2025 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants