Repository navigation
Add buzzer() command - #1405
Open
zaydmulani09 wants to merge 1 commit into
Open
Add buzzer() command#1405zaydmulani09 wants to merge 1 commit into
zaydmulani09 wants to merge 1 commit into
Conversation
Sends ESC B n t to trigger the printer's buzzer, matching the byte sequence used by python-escpos's buzzer() implementation. n and t are both restricted to 1-9 per that command's spec. Closes mike42#174
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.
Closes #174.
Adds a
buzzer($times, $duration)method that sendsESC B n tto trigger the printer's internal buzzer, for printers that have one (referenced in #174 by two people with Metapace/Sewoo/Epson hardware).I couldn't find a live copy of the Epson ESC/POS reference linked in the issue (epson-biz.com now redirects to a closure notice), so I cross-checked against python-escpos's
buzzer(), which implements the sameESC B n tcommand and is a maintained, tested reference: https://github.com/python-escpos/python-escpos/blob/main/src/escpos/escpos.py#L1548. Bothn(times) andt(duration) are restricted to 1-9 there, so I kept the same bounds.I don't own a printer with a buzzer, so this is unverified against real hardware — it's implemented and tested the same way as the existing
pulse()command (byte-for-byte assertions inEscposTest.php), but someone with one of the printers mentioned in the issue should confirm it actually beeps before merge.Ran the full suite locally (
phpunit,phpcs --standard=psr2): 266 tests, same 22 pre-existing Windows-only failures as on a cleandevelopmentcheckout (shell-quoting differences inWindowsPrintConnectorTest, unrelated to this change).