Button key pressed event catched without key was pressed



  • Hi folks

    Load the code below to a M5Stack device.
    then run for more than 30 min.
    DO NOT PRESS ANY KEY WHILE RUNNING!
    Do you see that the screen has changed the color?
    It means that a keypressed event was catched.

    Is this bug known?
    maybe https://github.com/m5stack/M5Stack/issues/52 (2 years old!!!)

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import wifiCfg

    ip = wifiCfg.wlan_sta.ifconfig()

    lcd.clear()
    lcd.font(lcd.FONT_DejaVu18)
    lcd.print('initializing...', 0, 0, 0xffffff)
    wifiCfg.screenShow()
    wifiCfg.autoConnect(lcdShow = True)

    setScreenColor(0x000000)

    def buttonA_wasPressed():
    lcd.fill(0xff0000)
    pass
    btnA.wasPressed(buttonA_wasPressed)

    def buttonB_wasPressed():
    lcd.fill(0x00ff00)
    pass
    btnB.wasPressed(buttonB_wasPressed)

    def buttonC_wasPressed():
    lcd.fill(0x0000ff)
    pass
    btnC.wasPressed(buttonC_wasPressed)

    Is there a workaround to avoid that?
    Its absolutely useless if an key pressed event is catched, if no key was pressed!

    Thanks ;-)
    Thomas



  • I have the same button #52 issue.
    A small delay in the loop (ref comments in the issue) makes it a lot better, but I still experience it some times and need to keep that in account.



  • yeah...this bug was from the ESP IDF. As you see in the Github issues



  • @m5stack said in Button key pressed event catched without key was pressed:

    yeah...this bug was from the ESP IDF. As you see in the Github issues

    And what can I do to avoid it? In this case I cannot use Button A. So the device is useless.



  • There is no good solution to this problem in UIFow. If it is in Arduino, you can refer to the issue mentioned in the issues to modify Digital read to Analog read