diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/powermgmt.h | 14 | ||||
-rw-r--r-- | 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 | |||
84 | extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */ | 84 | extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */ |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | #define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */ | 87 | #ifdef HAVE_MMC /* Values for Ondio */ |
88 | #define CURRENT_USB 500 /* usual current in mA in USB mode */ | 88 | #define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ |
89 | #define CURRENT_BACKLIGHT 30 /* additional current when backlight is always on */ | 89 | #define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ |
90 | #define CURRENT_CHARGING 300 /* charging current */ | 90 | #define CURRENT_BACKLIGHT 0 /* no backlight */ |
91 | #else /* Values for HD based jukeboxes */ | ||
92 | #define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */ | ||
93 | #define CURRENT_USB 500 /* usual current in mA in USB mode */ | ||
94 | #define CURRENT_BACKLIGHT 30 /* additional current when backlight is always on */ | ||
95 | #define CURRENT_CHARGING 300 /* charging current */ | ||
96 | #endif | ||
91 | 97 | ||
92 | extern unsigned short power_history[POWER_HISTORY_LEN]; | 98 | extern unsigned short power_history[POWER_HISTORY_LEN]; |
93 | 99 | ||
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) | |||
79 | 79 | ||
80 | #else /* not SIMULATOR */ | 80 | #else /* not SIMULATOR */ |
81 | 81 | ||
82 | int battery_capacity = 1500; /* only a default value */ | 82 | int battery_capacity = BATTERY_CAPACITY_MIN; /* only a default value */ |
83 | int battery_level_cached = -1; /* battery level of this minute, updated once | 83 | int battery_level_cached = -1; /* battery level of this minute, updated once |
84 | per minute */ | 84 | per minute */ |
85 | static bool car_adapter_mode_enabled = false; | 85 | static bool car_adapter_mode_enabled = false; |
@@ -368,6 +368,7 @@ void set_car_adapter_mode(bool setting) | |||
368 | 368 | ||
369 | static bool charger_power_is_on; | 369 | static bool charger_power_is_on; |
370 | 370 | ||
371 | #ifdef HAVE_CHARGING | ||
371 | static void car_adapter_mode_processing(void) | 372 | static void car_adapter_mode_processing(void) |
372 | { | 373 | { |
373 | static bool waiting_to_resume_play = false; | 374 | static bool waiting_to_resume_play = false; |
@@ -415,6 +416,7 @@ static void car_adapter_mode_processing(void) | |||
415 | } | 416 | } |
416 | } | 417 | } |
417 | } | 418 | } |
419 | #endif | ||
418 | 420 | ||
419 | /* | 421 | /* |
420 | * This function is called to do the relativly long sleep waits from within the | 422 | * 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) | |||
424 | */ | 426 | */ |
425 | static void power_thread_sleep(int ticks) | 427 | static void power_thread_sleep(int ticks) |
426 | { | 428 | { |
429 | #ifdef HAVE_CHARGING | ||
427 | while (ticks > 0) { | 430 | while (ticks > 0) { |
428 | int small_ticks = MIN(HZ/2, ticks); | 431 | int small_ticks = MIN(HZ/2, ticks); |
429 | sleep(small_ticks); | 432 | sleep(small_ticks); |
@@ -431,6 +434,9 @@ static void power_thread_sleep(int ticks) | |||
431 | 434 | ||
432 | car_adapter_mode_processing(); | 435 | car_adapter_mode_processing(); |
433 | } | 436 | } |
437 | #else | ||
438 | sleep(ticks); /* no fast-processing functions, sleep the whole time */ | ||
439 | #endif | ||
434 | } | 440 | } |
435 | 441 | ||
436 | 442 | ||