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.py did 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/img I changed file names of these three image files to: rock.jpg, paper.jpg and scissors.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 the script /apps/game.py crashed because the function machine.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.