diff --git a/MicroPython_BUILD/components/internalfs_image/image/main.py b/MicroPython_BUILD/components/internalfs_image/image/main.py index a803e8d..bdd7fd5 100644 --- a/MicroPython_BUILD/components/internalfs_image/image/main.py +++ b/MicroPython_BUILD/components/internalfs_image/image/main.py @@ -3,7 +3,7 @@ import machine, network, utime print("") print("Starting WiFi ...") sta_if = network.WLAN(network.STA_IF); sta_if.active(True) -sta_if.connect("MasterHax_5G", "wittyercheese551") +sta_if.connect("mySSID", "wifi_password") tmo = 50 while not sta_if.isconnected(): utime.sleep_ms(100) diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/boot.py b/MicroPython_BUILD/components/internalfs_image/image_go/boot.py deleted file mode 100644 index aabbc23..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/boot.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file is executed on every boot (including wake-boot from deepsleep) - -import sys - -# Set default path -# Needed for importing modules and upip -sys.path[1] = '/flash/lib' diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/examples/main.py b/MicroPython_BUILD/components/internalfs_image/image_go/examples/main.py deleted file mode 100644 index bdd7fd5..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/examples/main.py +++ /dev/null @@ -1,34 +0,0 @@ -import machine, network, utime - -print("") -print("Starting WiFi ...") -sta_if = network.WLAN(network.STA_IF); sta_if.active(True) -sta_if.connect("mySSID", "wifi_password") -tmo = 50 -while not sta_if.isconnected(): - utime.sleep_ms(100) - tmo -= 1 - if tmo == 0: - sta_if.disconnect() - break - -if tmo > 0: - print("WiFi started") - utime.sleep_ms(500) - - rtc = machine.RTC() - print("Synchronize time from NTP server ...") - rtc.ntp_sync(server="hr.pool.ntp.org") - tmo = 100 - while not rtc.synced(): - utime.sleep_ms(100) - tmo -= 1 - if tmo == 0: - break - - if tmo > 0: - print("Time set") - utime.sleep_ms(500) - t = rtc.now() - utime.strftime("%c") - print("") diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/examples/mqtt_example.py b/MicroPython_BUILD/components/internalfs_image/image_go/examples/mqtt_example.py deleted file mode 100644 index cbd7a86..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/examples/mqtt_example.py +++ /dev/null @@ -1,22 +0,0 @@ - -def conncb(task): - print("[{}] Connected".format(task)) - -def disconncb(task): - print("[{}] Disconnected".format(task)) - -def subscb(task): - print("[{}] Subscribed".format(task)) - -def pubcb(pub): - print("[{}] Published: {}".format(pub[0], pub[1])) - -def datacb(msg): - print("[{}] Data arrived from topic: {}, Message:\n".format(msg[0], msg[1]), msg[2]) - -mqtt = network.mqtt("loboris", "loboris.eu", user="wifimcu", password="wifimculobo", cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb) - -mqtts = network.mqtt("eclipse", "iot.eclipse.org", secure=True, cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb) - - - diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/examples/ssd1306_spi_example.py b/MicroPython_BUILD/components/internalfs_image/image_go/examples/ssd1306_spi_example.py deleted file mode 100644 index 6dec2ef..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/examples/ssd1306_spi_example.py +++ /dev/null @@ -1,27 +0,0 @@ -import machine -from ssd1306 import SSD1306_SPI - -WIDTH = const(128) -HEIGHT = const (64) -pdc = machine.Pin(27, machine.Pin.OUT) -pcs = machine.Pin(26, machine.Pin.OUT) -sck_pin = machine.Pin(19, machine.Pin.OUT) -mosi_pin = machine.Pin(23, machine.Pin.IN) -miso_pin = machine.Pin(25, machine.Pin.OUT) - -prst = machine.Pin(18, machine.Pin.OUT) - -spi = machine.SPI(1,baudrate=1000000, sck=sck_pin, mosi=mosi_pin, miso=miso_pin) - -ssd = SSD1306_SPI(WIDTH, HEIGHT, spi, pdc, prst, pcs) - -import freesans20 - -from writer import Writer -wri2 = Writer(ssd, freesans20, verbose=True) - -Writer.set_clip(True, True) -Writer.set_textpos(0, 0) -wri2.printstring('MicroPython\n') - -ssd.show() diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/examples/tftdemo.py b/MicroPython_BUILD/components/internalfs_image/image_go/examples/tftdemo.py deleted file mode 100644 index ddf72ea..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/examples/tftdemo.py +++ /dev/null @@ -1,283 +0,0 @@ -""" -Demo program demonstrating the capabities of the MicroPython display module -Author: LoBo (https://github/loboris) -Date: 08/10/2017 - -""" - -import machine, display, time, math - -tft = display.TFT() - -#ESP32-WROVER-KIT v3: -#tft.init(tft.ST7789, rst_pin=18, backl_pin=5, miso=25,mosi=23,clk=19,cs=22,dc=21) - -#Adafruit: -#tft.init(tft.ILI9341, width=240, height=320, miso=19,mosi=18,clk=5,cs=15,dc=33, bgr=True) - -#Set correct configuration -tft.init(tft.ILI9341, width=240, height=320, miso=19,mosi=23,clk=18,cs=5,dc=26,tcs=27,hastouch=True, bgr=True) - -maxx = 240 -maxy = 320 -miny = 12 -touch = False - -# fonts used in this demo -fontnames = ( - tft.FONT_Default, - tft.FONT_7seg, - tft.FONT_Ubuntu, - tft.FONT_Comic, - tft.FONT_Tooney, - tft.FONT_Minya -) - - -# Check if the display is touched -#------------- -def touched(): - if not touch: - return False - else: - tch,_,_ = tft.gettouch() - if tch <= 0: - return False - else: - return True - -# print display header -#---------------------- -def header(tx, setclip): - # adjust screen dimensions (depends on used display and orientation) - global maxx, maxy, miny - - maxx, maxy = tft.screensize() - tft.clear() - if maxx < 240: - tft.font(tft.FONT_Small, rotate=0) - else: - tft.font(tft.FONT_Default, rotate=0) - _,miny = tft.fontSize() - miny += 5 - tft.rect(0, 0, maxx-1, miny-1, tft.OLIVE, tft.DARKGREY) - tft.text(tft.CENTER, 2, tx, tft.CYAN, transparent=True) - - if setclip: - tft.setwin(0, miny, maxx, maxy) - -# Display some fonts -#------------------- -def dispFont(sec=5): - header("DISPLAY FONTS", False) - - if maxx < 240: - tx = "MicroPython" - else: - tx = "Hi from MicroPython" - starty = miny + 4 - - n = time.time() + sec - while time.time() < n: - y = starty - x = 0 - i = 0 - while y < maxy: - if i == 0: - x = 0 - elif i == 1: - x = tft.CENTER - elif i == 2: - x = tft.RIGHT - i = i + 1 - if i > 2: - i = 0 - - for font in fontnames: - if font == tft.FONT_7seg: - tft.font(font) - tft.text(x,y,"-12.45/",machine.random(0xFFFFFF)) - else: - tft.font(font) - tft.text(x,y,tx, machine.random(0xFFFFFF)) - _,fsz = tft.fontSize() - y = y + 2 + fsz - if y > (maxy-fsz): - y = maxy - if touched(): - break - -# Display random fonts -#------------------------------ -def fontDemo(sec=5, rot=False): - tx = "FONTS" - if rot: - tx = "ROTATED " + tx - header(tx, True) - - tx = "ESP32-MicrpPython" - n = time.time() + sec - while time.time() < n: - frot = 0 - if rot: - frot = math.floor(machine.random(359)/5)*5 - for font in fontnames: - if (not rot) or (font != tft.FONT_7seg): - x = machine.random(maxx-8) - if font != tft.FONT_7seg: - tft.font(font, rotate=frot) - _,fsz = tft.fontSize() - y = machine.random(miny, maxy-fsz) - tft.text(x,y,tx, machine.random(0xFFFFFF)) - else: - l = machine.random(6,12) - w = machine.random(1,l // 3) - tft.font(font, rotate=frot, dist=l, width=w) - _,fsz = tft.fontSize() - y = machine.random(miny, maxy-fsz) - tft.text(x,y,"-12.45/", machine.random(0xFFFFFF)) - if touched(): - break - tft.resetwin() - -# Display random lines -#------------------- -def lineDemo(sec=5): - header("LINE DEMO", True) - - n = time.time() + sec - while time.time() < n: - x1 = machine.random(maxx-4) - y1 = machine.random(miny, maxy-4) - x2 = machine.random(maxx-1) - y2 = machine.random(miny, maxy-1) - color = machine.random(0xFFFFFF) - tft.line(x1,y1,x2,y2,color) - if touched(): - break - tft.resetwin() - -# Display random circles -#---------------------------------- -def circleDemo(sec=5,dofill=False): - tx = "CIRCLE" - if dofill: - tx = "FILLED " + tx - header(tx, True) - - n = time.time() + sec - while time.time() < n: - color = machine.random(0xFFFFFF) - fill = machine.random(0xFFFFFF) - x = machine.random(4, maxx-2) - y = machine.random(miny+2, maxy-2) - if x < y: - r = machine.random(2, x) - else: - r = machine.random(2, y) - if dofill: - tft.circle(x,y,r,color,fill) - else: - tft.circle(x,y,r,color) - if touched(): - break - tft.resetwin() - -#------------------ -def circleSimple(): - tx = "CIRCLE" - header(tx, True) - - x = 110 - y = 160 - r = 110 - z = 0 - while z < 12: - color = machine.random(0xFFFFFF) - fill = machine.random(0xFFFFFF) - tft.circle(x,y,r,color,fill) - r -= 10 - x += 10 - z += 1 - -# Display random ellipses -#----------------------------------- -def ellipseDemo(sec=5,dofill=False): - tx = "ELLIPSE" - if dofill: - tx = "FILLED " + tx - header(tx, True) - - n = time.time() + sec - while time.time() < n: - x = machine.random(4, maxx-2) - y = machine.random(miny+2, maxy-2) - if x < y: - rx = machine.random(2, x) - else: - rx = machine.random(2, y) - if x < y: - ry = machine.random(2, x) - else: - ry = machine.random(2, y) - color = machine.random(0xFFFFFF) - if dofill: - fill = machine.random(0xFFFFFF) - tft.ellipse(x,y,rx,ry,15, color,fill) - else: - tft.ellipse(x,y,rx,ry,15,color) - if touched(): - break - tft.resetwin() - -# Display random rectangles -#--------------------------------- -def rectDemo(sec=5, dofill=False): - tx = "RECTANGLE" - if dofill: - tx = "FILLED " + tx - header(tx, True) - - n = time.time() + sec - while time.time() < n: - x = machine.random(4, maxx-2) - y = machine.random(miny, maxy-2) - w = machine.random(2, maxx-x) - h = machine.random(2, maxy-y) - color = machine.random(0xFFFFFF) - if dofill: - fill = machine.random(0xFFFFFF) - tft.rect(x,y,w,h,color,fill) - else: - tft.rect(x,y,w,h,color) - if touched(): - break - tft.resetwin() - -# Display random rounded rectangles -#-------------------------------------- -def roundrectDemo(sec=5, dofill=False): - tx = "ROUND RECT" - if dofill: - tx = "FILLED " + tx - header(tx, True) - - n = time.time() + sec - while time.time() < n: - x = machine.random(2, maxx-18) - y = machine.random(miny, maxy-18) - w = machine.random(12, maxx-x) - h = machine.random(12, maxy-y) - if w > h: - r = machine.random(2, h // 2) - else: - r = machine.random(2, w // 2) - color = machine.random(0xFFFFFF) - if dofill: - fill = machine.random(0xFFFFFF) - tft.roundrect(x,y,w,h,r,color,fill) - else: - tft.roundrect(x,y,w,h,r,color) - if touched(): - break - tft.resetwin() diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/examples/thread_example.py b/MicroPython_BUILD/components/internalfs_image/image_go/examples/thread_example.py deleted file mode 100644 index 828d3f5..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/examples/thread_example.py +++ /dev/null @@ -1,145 +0,0 @@ -import machine, _thread, time -import micropython, gc -import bme280 - -# Setup the LED pins -bled = machine.Pin(4, mode=machine.Pin.OUT) -#rled = machine.Pin(0, mode=machine.Pin.OUT) -#gled = machine.Pin(2, mode=machine.Pin.OUT) - -bled.value(0) -#gled.value(0) -#rled.value(0) - -# Setup I2C to be used with BME280 sensor -i2c=machine.I2C(scl=machine.Pin(26),sda=machine.Pin(25),speed=400000) -# Initialize BME280 -bme=bme280.BME280(i2c=i2c) - -# Define LED thread function -#--------------------------- -def rgbled(n=200, led=bled): - notif_exit = 4718 - notif_replay = 2 - notif_count = 3 - x = 0 - _thread.allowsuspend(True) - while True: - led.value(1) - time.sleep_ms(n) - led.value(0) - x = x + 1 - - t = 10 - while t > 0: - notif = _thread.getnotification() - if notif == notif_exit: - _thread.sendmsg(_thread.getReplID(), "[%s] Exiting" % (_thread.getSelfName())) - return - elif notif == notif_replay: - _thread.sendmsg(_thread.getReplID(), "[%s] I've been notified" % (_thread.getSelfName())) - elif notif == notif_count: - _thread.sendmsg(_thread.getReplID(), "[%s] Run counter = %u" % (_thread.getSelfName(), x)) - elif notif == 777: - _thread.sendmsg(_thread.getReplID(), "[%s] Forced EXCEPTION" % (_thread.getSelfName())) - time.sleep_ms(1000) - zz = 234 / 0 - elif notif != 0: - _thread.sendmsg(_thread.getReplID(), "[%s] Got unknown notification: %u" % (_thread.getSelfName(), notif)) - - typ, sender, msg = _thread.getmsg() - if msg: - _thread.sendmsg(_thread.getReplID(), "[%s] Message from '%s'\n'%s'" % (_thread.getSelfName(), _thread.getThreadName(sender), msg)) - time.sleep_ms(100) - t = t - 1 - gc.collect() - -# For LED thread we don't need more than 3K stack -_ = _thread.stack_size(3*1024) -# Start LED thread -#rth=_thread.start_new_thread("R_Led", rgbled, (100, rled)) - -time.sleep_ms(500) -#gth=_thread.start_new_thread("G_Led", rgbled, (250, gled)) -bth=_thread.start_new_thread("B_Led", rgbled, (100, bled)) - -# Function to generate BME280 values string -#--------------- -def bmevalues(): - t, p, h = bme.read_compensated_data() - - p = p // 256 - pi = p // 100 - pd = p - pi * 100 - - hi = h // 1024 - hd = h * 100 // 1024 - hi * 100 - #return "[{}] T={0:1g}C ".format(time.strftime("%H:%M:%S",time.localtime()), round(t / 100,1)) + "P={}.{:02d}hPa ".format(pi, pd) + "H={}.{:01d}%".format(hi, hd) - return "[{}] T={}C ".format(time.strftime("%H:%M:%S",time.localtime()), t / 100) + "P={}.{:02d}hPa ".format(pi, pd) + "H={}.{:02d}%".format(hi, hd) - -# Define BME280 thread function -#----------------------- -def bmerun(interval=60): - _thread.allowsuspend(True) - sendmsg = True - send_time = time.time() + interval - while True: - while time.time() < send_time: - notif = _thread.getnotification() - if notif == 10002: - _thread.sendmsg(_thread.getReplID(), bmevalues()) - elif notif == 10004: - sendmsg = False - elif notif == 10006: - sendmsg = True - elif (notif <= 3600) and (notif >= 10): - interval = notif - send_time = time.time() + interval - _thread.sendmsg(_thread.getReplID(), "Interval set to {} seconds".format(interval)) - - time.sleep_ms(100) - send_time = send_time + interval - if sendmsg: - _thread.sendmsg(_thread.getReplID(), bmevalues()) - -# 3K is enough for BME280 thread -_ = _thread.stack_size(3*1024) -# start the BME280 thread -bmeth=_thread.start_new_thread("BME280", bmerun, (60,)) - -# === In the 3rd thread we will run Neopixels rainbow demo === - -np=machine.Neopixel(machine.Pin(22), 24) - -# DEfine Neopixels thread function -#--------------- -def thrainbow(): - pos = 0 - bri = 0.02 - while True: - for i in range(0, 24): - dHue = 360.0/24*(pos+i); - hue = dHue % 360; - np.setHSB(i, hue, 1.0, bri, 1, False) - np.show() - notif = _thread.getnotification() - if (notif > 0) and (notif <= 100): - bri = notif / 100.0 - elif notif == 1000: - _thread.sendmsg(_thread.getReplID(), "[%s] Run counter = %u" % (_thread.getSelfName(), pos)) - pos = pos + 1 - -# Start the Neopixels thread -npth=_thread.start_new_thread("Neopixel", thrainbow, ()) - - -utime.sleep(1) - -machine.heap_info() -_thread.list() - -# Set neopixel brightnes (%) -#_thread.notify(npth, 20) -# Get counter value from Neopixel thread -#_thread.notify(npth, 1000) - diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/examples/webserver_example.py b/MicroPython_BUILD/components/internalfs_image/image_go/examples/webserver_example.py deleted file mode 100644 index 449290e..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/examples/webserver_example.py +++ /dev/null @@ -1,61 +0,0 @@ - -from microWebSrv import MicroWebSrv -import _thread - -def _httpHandlerTestGet(httpClient, httpResponse) : - content = """\ - - - - - TEST GET - - -

