mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Moved runtime-reset-when-charger-connected to status.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2925 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
34c03ef8bc
commit
34351e8251
2 changed files with 5 additions and 8 deletions
|
|
@ -349,14 +349,9 @@ int settings_save( void )
|
||||||
{
|
{
|
||||||
static long lasttime = 0;
|
static long lasttime = 0;
|
||||||
|
|
||||||
/* reset counter if charger is inserted */
|
global_settings.runtime += (current_tick - lasttime) / HZ;
|
||||||
if ( charger_inserted() ) {
|
lasttime = current_tick;
|
||||||
global_settings.runtime = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
global_settings.runtime += (current_tick - lasttime) / HZ;
|
|
||||||
lasttime = current_tick;
|
|
||||||
}
|
|
||||||
if ( global_settings.runtime > global_settings.topruntime )
|
if ( global_settings.runtime > global_settings.topruntime )
|
||||||
global_settings.topruntime = global_settings.runtime;
|
global_settings.topruntime = global_settings.runtime;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ void status_draw(void)
|
||||||
}
|
}
|
||||||
if(charger_inserted())
|
if(charger_inserted())
|
||||||
{
|
{
|
||||||
|
global_settings.runtime = 0;
|
||||||
if(TIME_AFTER(current_tick, switch_tick))
|
if(TIME_AFTER(current_tick, switch_tick))
|
||||||
{
|
{
|
||||||
lcd_icon(ICON_BATTERY, true);
|
lcd_icon(ICON_BATTERY, true);
|
||||||
|
|
@ -202,6 +203,7 @@ void status_draw(void)
|
||||||
battery_state = true;
|
battery_state = true;
|
||||||
plug_state = true;
|
plug_state = true;
|
||||||
if(charger_enabled) { /* animate battery if charging */
|
if(charger_enabled) { /* animate battery if charging */
|
||||||
|
global_settings.runtime = 0;
|
||||||
battlevel = battery_charge_step * 34; /* 34 for a better look */
|
battlevel = battery_charge_step * 34; /* 34 for a better look */
|
||||||
battlevel = battlevel > 100 ? 100 : battlevel;
|
battlevel = battlevel > 100 ? 100 : battlevel;
|
||||||
if(TIME_AFTER(current_tick, switch_tick)) {
|
if(TIME_AFTER(current_tick, switch_tick)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue