mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +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
|
||||
void IODevice::reset() {
|
||||
unsigned long currentMicros = micros();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user