TEST GET

- Client IP address = %s -
-
- First name:
- Last name:
- -
- - - """ % httpClient.GetIPAddr() - httpResponse.WriteResponseOk( headers = None, - contentType = "text/html", - contentCharset = "UTF-8", - content = content ) - -def _httpHandlerTestPost(httpClient, httpResponse) : - formData = httpClient.ReadRequestPostedFormData() - firstname = formData["firstname"] - lastname = formData["lastname"] - escape = httpClient.GetServer().HTMLEscape - content = """\ - - - - - TEST POST - - -

TEST POST

- Firstname = %s
- Lastname = %s
- - - """ % (escape(firstname), escape(lastname)) - httpResponse.WriteResponseOk( headers = None, - contentType = "text/html", - contentCharset = "UTF-8", - content = content ) - -routeHandlers = [ - ( "/test", "GET", _httpHandlerTestGet ), - ( "/test", "POST", _httpHandlerTestPost ) -] - -srv = MicroWebSrv(routeHandlers=routeHandlers) - -srv.Start(threaded=True) diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/BigFont.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/BigFont.fon deleted file mode 100644 index c7b3c48..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/BigFont.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans12.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans12.fon deleted file mode 100644 index 36e76bf..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans12.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans18.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans18.fon deleted file mode 100644 index 0d609fb..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans18.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans24.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans24.fon deleted file mode 100644 index 5220bfc..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DejaVuSans24.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DotMatrix_M.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DotMatrix_M.fon deleted file mode 100644 index a932f51..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/DotMatrix_M.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/Grotesk24x48.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/Grotesk24x48.fon deleted file mode 100644 index ee59c36..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/Grotesk24x48.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/OCR_A_Extended_M.c b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/OCR_A_Extended_M.c deleted file mode 100644 index 1104238..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/OCR_A_Extended_M.c +++ /dev/null @@ -1,119 +0,0 @@ -// OCR_A_Extended_M.c -// Font type : Full (95 characters) -// Font size : 16x24 pixels -// Memory usage : 4564 bytes - -#if defined(__AVR__) - #include - #define fontdatatype const uint8_t -#elif defined(__PIC32MX__) - #define PROGMEM - #define fontdatatype const unsigned char -#elif defined(__arm__) - #define PROGMEM - #define fontdatatype const unsigned char -#endif - -fontdatatype OCR_A_Extended_M[4564] PROGMEM={ -0x10,0x18,0x20,0x5F, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ! -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x1E,0x78,0x1E,0x78,0x0E,0x70,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // " -0x00,0x00,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x1F,0xF8,0x1F,0xF8,0x06,0x60,0x06,0x60,0x06,0x60,0x1F,0xF8,0x1F,0xF8,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // # -0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0xF8,0x1F,0xF8,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x18,0x00,0x18,0x1F,0xF8,0x1F,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // $ -0x00,0x00,0x1C,0x00,0x1C,0x18,0x1C,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0xE0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x07,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x38,0x18,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // % -0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x0F,0xC0,0x18,0x60,0x18,0x60,0x18,0x60,0x18,0x60,0x0C,0xC0,0x07,0x80,0x07,0x00,0x0F,0x80,0x1D,0xC8,0x18,0xF8,0x18,0x70,0x18,0xF0,0x0F,0xD8,0x0F,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // & -0x00,0x00,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ' -0x00,0x00,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x80,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x80,0x01,0x80,0x00,0xC0,0x00,0x60,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ( -0x00,0x00,0x0C,0x00,0x06,0x00,0x03,0x00,0x01,0x80,0x01,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x01,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ) -0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x19,0x88,0x19,0x98,0x0F,0xF0,0x07,0xE0,0x03,0xC0,0x03,0xC0,0x07,0xE0,0x0F,0xF0,0x1D,0xB8,0x11,0x98,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // * -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0xF8,0x1F,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // + -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x07,0xE0,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // , -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // - -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // . -0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // / - -0x00,0x00,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0 -0x00,0x00,0x1F,0x80,0x1F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x98,0x01,0x98,0x01,0x98,0x01,0x98,0x01,0x98,0x01,0x98,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 1 -0x00,0x00,0x1F,0xF0,0x1F,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0F,0xF8,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 2 -0x00,0x00,0x1F,0xF8,0x1F,0xFC,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x07,0xF8,0x07,0xF8,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x1F,0xFC,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 3 -0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x1F,0xF8,0x1F,0xF8,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 4 -0x00,0x00,0x07,0xF8,0x07,0xF8,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x07,0xF0,0x07,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x18,0x18,0x1F,0xF8,0x07,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 5 -0x00,0x00,0x1C,0x00,0x1C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 6 -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 7 -0x00,0x00,0x07,0xE0,0x07,0xE0,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 8 -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 9 -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // : -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x07,0xE0,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ; -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x78,0x00,0xE0,0x01,0xC0,0x07,0x00,0x0E,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x01,0xC0,0x00,0xE0,0x00,0x78,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // < -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // = -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x1E,0x00,0x07,0x00,0x03,0x80,0x00,0xE0,0x00,0x70,0x00,0x38,0x00,0x70,0x00,0xE0,0x03,0x80,0x07,0x00,0x1E,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // > -0x00,0x00,0x00,0x20,0x00,0x60,0x01,0xF0,0x03,0x98,0x07,0x18,0x0E,0x18,0x18,0x70,0x10,0xE0,0x01,0xC0,0x03,0x80,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ? - -0x00,0x00,0x07,0xE0,0x0F,0xF0,0x18,0x18,0x18,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0F,0x98,0x0F,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // @ -0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x0C,0x30,0x0F,0xF0,0x0F,0xF0,0x0C,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // A -0x00,0x00,0x1F,0xF0,0x1F,0xF8,0x18,0x1C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x1C,0x1F,0xF8,0x1F,0xF8,0x18,0x1C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x1C,0x1F,0xF8,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // B -0x00,0x00,0x01,0xFC,0x03,0xFC,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1C,0x00,0x0C,0x00,0x0E,0x00,0x06,0x00,0x07,0x00,0x03,0xFC,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // C -0x00,0x00,0x1F,0xC0,0x1F,0xE0,0x06,0x70,0x06,0x30,0x06,0x30,0x06,0x18,0x06,0x18,0x06,0x0C,0x06,0x0C,0x06,0x0C,0x06,0x0C,0x06,0x1C,0x06,0x18,0x06,0x38,0x06,0x30,0x06,0x70,0x1F,0xE0,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // D -0x00,0x00,0x1F,0xFC,0x1F,0xFC,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xC0,0x1F,0xC0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xFC,0x1F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // E -0x00,0x00,0x1F,0xFC,0x1F,0xFC,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF0,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // F -0x00,0x00,0x01,0xF8,0x03,0xF8,0x03,0x00,0x06,0x00,0x0E,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // G -0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // H -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // I -0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x07,0xF0,0x03,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // J -0x00,0x00,0x18,0x0C,0x18,0x18,0x18,0x30,0x18,0x60,0x18,0xC0,0x19,0x80,0x1B,0x00,0x1E,0x00,0x1C,0x00,0x1E,0x00,0x1F,0x00,0x1B,0x80,0x19,0xC0,0x18,0xE0,0x18,0x70,0x18,0x30,0x18,0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // K -0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // L -0x00,0x00,0x1C,0x38,0x1C,0x38,0x1E,0x78,0x1E,0xF8,0x1B,0xD8,0x19,0x98,0x19,0x98,0x19,0x98,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // M -0x00,0x00,0x1C,0x18,0x1C,0x18,0x1E,0x18,0x1E,0x18,0x1E,0x18,0x1B,0x18,0x1B,0x18,0x1B,0x18,0x19,0x98,0x19,0x98,0x18,0xD8,0x18,0xD8,0x18,0xD8,0x18,0x78,0x18,0x78,0x18,0x78,0x18,0x38,0x18,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // N -0x00,0x00,0x03,0xC0,0x03,0xC0,0x06,0x60,0x06,0x60,0x0E,0x70,0x0C,0x30,0x0C,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x30,0x0C,0x30,0x0E,0x70,0x06,0x60,0x06,0x60,0x03,0xC0,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // O - -0x00,0x00,0x1F,0xF0,0x1F,0xF0,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF0,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // P -0x00,0x00,0x00,0x70,0x00,0xF8,0x01,0xD8,0x03,0x98,0x07,0x18,0x0C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x98,0x19,0x98,0x19,0xF0,0x18,0xE0,0x19,0xC0,0x1B,0xE0,0x1F,0x78,0x0E,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Q -0x00,0x00,0x1F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF0,0x19,0x80,0x19,0x80,0x18,0xC0,0x18,0xC0,0x18,0x60,0x18,0x60,0x18,0x30,0x18,0x30,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // R -0x00,0x00,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0xC0,0x00,0x60,0x00,0x60,0x00,0x30,0x18,0x18,0x18,0x18,0x1F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // S -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x19,0x98,0x19,0x98,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // T -0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // U -0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x30,0x0C,0x30,0x0E,0x70,0x06,0x60,0x06,0x60,0x07,0xE0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // V -0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // W -0x00,0x00,0x18,0x18,0x18,0x18,0x0C,0x30,0x0C,0x30,0x06,0x60,0x06,0x60,0x03,0xC0,0x03,0xC0,0x01,0x80,0x01,0x80,0x03,0xC0,0x03,0xC0,0x06,0x60,0x06,0x60,0x0C,0x30,0x0C,0x30,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // X -0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x30,0x0E,0x60,0x07,0xE0,0x03,0xC0,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Y -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Z -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // [ -0x00,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x07,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0xC0,0x00,0xC0,0x00,0x60,0x00,0x70,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ] -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0xC0,0x03,0xC0,0x07,0xE0,0x07,0xE0,0x0E,0x70,0x0E,0x70,0x1C,0x30,0x1C,0x38,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^ -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, // _ - -0x00,0x00,0x06,0x00,0x07,0xC0,0x03,0xE0,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ` -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x07,0xF0,0x00,0x18,0x00,0x18,0x00,0x18,0x0F,0xF8,0x0F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1F,0xF8,0x0F,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // a -0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1B,0xE0,0x1F,0xF0,0x1E,0x38,0x1C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1C,0x18,0x1E,0x38,0x1F,0xF0,0x1B,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // b -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x07,0xFC,0x0E,0x00,0x1C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1C,0x00,0x0E,0x00,0x07,0xFC,0x03,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // c -0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x07,0xD8,0x0F,0xF8,0x1C,0x78,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1C,0x78,0x0F,0xF8,0x07,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // d -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x0F,0xF0,0x1C,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x18,0x00,0x18,0x00,0x1C,0x00,0x0F,0xF8,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // e -0x00,0x00,0x00,0xFC,0x01,0xFC,0x03,0x80,0x03,0x00,0x03,0x00,0x0F,0xF0,0x0F,0xF0,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // f -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xD8,0x0F,0xF8,0x1C,0x78,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1C,0x78,0x0F,0xF8,0x07,0xD8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x38,0x0F,0xF0,0x0F,0xE0, // g -0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x19,0xF0,0x1B,0xF0,0x1F,0x18,0x1C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // h -0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x0F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // i -0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x03,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0C,0x18,0x0C,0x18,0x07,0xF0,0x03,0xE0, // j -0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x30,0x18,0x60,0x18,0xC0,0x19,0x80,0x1B,0x80,0x1F,0x00,0x1E,0x00,0x1F,0x00,0x19,0x80,0x18,0xC0,0x18,0x60,0x18,0x30,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // k -0x00,0x00,0x0F,0x80,0x0F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // l -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x78,0x3F,0xFC,0x39,0xCC,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // m -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0xF0,0x1B,0xF0,0x1F,0x18,0x1C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // n -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x0F,0xF0,0x1C,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1C,0x38,0x0F,0xF0,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // o - -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0xC0,0x1F,0xE0,0x1E,0x70,0x1C,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1C,0x38,0x1E,0x70,0x1F,0xE0,0x1B,0xC0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00, // p -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xD8,0x0F,0xF8,0x1C,0x78,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1C,0x78,0x0F,0xF8,0x07,0xD8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18, // q -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0xF0,0x1B,0xF8,0x1F,0x0C,0x1C,0x0C,0x18,0x0C,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // r -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x00,0x1E,0x00,0x07,0x80,0x01,0xF0,0x00,0x70,0x00,0x18,0x00,0x18,0x18,0x18,0x1F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // s -0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x1F,0xF8,0x1F,0xF8,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x0C,0x06,0x1C,0x03,0xF8,0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // t -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x18,0xF8,0x0F,0xD8,0x07,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // u -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x38,0x38,0x18,0x30,0x18,0x30,0x0C,0x60,0x0C,0x60,0x06,0xC0,0x06,0xC0,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // v -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x33,0xCC,0x1F,0xF8,0x1E,0x78,0x1C,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // w -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x1C,0x38,0x0C,0x30,0x06,0x60,0x03,0xC0,0x03,0xC0,0x01,0x80,0x03,0xC0,0x06,0xE0,0x0E,0x70,0x0C,0x30,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // x -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x38,0x38,0x18,0x30,0x18,0x30,0x0C,0x60,0x0C,0x60,0x06,0xC0,0x07,0xC0,0x07,0x80,0x01,0x80,0x03,0x80,0x03,0x00,0x03,0x00,0x3E,0x00,0x3E,0x00, // y -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x38,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x1C,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // z -0x00,0x00,0x00,0xF8,0x01,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x00,0x1F,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0xF8,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // { -0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // | -0x00,0x00,0x1F,0x00,0x1F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0xF8,0x00,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // } -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x8C,0x1F,0xFC,0x18,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~ -}; diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/arial_bold.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/arial_bold.fon deleted file mode 100644 index 9cf4ee6..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/arial_bold.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/swiss721_outline.fon b/MicroPython_BUILD/components/internalfs_image/image_go/fonts/swiss721_outline.fon deleted file mode 100644 index 2ece05e..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/fonts/swiss721_outline.fon and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/LoRaReceiver.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/LoRaReceiver.py deleted file mode 100644 index 981e7fa..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/LoRaReceiver.py +++ /dev/null @@ -1,13 +0,0 @@ -def receive(lora): - print("LoRa Receiver") - - while True: - if lora.receivedPacket(): - lora.blink_led() - payload = lora.read_payload() - - try: - print("*** Received message ***\n{}".format(payload.decode())) - except Exception as e: - print(e) - print("with RSSI: {}\n".format(lora.packetRssi())) \ No newline at end of file diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/LoRaSender.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/LoRaSender.py deleted file mode 100644 index 028ec76..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/LoRaSender.py +++ /dev/null @@ -1,14 +0,0 @@ -from time import sleep - - -def send(lora): - counter = 0 - print("LoRa Sender") - - while True: - payload = 'Hello ({0})'.format(counter) - print("Sending packet: \n{}\n".format(payload)) - lora.println(payload) - - counter += 1 - sleep(5) \ No newline at end of file diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/bme280.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/bme280.py deleted file mode 100644 index c8d67ba..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/bme280.py +++ /dev/null @@ -1,206 +0,0 @@ -# Authors: Paul Cunnane 2016, Peter Dahlebrg 2016 -# -# This module borrows from the Adafruit BME280 Python library. Original -# Copyright notices are reproduced below. -# -# Those libraries were written for the Raspberry Pi. This modification is -# intended for the MicroPython and esp8266 boards. -# -# Copyright (c) 2014 Adafruit Industries -# Author: Tony DiCola -# -# Based on the BMP280 driver with BME280 changes provided by -# David J Taylor, Edinburgh (www.satsignal.eu) -# -# Based on Adafruit_I2C.py created by Kevin Townsend. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -import time -from ustruct import unpack, unpack_from -from array import array - -# BME280 default address. -BME280_I2CADDR = 0x76 - -# Operating Modes -BME280_OSAMPLE_1 = 1 -BME280_OSAMPLE_2 = 2 -BME280_OSAMPLE_4 = 3 -BME280_OSAMPLE_8 = 4 -BME280_OSAMPLE_16 = 5 - -BME280_REGISTER_CONTROL_HUM = 0xF2 -BME280_REGISTER_CONTROL = 0xF4 - - -class BME280: - - def __init__(self, - mode=BME280_OSAMPLE_1, - address=BME280_I2CADDR, - i2c=None, - **kwargs): - # Check that mode is valid. - if mode not in [BME280_OSAMPLE_1, BME280_OSAMPLE_2, BME280_OSAMPLE_4, - BME280_OSAMPLE_8, BME280_OSAMPLE_16]: - raise ValueError( - 'Unexpected mode value {0}. Set mode to one of ' - 'BME280_ULTRALOWPOWER, BME280_STANDARD, BME280_HIGHRES, or ' - 'BME280_ULTRAHIGHRES'.format(mode)) - self._mode = mode - self.address = address - if i2c is None: - raise ValueError('An I2C object is required.') - self.i2c = i2c - - # load calibration data - dig_88_a1 = self.i2c.readfrom_mem(self.address, 0x88, 26) - dig_e1_e7 = self.i2c.readfrom_mem(self.address, 0xE1, 7) - self.dig_T1, self.dig_T2, self.dig_T3, self.dig_P1, \ - self.dig_P2, self.dig_P3, self.dig_P4, self.dig_P5, \ - self.dig_P6, self.dig_P7, self.dig_P8, self.dig_P9, \ - _, self.dig_H1 = unpack("> 4) - - self.dig_H6 = unpack_from("> 4 - raw_press = ((readout[0] << 16) | (readout[1] << 8) | readout[2]) >> 4 - # temperature(0xFA): ((msb << 16) | (lsb << 8) | xlsb) >> 4 - raw_temp = ((readout[3] << 16) | (readout[4] << 8) | readout[5]) >> 4 - # humidity(0xFD): (msb << 8) | lsb - raw_hum = (readout[6] << 8) | readout[7] - - result[0] = raw_temp - result[1] = raw_press - result[2] = raw_hum - - def read_compensated_data(self, result=None): - """ Reads the data from the sensor and returns the compensated data. - - Args: - result: array of length 3 or alike where the result will be - stored, in temperature, pressure, humidity order. You may use - this to read out the sensor without allocating heap memory - - Returns: - array with temperature, pressure, humidity. Will be the one from - the result parameter if not None - """ - self.read_raw_data(self._l3_resultarray) - raw_temp, raw_press, raw_hum = self._l3_resultarray - # temperature - var1 = ((raw_temp >> 3) - (self.dig_T1 << 1)) * (self.dig_T2 >> 11) - var2 = (((((raw_temp >> 4) - self.dig_T1) * - ((raw_temp >> 4) - self.dig_T1)) >> 12) * self.dig_T3) >> 14 - self.t_fine = var1 + var2 - temp = (self.t_fine * 5 + 128) >> 8 - - # pressure - var1 = self.t_fine - 128000 - var2 = var1 * var1 * self.dig_P6 - var2 = var2 + ((var1 * self.dig_P5) << 17) - var2 = var2 + (self.dig_P4 << 35) - var1 = (((var1 * var1 * self.dig_P3) >> 8) + - ((var1 * self.dig_P2) << 12)) - var1 = (((1 << 47) + var1) * self.dig_P1) >> 33 - if var1 == 0: - pressure = 0 - else: - p = 1048576 - raw_press - p = (((p << 31) - var2) * 3125) // var1 - var1 = (self.dig_P9 * (p >> 13) * (p >> 13)) >> 25 - var2 = (self.dig_P8 * p) >> 19 - pressure = ((p + var1 + var2) >> 8) + (self.dig_P7 << 4) - - # humidity - h = self.t_fine - 76800 - h = (((((raw_hum << 14) - (self.dig_H4 << 20) - - (self.dig_H5 * h)) + 16384) - >> 15) * (((((((h * self.dig_H6) >> 10) * - (((h * self.dig_H3) >> 11) + 32768)) >> 10) + - 2097152) * self.dig_H2 + 8192) >> 14)) - h = h - (((((h >> 15) * (h >> 15)) >> 7) * self.dig_H1) >> 4) - h = 0 if h < 0 else h - h = 419430400 if h > 419430400 else h - humidity = h >> 12 - - if result: - result[0] = temp - result[1] = pressure - result[2] = humidity - return result - - return array("i", (temp, pressure, humidity)) - - @property - def values(self): - """ human readable values """ - - t, p, h = self.read_compensated_data() - - p = p // 256 - pi = p // 100 - pd = p - pi * 100 - - hi = h // 1024 - hd = h * 100 // 1024 - hi * 100 - return ("{}C".format(t / 100), "{}.{:02d}hPa".format(pi, pd), - "{}.{:02d}%".format(hi, hd)) diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/config_lora.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/config_lora.py deleted file mode 100644 index 6102814..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/config_lora.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import os -import time - - -def mac2eui(mac): - mac = mac[0:6] + 'fffe' + mac[6:] - return hex(int(mac[0:2], 16) ^ 2)[2:] + mac[2:] - - -# Node Name -from machine import unique_id -import ubinascii -unique_id = ubinascii.hexlify(unique_id()).decode() - -NODE_NAME = 'ESP32_' - -NODE_EUI = mac2eui(unique_id) -NODE_NAME = NODE_NAME + unique_id -# NODE_NAME = NODE_NAME + NODE_EUI - -# millisecond -millisecond = time.ticks_ms -# microsecond = time.ticks_us - - -# Controller -from controller_esp import Controller - - diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/controller.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/controller.py deleted file mode 100644 index 27537d9..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/controller.py +++ /dev/null @@ -1,122 +0,0 @@ -from time import sleep - - -class Controller: - - class Mock: - pass - - - ON_BOARD_LED_PIN_NO = None - ON_BOARD_LED_HIGH_IS_ON = True - GPIO_PINS = [] - - PIN_ID_FOR_LORA_RESET = None - - PIN_ID_SCK = None - PIN_ID_MOSI = None - PIN_ID_MISO = None - - PIN_ID_FOR_LORA_SS = None - PIN_ID_FOR_LORA_DIO0 = None - PIN_ID_FOR_LORA_DIO1 = None - PIN_ID_FOR_LORA_DIO2 = None - PIN_ID_FOR_LORA_DIO3 = None - PIN_ID_FOR_LORA_DIO4 = None - PIN_ID_FOR_LORA_DIO5 = None - - spi = None - - def __init__(self, - spi = spi, - pin_id_led = ON_BOARD_LED_PIN_NO, - on_board_led_high_is_on = ON_BOARD_LED_HIGH_IS_ON, - pin_id_reset = PIN_ID_FOR_LORA_RESET, - blink_on_start = (2, 0.5, 0.5)): - - self.pin_led = self.prepare_pin(pin_id_led) - self.on_board_led_high_is_on = on_board_led_high_is_on - self.pin_reset = self.prepare_pin(pin_id_reset) - self.spi = self.prepare_spi(spi) - self.reset_transceivers() - self.transceivers = {} - self.blink_led(*blink_on_start) - - - def add_transceiver(self, - transceiver, - pin_id_ss = PIN_ID_FOR_LORA_SS, - pin_id_RxDone = PIN_ID_FOR_LORA_DIO0, - pin_id_RxTimeout = PIN_ID_FOR_LORA_DIO1, - pin_id_ValidHeader = PIN_ID_FOR_LORA_DIO2, - pin_id_CadDone = PIN_ID_FOR_LORA_DIO3, - pin_id_CadDetected = PIN_ID_FOR_LORA_DIO4, - pin_id_PayloadCrcError = PIN_ID_FOR_LORA_DIO5): - - transceiver.transfer = self.spi.transfer - transceiver.blink_led = self.blink_led - - transceiver.pin_ss = self.prepare_pin(pin_id_ss) - transceiver.pin_RxDone = self.prepare_irq_pin(pin_id_RxDone) - transceiver.pin_RxTimeout = self.prepare_irq_pin(pin_id_RxTimeout) - transceiver.pin_ValidHeader = self.prepare_irq_pin(pin_id_ValidHeader) - transceiver.pin_CadDone = self.prepare_irq_pin(pin_id_CadDone) - transceiver.pin_CadDetected = self.prepare_irq_pin(pin_id_CadDetected) - transceiver.pin_PayloadCrcError = self.prepare_irq_pin(pin_id_PayloadCrcError) - - transceiver.init() - - self.transceivers[transceiver.name] = transceiver - return transceiver - - - def prepare_pin(self, pin_id, in_out = None): - reason = ''' - # a pin should provide: - # .low() - # .high() - # .value() # read input. - # .irq() # ref to the irq function of real pin object. - ''' - raise NotImplementedError('reason') - - - def prepare_irq_pin(self, pin_id): - reason = ''' - # a irq_pin should provide: - # .set_handler_for_irq_on_rising_edge() # to set trigger and handler. - # .detach_irq() - ''' - raise NotImplementedError('reason') - - - def prepare_spi(self, spi): - reason = ''' - # a spi should provide: - # .close() - # .transfer(address, value = 0x00) - ''' - raise NotImplementedError('reason') - - - def led_on(self, on = True): - self.pin_led.high() if self.on_board_led_high_is_on == on else self.pin_led.low() - - - def blink_led(self, times = 1, on_seconds = 0.1, off_seconds = 0.1): - for i in range(times): - self.led_on(True) - sleep(on_seconds) - self.led_on(False) - sleep(off_seconds) - - - def reset_transceivers(self, duration_low = 0.01, duration_high = 0.01): - self.pin_reset.low() - sleep(duration_low) - self.pin_reset.high() - sleep(duration_high) - - - def __exit__(self): - self.spi.close() diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/controller_esp.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/controller_esp.py deleted file mode 100644 index cd868c6..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/controller_esp.py +++ /dev/null @@ -1,163 +0,0 @@ -from machine import Pin, SPI, reset -import config_lora -import controller - - -''' -import time -PIN_ID_FOR_LORA_RESET = 18 -PIN_ID_FOR_LORA_SS = 26 -PIN_ID_SCK = 19 -PIN_ID_MOSI = 23 -PIN_ID_MISO = 25 -PIN_ID_FOR_LORA_DIO0 = 5 -ON_BOARD_LED_PIN_NO = 2 - -#spi = machine.SPI(1, baudrate = 8000000, sck = machine.Pin(PIN_ID_SCK, machine.Pin.OUT), mosi = machine.Pin(PIN_ID_MOSI, machine.Pin.OUT), miso = machine.Pin(PIN_ID_MISO, machine.Pin.IN), cs = machine.Pin(PIN_ID_FOR_LORA_SS, machine.Pin.OUT), duplex=False) -#spi = machine.SPI(1, baudrate = 8000000, sck = machine.Pin(PIN_ID_SCK, machine.Pin.OUT), mosi = machine.Pin(PIN_ID_MOSI, machine.Pin.OUT), miso = machine.Pin(PIN_ID_MISO, machine.Pin.IN), duplex=False) -spi = machine.SPI(1, baudrate = 8000000, sck = machine.Pin(PIN_ID_SCK, machine.Pin.OUT), mosi = machine.Pin(PIN_ID_MOSI, machine.Pin.OUT), miso = machine.Pin(PIN_ID_MISO, machine.Pin.IN)) - -dio=machine.Pin(PIN_ID_FOR_LORA_DIO0, machine.Pin.IN) -cs=machine.Pin(PIN_ID_FOR_LORA_SS, machine.Pin.OUT) -rst=machine.Pin(PIN_ID_FOR_LORA_RESET, machine.Pin.OUT) -rst.value(0) -response = bytearray(4) - -def xrst(): - rst.value(0) - time.sleep_ms(100) - rst.value(1) - -xrst() - -def xrd(reg): - cs.value(0) - spi.write_readinto(bytes([reg]), response); - cs.value(1) - print(response) - -def yrd(reg): - cs.value(0) - spi.write(bytes([reg])); - spi.readinto(response) - cs.value(1) - print(response) - -def zrd(reg): - cs.value(0) - spi.write(bytes([reg])); - spi.write_readinto(bytes([0]),response) - cs.value(1) - print(response) - -def wrd(reg): - cs.value(0) - res = spi.readfrom_mem(reg,4) - cs.value(1) - print(res) - -''' - -class Controller(controller.Controller): - - PIN_ID_FOR_LORA_RESET = 18 - - PIN_ID_FOR_LORA_SS = 26 - PIN_ID_SCK = 19 - PIN_ID_MOSI = 23 - PIN_ID_MISO = 25 - - PIN_ID_FOR_LORA_DIO0 = 5 - PIN_ID_FOR_LORA_DIO1 = None - PIN_ID_FOR_LORA_DIO2 = None - PIN_ID_FOR_LORA_DIO3 = None - PIN_ID_FOR_LORA_DIO4 = None - PIN_ID_FOR_LORA_DIO5 = None - - spi = None - - ON_BOARD_LED_PIN_NO = 2 - ON_BOARD_LED_HIGH_IS_ON = True - GPIO_PINS = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, - 23, 25, 26, 27, 32, 34, 35, 36, 37, 38, 39) - try: - if not spi: - spi = SPI(1, baudrate = 5000000, polarity = 0, phase = 0, bits = 8, firstbit = SPI.MSB, - sck = Pin(PIN_ID_SCK, Pin.OUT), - mosi = Pin(PIN_ID_MOSI, Pin.OUT), - miso = Pin(PIN_ID_MISO, Pin.IN)) - #spi.init() - print(spi) - - except Exception as e: - print(e) - if spi: - spi.deinit() - spi = None - reset() # in case SPI is already in use, need to reset. - - - def __init__(self, - spi = spi, - pin_id_led = ON_BOARD_LED_PIN_NO, - on_board_led_high_is_on = ON_BOARD_LED_HIGH_IS_ON, - pin_id_reset = PIN_ID_FOR_LORA_RESET, - blink_on_start = (2, 0.5, 0.5)): - - super().__init__(spi, - pin_id_led, - on_board_led_high_is_on, - pin_id_reset, - blink_on_start) - - - def prepare_pin(self, pin_id, in_out = Pin.OUT): - if pin_id is not None: - pin = Pin(pin_id, in_out) - new_pin = Controller.Mock() - new_pin.pin_id = pin_id - new_pin.value = pin.value - - if in_out == Pin.OUT: - new_pin.low = lambda : pin.value(0) - new_pin.high = lambda : pin.value(1) - else: - new_pin.irq = pin.irq - - return new_pin - - - def prepare_irq_pin(self, pin_id): - pin = self.prepare_pin(pin_id, Pin.IN) - if pin: - pin.set_handler_for_irq_on_rising_edge = lambda handler: pin.irq(handler = handler, trigger = Pin.IRQ_RISING) - pin.detach_irq = lambda : pin.irq(handler = None, trigger = 0) - return pin - - - def prepare_spi(self, spi): - if spi: - new_spi = Controller.Mock() - - def transfer(pin_ss, address, value = 0x00): - response = bytearray(1) - - pin_ss.low() - - spi.write(bytes([address])) # write register address - spi.write_readinto(bytes([value]), response) # write or read register walue - #spi.write_readinto(bytes([address]), response) - - pin_ss.high() - - return response - - new_spi.transfer = transfer - new_spi.close = spi.deinit - return new_spi - - - def __exit__(self): - self.spi.close() - diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/led.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/led.py deleted file mode 100644 index 17e7b61..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/led.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding: utf-8 - -import time - - -def blink(pin, times = 1, on_seconds = 0.1, off_seconds = 0.1, high_is_on = True): - for i in range(times): - pin.high() if high_is_on else pin.low() - time.sleep(on_seconds) - pin.low() if high_is_on else pin.high() - time.sleep(off_seconds) \ No newline at end of file diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/lib/sx127x.py b/MicroPython_BUILD/components/internalfs_image/image_go/lib/sx127x.py deleted file mode 100644 index 4b4aa22..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/lib/sx127x.py +++ /dev/null @@ -1,389 +0,0 @@ -from time import sleep -import time -import gc -import config_lora - - -PA_OUTPUT_RFO_PIN = 0 -PA_OUTPUT_PA_BOOST_PIN = 1 - - -# registers -REG_FIFO = 0x00 -REG_OP_MODE = 0x01 -REG_FRF_MSB = 0x06 -REG_FRF_MID = 0x07 -REG_FRF_LSB = 0x08 -REG_PA_CONFIG = 0x09 -REG_LNA = 0x0c -REG_FIFO_ADDR_PTR = 0x0d - -REG_FIFO_TX_BASE_ADDR = 0x0e -FifoTxBaseAddr = 0x00 -# FifoTxBaseAddr = 0x80 - -REG_FIFO_RX_BASE_ADDR = 0x0f -FifoRxBaseAddr = 0x00 -REG_FIFO_RX_CURRENT_ADDR = 0x10 -REG_IRQ_FLAGS_MASK = 0x11 -REG_IRQ_FLAGS = 0x12 -REG_RX_NB_BYTES = 0x13 -REG_PKT_RSSI_VALUE = 0x1a -REG_PKT_SNR_VALUE = 0x1b -REG_MODEM_CONFIG_1 = 0x1d -REG_MODEM_CONFIG_2 = 0x1e -REG_PREAMBLE_MSB = 0x20 -REG_PREAMBLE_LSB = 0x21 -REG_PAYLOAD_LENGTH = 0x22 -REG_FIFO_RX_BYTE_ADDR = 0x25 -REG_MODEM_CONFIG_3 = 0x26 -REG_RSSI_WIDEBAND = 0x2c -REG_DETECTION_OPTIMIZE = 0x31 -REG_DETECTION_THRESHOLD = 0x37 -REG_SYNC_WORD = 0x39 -REG_DIO_MAPPING_1 = 0x40 -REG_VERSION = 0x42 - -# modes -MODE_LONG_RANGE_MODE = 0x80 # bit 7: 1 => LoRa mode -MODE_SLEEP = 0x00 -MODE_STDBY = 0x01 -MODE_TX = 0x03 -MODE_RX_CONTINUOUS = 0x05 -MODE_RX_SINGLE = 0x06 - -# PA config -PA_BOOST = 0x80 - -# IRQ masks -IRQ_TX_DONE_MASK = 0x08 -IRQ_PAYLOAD_CRC_ERROR_MASK = 0x20 -IRQ_RX_DONE_MASK = 0x40 -IRQ_RX_TIME_OUT_MASK = 0x80 - -# Buffer size -MAX_PKT_LENGTH = 255 - - -class SX127x: - - # The controller needs to provide an interface consisted of: - # 1. a SPI, with transfer function. - # 2. a reset pin, with low(), high() functions. - # 3. IRQ pinS , to be triggered by RFM96W's DIO0~5 pins. These pins each has two functions: - # 3.1 set_handler_for_irq_on_rising_edge() - # 3.2 detach_irq() - # 4. a function to blink on-board LED. - - def __init__(self, - name = 'SX127x', - parameters = {'frequency': 868E6, 'tx_power_level': 2, 'signal_bandwidth': 125E3, - 'spreading_factor': 8, 'coding_rate': 5, 'preamble_length': 8, - 'implicitHeader': False, 'sync_word': 0x12, 'enable_CRC': False}, - onReceive = None): - - self.name = name - self.parameters = parameters - self._onReceive = onReceive - self._lock = False - - - def init(self): - # check version - version = self.readRegister(REG_VERSION) - if version != 0x12: - print("Detected version:", version) - raise Exception('Invalid version.') - - - # put in LoRa and sleep mode - self.sleep() - - - # config - self.setFrequency(self.parameters['frequency']) - self.setSignalBandwidth(self.parameters['signal_bandwidth']) - - # set LNA boost - self.writeRegister(REG_LNA, self.readRegister(REG_LNA) | 0x03) - - # set auto AGC - self.writeRegister(REG_MODEM_CONFIG_3, 0x04) - - self.setTxPower(self.parameters['tx_power_level']) - self._implicitHeaderMode = None - self.implicitHeaderMode(self.parameters['implicitHeader']) - self.setSpreadingFactor(self.parameters['spreading_factor']) - self.setCodingRate(self.parameters['coding_rate']) - self.setPreambleLength(self.parameters['preamble_length']) - self.setSyncWord(self.parameters['sync_word']) - self.enableCRC(self.parameters['enable_CRC']) - - # set base addresses - self.writeRegister(REG_FIFO_TX_BASE_ADDR, FifoTxBaseAddr) - self.writeRegister(REG_FIFO_RX_BASE_ADDR, FifoRxBaseAddr) - - self.standby() - - - def beginPacket(self, implicitHeaderMode = False): - self.standby() - self.implicitHeaderMode(implicitHeaderMode) - - # reset FIFO address and paload length - self.writeRegister(REG_FIFO_ADDR_PTR, FifoTxBaseAddr) - self.writeRegister(REG_PAYLOAD_LENGTH, 0) - - - def endPacket(self): - # put in TX mode - self.writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_TX) - - # wait for TX done, standby automatically on TX_DONE - tmo = 0 - freg = self.readRegister(REG_IRQ_FLAGS) - while (freg & IRQ_TX_DONE_MASK) == 0: - time.sleep_ms(10) - tmo += 1 - if tmo > 20: - break - freg = self.readRegister(REG_IRQ_FLAGS) - pass - - # clear IRQ's - self.writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK) - - if tmo >= 20: - print("Send timeout.") - - self.collect_garbage() - - - def write(self, buffer): - currentLength = self.readRegister(REG_PAYLOAD_LENGTH) - size = len(buffer) - - # check size - size = min(size, (MAX_PKT_LENGTH - FifoTxBaseAddr - currentLength)) - - # write data - for i in range(size): - self.writeRegister(REG_FIFO, buffer[i]) - - # update length - self.writeRegister(REG_PAYLOAD_LENGTH, currentLength + size) - return size - - - def aquire_lock(self, lock = False): - pass - - - def println(self, string, implicitHeader = False): - self.aquire_lock(True) # wait until RX_Done, lock and begin writing. - - self.beginPacket(implicitHeader) - self.write(string.encode()) - self.endPacket() - - self.aquire_lock(False) # unlock when done writing - - - def getIrqFlags(self): - irqFlags = self.readRegister(REG_IRQ_FLAGS) - self.writeRegister(REG_IRQ_FLAGS, irqFlags) - return irqFlags - - - def packetRssi(self): - return (self.readRegister(REG_PKT_RSSI_VALUE) - (164 if self._frequency < 868E6 else 157)) - - - def packetSnr(self): - return (self.readRegister(REG_PKT_SNR_VALUE)) * 0.25 - - - def standby(self): - self.writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_STDBY) - - - def sleep(self): - self.writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP) - - - def setTxPower(self, level, outputPin = PA_OUTPUT_PA_BOOST_PIN): - if (outputPin == PA_OUTPUT_RFO_PIN): - # RFO - level = min(max(level, 0), 14) - self.writeRegister(REG_PA_CONFIG, 0x70 | level) - - else: - # PA BOOST - level = min(max(level, 2), 17) - self.writeRegister(REG_PA_CONFIG, PA_BOOST | (level - 2)) - - - def setFrequency(self, frequency): - self._frequency = frequency - - frfs = {169E6: (42, 64, 0), - 433E6: (108, 64, 0), - 434E6: (108, 128, 0), - 866E6: (216, 128, 0), - 868E6: (217, 0, 0), - 915E6: (228, 192, 0)} - - self.writeRegister(REG_FRF_MSB, frfs[frequency][0]) - self.writeRegister(REG_FRF_MID, frfs[frequency][1]) - self.writeRegister(REG_FRF_LSB, frfs[frequency][2]) - - - def setSpreadingFactor(self, sf): - sf = min(max(sf, 6), 12) - self.writeRegister(REG_DETECTION_OPTIMIZE, 0xc5 if sf == 6 else 0xc3) - self.writeRegister(REG_DETECTION_THRESHOLD, 0x0c if sf == 6 else 0x0a) - self.writeRegister(REG_MODEM_CONFIG_2, (self.readRegister(REG_MODEM_CONFIG_2) & 0x0f) | ((sf << 4) & 0xf0)) - - - def setSignalBandwidth(self, sbw): - bins = (7.8E3, 10.4E3, 15.6E3, 20.8E3, 31.25E3, 41.7E3, 62.5E3, 125E3, 250E3) - - bw = 9 - for i in range(len(bins)): - if sbw <= bins[i]: - bw = i - break - - self.writeRegister(REG_MODEM_CONFIG_1, (self.readRegister(REG_MODEM_CONFIG_1) & 0x0f) | (bw << 4)) - - - def setCodingRate(self, denominator): - denominator = min(max(denominator, 5), 8) - cr = denominator - 4 - self.writeRegister(REG_MODEM_CONFIG_1, (self.readRegister(REG_MODEM_CONFIG_1) & 0xf1) | (cr << 1)) - - - def setPreambleLength(self, length): - self.writeRegister(REG_PREAMBLE_MSB, (length >> 8) & 0xff) - self.writeRegister(REG_PREAMBLE_LSB, (length >> 0) & 0xff) - - - def enableCRC(self, enable_CRC = False): - modem_config_2 = self.readRegister(REG_MODEM_CONFIG_2) - config = modem_config_2 | 0x04 if enable_CRC else modem_config_2 & 0xfb - self.writeRegister(REG_MODEM_CONFIG_2, config) - - - def setSyncWord(self, sw): - self.writeRegister(REG_SYNC_WORD, sw) - - - # def enable_Rx_Done_IRQ(self, enable = True): - # if enable: - # self.writeRegister(REG_IRQ_FLAGS_MASK, self.readRegister(REG_IRQ_FLAGS_MASK) & ~IRQ_RX_DONE_MASK) - # else: - # self.writeRegister(REG_IRQ_FLAGS_MASK, self.readRegister(REG_IRQ_FLAGS_MASK) | IRQ_RX_DONE_MASK) - - - def dumpRegisters(self): - for i in range(128): - print("0x{0:02x}: {1:02x}".format(i, self.readRegister(i))) - - - def implicitHeaderMode(self, implicitHeaderMode = False): - if self._implicitHeaderMode != implicitHeaderMode: # set value only if different. - self._implicitHeaderMode = implicitHeaderMode - modem_config_1 = self.readRegister(REG_MODEM_CONFIG_1) - config = modem_config_1 | 0x01 if implicitHeaderMode else modem_config_1 & 0xfe - self.writeRegister(REG_MODEM_CONFIG_1, config) - - - def onReceive(self, callback): - self._onReceive = callback - - if self.pin_RxDone: - if callback: - self.writeRegister(REG_DIO_MAPPING_1, 0x00) - self.pin_RxDone.set_handler_for_irq_on_rising_edge(handler = self.handleOnReceive) - else: - self.pin_RxDone.detach_irq() - - - def receive(self, size = 0): - self.implicitHeaderMode(size > 0) - if size > 0: self.writeRegister(REG_PAYLOAD_LENGTH, size & 0xff) - - # The last packet always starts at FIFO_RX_CURRENT_ADDR - # no need to reset FIFO_ADDR_PTR - self.writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_RX_CONTINUOUS) - - - # on RPi, interrupt callback is threaded and racing with main thread, - # Needs a lock for accessing FIFO. - # https://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/ - # http://raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio-part-2 - def handleOnReceive(self, event_source): - self.aquire_lock(True) # lock until TX_Done - - # irqFlags = self.getIrqFlags() should be 0x50 - if (self.getIrqFlags() & IRQ_PAYLOAD_CRC_ERROR_MASK) == 0: - if self._onReceive: - payload = self.read_payload() - self.aquire_lock(False) # unlock when done reading - - self._onReceive(self, payload) - - self.aquire_lock(False) # unlock in any case. - - - def receivedPacket(self, size = 0): - irqFlags = self.getIrqFlags() - - self.implicitHeaderMode(size > 0) - if size > 0: self.writeRegister(REG_PAYLOAD_LENGTH, size & 0xff) - - # if (irqFlags & IRQ_RX_DONE_MASK) and \ - # (irqFlags & IRQ_RX_TIME_OUT_MASK == 0) and \ - # (irqFlags & IRQ_PAYLOAD_CRC_ERROR_MASK == 0): - - if (irqFlags == IRQ_RX_DONE_MASK): # RX_DONE only, irqFlags should be 0x40 - # automatically standby when RX_DONE - return True - - elif self.readRegister(REG_OP_MODE) != (MODE_LONG_RANGE_MODE | MODE_RX_SINGLE): - # no packet received. - # reset FIFO address / # enter single RX mode - self.writeRegister(REG_FIFO_ADDR_PTR, FifoRxBaseAddr) - self.writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_RX_SINGLE) - - - def read_payload(self): - # set FIFO address to current RX address - # fifo_rx_current_addr = self.readRegister(REG_FIFO_RX_CURRENT_ADDR) - self.writeRegister(REG_FIFO_ADDR_PTR, self.readRegister(REG_FIFO_RX_CURRENT_ADDR)) - - # read packet length - packetLength = self.readRegister(REG_PAYLOAD_LENGTH) if self._implicitHeaderMode else \ - self.readRegister(REG_RX_NB_BYTES) - - payload = bytearray() - for i in range(packetLength): - payload.append(self.readRegister(REG_FIFO)) - - self.collect_garbage() - return bytes(payload) - - - def readRegister(self, address, byteorder = 'big', signed = False): - response = self.transfer(self.pin_ss, address & 0x7f) - return int.from_bytes(response, byteorder) - - - def writeRegister(self, address, value): - self.transfer(self.pin_ss, address | 0x80, value) - - - def collect_garbage(self): - gc.collect() - print('[Memory - free: {} allocated: {}]'.format(gc.mem_free(), gc.mem_alloc())) - diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/main.py b/MicroPython_BUILD/components/internalfs_image/image_go/main.py deleted file mode 100644 index bdd7fd5..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/main.py +++ /dev/null @@ -1,34 +0,0 @@ -import machine, network, utime - -print("") -print("Starting WiFi ...") -sta_if = network.WLAN(network.STA_IF); sta_if.active(True) -sta_if.connect("mySSID", "wifi_password") -tmo = 50 -while not sta_if.isconnected(): - utime.sleep_ms(100) - tmo -= 1 - if tmo == 0: - sta_if.disconnect() - break - -if tmo > 0: - print("WiFi started") - utime.sleep_ms(500) - - rtc = machine.RTC() - print("Synchronize time from NTP server ...") - rtc.ntp_sync(server="hr.pool.ntp.org") - tmo = 100 - while not rtc.synced(): - utime.sleep_ms(100) - tmo -= 1 - if tmo == 0: - break - - if tmo > 0: - print("Time set") - utime.sleep_ms(500) - t = rtc.now() - utime.strftime("%c") - print("") diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/spiffs.info b/MicroPython_BUILD/components/internalfs_image/image_go/spiffs.info deleted file mode 100644 index 68946a2..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/spiffs.info +++ /dev/null @@ -1,11 +0,0 @@ -INTRODUCTION - -Spiffs is a file system intended for SPI NOR flash devices on embedded targets. -Spiffs is designed with following characteristics in mind: - - * Small (embedded) targets, sparse RAM without heap - * Only big areas of data (blocks) can be erased - * An erase will reset all bits in block to ones - * Writing pulls one to zeroes - * Zeroes can only be pulled to ones by erase - * Wear leveling diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/www/favicon.ico b/MicroPython_BUILD/components/internalfs_image/image_go/www/favicon.ico deleted file mode 100644 index 169f21c..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/www/favicon.ico and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/www/index.html b/MicroPython_BUILD/components/internalfs_image/image_go/www/index.html deleted file mode 100644 index 15bdd01..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/www/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - MicroWebSrv test page - - - - -

MicroWebSrv test page

-

Hello from MicroPython !

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget ligula quis libero mollis dapibus. Suspendisse potenti. Nullam facilisis neque et sem. Proin placerat adipiscing urna. Aenean sollicitudin. Mauris lorem erat, fringilla quis, sagittis a, varius sed, nunc. Pellentesque ligula. Nullam egestas eleifend turpis. Vivamus ac sapien. Sed venenatis, ligula ut scelerisque vehicula, erat tellus euismod ipsum, eget faucibus tortor arcu et lectus. Vivamus vel purus. Fusce dignissim tortor quis diam elementum fermentum. Mauris eleifend lorem vel arcu. Vivamus tempus faucibus lectus. Curabitur volutpat ornare mi. Curabitur ac libero. Sed eu elit ac metus egestas iaculis. -

-
-
-
-
- -

- Download « PDF file » -

-
- - - \ No newline at end of file diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/www/pdf-sample.pdf b/MicroPython_BUILD/components/internalfs_image/image_go/www/pdf-sample.pdf deleted file mode 100644 index f698ff5..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/www/pdf-sample.pdf and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/www/pdf.png b/MicroPython_BUILD/components/internalfs_image/image_go/www/pdf.png deleted file mode 100644 index b5acfe6..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/image_go/www/pdf.png and /dev/null differ diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/www/style.css b/MicroPython_BUILD/components/internalfs_image/image_go/www/style.css deleted file mode 100644 index 9a7852e..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/www/style.css +++ /dev/null @@ -1,36 +0,0 @@ -html, body { - margin: 0; - padding: 0; - } -body { - background-color: white; - font-family: Verdana, sans-serif; - font-size: 100%; - } -h1 { - font-size: 200%; - color: navy; - text-align: center; - } -h2 { - font-size: 150%; - color: red; - padding-left: 15px; - } -p,ul,li,td { - color: black; - } -a:link { - color: green; - text-decoration: underline; - } -a:visited { - color: gray; - } -a:hover { - color: red; - text-decoration: none; -} -a:active, a:focus { - color: red; -} \ No newline at end of file diff --git a/MicroPython_BUILD/components/internalfs_image/image_go/www/test.pyhtml b/MicroPython_BUILD/components/internalfs_image/image_go/www/test.pyhtml deleted file mode 100644 index bb98d2c..0000000 --- a/MicroPython_BUILD/components/internalfs_image/image_go/www/test.pyhtml +++ /dev/null @@ -1,34 +0,0 @@ - - - TEST - - -

BEGIN

- {{ py }} - def _testFunction(x) : - return "IN TEST FUNCTION %s" % x - {{ end }} -
- {{ for toto in range(3) }} - This is an HTML test...
- TOTO = {{ toto + 1 }} !
- {{ for toto2 in range(3) }} - TOTO2 = {{ _testFunction(toto2) }} - {{ end }} - Ok good.
- {{ end }} -
- {{ _testFunction(100) }}
-
- {{ if 2+5 < 3 }} - IN IF (1) - {{ elif 10+15 != 25 }} - IN ELIF (2) - {{ elif 10+15 == 25 }} - IN ELIF (3) - {{ else }} - IN ELSE (4) - {{ end }} -

JC :')

- - diff --git a/MicroPython_BUILD/components/internalfs_image/spiffs_image.img b/MicroPython_BUILD/components/internalfs_image/spiffs_image.img deleted file mode 100644 index 0c612e7..0000000 Binary files a/MicroPython_BUILD/components/internalfs_image/spiffs_image.img and /dev/null differ diff --git a/MicroPython_BUILD/components/micropython/Kconfig.projbuild b/MicroPython_BUILD/components/micropython/Kconfig.projbuild index 33b93ab..88e6b41 100644 --- a/MicroPython_BUILD/components/micropython/Kconfig.projbuild +++ b/MicroPython_BUILD/components/micropython/Kconfig.projbuild @@ -100,6 +100,14 @@ menu "MicroPython" bool "Verbose" endchoice + config MICROPY_USE_THREADED_REPL + bool "Start REPL in separate thread" + default n + help + Start the REPL in its own thread + Running REPL in thread may solve some issues with uasyncio + and long running or infinite loops + config MICROPY_RX_BUFFER_SIZE int "RX buffer size" range 256 4096 @@ -121,6 +129,7 @@ menu "MicroPython" help Run MicroPython tasks on both cores, if not selected MicroPython tasks are created pinned to one core WARNING: When enabled, it may introduce some issues with uasyncio and threads + not recommended for now! config MICROPY_TASK_PRIORITY int "Main task priority" @@ -131,9 +140,9 @@ menu "MicroPython" config MICROPY_STACK_SIZE int "MicroPython stack size (KB)" - range 8 32 if !SPIRAM_SUPPORT - range 8 64 if SPIRAM_SUPPORT - default 20 + range 6 32 if !SPIRAM_SUPPORT + range 6 64 if SPIRAM_SUPPORT + default 16 help Set the size of the MicroPython stack in Kbytes. diff --git a/MicroPython_BUILD/components/micropython/esp32/machine_rtc.c b/MicroPython_BUILD/components/micropython/esp32/machine_rtc.c index 8b3c186..f4da311 100644 --- a/MicroPython_BUILD/components/micropython/esp32/machine_rtc.c +++ b/MicroPython_BUILD/components/micropython/esp32/machine_rtc.c @@ -50,6 +50,8 @@ #define RTC_MEM_INT_SIZE 64 #define RTC_MEM_STR_SIZE 2048 +char mpy_time_zone[64] = {'\0'}; + static int RTC_DATA_ATTR rtc_mem_int[RTC_MEM_INT_SIZE] = { 0 }; static char RTC_DATA_ATTR rtc_mem_str[RTC_MEM_STR_SIZE] = { 0 }; static uint16_t RTC_DATA_ATTR rtc_mem_int_crc; @@ -268,6 +270,29 @@ void sntp_task (void *pvParameters) vTaskDelete(NULL); } +//-------------------------------------------- +void tz_fromto_NVS(char *gettzs, char *settzs) +{ + size_t len = 0; + char value[64] = {'\0'}; + if (gettzs) { + gettzs[0] = '\0'; + esp_err_t ret = nvs_get_str(mpy_nvs_handle, "MpyTimeZone", NULL, &len); + if ((ret == ESP_OK ) && (len > 0) && (len < 64)) { + esp_err_t ret = nvs_get_str(mpy_nvs_handle, "MpyTimeZone", value, &len); + if ((ret == ESP_OK ) && (len > 0) && (len < 64)) { + if (gettzs) strcpy(gettzs, value); + } + } + } + if (settzs) { + esp_err_t esp_err = nvs_set_str(mpy_nvs_handle, "MpyTimeZone", settzs); + if (ESP_OK == esp_err) { + nvs_commit(mpy_nvs_handle); + } + } +} + //--------------------------------------------------------------------------------------------- STATIC mp_obj_t mach_rtc_ntp_sync(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { static const mp_arg_t allowed_args[] = { @@ -291,23 +316,30 @@ STATIC mp_obj_t mach_rtc_ntp_sync(size_t n_args, const mp_obj_t *pos_args, mp_ma if ((strlen(srvn) > 3) && (strlen(srvn) < 64)) sprintf(srv_name, "%s", srvn); } - char tz[64]; - #ifdef MICROPY_TIMEZONE - // ===== Set time zone ====== - sprintf(tz, "%s", MICROPY_TIMEZONE); + if (strlen(mpy_time_zone) == 0) { + // Try to get tz from NVS + tz_fromto_NVS(mpy_time_zone, NULL); + if (strlen(mpy_time_zone) == 0) { + #ifdef MICROPY_TIMEZONE + // ===== Set default time zone ====== + snprintf(mpy_time_zone, sizeof(mpy_time_zone)-1, "%s", MICROPY_TIMEZONE); + #endif + } + } + if (args[2].u_obj != mp_const_none) { + // get TZ argument const char *tzs = mp_obj_str_get_str(args[2].u_obj); - if (strlen(tzs) < 64) { - sprintf(tz, "%s", tzs); + if ((strlen(tzs) < 2) && (strlen(tzs) < 64)) { + sprintf(mpy_time_zone, "%s", tzs); + tz_fromto_NVS(NULL, mpy_time_zone); + } + else { + mp_raise_ValueError("tz string length must be 3 - 64"); } } - setenv("TZ", tz, 1); + setenv("TZ", mpy_time_zone, 1); tzset(); - // ========================== - #else - tz[0] = '\0'; - #endif - if (sntp_mutex == NULL) { // Create sntp mutex diff --git a/MicroPython_BUILD/components/micropython/esp32/machine_rtc.h b/MicroPython_BUILD/components/micropython/esp32/machine_rtc.h index d8b4af6..f1900c3 100644 --- a/MicroPython_BUILD/components/micropython/esp32/machine_rtc.h +++ b/MicroPython_BUILD/components/micropython/esp32/machine_rtc.h @@ -29,9 +29,11 @@ #ifndef MACHRTC_H_ #define MACHRTC_H_ +extern char mpy_time_zone[64]; extern const mp_obj_type_t mach_rtc_type; extern xSemaphoreHandle sntp_mutex; void rtc_init0(void); +void tz_fromto_NVS(char *gettzs, char *settzs); #endif // MACHRTC_H_ diff --git a/MicroPython_BUILD/components/micropython/esp32/machine_timer.c b/MicroPython_BUILD/components/micropython/esp32/machine_timer.c index 532ac87..badb7a3 100644 --- a/MicroPython_BUILD/components/micropython/esp32/machine_timer.c +++ b/MicroPython_BUILD/components/micropython/esp32/machine_timer.c @@ -670,7 +670,7 @@ STATIC const mp_map_elem_t machine_timer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_init), (mp_obj_t)&machine_timer_init_obj }, { MP_ROM_QSTR(MP_QSTR_value), (mp_obj_t)&machine_timer_value_obj }, { MP_ROM_QSTR(MP_QSTR_events), (mp_obj_t)&machine_timer_events_obj }, - { MP_ROM_QSTR(MP_QSTR_reshot), (mp_obj_t)&machine_timer_shot_obj }, + { MP_ROM_QSTR(MP_QSTR_reshoot), (mp_obj_t)&machine_timer_shot_obj }, { MP_ROM_QSTR(MP_QSTR_start), (mp_obj_t)&machine_timer_start_obj }, { MP_ROM_QSTR(MP_QSTR_stop), (mp_obj_t)&machine_timer_pause_obj }, { MP_ROM_QSTR(MP_QSTR_pause), (mp_obj_t)&machine_timer_pause_obj }, diff --git a/MicroPython_BUILD/components/micropython/esp32/machine_uart.c b/MicroPython_BUILD/components/micropython/esp32/machine_uart.c index da42588..8d6e8b6 100644 --- a/MicroPython_BUILD/components/micropython/esp32/machine_uart.c +++ b/MicroPython_BUILD/components/micropython/esp32/machine_uart.c @@ -63,6 +63,7 @@ typedef struct _machine_uart_obj_t { uint32_t *data_cb; uint32_t *pattern_cb; uint32_t *error_cb; + uint32_t inverted; uint8_t end_task; uint8_t lineend[3]; } machine_uart_obj_t; @@ -149,10 +150,10 @@ static void _sched_callback(mp_obj_t function, int uart, int type, int iarglen, if (!make_carg_entry(carg, 0, MP_SCHED_ENTRY_TYPE_INT, uart, NULL, NULL)) return; if (!make_carg_entry(carg, 1, MP_SCHED_ENTRY_TYPE_INT, type, NULL, NULL)) return; if (sarg) { - if (!make_carg_entry(carg, 2, MP_SCHED_ENTRY_TYPE_INT, iarglen, NULL, NULL)) return; + if (!make_carg_entry(carg, 2, MP_SCHED_ENTRY_TYPE_STR, iarglen, sarg, NULL)) return; } else { - if (!make_carg_entry(carg, 2, MP_SCHED_ENTRY_TYPE_STR, iarglen, sarg, NULL)) return; + if (!make_carg_entry(carg, 2, MP_SCHED_ENTRY_TYPE_INT, iarglen, NULL, NULL)) return; } mp_sched_schedule(function, mp_const_none, carg); } @@ -281,9 +282,10 @@ static const mp_arg_t allowed_args[] = { { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, { MP_QSTR_buffer_size, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 512} }, { MP_QSTR_lineend, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_inverted, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_int = -1} }, }; -enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_rts, ARG_cts, ARG_timeout, ARG_buffer_size, ARG_lineend }; +enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_rts, ARG_cts, ARG_timeout, ARG_buffer_size, ARG_lineend, ARG_inverted }; //----------------------------------------------------------------------------------------------- STATIC void machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { @@ -314,10 +316,28 @@ STATIC void machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_pri lnend_idx++; } } + char inverted[24] = {'\0'}; + if (self->inverted & (uint32_t)UART_INVERSE_RXD) { + if (inverted[0] != '\0') strcat(inverted, ", "); + strcat(inverted, "RX"); + } + if (self->inverted & (uint32_t)UART_INVERSE_TXD) { + if (inverted[0] != '\0') strcat(inverted, ", "); + strcat(inverted, "TX"); + } + if (self->inverted & (uint32_t)UART_INVERSE_CTS) { + if (inverted[0] != '\0') strcat(inverted, ", "); + strcat(inverted, "CTS"); + } + if (self->inverted & (uint32_t)UART_INVERSE_RTS) { + if (inverted[0] != '\0') strcat(inverted, ", "); + strcat(inverted, "RTS"); + } - mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%s, tx=%d, rx=%d, rts=%d, cts=%d, timeout=%u, buf_size=%u, lineend=b'%s')", + mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%s, tx=%d, rx=%d, rts=%d, cts=%d, inverted: [%s]\n", self->uart_num+1, baudrate, self->bits, _parity_name[self->parity], _stopbits_name[self->stop], - self->tx, self->rx, self->rts, self->cts, self->timeout, self->buffer_size, lnend); + self->tx, self->rx, self->rts, self->cts, inverted); + mp_printf(print, " timeout=%u, buf_size=%u, lineend=b'%s')", self->timeout, self->buffer_size, lnend); if (self->data_cb) { mp_printf(print, "\n data CB: True, on len: %d", self->data_cb_size); } @@ -420,6 +440,12 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co } } + // set inverted pins + if ((args[ARG_inverted].u_int > -1) && (args[ARG_inverted].u_int != self->inverted)) { + self->inverted = args[ARG_inverted].u_int & (UART_INVERSE_RXD | UART_INVERSE_TXD | UART_INVERSE_RTS | UART_INVERSE_CTS); + uart_set_line_inverse(self->uart_num+1, self->inverted); + } + // set pins if (((self->tx == -2) && (args[ARG_tx].u_int == UART_PIN_NO_CHANGE)) || ((self->rx == -2) && (args[ARG_rx].u_int == UART_PIN_NO_CHANGE))) { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Tx&Rx pins must be set: u=machine.UART(uart_num, tx=pin, rx=pin)")); @@ -435,8 +461,16 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co if (args[ARG_tx].u_int != UART_PIN_NO_CHANGE) self->tx = args[ARG_tx].u_int; if (args[ARG_rx].u_int != UART_PIN_NO_CHANGE) self->rx = args[ARG_rx].u_int; - if (args[ARG_rts].u_int != UART_PIN_NO_CHANGE) self->rts = args[ARG_rts].u_int; - if (args[ARG_cts].u_int != UART_PIN_NO_CHANGE) self->cts = args[ARG_cts].u_int; + if ((self->rts != args[ARG_rts].u_int) || (self->cts != args[ARG_cts].u_int)) { + if (args[ARG_rts].u_int != UART_PIN_NO_CHANGE) self->rts = args[ARG_rts].u_int; + if (args[ARG_cts].u_int != UART_PIN_NO_CHANGE) self->cts = args[ARG_cts].u_int; + // set flow control + int fwc = 0; + if (self->rts >= 0) fwc |= UART_HW_FLOWCTRL_RTS; + if (self->cts >= 0) fwc |= UART_HW_FLOWCTRL_CTS; + // Only when UART_HW_FLOWCTRL_RTS is set, will the rx_thresh value be set. + uart_set_hw_flow_ctrl(self->uart_num+1, fwc, UART_FIFO_LEN / 4 * 3); + } } // set timeout @@ -496,6 +530,7 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, self->stop = UART_STOP_BITS_1; self->rts = UART_PIN_NO_CHANGE; self->cts = UART_PIN_NO_CHANGE; + self->inverted = UART_INVERSE_DISABLE; self->timeout = 0; self->pattern[0] = 0; self->pattern_len = 0; @@ -773,6 +808,33 @@ STATIC mp_obj_t machine_uart_callback(size_t n_args, const mp_obj_t *pos_args, m } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_uart_callback_obj, 2, machine_uart_callback); +//--------------------------------------------------------------------------- +STATIC mp_obj_t machine_uart_write_break(size_t n_args, const mp_obj_t *args) +{ + machine_uart_obj_t *self = MP_OBJ_TO_PTR(args[0]); + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_READ); + + // break signal length + // unit: one BIT time at current_baudrate + int nbreak = nbreak = mp_obj_get_int_truncated(args[2]); + if ((nbreak < 1) || (nbreak > 255)) { + mp_raise_ValueError("values 1 - 255 are allowed"); + } + + int len = bufinfo.len; + if (n_args == 4) { + len = mp_obj_get_int_truncated(args[3]); + if ((len < 0) || (len > bufinfo.len)) len = bufinfo.len;; + } + + int bytes_written = uart_write_bytes_with_break(self->uart_num+1, (const char*)bufinfo.buf, len, nbreak); + + return MP_OBJ_NEW_SMALL_INT(bytes_written); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_uart_write_break_obj, 3, 4, machine_uart_write_break); + //================================================================= STATIC const mp_rom_map_elem_t machine_uart_locals_dict_table[] = { @@ -783,6 +845,7 @@ STATIC const mp_rom_map_elem_t machine_uart_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) }, { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) }, { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) }, + { MP_ROM_QSTR(MP_QSTR_write_break), MP_ROM_PTR(&machine_uart_write_break_obj) }, { MP_ROM_QSTR(MP_QSTR_readln), MP_ROM_PTR(&machine_uart_readln_obj) }, { MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&machine_uart_flush_obj) }, { MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&machine_uart_callback_obj) }, @@ -791,6 +854,12 @@ STATIC const mp_rom_map_elem_t machine_uart_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_CBTYPE_DATA), MP_ROM_INT(UART_CB_TYPE_DATA) }, { MP_ROM_QSTR(MP_QSTR_CBTYPE_PATTERN), MP_ROM_INT(UART_CB_TYPE_PATTERN) }, { MP_ROM_QSTR(MP_QSTR_CBTYPE_ERROR), MP_ROM_INT(UART_CB_TYPE_ERROR) }, + + { MP_ROM_QSTR(MP_QSTR_INV_RX), MP_ROM_INT(UART_INVERSE_RXD >> 1) }, + { MP_ROM_QSTR(MP_QSTR_INV_TX), MP_ROM_INT(UART_INVERSE_TXD >> 1) }, + { MP_ROM_QSTR(MP_QSTR_INV_CTS), MP_ROM_INT(UART_INVERSE_CTS >> 1) }, + { MP_ROM_QSTR(MP_QSTR_INV_RTS), MP_ROM_INT(UART_INVERSE_RTS >> 1) }, + { MP_ROM_QSTR(MP_QSTR_INV_NONE), MP_ROM_INT(0) }, }; STATIC MP_DEFINE_CONST_DICT(machine_uart_locals_dict, machine_uart_locals_dict_table); diff --git a/MicroPython_BUILD/components/micropython/esp32/main.c b/MicroPython_BUILD/components/micropython/esp32/main.c index 252f45f..25835d4 100644 --- a/MicroPython_BUILD/components/micropython/esp32/main.c +++ b/MicroPython_BUILD/components/micropython/esp32/main.c @@ -26,6 +26,7 @@ #include #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -63,6 +64,8 @@ #include "mqtt.h" #endif +#include "driver/uart.h" +#include "rom/uart.h" #include "sdkconfig.h" @@ -72,21 +75,16 @@ #define NVS_NAMESPACE "MPY_NVM" #define MP_TASK_PRIORITY CONFIG_MICROPY_TASK_PRIORITY -#define MP_TASK_STACK_SIZE (CONFIG_MICROPY_STACK_SIZE * 1024) -#define MP_TASK_HEAP_SIZE (CONFIG_MICROPY_HEAP_SIZE * 1024) -#define MP_TASK_STACK_LEN (MP_TASK_STACK_SIZE / sizeof(StackType_t)) +#define MP_TASK_STACK_LEN 3072 -STATIC TaskHandle_t MainTaskHandle = NULL; - -STATIC StaticTask_t DRAM_ATTR mp_task_tcb; -STATIC StackType_t DRAM_ATTR mp_task_stack[MP_TASK_STACK_LEN] __attribute__((aligned (8))); - -STATIC uint8_t *mp_task_heap; +static StaticTask_t DRAM_ATTR mp_task_tcb; +static StackType_t *mp_task_stack; +static uint8_t *mp_task_heap; +static int mp_task_stack_len = 4092; int MainTaskCore = 0; -#include "driver/uart.h" -#include "rom/uart.h" + //=============================== void mp_task(void *pvParameter) { volatile uint32_t sp = (uint32_t)get_sp(); @@ -121,38 +119,34 @@ void mp_task(void *pvParameter) { // ------------------------------------------------------------------------------------------------------------- */ - #ifdef CONFIG_MICROPY_USE_TASK_WDT - // Enable watchdog for MicroPython main task - esp_task_wdt_init(CONFIG_TASK_WDT_TIMEOUT_S, false); - esp_task_wdt_add(MainTaskHandle); - esp_task_wdt_reset(); - #endif - uart_init(); - // Check and open NVS name space - if (nvs_open(NVS_NAMESPACE, NVS_READWRITE, &mpy_nvs_handle) != ESP_OK) { - mpy_nvs_handle = 0; - printf("Error while opening MicroPython NVS name space\n"); - } + #if CONFIG_BOOT_SET_LED >= 0 + // Deactivate boot led + gpio_pad_select_gpio(CONFIG_BOOT_SET_LED); + GPIO_OUTPUT_SET(CONFIG_BOOT_SET_LED, CONFIG_BOOT_LED_ON ^ 1); + #endif - // Get and print reset & wakeup reasons + // Get and print reset & wakeup reasons mpsleep_init0(); if (mpsleep_get_reset_cause() != MPSLEEP_DEEPSLEEP_RESET) rtc_init0(); - mp_thread_preinit(&mp_task_stack[0], MP_TASK_STACK_LEN); + mp_thread_preinit(&mp_task_stack[0], mp_task_stack_len); -soft_reset: // Thread init mp_thread_init(); // Initialize the stack pointer for the main thread mp_stack_set_top((void *)sp); - mp_stack_set_limit(MP_TASK_STACK_SIZE - 1024); + #ifdef CONFIG_MICROPY_USE_THREADED_REPL + mp_stack_set_limit(mp_task_stack_len - 256); + #else + mp_stack_set_limit(mp_task_stack_len - 1024); + #endif // initialize the mp heap - gc_init(mp_task_heap, mp_task_heap + MP_TASK_HEAP_SIZE); + gc_init(mp_task_heap, mp_task_heap + mpy_heap_size); mp_init(); mp_obj_list_init(mp_sys_path, 0); @@ -168,12 +162,6 @@ soft_reset: // === Mount internal flash file system === int res = mount_vfs(VFS_NATIVE_TYPE_SPIFLASH, VFS_NATIVE_INTERNAL_MP); - #if CONFIG_BOOT_SET_LED >= 0 - // Deactivate boot led - gpio_pad_select_gpio(CONFIG_BOOT_SET_LED); - GPIO_OUTPUT_SET(CONFIG_BOOT_SET_LED, CONFIG_BOOT_LED_ON ^ 1); - #endif - if (res == 0) { // run boot-up script 'boot.py' pyexec_frozen_module("_boot.py"); @@ -188,7 +176,7 @@ soft_reset: } } } - else printf("Error mounting Flash file system\n"); + else ESP_LOGE("MicroPython", "Error mounting Flash file system"); // === Print some info === char sbuff[24] = { 0 }; @@ -226,7 +214,11 @@ soft_reset: printf("Wakeup source: %s\n", sbuff); } - printf(" uPY stack: %d bytes\n", MP_TASK_STACK_LEN-1024); + #ifdef CONFIG_MICROPY_USE_THREADED_REPL + printf(" REPL stack: %d bytes\n", mpy_repl_stack_size); + #else + printf(" uPY stack: %d bytes\n", mp_task_stack_len); + #endif #if CONFIG_SPIRAM_SUPPORT // ## USING SPI RAM FOR HEAP ## @@ -243,32 +235,63 @@ soft_reset: #endif // === Main loop ================================== - for (;;) { - if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { - if (pyexec_raw_repl() != 0) { - break; - } - } - else { - if (pyexec_friendly_repl() != 0) { - break; - } - } - } + MP_THREAD_GIL_EXIT(); + + #ifdef CONFIG_MICROPY_USE_TASK_WDT + // Enable watchdog for MicroPython main task + esp_task_wdt_init(CONFIG_TASK_WDT_TIMEOUT_S, false); + esp_task_wdt_add(MainTaskHandle); + esp_task_wdt_reset(); + #endif + + #ifdef CONFIG_MICROPY_USE_THREADED_REPL + // === Start REPL in separate thread === + pyexec_frozen_module("modREPL.py"); + #ifdef CONFIG_MICROPY_USE_TASK_WDT + if (ReplTaskHandle) { + // Enable watchdog for MicroPython main task + esp_task_wdt_init(CONFIG_TASK_WDT_TIMEOUT_S, false); + esp_task_wdt_add(ReplTaskHandle); + esp_task_wdt_reset(); + } + #endif + if (!ReplTaskHandle) { + printf("!! Error starting threaded REPL, Halted. !!\n"); + } + while (1) { + // Main task just waits doing nothing + vTaskDelay(CONFIG_TASK_WDT_TIMEOUT_S * 500 / portTICK_RATE_MS); + #ifdef CONFIG_MICROPY_USE_TASK_WDT + esp_task_wdt_reset(); + #endif + } + #else + // === Start REPL in main task === + ReplTaskHandle = MainTaskHandle; + for (;;) { + if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { + if (pyexec_raw_repl() != 0) { + break; + } + } + else { + if (pyexec_friendly_repl() != 0) { + break; + } + } + } + #endif // ================================================ - //ToDo: Remember the REPL mode !! + //ToDo: Remember the REPL mode (is it needed ?) !! prepareSleepReset(0, "ESP32: soft reboot\r\n"); - esp_restart(); - - goto soft_reset; + esp_restart(); // no return !! } //============================ -void micropython_entry(void) { - ESP_LOGI("MicroPython", "[=== Started ===]"); - +void micropython_entry(void) +{ // === Set esp32 log levels while running MicroPython === if (CONFIG_MICRO_PY_LOG_LEVEL < CONFIG_LOG_DEFAULT_LEVEL) esp_log_level_set("*", CONFIG_MICRO_PY_LOG_LEVEL); if ((CONFIG_LOG_DEFAULT_LEVEL > ESP_LOG_WARN) && (CONFIG_MICRO_PY_LOG_LEVEL > ESP_LOG_WARN)){ @@ -286,8 +309,6 @@ void micropython_entry(void) { else esp_log_level_set("OTA_UPDATE", CONFIG_LOG_DEFAULT_LEVEL); #endif - nvs_flash_init(); - #ifdef CONFIG_MICROPY_USE_MQTT esp_log_level_set(MQTT_TAG, CONFIG_MQTT_LOG_LEVEL); #endif @@ -295,19 +316,77 @@ void micropython_entry(void) { esp_log_level_set(FTP_TAG, CONFIG_FTPSERVER_LOG_LEVEL); #endif + nvs_flash_init(); + + // === Check and allocate stack === + // Open NVS name space + if (nvs_open(NVS_NAMESPACE, NVS_READWRITE, &mpy_nvs_handle) != ESP_OK) { + mpy_nvs_handle = 0; + ESP_LOGE("MicroPython","Error while opening MicroPython NVS name space"); + } + if (mpy_nvs_handle != 0) { + // Get stack size from NVS + if (ESP_ERR_NVS_NOT_FOUND == nvs_get_i32(mpy_nvs_handle, "MPY_StackSize", &mpy_repl_stack_size)) { + mpy_repl_stack_size = CONFIG_MICROPY_STACK_SIZE * 1024; + } + else { + if ((mpy_repl_stack_size < MPY_MIN_STACK_SIZE) || (mpy_repl_stack_size > MPY_MAX_STACK_SIZE)) { + mpy_repl_stack_size = CONFIG_MICROPY_STACK_SIZE * 1024; + ESP_LOGE("MicroPython","Wrong Stack size set in NVS: %d (set to configured: %d)", mpy_heap_size, CONFIG_MICROPY_HEAP_SIZE * 1024); + } + else { + ESP_LOGW("MicroPython","Stack size set from NVS: %d (configured: %d)", mpy_repl_stack_size, CONFIG_MICROPY_STACK_SIZE * 1024); + } + } + // restore time zone + tz_fromto_NVS(mpy_time_zone, NULL); + if (strlen(mpy_time_zone) > 0) { + setenv("TZ", mpy_time_zone, 1); + tzset(); + } + } + mpy_repl_stack_size &= 0x7FFFFFFC; + + #ifdef CONFIG_MICROPY_USE_THREADED_REPL + mp_task_stack_len = MP_TASK_STACK_LEN; + #else + mp_task_stack_len = mpy_repl_stack_size; + #endif + mp_task_stack = heap_caps_malloc(mp_task_stack_len, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); + if (mp_task_stack == NULL) { + printf("Error allocating stack, Halted.\n"); + return; + } + // ==== Allocate heap memory ==== + if (mpy_nvs_handle != 0) { + // Get heap size from NVS + if (ESP_ERR_NVS_NOT_FOUND == nvs_get_i32(mpy_nvs_handle, "MPY_HeapSize", &mpy_heap_size)) { + mpy_heap_size = CONFIG_MICROPY_HEAP_SIZE * 1024; + } + else { + if ((mpy_heap_size < MPY_MIN_HEAP_SIZE) || (mpy_heap_size > MPY_MAX_HEAP_SIZE)) { + mpy_heap_size = CONFIG_MICROPY_HEAP_SIZE * 1024; + ESP_LOGE("MicroPython","Wrong Heap size set in NVS: %d (set to configured: %d)", mpy_heap_size, CONFIG_MICROPY_HEAP_SIZE * 1024); + } + else { + ESP_LOGW("MicroPython","Heap size set from NVS: %d (configured: %d)", mpy_heap_size, CONFIG_MICROPY_HEAP_SIZE * 1024); + } + } + } + mpy_heap_size &= 0x7FFFFFFC; #if CONFIG_SPIRAM_SUPPORT // ## USING SPI RAM FOR HEAP ## #if CONFIG_SPIRAM_USE_CAPS_ALLOC - mp_task_heap = heap_caps_malloc(MP_TASK_HEAP_SIZE, MALLOC_CAP_SPIRAM); + mp_task_heap = heap_caps_malloc(mpy_heap_size, MALLOC_CAP_SPIRAM); #elif SPIRAM_USE_MEMMAP mp_task_heap = (uint8_t *)0x3f800000; #else - mp_task_heap = malloc(MP_TASK_HEAP_SIZE); + mp_task_heap = malloc(mpy_heap_size); #endif #else // ## USING DRAM FOR HEAP ## - mp_task_heap = malloc(MP_TASK_HEAP_SIZE); + mp_task_heap = malloc(mpy_heap_size); #endif if (mp_task_heap == NULL) { @@ -319,16 +398,17 @@ void micropython_entry(void) { periph_module_disable(PERIPH_I2C0_MODULE); periph_module_enable(PERIPH_I2C0_MODULE); + printf("\n[=== MicroPython started ===]\n"); // ==== Create and start main MicroPython task ==== #if CONFIG_FREERTOS_UNICORE MainTaskCore = 0; - MainTaskHandle = xTaskCreateStaticPinnedToCore(&mp_task, "mp_task", MP_TASK_STACK_LEN, NULL, MP_TASK_PRIORITY, &mp_task_stack[0], &mp_task_tcb, 0); + MainTaskHandle = xTaskCreateStaticPinnedToCore(&mp_task, "mp_task", mp_task_stack_len, NULL, MP_TASK_PRIORITY, &mp_task_stack[0], &mp_task_tcb, 0); #else MainTaskCore = 1; #if CONFIG_MICROPY_USE_BOTH_CORES - MainTaskHandle = xTaskCreateStatic(&mp_task, "mp_task", MP_TASK_STACK_LEN, NULL, MP_TASK_PRIORITY, &mp_task_stack[0], &mp_task_tcb); + MainTaskHandle = xTaskCreateStatic(&mp_task, "mp_task", mp_task_stack_len, NULL, MP_TASK_PRIORITY, &mp_task_stack[0], &mp_task_tcb); #else - MainTaskHandle = xTaskCreateStaticPinnedToCore(&mp_task, "mp_task", MP_TASK_STACK_LEN, NULL, MP_TASK_PRIORITY, &mp_task_stack[0], &mp_task_tcb, 1); + MainTaskHandle = xTaskCreateStaticPinnedToCore(&mp_task, "mp_task", mp_task_stack_len, NULL, MP_TASK_PRIORITY, &mp_task_stack[0], &mp_task_tcb, 1); #endif #endif } diff --git a/MicroPython_BUILD/components/micropython/esp32/modmachine.c b/MicroPython_BUILD/components/micropython/esp32/modmachine.c index d38881e..15e234a 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modmachine.c +++ b/MicroPython_BUILD/components/micropython/esp32/modmachine.c @@ -72,6 +72,8 @@ nvs_handle mpy_nvs_handle = 0; machine_rtc_config_t RTC_DATA_ATTR machine_rtc_config = {0}; +int mpy_repl_stack_size = CONFIG_MICROPY_STACK_SIZE * 1024; +int mpy_heap_size = CONFIG_MICROPY_HEAP_SIZE * 1024; // === Variables stored in RTC_SLOW_MEM === @@ -862,6 +864,47 @@ STATIC mp_obj_t mod_machine_set_wdt() { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_machine_set_wdt_obj, mod_machine_set_wdt); +//----------------------------------------------------------------------- +static void _set_stack_heap(char *key, int value, int valmin, int valmax) +{ + checkNVS(); + + if ((value != 0) && ((value < valmin) || (value > valmax))) { + mp_raise_msg(&mp_type_OSError, "Invalid size"); + } + + esp_err_t esp_err = nvs_set_i32(mpy_nvs_handle, key, value); + if (ESP_OK == esp_err) { + nvs_commit(mpy_nvs_handle); + } + else if (ESP_ERR_NVS_NOT_ENOUGH_SPACE == esp_err || ESP_ERR_NVS_PAGE_FULL == esp_err || ESP_ERR_NVS_NO_FREE_PAGES == esp_err) { + mp_raise_msg(&mp_type_OSError, "No space available for NVS variable."); + } + else if (ESP_ERR_NVS_INVALID_NAME == esp_err || ESP_ERR_NVS_KEY_TOO_LONG == esp_err) { + mp_raise_msg(&mp_type_OSError, "NVS Key invalid or too long"); + } +} + +//---------------------------------------------------------- +STATIC mp_obj_t mod_machine_set_stack_size (mp_obj_t _value) +{ + int value = mp_obj_get_int_truncated(_value); + value &= 0x7FFFFFFC; + _set_stack_heap("MPY_StackSize", value, MPY_MIN_STACK_SIZE, MPY_MAX_STACK_SIZE); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_machine_set_stack_size_obj, mod_machine_set_stack_size); + +//----------------------------------------------------------- +STATIC mp_obj_t mod_machine_set_heap_size (mp_obj_t _value) +{ + int value = mp_obj_get_int_truncated(_value); + value &= 0x7FFFFFFC; + _set_stack_heap("MPY_HeapSize", value, MPY_MIN_HEAP_SIZE, MPY_MAX_HEAP_SIZE); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_machine_set_heap_size_obj, mod_machine_set_heap_size); + //=============================================================== STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { @@ -882,6 +925,8 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_wake_description), MP_ROM_PTR(&machine_wake_desc_obj) }, { MP_ROM_QSTR(MP_QSTR_heap_info), MP_ROM_PTR(&machine_heap_info_obj) }, { MP_ROM_QSTR(MP_QSTR_stdin_disable), MP_ROM_PTR(&mod_machine_stdin_disable_obj) }, + { MP_ROM_QSTR(MP_QSTR_SetStackSize), MP_ROM_PTR(&mod_machine_set_stack_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_SetHeapSize), MP_ROM_PTR(&mod_machine_set_heap_size_obj) }, { MP_OBJ_NEW_QSTR(MP_QSTR_nvs_setint), MP_ROM_PTR(&mod_machine_nvs_set_int_obj) }, { MP_OBJ_NEW_QSTR(MP_QSTR_nvs_getint), MP_ROM_PTR(&mod_machine_nvs_get_int_obj) }, diff --git a/MicroPython_BUILD/components/micropython/esp32/modmachine.h b/MicroPython_BUILD/components/micropython/esp32/modmachine.h index 58c0812..bd3d8e0 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modmachine.h +++ b/MicroPython_BUILD/components/micropython/esp32/modmachine.h @@ -31,11 +31,27 @@ #ifndef MICROPY_INCLUDED_ESP32_MODMACHINE_H #define MICROPY_INCLUDED_ESP32_MODMACHINE_H +#include "sdkconfig.h" #include "nvs_flash.h" #include "nvs.h" #include "py/obj.h" #include "driver/rtc_io.h" +#define MPY_MIN_STACK_SIZE (6*1024) +#if CONFIG_SPIRAM_SUPPORT +#define MPY_MAX_STACK_SIZE (64*1024) +#define MPY_MIN_HEAP_SIZE (128*1024) +#define MPY_MAX_HEAP_SIZE (3584*1024) +#else +#define MPY_MAX_STACK_SIZE (32*1024) +#define MPY_MIN_HEAP_SIZE (48*1024) +#if defined(CONFIG_MICROPY_USE_CURL) && defined(CONFIG_MICROPY_USE_CURL_TLS) +#define MPY_MAX_HEAP_SIZE (72*1024) +#else +#define MPY_MAX_HEAP_SIZE (96*1024) +#endif +#endif + #define EXT1_WAKEUP_ALL_HIGH 2 //!< Wake the chip when all selected GPIOs go high #define EXT1_WAKEUP_MAX_PINS 4 @@ -78,6 +94,8 @@ extern const mp_obj_type_t machine_ds18x20_type; extern const mp_obj_type_t machine_i2s_type; extern nvs_handle mpy_nvs_handle; +extern int mpy_repl_stack_size; +extern int mpy_heap_size; void machine_pins_init(void); void machine_pins_deinit(void); diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/inisetup.py b/MicroPython_BUILD/components/micropython/esp32/modules/inisetup.py index ee57bf3..56fdfe8 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modules/inisetup.py +++ b/MicroPython_BUILD/components/micropython/esp32/modules/inisetup.py @@ -10,7 +10,7 @@ sys.path[1] = '/flash/lib' from m5stack import lcd, speaker, buttonA, buttonB, buttonC # ---------- M5Cloud ------------ -if True: +if False: if buttonB.isPressed(): lcd.println('On: OFF-LINE Mode', color=lcd.ORANGE) else: diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/m5stack.py b/MicroPython_BUILD/components/micropython/esp32/modules/m5stack.py index 4d80d49..9687050 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modules/m5stack.py +++ b/MicroPython_BUILD/components/micropython/esp32/modules/m5stack.py @@ -151,7 +151,7 @@ print('\nDevice ID:' + node_id) # LCD lcd = lcd.TFT() -lcd.init(lcd.M5STACK, width=240, height=320, speed=27000000, rst_pin=33, backl_pin=32, miso=19, mosi=23, clk=18, cs=14, dc=27, bgr=True, backl_on=1, invrot=3) +lcd.init(lcd.M5STACK, width=240, height=320, speed=40000000, rst_pin=33, backl_pin=32, miso=19, mosi=23, clk=18, cs=14, dc=27, bgr=True, backl_on=1, invrot=3) lcd.clear() lcd.setBrightness(500) lcd.setColor(0xCCCCCC) diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/modREPL.py b/MicroPython_BUILD/components/micropython/esp32/modules/modREPL.py new file mode 100644 index 0000000..f0f4392 --- /dev/null +++ b/MicroPython_BUILD/components/micropython/esp32/modules/modREPL.py @@ -0,0 +1,11 @@ +import _thread +import sys + +def thREPL(): + while True: + print(">>> Starting REPL in thread <<<\n") + sys.REPL() + +_thread.stack_size(sys.stackSize()) +REPLthread = _thread.start_new_thread("REPLthread", thREPL, ()) +_thread.stack_size(4096) diff --git a/MicroPython_BUILD/components/micropython/esp32/mpthreadport.c b/MicroPython_BUILD/components/micropython/esp32/mpthreadport.c index 665814c..660a582 100644 --- a/MicroPython_BUILD/components/micropython/esp32/mpthreadport.c +++ b/MicroPython_BUILD/components/micropython/esp32/mpthreadport.c @@ -63,6 +63,7 @@ extern TaskHandle_t FtpTaskHandle; extern int MainTaskCore; TaskHandle_t MainTaskHandle = NULL; +TaskHandle_t ReplTaskHandle = NULL; uint8_t main_accept_msg = 1; @@ -200,7 +201,13 @@ STATIC void freertos_entry(void *arg) { //------------------------------------------------------------------------------------------------------------------------------ TaskHandle_t mp_thread_create_ex(void *(*entry)(void*), void *arg, size_t *stack_size, int priority, char *name, bool same_core) { - // store thread entry function into a global variable so we can access it + bool is_repl = (strcmp(name, "REPLthread") == 0); + if (is_repl) { + if (ReplTaskHandle) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "REPL thread already started")); + } + } + // store thread entry function into a global variable so we can access it ext_thread_entry = entry; // Check thread stack size @@ -247,6 +254,7 @@ TaskHandle_t mp_thread_create_ex(void *(*entry)(void*), void *arg, size_t *stack nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "can't create thread")); } + if (is_repl) ReplTaskHandle = id; // adjust the stack_size to provide room to recover from hitting the limit //*stack_size -= 1024; @@ -265,7 +273,8 @@ TaskHandle_t mp_thread_create_ex(void *(*entry)(void*), void *arg, size_t *stack th->waiting = 0; th->deleted = 0; th->notifyed = 0; - th->type = THREAD_TYPE_PYTHON; + if (is_repl) th->type = THREAD_TYPE_REPL; + else th->type = THREAD_TYPE_PYTHON; thread = th; mp_thread_mutex_unlock(&thread_mutex); @@ -682,6 +691,23 @@ int mp_thread_list(thread_list_t *list) { int mp_thread_replAcceptMsg(int8_t accept) { int res = main_accept_msg; mp_thread_mutex_lock(&thread_mutex, 1); + for (thread_t *th = thread; th != NULL; th = th->next) { + if (th->id == xTaskGetCurrentTaskHandle()) { + if ((th->id == ReplTaskHandle) && (accept >= 0)) { + main_accept_msg = accept & 1; + } + break; + } + } + mp_thread_mutex_unlock(&thread_mutex); + + return res; +} + +//------------------------------------------ +int mp_thread_mainAcceptMsg(int8_t accept) { + int res = main_accept_msg; + mp_thread_mutex_lock(&thread_mutex, 1); for (thread_t *th = thread; th != NULL; th = th->next) { if (th->id == xTaskGetCurrentTaskHandle()) { if ((th->id == MainTaskHandle) && (accept >= 0)) { diff --git a/MicroPython_BUILD/components/micropython/esp32/mpthreadport.h b/MicroPython_BUILD/components/micropython/esp32/mpthreadport.h index a890090..ab3348f 100644 --- a/MicroPython_BUILD/components/micropython/esp32/mpthreadport.h +++ b/MicroPython_BUILD/components/micropython/esp32/mpthreadport.h @@ -39,6 +39,7 @@ #define THREAD_TYPE_MAIN 1 #define THREAD_TYPE_PYTHON 2 #define THREAD_TYPE_SERVICE 3 +#define THREAD_TYPE_REPL 3 // Reserved thread notification constants #define THREAD_NOTIFY_PAUSE 0x01000000 @@ -112,6 +113,9 @@ typedef struct _thread_list_t { threadlistitem_t *threads; // pointer to thread info } thread_list_t; +extern TaskHandle_t MainTaskHandle; +extern TaskHandle_t ReplTaskHandle; + thread_msg_t thread_messages[MAX_THREAD_MESSAGES]; uint8_t main_accept_msg; @@ -140,6 +144,7 @@ int mp_thread_getSelfname(char *name); int mp_thread_getname(TaskHandle_t id, char *name); int mp_thread_list(thread_list_t *list); int mp_thread_replAcceptMsg(int8_t accept); +int mp_thread_mainAcceptMsg(int8_t accept); #ifdef CONFIG_MICROPY_USE_TELNET uintptr_t mp_thread_createTelnetTask(size_t stack_size); diff --git a/MicroPython_BUILD/components/micropython/esp32/mpversion.h b/MicroPython_BUILD/components/micropython/esp32/mpversion.h index 4829843..81c77ef 100644 --- a/MicroPython_BUILD/components/micropython/esp32/mpversion.h +++ b/MicroPython_BUILD/components/micropython/esp32/mpversion.h @@ -24,12 +24,12 @@ * THE SOFTWARE. */ -#define MICROPY_GIT_TAG "ESP32_LoBo_v3.2.11" +#define MICROPY_GIT_TAG "ESP32_LoBo_v3.2.12" #define MICROPY_GIT_HASH "gbae9709a" -#define MICROPY_BUILD_DATE "2018-04-16" +#define MICROPY_BUILD_DATE "2018-04-18" #define MICROPY_VERSION_MAJOR (3) #define MICROPY_VERSION_MINOR (2) -#define MICROPY_VERSION_MICRO (11) -#define MICROPY_VERSION_STRING "3.2.11" +#define MICROPY_VERSION_MICRO (12) +#define MICROPY_VERSION_STRING "3.2.12" #define MICROPY_CORE_VERSION "59dda71" #define MICROPY_CORE_DATE "2018-04-10" diff --git a/MicroPython_BUILD/components/micropython/lib/utils/pyexec.c b/MicroPython_BUILD/components/micropython/lib/utils/pyexec.c index c8f7b68..15a5ce9 100644 --- a/MicroPython_BUILD/components/micropython/lib/utils/pyexec.c +++ b/MicroPython_BUILD/components/micropython/lib/utils/pyexec.c @@ -374,6 +374,7 @@ raw_repl_reset: return ret; } } + return 0; } int pyexec_friendly_repl(void) { @@ -499,6 +500,7 @@ friendly_repl_reset: return ret; } } + return 0; } #endif // MICROPY_REPL_EVENT_DRIVEN diff --git a/MicroPython_BUILD/components/micropython/py/modsys.c b/MicroPython_BUILD/components/micropython/py/modsys.c index 174c32f..dbb6169 100644 --- a/MicroPython_BUILD/components/micropython/py/modsys.c +++ b/MicroPython_BUILD/components/micropython/py/modsys.c @@ -26,6 +26,8 @@ * THE SOFTWARE. */ +#include "sdkconfig.h" +#include #include #include "py/builtin.h" #include "py/objlist.h" @@ -36,6 +38,9 @@ #include "py/stream.h" #include "py/smallint.h" #include "py/runtime.h" +#include "lib/utils/pyexec.h" +#include "modmachine.h" +#include "machine_rtc.h" #if MICROPY_PY_SYS @@ -101,6 +106,7 @@ STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) { exc = mp_obj_new_exception_arg1(&mp_type_SystemExit, args[0]); } nlr_raise(exc); + return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit); @@ -158,23 +164,94 @@ STATIC mp_obj_t mp_sys_mpycore() { } MP_DEFINE_CONST_FUN_OBJ_0(mp_sys_mpycore_obj, mp_sys_mpycore); +#ifdef CONFIG_MICROPY_USE_THREADED_REPL +//------------------------------------ +STATIC mp_obj_t mp_sys_exec_repl(void) +{ + for (;;) { + if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { + if (pyexec_raw_repl() != 0) { + break; + } + } + else { + if (pyexec_friendly_repl() != 0) { + break; + } + } + } + prepareSleepReset(0, "ESP32: soft reboot\r\n"); + esp_restart(); // no return !! + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_sys_exec_repl_obj, mp_sys_exec_repl); + +//------------------------------------- +STATIC mp_obj_t mp_sys_stack_size(void) +{ + return mp_obj_new_int(mpy_repl_stack_size); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_sys_stack_size_obj, mp_sys_stack_size); +#endif + +//------------------------------------------------------------------ +STATIC mp_obj_t mp_sys_timezone(size_t n_args, const mp_obj_t *args) +{ + if (n_args == 0) { + char tzs[64] = {'\0'}; + if (strlen(mpy_time_zone) == 0) { + // Try to get tz from NVS + tz_fromto_NVS(tzs, NULL); + if (strlen(tzs) > 0) { + strcpy(mpy_time_zone, tzs); + setenv("TZ", mpy_time_zone, 1); + tzset(); + } + } + else strcpy(tzs, mpy_time_zone); + } + else { + const char *newtzs = mp_obj_str_get_str(args[0]); + if (strcmp(newtzs, mpy_time_zone) != 0) { + if ((strlen(newtzs) > 2) && (strlen(newtzs) < 64)) { + sprintf(mpy_time_zone, "%s", newtzs); + tz_fromto_NVS(NULL, mpy_time_zone); + } + else { + mp_raise_ValueError("tz string length must be 3 - 64"); + } + } + setenv("TZ", mpy_time_zone, 1); + tzset(); + } + + return mp_obj_new_str(mpy_time_zone, strlen(mpy_time_zone)); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_timezone_obj, 0, 1, mp_sys_timezone); + + //============================================================== STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys) }, - { MP_ROM_QSTR(MP_QSTR_path), MP_ROM_PTR(&MP_STATE_VM(mp_sys_path_obj)) }, - { MP_ROM_QSTR(MP_QSTR_argv), MP_ROM_PTR(&MP_STATE_VM(mp_sys_argv_obj)) }, - { MP_ROM_QSTR(MP_QSTR_version), MP_ROM_PTR(&version_obj) }, - { MP_ROM_QSTR(MP_QSTR_version_info), MP_ROM_PTR(&mp_sys_version_info_obj) }, - { MP_ROM_QSTR(MP_QSTR_implementation), MP_ROM_PTR(&mp_sys_implementation_obj) }, - { MP_ROM_QSTR(MP_QSTR_mpycore), MP_ROM_PTR(&mp_sys_mpycore_obj) }, + #ifdef CONFIG_MICROPY_USE_THREADED_REPL + { MP_ROM_QSTR(MP_QSTR_REPL), MP_ROM_PTR(&mp_sys_exec_repl_obj) }, + { MP_ROM_QSTR(MP_QSTR_stackSize), MP_ROM_PTR(&mp_sys_stack_size_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_path), MP_ROM_PTR(&MP_STATE_VM(mp_sys_path_obj)) }, + { MP_ROM_QSTR(MP_QSTR_argv), MP_ROM_PTR(&MP_STATE_VM(mp_sys_argv_obj)) }, + { MP_ROM_QSTR(MP_QSTR_version), MP_ROM_PTR(&version_obj) }, + { MP_ROM_QSTR(MP_QSTR_version_info), MP_ROM_PTR(&mp_sys_version_info_obj) }, + { MP_ROM_QSTR(MP_QSTR_implementation), MP_ROM_PTR(&mp_sys_implementation_obj) }, + { MP_ROM_QSTR(MP_QSTR_mpycore), MP_ROM_PTR(&mp_sys_mpycore_obj) }, + { MP_ROM_QSTR(MP_QSTR_tz), MP_ROM_PTR(&mp_sys_timezone_obj) }, #ifdef MICROPY_PY_SYS_PLATFORM - { MP_ROM_QSTR(MP_QSTR_platform), MP_ROM_PTR(&platform_obj) }, + { MP_ROM_QSTR(MP_QSTR_platform), MP_ROM_PTR(&platform_obj) }, #endif #if MP_ENDIANNESS_LITTLE - { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_QSTR(MP_QSTR_little) }, + { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_QSTR(MP_QSTR_little) }, #else - { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_QSTR(MP_QSTR_big) }, + { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_QSTR(MP_QSTR_big) }, #endif #if MICROPY_PY_SYS_MAXSIZE @@ -184,37 +261,37 @@ STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = { // to not try to compare sys.maxsize to some literal number (as this // number might not fit in available int size), but instead count number // of "one" bits in sys.maxsize. - { MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_INT(MP_SMALL_INT_MAX) }, + { MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_INT(MP_SMALL_INT_MAX) }, #else - { MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_PTR(&mp_maxsize_obj) }, + { MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_PTR(&mp_maxsize_obj) }, #endif #endif #if MICROPY_PY_SYS_EXIT - { MP_ROM_QSTR(MP_QSTR_exit), MP_ROM_PTR(&mp_sys_exit_obj) }, + { MP_ROM_QSTR(MP_QSTR_exit), MP_ROM_PTR(&mp_sys_exit_obj) }, #endif #if MICROPY_PY_SYS_STDFILES - { MP_ROM_QSTR(MP_QSTR_stdin), MP_ROM_PTR(&mp_sys_stdin_obj) }, - { MP_ROM_QSTR(MP_QSTR_stdout), MP_ROM_PTR(&mp_sys_stdout_obj) }, - { MP_ROM_QSTR(MP_QSTR_stderr), MP_ROM_PTR(&mp_sys_stderr_obj) }, + { MP_ROM_QSTR(MP_QSTR_stdin), MP_ROM_PTR(&mp_sys_stdin_obj) }, + { MP_ROM_QSTR(MP_QSTR_stdout), MP_ROM_PTR(&mp_sys_stdout_obj) }, + { MP_ROM_QSTR(MP_QSTR_stderr), MP_ROM_PTR(&mp_sys_stderr_obj) }, #endif #if MICROPY_PY_SYS_MODULES - { MP_ROM_QSTR(MP_QSTR_modules), MP_ROM_PTR(&MP_STATE_VM(mp_loaded_modules_dict)) }, + { MP_ROM_QSTR(MP_QSTR_modules), MP_ROM_PTR(&MP_STATE_VM(mp_loaded_modules_dict)) }, #endif #if MICROPY_PY_SYS_EXC_INFO - { MP_ROM_QSTR(MP_QSTR_exc_info), MP_ROM_PTR(&mp_sys_exc_info_obj) }, + { MP_ROM_QSTR(MP_QSTR_exc_info), MP_ROM_PTR(&mp_sys_exc_info_obj) }, #endif #if MICROPY_PY_SYS_GETSIZEOF - { MP_ROM_QSTR(MP_QSTR_getsizeof), MP_ROM_PTR(&mp_sys_getsizeof_obj) }, + { MP_ROM_QSTR(MP_QSTR_getsizeof), MP_ROM_PTR(&mp_sys_getsizeof_obj) }, #endif /* * Extensions to CPython */ - { MP_ROM_QSTR(MP_QSTR_print_exception), MP_ROM_PTR(&mp_sys_print_exception_obj) }, + { MP_ROM_QSTR(MP_QSTR_print_exception), MP_ROM_PTR(&mp_sys_print_exception_obj) }, }; STATIC MP_DEFINE_CONST_DICT(mp_module_sys_globals, mp_module_sys_globals_table); diff --git a/MicroPython_BUILD/components/micropython/py/modthread.c b/MicroPython_BUILD/components/micropython/py/modthread.c index 95286c6..b3795e8 100644 --- a/MicroPython_BUILD/components/micropython/py/modthread.c +++ b/MicroPython_BUILD/components/micropython/py/modthread.c @@ -36,13 +36,11 @@ #include "py/mpthread.h" #include "mphalport.h" -extern TaskHandle_t MainTaskHandle; - /****************************************************************/ // _thread module -STATIC size_t thread_stack_size = MP_THREAD_DEFAULT_STACK_SIZE; +size_t thread_stack_size = MP_THREAD_DEFAULT_STACK_SIZE; //-------------------------------------------------------------------------- STATIC mp_obj_t mod_thread_stack_size(size_t n_args, const mp_obj_t *args) { @@ -78,8 +76,8 @@ typedef struct _thread_entry_args_t { mp_obj_t args[]; } thread_entry_args_t; -//-------------------------------------- -STATIC void *thread_entry(void *args_in) +//------------------------------- +void *thread_entry(void *args_in) { // Execution begins here for a new thread. We do not have the GIL. @@ -312,10 +310,16 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_thread_isnotified_obj, mod_thread_isnotifie //-------------------------------------- STATIC mp_obj_t mod_thread_getREPLId() { - return mp_obj_new_int_from_uint((uintptr_t)MainTaskHandle); + return mp_obj_new_int_from_uint((uintptr_t)ReplTaskHandle); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_getREPLId_obj, mod_thread_getREPLId); +//-------------------------------------- +STATIC mp_obj_t mod_thread_getMAINId() { + return mp_obj_new_int_from_uint((uintptr_t)MainTaskHandle); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_getMAINId_obj, mod_thread_getMAINId); + //-------------------------------------- STATIC mp_obj_t mod_thread_getnotify() { @@ -439,6 +443,7 @@ STATIC mp_obj_t mod_thread_list(mp_uint_t n_args, const mp_obj_t *args) { char th_type[8] = {'\0'}; char th_state[16] = {'\0'}; if (thr->type == THREAD_TYPE_MAIN) sprintf(th_type, "MAIN"); + else if (thr->type == THREAD_TYPE_REPL) sprintf(th_type, "REPL"); else if (thr->type == THREAD_TYPE_PYTHON) sprintf(th_type, "PYTHON"); else if (thr->type == THREAD_TYPE_SERVICE) sprintf(th_type, "SERVICE"); else sprintf(th_type, "Unknown"); @@ -532,6 +537,19 @@ STATIC mp_obj_t mod_thread_replAcceptMsg(mp_uint_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_thread_replAcceptMsg_obj, 0, 1, mod_thread_replAcceptMsg); +//-------------------------------------------------------------------------------- +STATIC mp_obj_t mod_thread_mainAcceptMsg(mp_uint_t n_args, const mp_obj_t *args) { + int res = 0; + if (n_args == 0) { + res = mp_thread_mainAcceptMsg(-1); + } + else { + res = mp_thread_mainAcceptMsg(mp_obj_is_true(args[0])); + } + return mp_obj_new_bool(res); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_thread_mainAcceptMsg_obj, 0, 1, mod_thread_mainAcceptMsg); + //----------------------------------------------------------------------------- STATIC mp_obj_t mod_thread_waitnotify(mp_uint_t n_args, const mp_obj_t *args) { uint32_t tmo = portMAX_DELAY; @@ -588,7 +606,9 @@ STATIC const mp_rom_map_elem_t mp_module_thread_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_getnotification), MP_ROM_PTR(&mod_thread_getnotify_obj) }, { MP_ROM_QSTR(MP_QSTR_isnotified), MP_ROM_PTR(&mod_thread_isnotified_obj) }, { MP_ROM_QSTR(MP_QSTR_getReplID), MP_ROM_PTR(&mod_thread_getREPLId_obj) }, + { MP_ROM_QSTR(MP_QSTR_getMainID), MP_ROM_PTR(&mod_thread_getMAINId_obj) }, { MP_ROM_QSTR(MP_QSTR_replAcceptMsg), MP_ROM_PTR(&mod_thread_replAcceptMsg_obj) }, + { MP_ROM_QSTR(MP_QSTR_mainAcceptMsg), MP_ROM_PTR(&mod_thread_mainAcceptMsg_obj) }, { MP_ROM_QSTR(MP_QSTR_sendmsg), MP_ROM_PTR(&mod_thread_sendmsg_obj) }, { MP_ROM_QSTR(MP_QSTR_getmsg), MP_ROM_PTR(&mod_thread_getmsg_obj) }, { MP_ROM_QSTR(MP_QSTR_list), MP_ROM_PTR(&mod_thread_list_obj) }, diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip index 0be99d1..f44820a 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip index 1fd7a74..b82bb42 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip index 0ebe973..f142a54 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip index bbb45a9..5df17c5 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip index c7afee7..67caa7b 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip index 618eea4..98c8e09 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip differ diff --git a/MicroPython_BUILD/firmware/esp32/sdkconfig b/MicroPython_BUILD/firmware/esp32/sdkconfig index 3f267a7..85bcbe2 100644 --- a/MicroPython_BUILD/firmware/esp32/sdkconfig +++ b/MicroPython_BUILD/firmware/esp32/sdkconfig @@ -97,6 +97,7 @@ CONFIG_MICRO_PY_LOG_LEVEL2= CONFIG_MICRO_PY_LOG_LEVEL3= CONFIG_MICRO_PY_LOG_LEVEL4= CONFIG_MICRO_PY_LOG_LEVEL5= +CONFIG_MICROPY_USE_THREADED_REPL= CONFIG_MICROPY_RX_BUFFER_SIZE=1080 CONFIG_MICROPY_USE_TASK_WDT=y CONFIG_MICROPY_USE_BOTH_CORES= diff --git a/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin index 3ef432b..100358e 100644 Binary files a/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin index 406b9c6..02cc4ca 100644 Binary files a/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_all/partitions_mpy.bin b/MicroPython_BUILD/firmware/esp32_all/partitions_mpy.bin index 0bdd9d7..f37f3bf 100644 Binary files a/MicroPython_BUILD/firmware/esp32_all/partitions_mpy.bin and b/MicroPython_BUILD/firmware/esp32_all/partitions_mpy.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_all/sdkconfig b/MicroPython_BUILD/firmware/esp32_all/sdkconfig index 81e809f..e6c32b3 100644 --- a/MicroPython_BUILD/firmware/esp32_all/sdkconfig +++ b/MicroPython_BUILD/firmware/esp32_all/sdkconfig @@ -93,6 +93,7 @@ CONFIG_MICRO_PY_LOG_LEVEL2=y CONFIG_MICRO_PY_LOG_LEVEL3= CONFIG_MICRO_PY_LOG_LEVEL4= CONFIG_MICRO_PY_LOG_LEVEL5= +CONFIG_MICROPY_USE_THREADED_REPL= CONFIG_MICROPY_RX_BUFFER_SIZE=1080 CONFIG_MICROPY_USE_TASK_WDT=y CONFIG_MICROPY_USE_BOTH_CORES= diff --git a/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin index 0947e2c..ce0f168 100644 Binary files a/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin index aae4ece..7006b2d 100644 Binary files a/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_ota/sdkconfig b/MicroPython_BUILD/firmware/esp32_ota/sdkconfig index 6a43d48..5ed5444 100644 --- a/MicroPython_BUILD/firmware/esp32_ota/sdkconfig +++ b/MicroPython_BUILD/firmware/esp32_ota/sdkconfig @@ -94,6 +94,7 @@ CONFIG_MICRO_PY_LOG_LEVEL2=y CONFIG_MICRO_PY_LOG_LEVEL3= CONFIG_MICRO_PY_LOG_LEVEL4= CONFIG_MICRO_PY_LOG_LEVEL5= +CONFIG_MICROPY_USE_THREADED_REPL= CONFIG_MICROPY_RX_BUFFER_SIZE=1080 CONFIG_MICROPY_USE_TASK_WDT=y CONFIG_MICROPY_USE_BOTH_CORES= diff --git a/MicroPython_BUILD/firmware/esp32_psram/sdkconfig b/MicroPython_BUILD/firmware/esp32_psram/sdkconfig index c7e7f4a..8bbcb7e 100644 --- a/MicroPython_BUILD/firmware/esp32_psram/sdkconfig +++ b/MicroPython_BUILD/firmware/esp32_psram/sdkconfig @@ -93,6 +93,7 @@ CONFIG_MICRO_PY_LOG_LEVEL2= CONFIG_MICRO_PY_LOG_LEVEL3= CONFIG_MICRO_PY_LOG_LEVEL4= CONFIG_MICRO_PY_LOG_LEVEL5= +CONFIG_MICROPY_USE_THREADED_REPL= CONFIG_MICROPY_RX_BUFFER_SIZE=1080 CONFIG_MICROPY_USE_TASK_WDT=y CONFIG_MICROPY_USE_BOTH_CORES= diff --git a/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin index 083724a..f5c67be 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin index 8055eb0..d0772cd 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_all/sdkconfig b/MicroPython_BUILD/firmware/esp32_psram_all/sdkconfig index 97e2389..da109b9 100644 --- a/MicroPython_BUILD/firmware/esp32_psram_all/sdkconfig +++ b/MicroPython_BUILD/firmware/esp32_psram_all/sdkconfig @@ -93,6 +93,7 @@ CONFIG_MICRO_PY_LOG_LEVEL2=y CONFIG_MICRO_PY_LOG_LEVEL3= CONFIG_MICRO_PY_LOG_LEVEL4= CONFIG_MICRO_PY_LOG_LEVEL5= +CONFIG_MICROPY_USE_THREADED_REPL= CONFIG_MICROPY_RX_BUFFER_SIZE=1080 CONFIG_MICROPY_USE_TASK_WDT=y CONFIG_MICROPY_USE_BOTH_CORES= diff --git a/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin index 35876c0..eb54087 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin index a0108ae..0d55aeb 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_ota/sdkconfig b/MicroPython_BUILD/firmware/esp32_psram_ota/sdkconfig index 8297667..b52f0fe 100644 --- a/MicroPython_BUILD/firmware/esp32_psram_ota/sdkconfig +++ b/MicroPython_BUILD/firmware/esp32_psram_ota/sdkconfig @@ -94,6 +94,7 @@ CONFIG_MICRO_PY_LOG_LEVEL2=y CONFIG_MICRO_PY_LOG_LEVEL3= CONFIG_MICRO_PY_LOG_LEVEL4= CONFIG_MICRO_PY_LOG_LEVEL5= +CONFIG_MICROPY_USE_THREADED_REPL= CONFIG_MICROPY_RX_BUFFER_SIZE=1080 CONFIG_MICROPY_USE_TASK_WDT=y CONFIG_MICROPY_USE_BOTH_CORES=