UIFlow Firmware, ToF unit and ampy



  • Hi,

    I like the UIFlow firmware as it's a neat way to test small (less than a screen full of code) samples. I don't care about Blocky in particular.
    In short: I like to use MicroPython primarily, but UIFlow secondarily.

    However I cannot make a simple example work though:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import unit
    
    setScreenColor(0x222222)
    tof0 = unit.get(unit.TOF, unit.PORTA)
    
    for count in range(100):
      lcd.print('        ', 0, 0, 0xffffff)
      lcd.print((tof0.distance), 0, 0, 0xffffff)
      wait(1)
    

    This is the output from a very simply Blocky block. Works fine in the UIFlow UI.
    But sending the same code via ampy does not work: the tof0.distance is always 0. But the screen clearing works just fine.

    Is there a way to send Python code to an M5Stack with UIFlow firmware
    What's the difference between running UIFlow code and the equivalent Python code?

    BTW other examples with other external units work fine. So maybe this problem is limited to the ToF unit...



  • After testing other units, it seems ToF is the only one broken. All the other ones work just fine when copy&pasting the Python code and running via ampy.

    Looks like a bug report is in order.



  • @hkubota You can send micropython code direct to the M5stack using the download and play buttons.
    I have been doing things this way while testing the TOF with the I2C hub.
    however, a better way is to use Visual Studio. see the video @lukasmaximus uploaded to the M5Stack youtube channel.


  • M5Stack

    The video @ajb2k3 was referring to is here https://www.youtube.com/watch?v=Y9pOWgsNgKk&t=73s hope it helps