Skip to content

Commit 093da7b

Browse files
camera_app.py: only try for supported hardware
1 parent 2660ef1 commit 093da7b

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
def onResume(self, screen):
106+
try:
107+
assert(current_hardware == "unix" or current_hardware == "waveshare-esp32-s3-touch-lcd-2")
108+
except Exception as e: # 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
if self.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
from machine import Pin, SPI
56
import st7789

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
import lcd_bus
45
import lvgl as lv

0 commit comments

Comments
 (0)