You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If "WithHCSR04UseEdgePolling()" is used, stopping the robot by CTRL-C hangs. This is only tested with gpiod driver, not sysfs.
This is caused by the reconfiguration of the pin with this call hierarchy:
DigitalPinsAdaptor.Finalize()
pin.Unexport()
digitalPinGpiodReconfigure()
digitalPinGpiodReconfigureLine()
startEdgePolling()
call of a go - function with a loop, like this
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
...
var firstLoopDone bool
for {
select {
case <-quitChan:
return
default:
... if !firstLoopDone {
wg.Done()
firstLoopDone = true
}
}
}
}()
wg.Wait()
The wait group ensures, that the first reading is done for the edge detection. But for the "Finalize()" call the quitChan will be closed immediately and the waitgroup is not done. This is more clean and will fix the problem:
for {
select {
case <-quitChan:
if !firstLoopDone {
wg.Done()
}
return
default:
The text was updated successfully, but these errors were encountered:
If "WithHCSR04UseEdgePolling()" is used, stopping the robot by CTRL-C hangs. This is only tested with gpiod driver, not sysfs.
This is caused by the reconfiguration of the pin with this call hierarchy:
The wait group ensures, that the first reading is done for the edge detection. But for the "Finalize()" call the quitChan will be closed immediately and the waitgroup is not done. This is more clean and will fix the problem:
The text was updated successfully, but these errors were encountered: