🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Core S3 m5ui/port.py callback error

    Scheduled Pinned Locked Moved UiFlow 2.0
    1 Posts 1 Posters 557 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      RPI25
      last edited by

      I'm not sure whether anyone else is having this issue but my Core S3 keeps saying:

      Traceback (most recent call last):
        File "m5ui/port.py", line 40, in timer_cb
      KeyboardInterrupt:
      

      I have tried python code on UIFlow 2 and blocks in UIFlow 2 but neither seem to work. It seems that with no blocks in the loop the Core S3 works fine but with a loop block and something inside it then it just crashes with that error.

      import os, sys, io
      import M5
      from M5 import *
      import m5ui
      import lvgl as lv
      from unit import GPSV11Unit
      
      
      
      TimeburnerxJB8_20px = None
      TimeburnerBold_peGR_70px = None
      page0 = None
      image0 = None
      timelabel = None
      battlabel = None
      label0 = None
      label1 = None
      label2 = None
      image1 = None
      label3 = None
      label4 = None
      gpssma_0 = None
      
      
      date1 = None
      spd = None
      
      
      def setup():
        global TimeburnerxJB8_20px, TimeburnerBold_peGR_70px, page0, image0, timelabel, battlabel, label0, label1, label2, image1, label3, label4, gpssma_0, date1, spd
      
        M5.begin()
        Widgets.setRotation(1)
        m5ui.init()
        TimeburnerxJB8_20px = lv.binfont_create("S:/flash/res/font/TimeburnerxJB8-20px.bin")
        TimeburnerBold_peGR_70px = lv.binfont_create("S:/flash/res/font/TimeburnerBold-peGR-70px.bin")
        page0 = m5ui.M5Page(bg_c=0x000000)
        image0 = m5ui.M5Image("/flash/res/img/GPS.png", x=257, y=0, rotation=0, scale_x=0.6, scale_y=0.6, parent=page0)
        timelabel = m5ui.M5Label("00:00", x=277, y=0, text_c=0xffffff, bg_c=0xffffff, bg_opa=0, font=lv.font_montserrat_14, parent=page0)
        battlabel = m5ui.M5Label("100%", x=0, y=0, text_c=0xffffff, bg_c=0xffffff, bg_opa=0, font=lv.font_montserrat_14, parent=page0)
        label0 = m5ui.M5Label("100", x=0, y=79, text_c=0xffffff, bg_c=0xffffff, bg_opa=0, font=TimeburnerBold_peGR_70px, parent=page0)
        label1 = m5ui.M5Label("mph", x=110, y=120, text_c=0xffffff, bg_c=0xffffff, bg_opa=0, font=TimeburnerxJB8_20px, parent=page0)
        label2 = m5ui.M5Label("10000m", x=72, y=159, text_c=0xffffff, bg_c=0xffffff, bg_opa=0, font=TimeburnerBold_peGR_70px, parent=page0)
        image1 = m5ui.M5Image("/flash/res/img/satellite.png", x=235, y=2, rotation=0, scale_x=0.6, scale_y=0.6, parent=page0)
        label3 = m5ui.M5Label("HDG:", x=140, y=45, text_c=0xffffff, bg_c=0xffffff, bg_opa=0, font=lv.font_montserrat_14, parent=page0)
        label4 = m5ui.M5Label("360", x=188, y=40, text_c=0xffffff, bg_c=0xffffff, bg_opa=0, font=TimeburnerBold_peGR_70px, parent=page0)
      
        gpssma_0 = GPSV11Unit(2, port=(18, 17))
        page0.screen_load()
        gpssma_0.set_work_mode(7)
        gpssma_0.set_time_zone(0)
      
      
      def loop():
        global TimeburnerxJB8_20px, TimeburnerBold_peGR_70px, page0, image0, timelabel, battlabel, label0, label1, label2, image1, label3, label4, gpssma_0, date1, spd
        M5.update()
        date1 = []
        date1 = gpssma_0.get_gps_time()
        timelabel.set_text(str((str((date1[0])) + str(((str(':') + str((date1[1]))))))))
        timelabel.align_to(page0, lv.ALIGN.TOP_RIGHT, 0, 0)
        if (gpssma_0.get_satellite_num()) == 0:
          image0.set_flag(lv.obj.FLAG.HIDDEN, False)
          image1.set_flag(lv.obj.FLAG.HIDDEN, True)
        else:
          image1.set_flag(lv.obj.FLAG.HIDDEN, False)
          image0.set_flag(lv.obj.FLAG.HIDDEN, True)
        label2.set_text(str(gpssma_0.get_altitude()))
        label2.align_to(page0, lv.ALIGN.BOTTOM_RIGHT, 0, 0)
        spd = int(gpssma_0.get_speed_over_ground())
        spd = spd * 1.151
        label0.set_text(str(str(spd)))
        label0.align_to(page0, lv.ALIGN.LEFT_MID, 0, 0)
        battlabel.set_text(str((str((str((Power.getBatteryLevel())))) + str('%'))))
        battlabel.align_to(page0, lv.ALIGN.TOP_LEFT, 0, 0)
        label4.set_text(str(gpssma_0.get_corse_over_ground()))
      
      
      if __name__ == '__main__':
        try:
          setup()
          while True:
            loop()
        except (Exception, KeyboardInterrupt) as e:
          try:
            m5ui.deinit()
            from utility import print_error_msg
            print_error_msg(e)
          except ImportError:
            print("please update to latest firmware")
      
      

      That was the code that hasn't worked.
      Any help much appreciated,
      RPi

      1 Reply Last reply Reply Quote 1

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post