node-modbus-serial icon indicating copy to clipboard operation
node-modbus-serial copied to clipboard

Timeouts when I d'ont include sleeps

Open LeNouveau opened this issue 2 years ago • 0 comments

Hi,

I'm having a lot a Timeouts when using Modbus RTU calls. The only wait I found to prevent it is using "sleeps" but I don't think it is nice and I would like to understand why.

I'm having the issue with several products. I tested with Python, I did not have Timeouts. So I thing it is related to the modbus library.

All my files are available at https://gist.github.com/LeNouveau/bf5861e75a5b9eee76cb1dd17db775a3. My questions will be related to index.ts, line 71~72.

  1. Why do I have so many Timeouts without adding a sleep ? Did I miss a step ? What is the best practice ?

  2. Why does my 1ms sleep generates +10~20ms for each call ? Is it the time required to load the context of the "fake function" ? But why not always, then ? Is the modbus-serial library doing something ?

Thanks for your help. Regards, LeNouveau

LeNouveau avatar Sep 07 '22 09:09 LeNouveau