diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 5452aba1e2..55838f2b39 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -10687,3 +10687,17 @@ *: "Previous Screen" + + id: LANG_ALARM_WAKEUP_SCREEN + desc: in alarm menu setting + user: + + *: "Alarm Wake up Screen" + + + *: "Alarm Wake up Screen" + + + *: "Alarm Wake up Screen" + + diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 690f9e62e4..b962f1fb52 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -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 diff --git a/apps/root_menu.c b/apps/root_menu.c index b797d473a5..3b9f6eab36 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -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) diff --git a/apps/settings.h b/apps/settings.h index 6e2db093d9..f9e08152af 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -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 **/ diff --git a/apps/settings_list.c b/apps/settings_list.c index c01584f8e2..ac410d57ca 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -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);