Skip to content
Discussion options

You must be logged in to vote

The problem is that the text datum is being changed whenever the redBtn() and greenBtn() functions are called. The default is top left datum and this is over-ridden. The setTextDatum is a "global" function so changes the position of text subsequently drawn on the screen.

Here are updated functions that restores the datum to the same setting as when the function was called. If you use these functions then I think your sketch will behave as you expect.

//-------------- ON/OFF Draw redBtn -------------------
void redBtn()
{
      // Fetch current text datum so it can be restored
      uint8_t datum = tft.getTextDatum();

      tft.fillRoundRect(REDBUTTON_X, FRAME_Y, REDBUTTON_W, REDBUTTON_H,…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@llmpowerll
Comment options

@llmpowerll
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@llmpowerll
Comment options

Answer selected by Bodmer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants