Open
Conversation
I've implemented a backend system to send G-code commands directly to a GRBL-based pen plotter via a serial connection.
Key changes include:
- Added `grbl_communicator.py` with a `GRBLCommunicator` class to handle serial connection, G-code command sending, and GRBL response parsing ('ok', 'error').
- Updated the `/api/send_job` route in `app.py` to utilize `GRBLCommunicator` for processing and sending G-code jobs. Includes default serial port and baud rate configuration.
- Added `pyserial` to `requirements.txt` for serial communication.
- Implemented comprehensive unit tests for `GRBLCommunicator` in `test_grbl_communicator.py`, using `unittest.mock` to simulate serial port interactions.
- Updated `README.md` with details on the new backend, configuration instructions for serial port/baud rate, and dependency information.
The system now allows you to send G-code from the frontend, which is then relayed to the connected GRBL device. Error handling for connection issues and GRBL errors is included.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've implemented a backend system to send G-code commands directly to a GRBL-based pen plotter via a serial connection.
Key changes include:
grbl_communicator.pywith aGRBLCommunicatorclass to handle serial connection, G-code command sending, and GRBL response parsing ('ok', 'error')./api/send_jobroute inapp.pyto utilizeGRBLCommunicatorfor processing and sending G-code jobs. Includes default serial port and baud rate configuration.pyserialtorequirements.txtfor serial communication.GRBLCommunicatorintest_grbl_communicator.py, usingunittest.mockto simulate serial port interactions.README.mdwith details on the new backend, configuration instructions for serial port/baud rate, and dependency information.The system now allows you to send G-code from the frontend, which is then relayed to the connected GRBL device. Error handling for connection issues and GRBL errors is included.