Skip to content

Conversation

@adcondev
Copy link
Owner

Implemented automatic calculation of QR code MaxPixelWidth based on the printer profile configuration. This replaces the hardcoded switch statement that only supported standard 58mm and 80mm widths, allowing for correct QR sizing on printers with different DPIs or paper widths.

  • Modified pkg/service/printer_service.go to calculate MaxPixelWidth using DotsPerLine, PrintWidth, PaperWidth, and DPI.
  • Added pkg/service/qr_test.go to verify the calculation logic across different scenarios.
  • Updated LEARNING.md to document the new dynamic sizing feature.

PR created automatically by Jules for task 4903696488801770730 started by @adcondev

Calculates default QR options (dots per line) based on the printer profile (DPI and Paper Width/DotsPerLine) to ensure proper sizing on different printer models.
Prioritizes `DotsPerLine` from profile, falling back to calculation based on `PrintWidth` or `PaperWidth` and `DPI`.
Includes unit tests for various profile configurations.
Updates LEARNING.md with new feature details.

Co-authored-by: adcondev <38170282+adcondev@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings February 12, 2026 16:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

👋 Thanks for opening this PR, @adcondev!

Here's what will happen next:

  • 🤖 Automated checks will run
  • 🏷️ Labels will be added automatically
  • 👀 A maintainer will review your changes

Please make sure:

  • ✅ All tests pass
  • 📝 The PR title follows conventional commits
  • 📋 The PR template is filled out completely

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

⚡ Benchmark Results

📈 Performance Comparison

📊 Click to expand detailed results

Current Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3123 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3609886	       332.1 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  396123	      2811 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  537199	      2062 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  517658	      2332 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   94582	     12727 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  420602	      2683 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  275415	      4165 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  534871	      2160 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  242685	      4803 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 8571564	       138.4 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 6747636	       177.2 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	362332773	         3.277 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	36542439	        36.54 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14535220	        82.65 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  499003	      2416 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  137240	      8537 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     576	   2038296 ns/op	 3469933 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     294	   4254574 ns/op	 5481087 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     141	   8741359 ns/op	 5235280 B/op	  230723 allocs/op

Base Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3115 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3725599	       323.8 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  422442	      2753 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  527313	      2138 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  510448	      2311 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   93404	     12627 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  428556	      2708 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  276584	      4173 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  516481	      2118 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  243327	      4775 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 8724670	       136.0 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 6621434	       185.0 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	373246788	         3.223 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	31888278	        38.48 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14520705	        83.68 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  468417	      2560 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  130690	      9138 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     621	   1909765 ns/op	 3469935 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     309	   4006994 ns/op	 5481084 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     136	   8650063 ns/op	 5235277 B/op	  230723 allocs/op

💡 Note: Use benchstat for statistical comparison

🎯 Summary

  • Total Benchmarks: 32
  • Average Speed: 2714438 ns/op
  • Average Memory: 2396935 B/op
  • Average Allocations: 41093 allocs/op

Calculates default QR options (dots per line) based on the printer profile (DPI and Paper Width/DotsPerLine) to ensure proper sizing on different printer models.
Prioritizes `DotsPerLine` from profile, falling back to calculation based on `PrintWidth` or `PaperWidth` and `DPI`.
Includes unit tests for various profile configurations.
Updates LEARNING.md with new feature details.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@github-actions github-actions bot added documentation Improvements or additions to documentation tests size/M labels Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/M size/XS tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant