From c4f96930f03db6c715f71dcf964217179cc698d4 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 15 Oct 2004 18:18:15 +0000 Subject: Adjusted power thread to Ondio: no charging, no car adapter mode, different current values for runtime estimation git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5286 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/powermgmt.h | 14 ++++++++++---- firmware/powermgmt.c | 8 +++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index e03681082c..663a27862c 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -84,10 +84,16 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */ #endif -#define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */ -#define CURRENT_USB 500 /* usual current in mA in USB mode */ -#define CURRENT_BACKLIGHT 30 /* additional current when backlight is always on */ -#define CURRENT_CHARGING 300 /* charging current */ +#ifdef HAVE_MMC /* Values for Ondio */ +#define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ +#define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ +#define CURRENT_BACKLIGHT 0 /* no backlight */ +#else /* Values for HD based jukeboxes */ +#define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */ +#define CURRENT_USB 500 /* usual current in mA in USB mode */ +#define CURRENT_BACKLIGHT 30 /* additional current when backlight is always on */ +#define CURRENT_CHARGING 300 /* charging current */ +#endif extern unsigned short power_history[POWER_HISTORY_LEN]; diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index e4bdd5192b..9cd88819d9 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -79,7 +79,7 @@ void set_car_adapter_mode(bool setting) #else /* not SIMULATOR */ -int battery_capacity = 1500; /* only a default value */ +int battery_capacity = BATTERY_CAPACITY_MIN; /* only a default value */ int battery_level_cached = -1; /* battery level of this minute, updated once per minute */ static bool car_adapter_mode_enabled = false; @@ -368,6 +368,7 @@ void set_car_adapter_mode(bool setting) static bool charger_power_is_on; +#ifdef HAVE_CHARGING static void car_adapter_mode_processing(void) { static bool waiting_to_resume_play = false; @@ -415,6 +416,7 @@ static void car_adapter_mode_processing(void) } } } +#endif /* * This function is called to do the relativly long sleep waits from within the @@ -424,6 +426,7 @@ static void car_adapter_mode_processing(void) */ static void power_thread_sleep(int ticks) { +#ifdef HAVE_CHARGING while (ticks > 0) { int small_ticks = MIN(HZ/2, ticks); sleep(small_ticks); @@ -431,6 +434,9 @@ static void power_thread_sleep(int ticks) car_adapter_mode_processing(); } +#else + sleep(ticks); /* no fast-processing functions, sleep the whole time */ +#endif } -- cgit v1.2.3