Skip to content

Commit

Permalink
Merge pull request #12 from odudex/new_features
Browse files Browse the repository at this point in the history
 visible QR scan progress bar on all devices
  • Loading branch information
tadeubas authored Mar 29, 2023
2 parents 572a5a9 + 046df40 commit 4538e04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/krux/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ def capture_qr_code_loop(self, callback):
res = img.find_qrcodes()
if board.config["type"] == "m5stickv":
img.lens_corr(strength=1.0, zoom=0.56)
lcd.display(img)
lcd.display(img, oft=(0, 0), roi=(68, 52, 185, 135))
elif board.config["type"].startswith("amigo"):
lcd.display(img, oft=(40, 40))
else:
lcd.display(img, oft=(0, 0), roi=(0, 0, 304, 240))
if len(res) > 0:
data = res[0].payload()

Expand Down
15 changes: 11 additions & 4 deletions src/krux/pages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,20 @@ def callback(part_total, num_parts_captured, new_part):
# Indicate progress to the user that a new part was captured
if new_part:
self.ctx.display.to_portrait()
filled = self.ctx.display.usable_width() * num_parts_captured
filled = self.ctx.display.width() * num_parts_captured
filled //= part_total
self.ctx.display.width()
if self.ctx.display.height() < 320: # M5StickV
height = 210
elif self.ctx.display.height() > 320: # Amigo
height = 380
else:
height = 305
self.ctx.display.fill_rectangle(
DEFAULT_PADDING,
self.ctx.display.height() // 2 - self.ctx.display.font_height // 2,
0,
height,
filled,
self.ctx.display.font_height,
15,
lcd.WHITE,
)
time.sleep_ms(QR_CODE_STEP_TIME)
Expand Down

0 comments on commit 4538e04

Please sign in to comment.