Skip to content

Add GrblSerialSimpleDriver (ping-pong protocol)#263

Merged
knipknap merged 4 commits into
mainfrom
feat/grbl-simple-serial-driver
Jun 9, 2026
Merged

Add GrblSerialSimpleDriver (ping-pong protocol)#263
knipknap merged 4 commits into
mainfrom
feat/grbl-simple-serial-driver

Conversation

@knipknap

Copy link
Copy Markdown
Contributor

Summary

Adds a new GrblSerialSimpleDriver that uses the simplest possible GRBL communication strategy: send one G-code line, wait for ok, send the next. No character-counting buffer management, no deadlock detection, no buffer stall recovery.

Motivation

Some users experience persistent communication issues with the advanced GrblSerialDriver (false ALARM:3 errors, buffer desync, etc.) as documented in #256. This driver provides an alternative that trades throughput for robustness — since there is no buffer management, there is nothing to desynchronize.

Key Differences from GrblSerialDriver

Feature GrblSerialDriver GrblSerialSimpleDriver
Transport GrblSerialTransport (buffer counting) Raw SerialTransport
Flow control Character-counting (128-byte RX buffer) Ping-pong (wait for ok)
Buffer stall recovery Poll + G4 recovery + deadlock detection None needed
Throughput High (pipelined) Lower (one-at-a-time)
Complexity ~1600 lines ~620 lines
Maturity Stable Experimental

What's Included

  • New driver: rayforge/machine/driver/grbl/grbl_serial_simple.py
  • Registration: Exported from grbl/__init__.py and driver/__init__.py
  • Full GRBL feature set: Settings, WCS offsets, probing, homing, jogging, tool changes, power control — all reusing the existing grbl_util helpers
  • Status polling: Simplified polling loop that pauses during jobs
  • Label: Appears as "GRBL (Serial Simple)" in the driver selection dropdown

Testing

  • Syntax check passes on all modified/new files
  • No unit tests exist for driver implementations (test infrastructure requires PyGObject)

Related: #256

knipknap added 4 commits June 9, 2026 18:12
Implements a minimal GRBL serial driver that sends one G-code line at
a time and waits for 'ok' before proceeding. No character-counting
buffer management, no deadlock detection, no buffer stall recovery.

Key differences from GrblSerialDriver:
- Uses raw SerialTransport instead of GrblSerialTransport
- No RX buffer tracking or backpressure
- Strict ping-pong: send -> wait ok -> send next
- Simpler connection loop with handshake detection
- No command queue or interactive/queued command separation
- Marked as EXPERIMENTAL maturity level

Useful for devices where the advanced buffer-counting protocol causes
issues (false ALARM:3, communication errors, etc.).
- Make cleanup() async to match Driver base class
- Make _start_job() sync (not async) like GrblSerialDriver
- Add assert for machine.dialect None check in create_encoder
- Fix parse_state() call to pass required default arg
- Remove invalid pos_x/pos_y assignments (use parse_state instead)
- Fix alarm_code_to_device_error() to pass single alarm_code arg
@knipknap
knipknap force-pushed the feat/grbl-simple-serial-driver branch from ff4f5be to 96e5383 Compare June 9, 2026 16:14
@knipknap
knipknap merged commit 66da4a1 into main Jun 9, 2026
19 checks passed
@knipknap
knipknap deleted the feat/grbl-simple-serial-driver branch June 12, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant