For some reason it looks like choosing Device > Upload Game to Device turns off the simulator’s accelerometer, causing playdate.readAccelerometer()
to return nil.
Workaround: make sure your code gracefully handles nil values returned from playdate.readAccelerometer()
and have a way to call playdate.startAccelerometer()
again after the upload finishes if you want to keep testing it in the simulator.
Steps to reproduce (SDK 2.7.1, macOS 15.4.1, I’m starting the sim using the Nova 12.4 Playdate Simulator task):
- Run a lua game in the simulator that:
- on start, calls
playdate.startAccelerometer()
- calls
playdate.readAccelerometer()
every frame without a way to gracefully handle nil values (e.g. the accelerometer sample code in the docs)
- on start, calls
- In the simulator, choose Device > Upload Game to Device.
Actual result: calls to playdate.readAccelerometer()
in the simulated game return nil from that point forward, unless the game calls startAccelerometer()
again to reactivate it. If the game can’t handle nil values and crashes, the simulator hangs with the upload modal stuck on “waiting for data disk”.
Expected result: I wouldn’t expect Upload Game To Device to change the state of the simulated game.