geekscape / aiko_engine_mp

microPython event based engine supporting network messages (MQTT), times and various hardware drivers
Other
22 stars 24 forks source link

WIP: Update game snake to check oled state with new format #28

Open robertlayton opened 3 years ago

robertlayton commented 3 years ago

Update the snake game to run, as the OLED interface has changed.

WIP: the game now runs, but its weird and buggy, which I'm working on now

geekscape commented 3 years ago

Thanks @robertlayton, with so much to do, I dropped / paused working on this game example. Didn't even get to integrating with the Aiko framework :( So, thanks very much for pushing this along !

With microPython, we can only get 20 FPS per OLED. Don't have to always update both of them, but if we do ... results in an effective rate of only 10 FPS maximum. Also, some processing time is still required to manage Wi-Fi, MQTT and other things. So, expect that 5 to 8 FPS ... that would be 5 to 8 calls to aiko.oled.oleds_show() maximum each second.

I recommend temporarily hacking in a print() statement into aiko.oled.oleds_show() ... to give you some clues as to how often the OLED screens are being refreshed ...

from time import ticks_ms
def oleds_show():
  print("oleds_show(): " + str(ticks_ms() // 1000))

I'll wait for you to mention that the "weird and buggy" bits are no longer a problem. Thanks again !