Fix alarm wake up. If the target has fm or recording (or both) an option is in the System menu to choose what to start when the alarm wakes up,

otherwise the WPS will start


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12654 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-03-07 01:16:25 +00:00
parent f609c5bd3e
commit 9e554a87fc
5 changed files with 75 additions and 7 deletions

View file

@ -10687,3 +10687,17 @@
*: "Previous Screen"
</voice>
</phrase>
<phrase>
id: LANG_ALARM_WAKEUP_SCREEN
desc: in alarm menu setting
user:
<source>
*: "Alarm Wake up Screen"
</source>
<dest>
*: "Alarm Wake up Screen"
</dest>
<voice>
*: "Alarm Wake up Screen"
</voice>
</phrase>

View file

@ -211,6 +211,10 @@ MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
#ifdef HAVE_RTC_ALARM
MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
(menu_function)alarm_screen, NULL, Icon_NOICON);
#if defined(HAVE_RECORDING) || CONFIG_TUNER
MENUITEM_SETTING(alarm_wake_up_screen,
&global_settings.alarm_wake_up_screen, NULL);
#endif
#endif
/* Limits menu */
@ -256,6 +260,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
&poweroff,
#ifdef HAVE_RTC_ALARM
&alarm_screen_call,
#if defined(HAVE_RECORDING) || CONFIG_TUNER
&alarm_wake_up_screen,
#endif
#endif
&limits_menu,
#if CONFIG_CODEC == MAS3507D

View file

@ -152,13 +152,6 @@ static int wpsscrn(void* param)
DEBUGF("Resume index %X offset %X\n",
global_status.resume_index,
global_status.resume_offset);
#ifdef HAVE_RTC_ALARM
if ( rtc_check_alarm_started(true) ) {
rtc_enable_alarm(false);
}
#endif
if (playlist_resume() != -1)
{
playlist_start(global_status.resume_index,
@ -329,6 +322,22 @@ void root_menu(void)
ret_val = (int)global_status.last_screen;
else ret_val = global_settings.start_in_screen - 2;
#ifdef HAVE_RTC_ALARM
if ( rtc_check_alarm_started(true) )
{
rtc_enable_alarm(false);
ret_val = GO_TO_WPS;
#if CONFIG_TUNER
if (global_settings.alarm_wake_up_screen == ALARM_START_FM)
ret_val = GO_TO_FM;
#endif
#ifdef HAVE_RECORDING
if (global_settings.alarm_wake_up_screen == ALARM_START_REC)
ret_val = GO_TO_RECSCREEN;
#endif
}
#endif /* HAVE_RTC_ALARM */
while (true)
{
switch (ret_val)

View file

@ -166,7 +166,26 @@ enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE };
/* show path types */
enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
/* Alarm settings */
#ifdef HAVE_RTC_ALARM
enum { ALARM_START_WPS = 0,
#if CONFIG_TUNER
ALARM_START_FM,
#endif
#ifdef HAVE_RECORDING
ALARM_START_REC,
#endif
ALARM_START_COUNT
};
#if CONFIG_TUNER && defined(HAVE_RECORDING)
#define ALARM_SETTING_TEXT "wps,fm,rec"
#elif CONFIG_TUNER
#define ALARM_SETTING_TEXT "wps,fm"
#elif defined(HAVE_RECORDING)
#define ALARM_SETTING_TEXT "wps,rec"
#endif
#endif /* HAVE_RTC_ALARM */
/** virtual pointer stuff.. move to another .h maybe? **/
/* These define "virtual pointers", which could either be a literal string,
or a mean a string ID if the pointer is in a certain range.
@ -681,6 +700,11 @@ struct user_settings
#endif /* CONFIG_CODEC == SWCODEC */
bool cuesheet;
int start_in_screen;
#if defined(HAVE_RTC_ALARM) && \
(defined(HAVE_RECORDING) || CONFIG_TUNER)
int alarm_wake_up_screen;
#endif
};
/** global variables **/

View file

@ -1113,6 +1113,20 @@ const struct settings_list settings[] = {
ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS)
),
SYSTEM_SETTING(NVRAM(1),last_screen,-1),
#if defined(HAVE_RTC_ALARM) && \
(defined(HAVE_RECORDING) || CONFIG_TUNER)
CHOICE_SETTING(0, alarm_wake_up_screen, LANG_ALARM_WAKEUP_SCREEN,
ALARM_START_WPS,
"alarm wakeup screen", ALARM_SETTING_TEXT,
NULL, ALARM_START_COUNT, ID2P(LANG_RESUME_PLAYBACK)
#if CONFIG_TUNER
,ID2P(LANG_FM_RADIO)
#endif
#ifdef HAVE_RECORDING
,ID2P(LANG_RECORDING)
#endif
),
#endif /* HAVE_RTC_ALARM */
};
const int nb_settings = sizeof(settings)/sizeof(*settings);