Skip to content

Commit d166d46

Browse files
Merge pull request #1 from brilliantlabsAR/camera/fix
camera
2 parents db36eba + 1c2e8e5 commit d166d46

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ async def main():
122122
# draw the endcap of the battery
123123
await f.display.draw_rect(640-32,40 + batteryHeight//2-8, 32, 16, PaletteColors.WHITE)
124124
# draw the battery outline
125-
await f.display.draw_rect_filled(640-16-batteryWidth, 40-8, batteryWidth+16, batteryHeight+16, PaletteColors.WHITE, 1, 15)
125+
await f.display.draw_rect_filled(640-16-batteryWidth, 40-8, batteryWidth+16, batteryHeight+16, 1, PaletteColors.WHITE, PaletteColors.YELLOW)
126126
# fill the battery based on level
127127
await f.display.draw_rect(640-8-batteryWidth, 40, int(batteryWidth * 0.01 * batteryPercent), batteryHeight, color)
128128
# write the battery level

src/frame_sdk/camera.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ class AutofocusType(Enum):
2323
class Camera:
2424
"""Helpers for working with the Frame camera."""
2525

26+
2627
frame: "Frame" = None
2728

2829
_auto_process_photo = True
2930

3031
def __init__(self, frame: "Frame"):
3132
"""Initialize the Camera with a Frame instance."""
3233
self.frame = frame
33-
self.is_awake = True
3434

3535
@property
3636
def auto_process_photo(self) -> bool:
@@ -43,7 +43,7 @@ def auto_process_photo(self, value: bool):
4343
self._auto_process_photo = value
4444

4545

46-
async def take_photo(self, autofocus_seconds: Optional[int] = 3, quality: Quality = Quality.MEDIUM, autofocus_type: AutofocusType = AutofocusType.AVERAGE) -> bytes:
46+
async def take_photo(self, autofocus_seconds: Optional[int] = 3, quality: Quality = Quality.MEDIUM, autofocus_type: AutofocusType = AutofocusType.CENTER_WEIGHTED) -> bytes:
4747
"""Take a photo with the camera.
4848
4949
Args:
@@ -58,10 +58,6 @@ async def take_photo(self, autofocus_seconds: Optional[int] = 3, quality: Qualit
5858
Exception: If the photo capture fails.
5959
"""
6060

61-
if not self.is_awake:
62-
await self.frame.run_lua("frame.camera.wake()", checked=True)
63-
self.is_awake = True
64-
6561
if type(quality) == int:
6662
quality = Quality(quality)
6763
if type(autofocus_type) == int:

src/frame_sdk/library_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
state_time = frame.time.utc()
105105
state = 'WAIT'
106106
elseif state == 'WAIT' then
107-
if frame.time.utc() > state_time + 0.5 then
107+
if frame.camera.image_ready() then
108108
state = 'SEND'
109109
end
110110
elseif state == 'SEND' then

0 commit comments

Comments
 (0)