refactor: update serial port handling and dependencies #1
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jonasclaes/go-thermal-printer!1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/refactor-serial-implementation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull Request Overview
This PR refactors the serial port handling by migrating from the
jacobsa/go-seriallibrary togo.bug.st/serialand modernizes the printer communication architecture.Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
@ -1,95 +1,99 @@package escposUsing log.Fatalf will terminate the entire application when buffer reset fails. This should return an error or use a less severe logging level to allow graceful error handling.
@ -27,24 +26,48 @@ type StatusRequest struct {}The serial port path is hardcoded to "/dev/ttyUSB0" which may not work across different systems. Consider making this configurable through environment variables or configuration parameters.
@ -147,7 +164,7 @@ func (pm *PrintService) Print(ctx context.Context, data []byte) error {}select {The print method now writes to ps.printer instead of the serial port directly, but the printer should write to the underlying serial port. This change may break the printing functionality.
Pull Request Overview
This PR modernizes the serial port handling by replacing the deprecated
github.com/jacobsa/go-seriallibrary withgo.bug.st/serialand introduces a configuration system using TOML files. The changes make the application more configurable and use a more maintained serial library.Reviewed Changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
@ -27,24 +26,48 @@ type StatusRequest struct {}The StopBits field is set to OneStopBit initially but then immediately overridden by the switch statement below. Consider removing this redundant initialization to improve code clarity.
The Parity field is set to NoParity initially but then immediately overridden by the switch statement below. Consider removing this redundant initialization to improve code clarity.
@ -172,3 +188,4 @@case ps.statusQueue <- req:// Status request queued successfully, wait for responseselect {case status := <-response:The print method is writing data to ps.printer instead of ps.port. This appears inconsistent with the previous implementation which wrote directly to the port. Verify that the ESCPOS Write method handles the data correctly for printing.