FYI, I’ve been doing this:
hasUsbPower = digitalRead(PWR);
isCharging = (hasUsbPower && !digitalRead(CHG));
onBatteryPower = (!hasUsbPower || !isCharging);
Based on that if you have both battery and usb you’ll see the usb is only used to charge the battery, then it runs off battery for awhile. That surprised me, I thought it’d charge the battery and then run off the USB but that’s not what the above is showing in my testing.
–April update: I think the battery part of the above is wrong. It appears to use USB and not battery, when USB is available, thus onBatteryPower = !hasUsbPower; is what I use now. The part that tripped me up before is the voltage is different between USB only and USB + charged battery.