chilipeppr / serial-port-json-server

Serial Port JSON Server is a websocket server for your serial devices. It compiles to a binary for Windows, Mac, Linux, Raspberry Pi, or BeagleBone Black that lets you communicate with your serial port from a web application. This enables web apps to be written that can communicate with your local serial device such as an Arduino, CNC controller, or any device that communicates over the serial port.
http://chilipeppr.com
GNU General Public License v2.0
321 stars 101 forks source link

grbl buffer size queried on reset and used in server if plausible #57

Closed MatthiasWM closed 2 years ago

MatthiasWM commented 5 years ago

Grbl Mega has a larger buffer than Grbl Uno. The new code emits a '$I' after receiving Arduino initialization string, and when receiving the '[OPT:..]', checking it for plausibility and adjusting the internal buffer size of the server.

It's all explained a bit more in the source code.

I apologize for the reformatting done by the editor that creates a bit of noise in the git commit.

Also, the code is a bit too explicit, but I am new to 'go', so I like to spell things out.

Lastly, this code was tested with two different Grbl Mega and seems to work just fine, but I had no non-1.1f version Arduino to test a well behaved code in case the '$I' sends a different reply.

chilipeppr commented 5 years ago

Hmm. With how much this buffer is used out there and has not had reported issues, it might be safer to deploy this as Grbl2 or GrblMega and just add it to the choice of buffers in the list that SPJS supports. Then we could move it to Grbl over time if folks feel good about it. These buffers are one of the most important areas for running 100% reliable jobs, so it would worry me to push this out untested.

On Mon, Aug 13, 2018 at 5:15 PM MatthiasWM notifications@github.com wrote:

Grbl Mega has a larger buffer than Grbl Uno. The new code emits a '$I' after receiving Arduino initialization string, and when receiving the '[OPT:..]', checking it for plausibility and adjusting the internal buffer size of the server.

It's all explained a bit more in the source code.

I apologize for the reformatting done by the editor that creates a bit of noise in the git commit.

Also, the code is a bit too explicit, but I am new to 'go', so I like to spell things out.

Lastly, this code was tested with two different Grbl Mega and seems to work just fine, but I had no non-1.1f version Arduino to test a well behaved code in case the '$I' sends a different reply.

You can view, comment on, or merge this pull request online at:

https://github.com/chilipeppr/serial-port-json-server/pull/57 Commit Summary

  • Added comment on how to improve grbl buffer size calculation
  • Startegy to get buffer size
  • grbl 1.1f: request total buffer size and update server buffer accordingly

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chilipeppr/serial-port-json-server/pull/57, or mute the thread https://github.com/notifications/unsubscribe-auth/AHidbWzDu2OVKZcG20vbZQsRuZYLqAIbks5uQhamgaJpZM4V7mQ7 .

MatthiasWM commented 5 years ago

Yes, that is absolutely true. It was a happy experience in golang. Let's reject the pull request. Everything else seems to be working just fine.