-
Notifications
You must be signed in to change notification settings - Fork 14
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
modbus_poll should change timeout->silent only for async packet #27
Comments
The risk is, IMO, low since grblHAL in essence is single threaded. I'll add your test anyway since the state transition is also taken care of when the blocking loop exits.
This is deliberate, async packets is intended for querying the device status and is typically sent when the real time status is requested. But since the API may be used for other devices than VFDs is should be added? And perhaps support for async timeouts should be added to the VFD drivers too? |
My understanding was that async call differs from sync call just by non-blocking waiting for result, but result of operation is important and must be equal for async/sync from API perspective. |
A new issue is ok - provinding the timeout callback is easy, how it should be handled is another story. Retry or not? Generate an alarm and in which circumstances? ... |
Is your concern about request speed case or in general? |
I did not add the async timeout callback since I did not (and still do not) have a clear idea how to handle it at the client side. |
The risk of current implementation is to miss timeout state in modbus_send_rtu, because second call of modbus_poll will change it to silent.
Currently it works, just because modbus_poll is called from modbus_send_rtu, but this is very dangerous - in other conditions modbus_poll can be called by core main thread, because it hooks grbl.on_execute_realtime.
And I think that intention was that modbus_poll procedure handles this state transition for async packet, whereas for blocking packet timeout state will be changed to silent/idle by modbus_send_rtu code.
Proposed fix:
![image](https://private-user-images.githubusercontent.com/53602873/319086504-629ff304-055d-4058-8272-ddbcad817198.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTg0ODYsIm5iZiI6MTczODk5ODE4NiwicGF0aCI6Ii81MzYwMjg3My8zMTkwODY1MDQtNjI5ZmYzMDQtMDU1ZC00MDU4LTgyNzItZGRiY2FkODE3MTk4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA3MDMwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYzNTRhYTE3ODFlZjhkMDk2ODNhZWMxODhlNzFjMGYyNmIxMzM0MGNhMmU5ZTIyZjUzNzhmYWVhMDNjM2Q3ZDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.SLpxJ3UGK1WX4UvJNTermYcPo-varw6aAHABEbGJlUc)
Additionally, I didn't find on_rx_exception callback for timeout case for async packet.
The text was updated successfully, but these errors were encountered: