summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r--firmware/powermgmt.c8
1 files changed, 7 insertions, 1 deletions
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
82int battery_capacity = 1500; /* only a default value */ 82int battery_capacity = BATTERY_CAPACITY_MIN; /* only a default value */
83int battery_level_cached = -1; /* battery level of this minute, updated once 83int battery_level_cached = -1; /* battery level of this minute, updated once
84 per minute */ 84 per minute */
85static bool car_adapter_mode_enabled = false; 85static bool car_adapter_mode_enabled = false;
@@ -368,6 +368,7 @@ void set_car_adapter_mode(bool setting)
368 368
369static bool charger_power_is_on; 369static bool charger_power_is_on;
370 370
371#ifdef HAVE_CHARGING
371static void car_adapter_mode_processing(void) 372static 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 */
425static void power_thread_sleep(int ticks) 427static 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