FACES /apps/game.py doesn't run properly (solved)
-
Hi, I just got a FACES set delivered.
When exploring the apps that came with the UIFlow firmware (V1.3.3) I discovered the following:
The script/apps/game.pydid not run properly. It showed only the small icon image above the btnB position and a bigger version of this icon in the upper half of the display. However the latter did not change (which it should).
I discovered that the source of the problem was: filenames of the image files that had more than 8 characters.
In the folder/flash/imgI changed file names of these three image files to:rock.jpg,paper.jpgandscissors.jpg.rps_img = (
'img/rock_128.jpg',
'img/paper_128.jpg',
'img/scissors_128.jpg'
)lcd.clear(lcd.WHITE)
lcd.image(48, 200, 'img/rock_128.jpg', 2)
lcd.image(143, 200, 'img/paper_128.jpg', 2)
lcd.image(238, 200, 'img/scissors_128.jpg', 2)This fact did not crash the script but it worked only partially.
I made the following modifications:
a)rps_img = (
'img/rock.jpg',
'img/paper.jpg',
'img/scissors.jpg'
)b) since there was already defined
rps_img, I used this in the following commands:lcd.image(48, 200, rps_img[0], 2)
lcd.image(143, 200, rps_img[1], 2)
lcd.image(238, 200, rps_img[2], 2)Another problem occurred after I flashed the device with the latest UIFlow firmware (V1.9.4) using M5Burner.
Now thescript /apps/game.pycrashed because the functionmachine.random()does not exist anymore.
The command:rand = machine.random(2)I replaced by:
from random import randint
rand = randint(0,2)Now the script ran again OK.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login