Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit093da7b

Browse files
camera_app.py: only try for supported hardware
1 parent2660ef1 commit093da7b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

‎internal_filesystem/apps/com.micropythonos.camera/assets/camera_app.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,16 @@ def onCreate(self):
9898
self.status_label=lv.label(self.status_label_cont)
9999
self.status_label.set_text("No camera found.")
100100
self.status_label.set_long_mode(lv.label.LONG.WRAP)
101-
self.status_label.set_style_text_color(lv.color_white(),0)
102101
self.status_label.set_width(lv.pct(100))
103102
self.status_label.center()
104103
self.setContentView(main_screen)
105104

106105
defonResume(self,screen):
106+
try:
107+
assert(current_hardware=="unix"orcurrent_hardware=="waveshare-esp32-s3-touch-lcd-2")
108+
exceptExceptionase:# use an assert in case current_hardware isn't defined for some boards
109+
print("WARNING: the current_hardware doesn't have support for a camera!")
110+
return
107111
self.cam=init_internal_cam()
108112
ifself.cam:
109113
self.image.set_rotation(900)# internal camera is rotated 90 degrees

‎internal_filesystem/boot.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Hardware initialization for ESP32-S3-Touch-LCD-2
22
# Manufacturer's website at https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-2
3+
current_hardware="waveshare-esp32-s3-touch-lcd-2"
34

45
frommachineimportPin,SPI
56
importst7789

‎internal_filesystem/boot_unix.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Hardware initialization for Unix and MacOS systems
2+
current_hardware="unix"
23

34
importlcd_bus
45
importlvglaslv

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp