Skip to content

Commit f91de65

Browse files
committed
fix camera issue
1 parent 4f3ef2a commit f91de65

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/frame_sdk/camera.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ async def take_photo(self, autofocus_seconds: Optional[int] = 3, quality: Qualit
7373
if image_buffer is None or len(image_buffer) == 0:
7474
raise Exception("Failed to get photo")
7575

76+
while image_buffer[0] == 0x04 and len(image_buffer) < 5:
77+
print("Ignoring tap data while waiting for photo")
78+
image_buffer = await self.frame.bluetooth.wait_for_data()
79+
80+
if image_buffer is None or len(image_buffer) == 0:
81+
raise Exception("Failed to get photo")
82+
7683
if self.auto_process_photo:
7784
image_buffer = self.process_photo(image_buffer, autofocus_type)
7885
return image_buffer

src/frame_sdk/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ async def sleep(self, deep_sleep: bool = False) -> None:
162162
if self._callback_on_wake is not None:
163163
run_on_wake = "frame.bluetooth.send('\\x"+FrameDataTypePrefixes.WAKE.value_as_hex+"');"+run_on_wake
164164
run_on_wake = "if not is_awake then;is_awake=true;"+run_on_wake+";end"
165-
self.motion.run_on_tap(run_on_wake)
165+
await self.motion.run_on_tap(run_on_wake)
166166
await self.run_lua("frame.display.text(' ',1,1);frame.display.show();frame.camera.sleep()", checked=True)
167167
self.camera.is_awake = False
168168

0 commit comments

Comments
 (0)