-
Notifications
You must be signed in to change notification settings - Fork 11
Fix check_for_low double-fire on button release #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8cf1e9a
429199c
30081c9
8927ddf
71229dd
9660a19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |||||||||||||||||||||||||||||||||||||||||
| # screens with buttons. | ||||||||||||||||||||||||||||||||||||||||||
| RET_CODE__BACK_BUTTON = 1000 | ||||||||||||||||||||||||||||||||||||||||||
| RET_CODE__POWER_BUTTON = 1001 | ||||||||||||||||||||||||||||||||||||||||||
| RET_CODE__DISPLAY_TOGGLE = 1002 | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -866,7 +867,7 @@ def run(self): | |||||||||||||||||||||||||||||||||||||||||
| # Display the brightness tips toast | ||||||||||||||||||||||||||||||||||||||||||
| duration = 10 ** 9 * 1.2 # 1.2 seconds | ||||||||||||||||||||||||||||||||||||||||||
| if is_brightness_tip_enabled and time.time_ns() - self.tips_start_time.cur_count < duration: | ||||||||||||||||||||||||||||||||||||||||||
| image = self.qr_encoder.part_to_image(self.qr_encoder.cur_part(), 240, 240, border=2, background_color=hex_color) | ||||||||||||||||||||||||||||||||||||||||||
| image = self.qr_encoder.part_to_image(self.qr_encoder.cur_part(), self.renderer.canvas_width, self.renderer.canvas_height, border=2, background_color=hex_color) | ||||||||||||||||||||||||||||||||||||||||||
| self.render_brightness_tip(image) | ||||||||||||||||||||||||||||||||||||||||||
| pending_encoder_restart = True | ||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -876,7 +877,7 @@ def run(self): | |||||||||||||||||||||||||||||||||||||||||
| # brightness tip is stowed. | ||||||||||||||||||||||||||||||||||||||||||
| self.qr_encoder.restart() | ||||||||||||||||||||||||||||||||||||||||||
| pending_encoder_restart = False | ||||||||||||||||||||||||||||||||||||||||||
| image = self.qr_encoder.next_part_image(240, 240, border=2, background_color=hex_color) | ||||||||||||||||||||||||||||||||||||||||||
| image = self.qr_encoder.next_part_image(self.renderer.canvas_width, self.renderer.canvas_height, border=2, background_color=hex_color) | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
| image = self.qr_encoder.next_part_image(self.renderer.canvas_width, self.renderer.canvas_height, border=2, background_color=hex_color) | |
| canvas_width = self.renderer.canvas_width | |
| canvas_height = self.renderer.canvas_height | |
| qr_side = min(canvas_width, canvas_height) | |
| qr_image = self.qr_encoder.next_part_image( | |
| qr_side, | |
| qr_side, | |
| border=2, | |
| background_color=hex_color, | |
| ) | |
| # Center the square QR image on the full canvas to preserve aspect ratio | |
| if qr_side == canvas_width and qr_side == canvas_height: | |
| image = qr_image | |
| else: | |
| # Use the same background color as the QR image | |
| background = "#" + hex_color | |
| image = Image.new(qr_image.mode, (canvas_width, canvas_height), background) | |
| offset_x = (canvas_width - qr_side) // 2 | |
| offset_y = (canvas_height - qr_side) // 2 | |
| image.paste(qr_image, (offset_x, offset_y)) |
Copilot
AI
Mar 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title/description focus on the phantom camera button press fix, but this PR also adds a home-screen very-long-press shortcut for switching display drivers (and related display driver/settings/docs changes). Please update the PR description/title to reflect this added scope, or split into separate PRs to keep review risk isolated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QR images are now generated using (canvas_width, canvas_height). On non-square canvases (e.g. ILI9341 where canvas is 240x320), this will stretch the QR code via qrencode/PIL resize, which can reduce scan reliability. Consider generating a square QR image using a single size (e.g. min(canvas_width, canvas_height)) and centering/padding it instead of resizing to a rectangle.