getPowerStatus() can't recognize power connection at 100% charge

My Playtime clock app is intended to respond to (and sometimes display) being plugged/unplugged from power.

I'm using getPowerStatus(), but it fails when the charge is fully 100% (not 99.9% rounded up, but truly 100).

At 100.0%, it ALWAYS reports charging = false even when power is connected. Only once the reported charge has dropped slightly (which can take a while) will getPowerStatus() report being connected.

(I know technically it's accurate, since at 100% it can't charge... there's no more battery left to fill! But what the user and apps really want to know is whether you're connected to power or not.)

My semi-workaround is to just assume that at 100.0%, you're plugged into power. But that only "sort of" works: when you unplug, it can take the app quite a while to detect that (depending how fast the battery is draining, and the vague nature of the battery measurement).

So it still fails, just in the other direction. But at least it doesn't appear to the user that their USB connection is coming and going on its own while the PD sits plugged in.

It would be great if we could detect USB/Stereo Dock being CONNECTED, regardless of whether the battery NEEDS power at the moment.

(Just wanted add: at the OS level my Playdate is successfully recognizing USB power connection at ALL charge levels—I always get the "chirp" on plug/unplug.)

Hey @AdamsImmersive,

Have you tried using getPowerStatus().USB or getPowerStatus().screws ? This should tell you if there is any connection to power, regardless of charge state.

1 Like

.screws is not documented, but I will try it!

I'll revise my power check to use only .USB and .screws and not use .charging at all. I'll see what that does and report back. Thanks!

The Stereo Dock may be only in our imaginations at the moment, but Playtime is ready for it...