Skip to content

Conversation

@ariel-nathan
Copy link

📝 Description
This PR addresses a critical bug in the printWrappedUpsideDown function where newline characters (\n) in user input were not being handled properly, causing malformed output on the thermal printer.

🐞 Bug Fix
Problem: When users entered text with newlines (e.g., pressing Shift + Enter in the web form), the thermal printer would produce garbled output with incorrect line ordering and spacing.

Before:

Input: "Todo:\n[ ] Task 1\n[ ] Task 2\n[ ] Task 3\n[ ] Task 4"

Printed:
[ ]
[ ] Task 2
[ ] Task 1
Todo:
[ ] Task 4
Task 3

After:

Input: "Todo:\n[ ] Task 1\n[ ] Task 2\n[ ] Task 3\n[ ] Task 4"

Printed:
Todo:
[ ] Task 1
[ ] Task 2
[ ] Task 3
[ ] Task 4

Code formatting improvements:

  • Applied VSCode C/C++ extension formatting for better readability

📋 Technical Details
The updated function now:

  • Splits input text by newline characters first
  • Applies word wrapping to each line segment individually
  • Maintains the existing 32-character line limit (maxCharsPerLine)
  • Preserves the reverse printing order for proper 180° rotation display

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