summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-01-01 21:05:13 -0500
committerSolomon Peachy <pizza@shaftnet.org>2019-02-03 23:36:57 +0100
commit0a6cad736f6b4afe32df3eeb82c87e7108315983 (patch)
tree6b9a665670a69627f23871b6b86918121860688f
parent60c9df0b1211a4f519201b46ffd77e36bafe1759 (diff)
downloadrockbox-0a6cad736f6b4afe32df3eeb82c87e7108315983.tar.gz
rockbox-0a6cad736f6b4afe32df3eeb82c87e7108315983.zip
FS#12353: For car adapter mode, make delay before resuming configurable
Original patch by Stanislav Chizhik Udpated by Igor Poretsky & myself Change-Id: I472d4852ac25885658245f077723e4c98b9ad9b8
-rw-r--r--apps/lang/english.lang17
-rw-r--r--apps/lang/russian.lang17
-rw-r--r--apps/menus/settings_menu.c5
-rw-r--r--apps/misc.c11
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c3
-rwxr-xr-xmanual/configure_rockbox/system_options.tex15
7 files changed, 63 insertions, 6 deletions
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 @@
13983 *: "Playing time" 13983 *: "Playing time"
13984 </voice> 13984 </voice>
13985</phrase> 13985</phrase>
13986<phrase>
13987 id: LANG_CAR_ADAPTER_MODE_DELAY
13988 desc: Displayed for setting car adapter mode delay
13989 user: core
13990 <source>
13991 *: none
13992 charging: "Delay Before Resume"
13993 </source>
13994 <dest>
13995 *: none
13996 charging: "Delay Before Resume"
13997 </dest>
13998 <voice>
13999 *: none
14000 charging: "Delay Before Resume"
14001 </voice>
14002</phrase>
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 @@
13740 *: "Play" 13740 *: "Play"
13741 </voice> 13741 </voice>
13742</phrase> 13742</phrase>
13743<phrase>
13744 id: LANG_CAR_ADAPTER_MODE_DELAY
13745 desc: Displayed for setting car adapter mode delay
13746 user: core
13747 <source>
13748 *: none
13749 charging: "Delay Before Resume"
13750 </source>
13751 <dest>
13752 *: none
13753 charging: "Задержка перед возобновлением"
13754 </dest>
13755 <voice>
13756 *: none
13757 charging: "Задержка перед возобновлением"
13758 </voice>
13759</phrase>
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);
345#endif 345#endif
346#if CONFIG_CHARGING 346#if CONFIG_CHARGING
347MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL); 347MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
348MENUITEM_SETTING(car_adapter_mode_delay, &global_settings.car_adapter_mode_delay, NULL);
349MAKE_MENU(car_adapter_mode_menu, ID2P(LANG_CAR_ADAPTER_MODE), 0, Icon_NOICON,
350 &car_adapter_mode, &car_adapter_mode_delay);
348#endif 351#endif
349#ifdef IPOD_ACCESSORY_PROTOCOL 352#ifdef IPOD_ACCESSORY_PROTOCOL
350MENUITEM_SETTING(serial_bitrate, &global_settings.serial_bitrate, NULL); 353MENUITEM_SETTING(serial_bitrate, &global_settings.serial_bitrate, NULL);
@@ -424,7 +427,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
424 &line_in, 427 &line_in,
425#endif 428#endif
426#if CONFIG_CHARGING 429#if CONFIG_CHARGING
427 &car_adapter_mode, 430 &car_adapter_mode_menu,
428#endif 431#endif
429#ifdef IPOD_ACCESSORY_PROTOCOL 432#ifdef IPOD_ACCESSORY_PROTOCOL
430 &serial_bitrate, 433 &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)
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)
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
500 bool audioscrobbler; /* Audioscrobbler logging */ 500 bool audioscrobbler; /* Audioscrobbler logging */
501 bool cuesheet; 501 bool cuesheet;
502 bool car_adapter_mode; /* 0=off 1=on */ 502 bool car_adapter_mode; /* 0=off 1=on */
503 int car_adapter_mode_delay; /* delay before resume, in seconds*/
503 int start_in_screen; 504 int start_in_screen;
504#if defined(HAVE_RTC_ALARM) && \ 505#if defined(HAVE_RTC_ALARM) && \
505 (defined(HAVE_RECORDING) || CONFIG_TUNER) 506 (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[] = {
1061#if CONFIG_CHARGING 1061#if CONFIG_CHARGING
1062 OFFON_SETTING(NVRAM(1), car_adapter_mode, 1062 OFFON_SETTING(NVRAM(1), car_adapter_mode,
1063 LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL), 1063 LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL),
1064 INT_SETTING_NOWRAP(0, car_adapter_mode_delay, LANG_CAR_ADAPTER_MODE_DELAY,
1065 5, "delay before resume", UNIT_SEC, 5, 30, 5,
1066 NULL, NULL, NULL),
1064#endif 1067#endif
1065#ifdef IPOD_ACCESSORY_PROTOCOL 1068#ifdef IPOD_ACCESSORY_PROTOCOL
1066 CHOICE_SETTING(0, serial_bitrate, LANG_SERIAL_BITRATE, 0, "serial bitrate", 1069 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.
145 in the \setting{Idle Poweroff} setting 145 in the \setting{Idle Poweroff} setting
146 (see \reference{ref:IdlePoweroffSetting}). 146 (see \reference{ref:IdlePoweroffSetting}).
147 If power to the DC in jack is turned back on before the \emph{Idle Poweroff} 147 If power to the DC in jack is turned back on before the \emph{Idle Poweroff}
148 function has shut the \dap{} off, playback will be resumed 5 seconds after 148 function has shut the \dap{} off, playback will be resumed after
149 the power is applied. This delay is to allow for the time while the car 149 \setting{Car Adapter Mode Delay} seconds after the power is applied.
150 engine is being started. 150 This delay is to allow for the time while the car engine is being started.
151 \end{description} 151 \end{description}
152 152
153 Once the \dap{} is shut off either manually, or automatically with the 153 Once the \dap{} is shut off either manually, or automatically with the
154 \setting{Idle Poweroff} function, it must be powered up manually to resume 154 \setting{Idle Poweroff} function, it must be powered up manually to resume
155 playback. 155 playback.
156
157\subsection{Car Adapter Mode Delay}
158 This option specifies
159 the time between power being applied and playback resuming
160 \begin{description}
161 \item [Car Adapter Mode Delay.] As different car headunits take
162 varying amounts of time to start up, the \setting{Car Adapter Mode Delay}
163 is configurable between 5 and 30 seconds, in 5 second increments.
164 \end{description}
156} 165}
157 166
158\opt{accessory_supply}{ 167\opt{accessory_supply}{