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:
    0_1590177150236_944a0098-9359-4515-9362-d286beb9aaf9-image.png

    Python Code:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    lcd.setRotation(1)
    lcd.setRotation(3)
    
    setScreenColor(0x222222)
    
    label0 = M5TextBox(123, 111, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
    
    def buttonA_wasPressed():
      # global params
      pass
    btnA.wasPressed(buttonA_wasPressed)
    
    def buttonB_wasPressed():
      # global params
      pass
    btnB.wasPressed(buttonB_wasPressed)
    

    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 1.4.5.1 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.