Analog joystick on the PyGamer

I’m seeing similar numbers to kjw when I test it on my PyGamer. I made some tweaks to the code, but for some reason it crashes after a seemingly random amount of time. Anything obvious that I’m doing wrong that could cause the crash?

https://makecode.com/_EWgf9XHRYErA