Skip to content

Commit a23fb7c

Browse files
Cleanup boot_unix.py
It had some leftover code for the OV5640 camera, which is currently only supported on the ESP32.
1 parent 9fac0c6 commit a23fb7c

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

internal_filesystem/boot_unix.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,4 @@ def catch_escape_key(indev, indev_data):
7171
# print(f"boot_unix: code={event_code}") # target={event.get_target()}, user_data={event.get_user_data()}, param={event.get_param()}
7272
#keyboard.add_event_cb(keyboard_cb, lv.EVENT.ALL, None)
7373

74-
# On the Waveshare ESP32-S3-Touch-LCD-2, the camera is hard-wired to power on,
75-
# so it needs a software power off to prevent it from staying hot all the time and quickly draining the battery.
76-
# 1) Initialize camera, otherwise it doesn't reply to I2C commands:
77-
try:
78-
from camera import Camera
79-
cam = Camera(data_pins=[12,13,15,11,14,10,7,2],vsync_pin=6,href_pin=4,sda_pin=21,scl_pin=16,pclk_pin=9,xclk_pin=8,xclk_freq=20000000,powerdown_pin=-1,reset_pin=-1,pixel_format=PixelFormat.RGB565,frame_size=FrameSize.R240X240,grab_mode=GrabMode.LATEST)
80-
cam.deinit()
81-
except Exception as e:
82-
print(f"camera init for power off got exception: {e}")
83-
# 2) Soft-power off camera, otherwise it uses a lot of current for nothing:
84-
try:
85-
from machine import Pin, I2C
86-
i2c = I2C(1, scl=Pin(16), sda=Pin(21)) # Adjust pins and frequency
87-
devices = i2c.scan()
88-
print("Scan of I2C bus on scl=16, sda=21:")
89-
print([hex(addr) for addr in devices]) # finds it on 60 = 0x3C after init
90-
camera_addr = 0x3C # for OV5640
91-
reg_addr = 0x3008
92-
reg_high = (reg_addr >> 8) & 0xFF # 0x30
93-
reg_low = reg_addr & 0xFF # 0x08
94-
power_off_command = 0x42 # Power off command
95-
i2c.writeto(camera_addr, bytes([reg_high, reg_low, power_off_command]))
96-
except Exception as e:
97-
print(f"Warning: powering off camera got exception: {e}")
98-
9974
print("boot_unix.py finished")

0 commit comments

Comments
 (0)