lcd.print disappears with rotate 270 and Y > 104

  • I filed an issue, but also thought I'd post here.

    I'm trying to print with a colored background, in either horizontal orientation. rotation 90 works fine, but when I go to rotation 270, I hit this issue where the text completely disappears if I try to move it all the way next to the button. I tried using labels, but when I set the background, the label gets overwritten. Maybe I just haven't hit the right combination yet.

  • This kind of works, but the screen flashes every time, which is annoying

    while True:
      label0.setText('Hello M5')

  • Every time you call SetScreenColor(0xff0000) in your loop the display is completly erased and then your text is displayed again. So the annoying flashing is due to your programming style ! If you rotate a label, you mostly will have to rearrange its position. If you rotate a label at the bottom of the screen simply by changing the rotate value for your text in python to eg. 90 it will fall of the bottom of the screen. If you keep your programming strictly to Blockly, you can see what happens.

  • Thanks! To be clear, I was trying to do this:

    while True:
      lcd.font(lcd.FONT_DejaVu56, rotate=270)
      lcd.print('aqi', 10, 104, 0xffffff)

    All Y values up to 104 move the text further away from the button, as expected if 0,0 is at the top.
    But once the Y parameter is 105 or larger (which is about mid-screen), the text just disappears! This happens in Blockly, too.
    That's the gist of my bug, which is why I tried to work around it with the above code.

    I guess that I could just require the unit be set down in the 90 degree orientation, but I was hoping to be user-friendly and detect which way the unit was sitting and react accordingly.

  • @dclaar
    The M5stack grey has a built-in gyroscope, the black one hasn't. Use the gyroscope data determining at which angle your text shall be displayed. In Blockly you can define different labels for the different angles and display them accordingly. If you write the program in Blockly/Python you won't be able to save it. In that case I put the Python line into a Blockly exec code calling the exec code with a subroutine. That way your block code can be stored in a *.m5f file. You can even pass global variables into your exec code (eg the x,y position of your text on the display and the rotation angle.

  • I tried using a rectangle + label, and it still blinks:

    while True:

    So I think only lcd.print will not do the blinking thing. Even though the rectangle is "below" the text, it appears to completely replace the screen rather than honoring the layering.

  • I see that even with lcd.print, the display still blinks. I thought that having layers meant that the graphics routines were more sophisticated than they are.

  • I will finally note that lcd.print works fine with lcd.orient(lcd.LANDSCAPE)
    and lcd.orient(lcd.LANDSCAPE_FLIP)