|
| 1 | +import mip |
| 2 | +import urequests as requests |
| 3 | +import network |
| 4 | +import os |
| 5 | +import machine |
| 6 | + |
| 7 | +ssid = 'YOUR NETWORK NAME' |
| 8 | +password = 'YOUR NETWORK PASS' |
| 9 | + |
| 10 | +sta_if = network.WLAN(network.STA_IF) |
| 11 | + |
| 12 | +FILEPREFIX = 'https://raw.githubusercontent.com/asherevan/microOS/master/' |
| 13 | + |
| 14 | +def downloadfile(filename, path): |
| 15 | + print('Downloading '+filename) |
| 16 | + r=requests.get(FILEPREFIX+path).text |
| 17 | + file=open(filename, 'w') |
| 18 | + file.write(r) |
| 19 | + file.close() |
| 20 | + |
| 21 | +print('Connecting to network: '+ssid) |
| 22 | +sta_if.active(True) |
| 23 | +sta_if.connect(ssid, password) |
| 24 | +while not sta_if.isconnected(): |
| 25 | + print('.') |
| 26 | + |
| 27 | +print('Installing SD Card library') |
| 28 | +mip.install('sdcard') |
| 29 | +print('Installing String library') |
| 30 | +mip.install('string') |
| 31 | + |
| 32 | +#create directories |
| 33 | +os.mkdir('/system') |
| 34 | +os.mkdir('/apps') |
| 35 | +os.mkdir('/tmp') |
| 36 | +os.mkdir('/system/drivers') |
| 37 | + |
| 38 | +downloadfile('/boot.py', 'boot.py') |
| 39 | +downloadfile('/system/microOS.py', 'microOS.py') |
| 40 | +downloadfile('/system/functions.py', 'functions.py') |
| 41 | +downloadfile('/system/systemsettings.txt', 'systemsettings.txt') |
| 42 | +downloadfile('/system/sound.py', 'sound.py') |
| 43 | +downloadfile('/system/appRefresh.py', 'appRefresh.py') |
| 44 | +downloadfile('/system/drivers/drivers.conf', 'drivers/drivers.conf') |
| 45 | +downloadfile('/system/drivers/analog_joystick_driver.py', 'drivers/analog_joystick_driver.py') |
| 46 | +downloadfile('/system/drivers/externalSD.py', 'drivers/analog_joystick_driver.py') |
| 47 | +downloadfile('/system/drivers/onscreen_keyboard.py', 'drivers/onscreen_keyboard.py') |
| 48 | +downloadfile('/system/drivers/st7789_driver.py', 'drivers/st7789_driver.py') |
| 49 | + |
| 50 | +print('MicroOS has now been installed!') |
| 51 | +print('You will need to restart your device.') |
| 52 | + |
| 53 | +#os.remove('./installer.py') |
| 54 | + |
| 55 | +#time.sleep(1) |
| 56 | +#machine.reset() |
0 commit comments