summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 8b1668b63c..b9d6bfb1d9 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -466,6 +466,7 @@ bool list_stop_handler(void)
466 466
467#if CONFIG_CHARGING 467#if CONFIG_CHARGING
468static bool waiting_to_resume_play = false; 468static bool waiting_to_resume_play = false;
469static bool paused_on_unplugged = false;
469static long play_resume_tick; 470static long play_resume_tick;
470 471
471static void car_adapter_mode_processing(bool inserted) 472static void car_adapter_mode_processing(bool inserted)
@@ -477,10 +478,10 @@ static void car_adapter_mode_processing(bool inserted)
477 /* 478 /*
478 * Just got plugged in, delay & resume if we were playing 479 * Just got plugged in, delay & resume if we were playing
479 */ 480 */
480 if (audio_status() & AUDIO_STATUS_PAUSE) 481 if ((audio_status() & AUDIO_STATUS_PAUSE) && paused_on_unplugged)
481 { 482 {
482 /* delay resume a bit while the engine is cranking */ 483 /* delay resume a bit while the engine is cranking */
483 play_resume_tick = current_tick + HZ*5; 484 play_resume_tick = current_tick + HZ*global_settings.car_adapter_mode_delay;
484 waiting_to_resume_play = true; 485 waiting_to_resume_play = true;
485 } 486 }
486 } 487 }
@@ -493,7 +494,10 @@ static void car_adapter_mode_processing(bool inserted)
493 !(audio_status() & AUDIO_STATUS_PAUSE)) 494 !(audio_status() & AUDIO_STATUS_PAUSE))
494 { 495 {
495 pause_action(true, true); 496 pause_action(true, true);
497 paused_on_unplugged = true;
496 } 498 }
499 else if (!waiting_to_resume_play)
500 paused_on_unplugged = false;
497 waiting_to_resume_play = false; 501 waiting_to_resume_play = false;
498 } 502 }
499 } 503 }
@@ -503,6 +507,9 @@ static void car_adapter_tick(void)
503{ 507{
504 if (waiting_to_resume_play) 508 if (waiting_to_resume_play)
505 { 509 {
510 if ((audio_status() & AUDIO_STATUS_PLAY) &&
511 !(audio_status() & AUDIO_STATUS_PAUSE))
512 waiting_to_resume_play = false;
506 if (TIME_AFTER(current_tick, play_resume_tick)) 513 if (TIME_AFTER(current_tick, play_resume_tick))
507 { 514 {
508 if (audio_status() & AUDIO_STATUS_PAUSE) 515 if (audio_status() & AUDIO_STATUS_PAUSE)