mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
scripts/libraries: Update Alif HP boot script.
Create readme.txt, main.py and openmv_disk. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
ad5d86d37d
commit
b435a2d0eb
@ -3,6 +3,44 @@ import os
|
||||
import alif
|
||||
import vfs
|
||||
|
||||
main_py = """import time
|
||||
from machine import LED
|
||||
|
||||
led = LED("LED_BLUE")
|
||||
|
||||
while True:
|
||||
led.on()
|
||||
time.sleep_ms(150)
|
||||
led.off()
|
||||
time.sleep_ms(100)
|
||||
led.on()
|
||||
time.sleep_ms(150)
|
||||
led.off()
|
||||
time.sleep_ms(600)
|
||||
"""
|
||||
|
||||
readme_txt = """Thank you for supporting the OpenMV project!
|
||||
|
||||
To download the IDE, please visit:
|
||||
https://openmv.io/pages/download
|
||||
|
||||
For tutorials and documentation, please visit:
|
||||
http://docs.openmv.io/
|
||||
|
||||
For technical support and projects, please visit the forums:
|
||||
http://forums.openmv.io/
|
||||
|
||||
Please use github to report bugs and issues:
|
||||
https://github.com/openmv/openmv
|
||||
"""
|
||||
|
||||
|
||||
def create_file(path, data=None):
|
||||
with open(path, "w") as f:
|
||||
if data is not None:
|
||||
f.write(data)
|
||||
|
||||
|
||||
bdev = alif.Flash()
|
||||
try:
|
||||
fat = vfs.VfsFat(bdev)
|
||||
@ -11,9 +49,16 @@ except:
|
||||
vfs.VfsFat.mkfs(bdev)
|
||||
fat = vfs.VfsFat(bdev)
|
||||
vfs.mount(fat, "/flash")
|
||||
create_file("/flash/main.py", main_py)
|
||||
create_file("/flash/README.txt", readme_txt)
|
||||
|
||||
os.chdir("/flash")
|
||||
sys.path.append("/flash")
|
||||
sys.path.append("/flash/lib")
|
||||
os.chdir("/flash")
|
||||
|
||||
try:
|
||||
os.stat(".openmv_disk")
|
||||
except Exception:
|
||||
create_file(".openmv_disk")
|
||||
|
||||
del sys, os, alif, bdev
|
||||
|
Loading…
Reference in New Issue
Block a user