-
-
Notifications
You must be signed in to change notification settings - Fork 123
EXRAIL add SAVESPEED and RESTORESPEED #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
|
Should we save the speed against the exrail task (as you have done) or save it against the loco id... (I appreciate this is looking a little further ahead to having Railcom implemented) |
|
I think storing the speed on the locomotive is absolutely logical and correct. In my case, the use case is very simple. I used SAVESPEED and RESTORESPEED for the reservation case, since RESERVE always forces the loco to slow down: So I only need the reference to the task. That’s why I kept the task reference simple. The |
|
Yes locoslot would be the place where we keep loco specific variables. This should be saved as a copy of the targetSpeed byte which is the most recent speed set by a throttle or exrail. |
…orks. I would prefer a method at locoslot, but there are any calls to DCC until now. Maybe by reason.
|
Generally speaking, throttle commands call the DCC layer. The DCC layer creates packets etc but is also responsible for maintaining the reminders table, which is where the the original locoslots came from. Sometimes, as in the case of a non-zero momentum, the DCC packet is not created/sent immediately but the target speed is updated and the reminder loop will pick up the calculation of the real packets as it goes around the active loco reminder loop. This it make sense that the current throttle setting (target speed) is saved and on restore the DCC throttle is called so it can make the usual decision based on the optional momentum. |
|
Tested at my setup. Restore is working as expected. |
|
Converted to draft. Usage of setThrottle is currently wrong because LocoSlot::savedspeed is a speedcode, not a exrail user speed. Maybe introduce a DCC::restoreThrottle(loco), because we don't want to know the internal speedcode in exrail. |
I like the ideas in #465. I need SAVESPEED/RESTORESPEED, so I’ve implemented a simple version for now, until a more advanced solution can be developed.