grblHAL / core

grblHAL core code and master Wiki
Other
320 stars 84 forks source link

Reducing the baud rate of the Keypad plug-in serial port will also reduce the communication speed of the USB virtual serial port #179

Closed hanke-cnc closed 2 years ago

hanke-cnc commented 2 years ago

hi, I tried to make an encoder version of the handwheel for grblhal, using the keyboard plug-in, the test is no problem at all, but I found that if I reduce the serial communication rate of the keyboard plug-in (hope to improve the noise immunity with a lower communication rate), then The communication rate of the USB virtual serial port will also be reduced, sending "?", the reply becomes very slow,

hanke-cnc commented 2 years ago

gg

terjeio commented 2 years ago

This is expected behaviour. The slowest stream will block processing when its output buffer is full - increase the reporting interval enough to let the output buffer empty out between requests to avoid blocking.

hanke-cnc commented 2 years ago

This is expected behaviour. The slowest stream will block processing when its output buffer is full - increase the reporting interval enough to let the output buffer empty out between requests to avoid blocking.

My handwheel doesn't need to receive replies from grblhal, what should I comment out? This way it shouldn't block

hanke-cnc commented 2 years ago

My handwheel only represents G91G1X1F500 by sending a single character, like "Q", it doesn't need to receive information from grblhal, I don't know where I should comment out so that grblhal doesn't send information to the keyboard serial port so it doesn't block

hanke-cnc commented 2 years ago

google translate is a bit bad,

terjeio commented 2 years ago

Try:

#elif MPG_MODE == 2
    hal.driver_cap.mpg_mode = stream_mpg_register(stream_open_instance(MPG_STREAM, 115200, NULL), true, keypad_enqueue_keycode);
#elif KEYPAD_ENABLE == 2

second parameter to stream_mpg_register() changed from false to true.

hanke-cnc commented 2 years ago

true

After changing to "true" it doesn't send info but also doesn't receive my handwheel info☺

hanke-cnc commented 2 years ago

It has been tested 2 times, you may have misremembered the code?

Try:

#elif MPG_MODE == 2
    hal.driver_cap.mpg_mode = stream_mpg_register(stream_open_instance(MPG_STREAM, 115200, NULL), true, keypad_enqueue_keycode);
#elif KEYPAD_ENABLE == 2

second parameter to stream_mpg_register() changed from false to true.

It has been tested 2 times, you may have misremembered the code?

hanke-cnc commented 2 years ago

Try:

#elif MPG_MODE == 2
    hal.driver_cap.mpg_mode = stream_mpg_register(stream_open_instance(MPG_STREAM, 115200, NULL), true, keypad_enqueue_keycode);
#elif KEYPAD_ENABLE == 2

second parameter to stream_mpg_register() changed from false to true.

I pass the comment // hal.stream.write_all = stream_write_all; it got better, thanks