M5Flow Blockly Screen rotate issue

  • If I develop a simple Blockly (M5Flow) layout for rotating the screen, this does not work. When I look at the underlying Python code I noticed the "lcd.setRotation()" code ends up at the start of the code, and not at the spots where I would expect it (for this example in the button code blocks)

    Blockly Code:

    Python Code:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    label0 = M5TextBox(123, 111, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
    def buttonA_wasPressed():
      # global params
    def buttonB_wasPressed():
      # global params

    If I copy/paste the "lcd.setRotation()" code blocks into the button blocks, the code works properly on the device. But when I switch back to Blockly, this solution is reverted. I'm having this issue with firmwares and 1.5.2

  • Does anybody have any clue why this happens? Should the screen only be rotated once?

  • thank you feedback. this bug we will fix as soon as possible

  • Thanks, much appreciated!

  • @m5stack

    Sorry for revive old post.

    Any news about this?

  • There should be an initial Set Rotation should always be at the start in the setup phase before the main loop.

  • Just calling the screenrotate function will not rotate the already drawn screen contents. Just after using this function, the rest of the graphic functions will draw on the screen in a different orientation. So it seems to me that where this instruction does not need to be right at the beginning of the program.