Start sync program, add stls
This commit is contained in:
parent
595a2eb1e3
commit
70c0702236
|
@ -0,0 +1,2 @@
|
|||
|
||||
TEST 1 text here
|
|
@ -0,0 +1 @@
|
|||
Test 2 dat
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
{"device_name": "rmgr's pda", "time": "695932424", "timezone": "+10:30", "primary_colour": "blue", "wifi_ssid": "SSID", "wifi_password": "PASSWORD" }
|
|
@ -0,0 +1,54 @@
|
|||
class sync():
|
||||
def __init__(self, parent_object):
|
||||
import gc
|
||||
parent_object.destroy()
|
||||
import socket
|
||||
import network
|
||||
gc.collect()
|
||||
station = network.WLAN(network.STA_IF)
|
||||
station.active(True)
|
||||
|
||||
user_settings = {}
|
||||
with open('sd/appdata/settings/settings.json') as json_file:
|
||||
user_settings = json.load(json_file)
|
||||
#station.connect("THE INTERNET", "aG22p]H{")
|
||||
station.connect(user_settings["wifi_ssid"], user_settings["wifi_password"])
|
||||
while not station.isconnected():
|
||||
time.sleep(1)
|
||||
print(station.ifconfig())
|
||||
### MAYBE WE'RE LOSING CONNECTION???
|
||||
# addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
|
||||
# s = socket.socket()
|
||||
# s.bind(addr)
|
||||
# s.listen(1)
|
||||
# print("listening on ", addr)
|
||||
# while True:
|
||||
# print ('waiting for you uwu')
|
||||
# cl, addr = s.accept()
|
||||
# print('client connected from', addr)
|
||||
# cl_file = cl.makefile('rwb', 0)
|
||||
# while True:
|
||||
# line = cl_file.readline()
|
||||
# if not line or line == b'\r\n':
|
||||
# break
|
||||
#rows = ['<tr><td>%s</td><td>%d</td></tr>' % (str(p), p.value()) for p in pins]
|
||||
# response = html % '\n'.join(rows)
|
||||
# cl.send('HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n')
|
||||
# cl.send(response)
|
||||
# cl.close()
|
||||
|
||||
addr_info = socket.getaddrinfo("towel.blinkenlights.nl", 23)
|
||||
addr = addr_info[0][-1]
|
||||
|
||||
s = socket.socket()
|
||||
s.connect(addr)
|
||||
while True:
|
||||
data = s.recv(500)
|
||||
print(str(data, 'utf8'), end='')
|
||||
|
||||
def destroy(self):
|
||||
for obj in self.objects:
|
||||
obj.delete()
|
||||
self.objects.remove(obj)
|
||||
|
||||
n = sync(launcher)
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
mount /dev/sdd1 /mnt/sd
|
||||
cp /home/jake/dev/diy-pda/apps/*.py /mnt/sd/apps/
|
||||
cp -r /home/jake/dev/diy-pda/appdata/* /mnt/sd/appdata/
|
||||
umount /mnt/sd
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
14
main.py
14
main.py
|
@ -1,16 +1,24 @@
|
|||
import lvgl as lv
|
||||
import espidf as esp
|
||||
import os,machine,sdcard
|
||||
import json
|
||||
import time
|
||||
|
||||
#Initialise hardware
|
||||
lv.init()
|
||||
from ili9XXX import ili9341
|
||||
disp = ili9341(dc=21, miso=19, mosi=23, cs=5, clk=18)
|
||||
disp = ili9341(dc=21, miso=19, mosi=23, cs=5, clk=18, factor=16, double_buffer=True)
|
||||
from xpt2046 import xpt2046
|
||||
touch = xpt2046(cs=27, cal_x0=242, cal_x1=3300, cal_y0=3850, cal_y1=423)
|
||||
sd = sdcard.SDCard(machine.SoftSPI(sck=machine.Pin(13),miso=machine.Pin(14),mosi=machine.Pin(15)), machine.Pin(25))
|
||||
os.mount(sd,'/sd')
|
||||
|
||||
user_settings = {}
|
||||
with open('sd/appdata/settings/settings.json') as json_file:
|
||||
user_settings = json.load(json_file)
|
||||
current_datetime = time.gmtime(int(user_settings["time"]))
|
||||
rtc = machine.RTC()
|
||||
rtc.datetime(current_datetime)
|
||||
print(rtc.datetime())
|
||||
#Launcher application
|
||||
class Launcher():
|
||||
def __init__(self):
|
||||
|
@ -32,7 +40,7 @@ class Launcher():
|
|||
self.btn = e.get_target()
|
||||
label = self.btn.get_child(0)
|
||||
print("Executing " + label.get_text())
|
||||
exec(open("/sd/apps/"+ label.get_text()).read(), {'lv':lv, 'launcher': self, 'os':os, }, {})
|
||||
exec(open("/sd/apps/"+ label.get_text()).read(), {'lv':lv, 'launcher': self, 'os':os, 'json':json, 'time':time}, {})
|
||||
|
||||
def destroy(self):
|
||||
print("destroying launcher")
|
||||
|
|
Loading…
Reference in New Issue