FATAL ERROR: Name m5line is not defined



  • from m5stack import *
    from m5ui import *
    from uiflow import *
    import unit
    
    setScreenColor(0x514f4f)
    earth0 = unit.get(unit.EARTH, unit.PORTA)
    
    std = M5Circle(40, 91, 10, 0xFFFFFF, 0xFFFFFF)
    text0 = M5TextBox(61, 119, "Status", lcd.FONT_Default, 0x78ff00, rotate=180)
    text1 = M5TextBox(77, 149, "Water monitor", lcd.FONT_DefaultSmall, 0x00e5ff, rotate=0)
    label0 = M5TextBox(77, 58, "value:", lcd.FONT_Default, 0xe4ff00, rotate=180)
    rectangle0 = M5Rect(2, 41, 34, 20, 0xFFFFFF, 0xFFFFFF)
    angread = M5TextBox(30, 57, "err", lcd.FONT_DefaultSmall, 0x000000, rotate=180)
    rectangle1 = M5Rect(16, 11, 20, 20, 0xFFFFFF, 0xFFFFFF)
    label1 = M5TextBox(77, 27, "Unit std:", lcd.FONT_DefaultSmall, 0xfffe00, rotate=180)
    line0 = M5Line(M5Line.PLINE, 16, 128, 62, 128, 0xFFFFFF)    # <--bug line
    need = M5TextBox(75, 74, "Water needed!", lcd.FONT_DefaultSmall, 0xff0000, rotate=180)
    
    # sysinit
    def init():
      need.hide()
      angread.setText('0')
      rectangle0.setBgColor(0xff0000)
      rectangle0.setBorderColor(0xff0000)
      std.setBgColor(0xff0000)
      std.setBorderColor(0xff0000)
    
    
    
    init()
    while True:
      if False:
        angread.setText(str(earth0.analogValue))
      elif False:
        pass
      wait_ms(2)