File tree Expand file tree Collapse file tree 5 files changed +23
-17
lines changed
Expand file tree Collapse file tree 5 files changed +23
-17
lines changed Original file line number Diff line number Diff line change 1+ # This file is the only one that can't be overridden (without rebuilding) for development, so keep it minimal.
2+
3+ # Make sure the storage partition's /lib is first in the path, so whatever is placed there overrides frozen libraries
4+ # This allows a "prod[uction]" build to be used for development as well, just by overriding the libraries in /lib
5+ import sys
6+ sys .path .insert (0 , '/lib' )
7+
8+ print ("Passing execution over to MicroPythonOS's main.py" )
9+ import mpos .main
10+
Original file line number Diff line number Diff line change 1313import lvgl as lv
1414import task_handler
1515
16- import mpos .info
1716import mpos .ui
1817import mpos .ui .focus_direction
1918
20- mpos .info .set_hardware_id ("fri3d-2024" )
2119
2220# Pin configuration
2321SPI_BUS = 2
Original file line number Diff line number Diff line change 33import lvgl as lv
44import sdl_display
55
6- # Add lib/ to the path for modules, otherwise it will only search in ~/.micropython/lib and /usr/lib/micropython
7- import sys
8- sys .path .append ('lib/' )
9-
106import mpos .clipboard
117import mpos .indev .mpos_sdl_keyboard
12- import mpos .info
138import mpos .ui
149import mpos .ui .focus_direction
1510
16- mpos .info .set_hardware_id ("linux-desktop" )
17-
1811# Same as Waveshare ESP32-S3-Touch-LCD-2 and Fri3d Camp 2026 Badge
1912TFT_HOR_RES = 320
2013TFT_VER_RES = 240
Original file line number Diff line number Diff line change 1111import task_handler
1212
1313import mpos .ui
14- import mpos .info
15-
16- mpos .info .set_hardware_id ("waveshare-esp32-s3-touch-lcd-2" )
1714
1815# Pin configuration
1916SPI_BUS = 2
9289try :
9390 from machine import Pin , I2C
9491 i2c = I2C (1 , scl = Pin (16 ), sda = Pin (21 )) # Adjust pins and frequency
95- devices = i2c .scan ()
96- print ("Scan of I2C bus on scl=16, sda=21:" )
97- print ([hex (addr ) for addr in devices ]) # finds it on 60 = 0x3C after init
92+ # Warning: don't do an i2c scan because it confuses the camera!
9893 camera_addr = 0x3C # for OV5640
9994 reg_addr = 0x3008
10095 reg_high = (reg_addr >> 8 ) & 0xFF # 0x30
Original file line number Diff line number Diff line change 1111# Auto-detect and initialize hardware
1212import sys
1313if sys .platform == "linux" or sys .platform == "darwin" : # linux and macOS
14- import mpos . board . linux
14+ board = " linux"
1515elif sys .platform == "esp32" :
16- print ("TODO: detect which esp32 this is and then load the appropriate board" )
16+ board = "fri3d-2024" # default fallback
17+ import machine
18+ from machine import Pin , I2C
19+ i2c0 = I2C (0 , sda = machine .Pin (48 ), scl = machine .Pin (47 ))
20+ if i2c0 .scan () == [21 , 107 ]: # touch screen and IMU
21+ board = "waveshare-esp32-s3-touch-lcd-2"
22+
23+ print (f"Detected hardware { board } , initializing..." )
24+ import mpos .info
25+ mpos .info .set_hardware_id (board )
26+ __import__ (f"mpos.board.{ board } " )
1727
1828# Allow LVGL M:/path/to/file or M:relative/path/to/file to work for image set_src etc
1929import mpos .fs_driver
You can’t perform that action at this time.
0 commit comments