QiTech-Industries / Winder

Filament winding machine powererd by ESPdruino
GNU General Public License v3.0
27 stars 7 forks source link

Websocket update interval is slow #16

Open DreiDe opened 2 years ago

DreiDe commented 2 years ago

Expected behavior New stats from the Winder should be received as fast as possible to allow smooth graphs and avoid lags on button presses.

Actual behavior The Winder sends stats every second only and introduces a lag in the diagrams. In the current configuration Http polling would allow the same speed.

To Reproduce Steps to reproduce the behavior:

  1. Open the Winder interface.
  2. Start Operation of a motor.
  3. Look at the diagrams.

Screenshots / Logs N/A

happybrick commented 2 years ago

From what I see, increasing the interval itself should be as easy as adjusting these lines: https://github.com/QiTech-Industries/Winder/blob/a333f743f68a83dbed4d938a98187a8aa299d0cc/esp/src/QiMachineWinder.cpp#L235-L236

Adjustments would also need to be made to https://github.com/QiTech-Industries/Winder/blob/a333f743f68a83dbed4d938a98187a8aa299d0cc/client/src/utils/StatsProvider.js as it is seems to assume that new data is provided in 1s intervals, see: https://github.com/QiTech-Industries/Winder/blob/a333f743f68a83dbed4d938a98187a8aa299d0cc/client/src/utils/StatsProvider.js#L53-L55

This should be quite doable without adjusting the backend-interface (read: no breaking changes), however would require some cross-testing. Is this really worth the effort to implement though, considering that we will want to write an app anyways?