Check your uPython version

  • 0_1612516245921_1612516092645.jpg

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import time
    import uos
    vstart = None
    vsysinfo = None
    vsecs = None
    vmins = None
    vtimetext = None
    battery = M5TextBox(0, 0, "loading", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
    uptime = M5TextBox(0, 32, "loading", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
    lb_sysinfo = M5TextBox(0, 64, "loading", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
    import math
    vstart = time.ticks_ms()
    vsysinfo = uos.uname()
    while True:
      battery.setText(str((str(((str('Battery: ') + str((power.getBatteryLevel()))))) + str('%'))))
      vsecs = round(((time.ticks_ms()) - vstart) / 1000)
      vmins = math.floor(vsecs / 60)
      vtimetext = (str((vsecs % 60)) + str('s'))
      if vmins != 0:
        vtimetext = (str(((str(vmins) + str('m ')))) + str(vtimetext))
      vtimetext = (str('Uptime: ') + str(vtimetext))

  • Interesting, when executing on a M5Stack Core2 via REPL I get an error message:

    Traceback (most recent call last):
      File "<stdin>", line 21, in <module>
    AttributeError: 'TFT' object has no attribute 'setBrightness'

  • @mb

    Different code...



  • I would prefer to have a stable API for all devices. Current situation makes re-use of code complicated.

    Someone could write a wrapper API to cover the differences ;-)

    alt text

    xkcd comic

  • I'm trying to push for a unified API but the problem is that some of the devices are slightly different and require slightly different commands.
    Please add your request for a unified API to the suggestions list.