diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 1f5afa0a50..207bad6873 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -13983,3 +13983,20 @@ *: "Playing time" + + id: LANG_CAR_ADAPTER_MODE_DELAY + desc: Displayed for setting car adapter mode delay + user: core + + *: none + charging: "Delay Before Resume" + + + *: none + charging: "Delay Before Resume" + + + *: none + charging: "Delay Before Resume" + + diff --git a/apps/lang/russian.lang b/apps/lang/russian.lang index e744542e1c..da326caf02 100644 --- a/apps/lang/russian.lang +++ b/apps/lang/russian.lang @@ -13740,3 +13740,20 @@ *: "Play" + + id: LANG_CAR_ADAPTER_MODE_DELAY + desc: Displayed for setting car adapter mode delay + user: core + + *: none + charging: "Delay Before Resume" + + + *: none + charging: "Задержка перед возобновлением" + + + *: none + charging: "Задержка перед возобновлением" + + diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 41734a9a63..ca0ec91967 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -345,6 +345,9 @@ MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback); #endif #if CONFIG_CHARGING MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL); +MENUITEM_SETTING(car_adapter_mode_delay, &global_settings.car_adapter_mode_delay, NULL); +MAKE_MENU(car_adapter_mode_menu, ID2P(LANG_CAR_ADAPTER_MODE), 0, Icon_NOICON, + &car_adapter_mode, &car_adapter_mode_delay); #endif #ifdef IPOD_ACCESSORY_PROTOCOL MENUITEM_SETTING(serial_bitrate, &global_settings.serial_bitrate, NULL); @@ -424,7 +427,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), &line_in, #endif #if CONFIG_CHARGING - &car_adapter_mode, + &car_adapter_mode_menu, #endif #ifdef IPOD_ACCESSORY_PROTOCOL &serial_bitrate, 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) #if CONFIG_CHARGING static bool waiting_to_resume_play = false; +static bool paused_on_unplugged = false; static long play_resume_tick; static void car_adapter_mode_processing(bool inserted) @@ -477,10 +478,10 @@ static void car_adapter_mode_processing(bool inserted) /* * Just got plugged in, delay & resume if we were playing */ - if (audio_status() & AUDIO_STATUS_PAUSE) + if ((audio_status() & AUDIO_STATUS_PAUSE) && paused_on_unplugged) { /* delay resume a bit while the engine is cranking */ - play_resume_tick = current_tick + HZ*5; + play_resume_tick = current_tick + HZ*global_settings.car_adapter_mode_delay; waiting_to_resume_play = true; } } @@ -493,7 +494,10 @@ static void car_adapter_mode_processing(bool inserted) !(audio_status() & AUDIO_STATUS_PAUSE)) { pause_action(true, true); + paused_on_unplugged = true; } + else if (!waiting_to_resume_play) + paused_on_unplugged = false; waiting_to_resume_play = false; } } @@ -503,6 +507,9 @@ static void car_adapter_tick(void) { if (waiting_to_resume_play) { + if ((audio_status() & AUDIO_STATUS_PLAY) && + !(audio_status() & AUDIO_STATUS_PAUSE)) + waiting_to_resume_play = false; if (TIME_AFTER(current_tick, play_resume_tick)) { if (audio_status() & AUDIO_STATUS_PAUSE) diff --git a/apps/settings.h b/apps/settings.h index 05ad948c0d..ee67a1734f 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -500,6 +500,7 @@ struct user_settings bool audioscrobbler; /* Audioscrobbler logging */ bool cuesheet; bool car_adapter_mode; /* 0=off 1=on */ + int car_adapter_mode_delay; /* delay before resume, in seconds*/ int start_in_screen; #if defined(HAVE_RTC_ALARM) && \ (defined(HAVE_RECORDING) || CONFIG_TUNER) diff --git a/apps/settings_list.c b/apps/settings_list.c index 45434d1859..027ed6a87c 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1061,6 +1061,9 @@ const struct settings_list settings[] = { #if CONFIG_CHARGING OFFON_SETTING(NVRAM(1), car_adapter_mode, LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL), + INT_SETTING_NOWRAP(0, car_adapter_mode_delay, LANG_CAR_ADAPTER_MODE_DELAY, + 5, "delay before resume", UNIT_SEC, 5, 30, 5, + NULL, NULL, NULL), #endif #ifdef IPOD_ACCESSORY_PROTOCOL CHOICE_SETTING(0, serial_bitrate, LANG_SERIAL_BITRATE, 0, "serial bitrate", diff --git a/manual/configure_rockbox/system_options.tex b/manual/configure_rockbox/system_options.tex index 1733a9b8ec..7c3300b875 100755 --- a/manual/configure_rockbox/system_options.tex +++ b/manual/configure_rockbox/system_options.tex @@ -145,14 +145,23 @@ This sub menu relates to limits in the Rockbox operating system. in the \setting{Idle Poweroff} setting (see \reference{ref:IdlePoweroffSetting}). If power to the DC in jack is turned back on before the \emph{Idle Poweroff} - function has shut the \dap{} off, playback will be resumed 5 seconds after - the power is applied. This delay is to allow for the time while the car - engine is being started. + function has shut the \dap{} off, playback will be resumed after + \setting{Car Adapter Mode Delay} seconds after the power is applied. + This delay is to allow for the time while the car engine is being started. \end{description} Once the \dap{} is shut off either manually, or automatically with the \setting{Idle Poweroff} function, it must be powered up manually to resume playback. + +\subsection{Car Adapter Mode Delay} + This option specifies + the time between power being applied and playback resuming + \begin{description} + \item [Car Adapter Mode Delay.] As different car headunits take + varying amounts of time to start up, the \setting{Car Adapter Mode Delay} + is configurable between 5 and 30 seconds, in 5 second increments. + \end{description} } \opt{accessory_supply}{