mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Improve IODevice::reset function
Ensure that the _loop() function is able to run after a device is reset.
This commit is contained in:
parent
7e2487ffbb
commit
5f9705d1b7
|
@ -76,7 +76,12 @@ void IODevice::begin() {
|
||||||
|
|
||||||
// reset() function to reinitialise all devices
|
// reset() function to reinitialise all devices
|
||||||
void IODevice::reset() {
|
void IODevice::reset() {
|
||||||
|
unsigned long currentMicros = micros();
|
||||||
for (IODevice *dev = _firstDevice; dev != NULL; dev = dev->_nextDevice) {
|
for (IODevice *dev = _firstDevice; dev != NULL; dev = dev->_nextDevice) {
|
||||||
|
dev->_deviceState = DEVSTATE_DORMANT;
|
||||||
|
// First ensure that _loop isn't delaying
|
||||||
|
dev->delayUntil(currentMicros);
|
||||||
|
// Then invoke _begin to restart driver
|
||||||
dev->_begin();
|
dev->_begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user