No clue why function executes twice #18830
Replies: 4 comments 1 reply
-
|
By twice are you including the I have been caught-out by |
Beta Was this translation helpful? Give feedback.
-
|
keyflag is utterly useless. |
Beta Was this translation helpful? Give feedback.
-
|
@davefes : twice in the loop (the initial draw is there to make sure something shows on screen before key is pressed). I have a print statement in the @GitHubsSilverBullet : you're right about keyflag, but that's not the issue here. The code is just a small tweak of the sample provided with Waveshare 0.96 lcd screen and I did not went through "cleanup pass" yet. If I read the code correctly the keflag has been added exactly for the purpose that's the issue here - so the |
Beta Was this translation helpful? Give feedback.
-
|
Try putting the draw function after every option in the first example. Do you still get only one redraw? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've started playing with Micropython on Pico and I've noticed behavior I don't understand. I have an infinite loop with a bunch of if statements checking for button press. When the button is pressed variable is updated and screen is redrawn.
And here's the kicker - when I put the function that redraws the screen inside if statement it executes once - exactly as expected. But if I put it after all the if statements (which would make sense) - it executes twice. Any ideas why?
Beta Was this translation helpful? Give feedback.
All reactions