forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Interesting Battery find

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sun Jan 06, 2008 4:04 pm    Post subject: Interesting Battery find Reply with quote

Ha. I lied.
If I could really quantify how interesting this is now that I'm over it,
the value would need a float for a very large negative number.

In the situation where there is enough power available at the connector to
power the PSP, but not enough to charge (say using an external battery),
the battery level returns as 1. When the battery is charging, you get the correct value.
After the battery has charged, so the charger stops, I don't know.

It is possible to receive enough power at the power socket for the PSP to
report through the XMB setting screen, and through sceispoweronline,
that the PSP is currently externally powered, but the PSP is still using the
battery, and the battery can go flat. while the PSP was telling lies the whole time.

So the PSP has a Twilight Zone.

If you want to monitor what sort of power is available because your PSP
is in charge of a rocket launcher you have real problems.

Code:

if (scePowerIsBatteryExist()) {
         wehavepower = scePowerIsBatteryCharging();
         if (wehavepower != 1) {wehavepower = 0;} // should there really be more than two outcomes ?

         batt = scePowerGetBatteryLifePercent();
         if (batt == 100) {wehavepower = scePowerIsPowerOnline();}
} else {
         if (scePowerIsPowerOnline()) {wehavepower = 1;} // otherwise the program wouldn't be running
} // battery exist


Is not any sort of working useable code, but if you assume the battery exists, it is.
Cheers, Art.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group