diff options
-rw-r--r-- | apps/filetree.c | 12 | ||||
-rw-r--r-- | apps/lang/english.lang | 12 | ||||
-rw-r--r-- | apps/screens.c | 6 | ||||
-rw-r--r-- | apps/settings.c | 2 | ||||
-rw-r--r-- | apps/settings.h | 7 | ||||
-rw-r--r-- | apps/settings_menu.c | 9 | ||||
-rw-r--r-- | apps/tree.c | 105 | ||||
-rw-r--r-- | apps/wps.c | 9 | ||||
-rw-r--r-- | firmware/drivers/button.c | 3 |
9 files changed, 31 insertions, 134 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 60443a163c..c7a2dbf071 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -447,13 +447,11 @@ int ft_enter(struct tree_context* c) | |||
447 | } | 447 | } |
448 | 448 | ||
449 | if ( play ) { | 449 | if ( play ) { |
450 | if ( global_settings.resume ) { | 450 | /* the resume_index must always be the index in the |
451 | /* the resume_index must always be the index in the | 451 | shuffled list in case shuffle is enabled */ |
452 | shuffled list in case shuffle is enabled */ | 452 | global_settings.resume_index = start_index; |
453 | global_settings.resume_index = start_index; | 453 | global_settings.resume_offset = 0; |
454 | global_settings.resume_offset = 0; | 454 | settings_save(); |
455 | settings_save(); | ||
456 | } | ||
457 | 455 | ||
458 | start_wps = true; | 456 | start_wps = true; |
459 | } | 457 | } |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 3b068bf50d..91858fde4e 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -391,12 +391,6 @@ eng: "Is Full!" | |||
391 | voice: "" | 391 | voice: "" |
392 | new: | 392 | new: |
393 | 393 | ||
394 | id: LANG_RESUME_ASK | ||
395 | desc: question asked at the begining when resume is on | ||
396 | eng: "Resume?" | ||
397 | voice: "" | ||
398 | new: | ||
399 | |||
400 | id: LANG_RESUME_CONFIRM_PLAYER | 394 | id: LANG_RESUME_CONFIRM_PLAYER |
401 | desc: possible answers to resume question | 395 | desc: possible answers to resume question |
402 | eng: "(PLAY/STOP)" | 396 | eng: "(PLAY/STOP)" |
@@ -847,12 +841,6 @@ eng: "Dec" | |||
847 | voice: "December" | 841 | voice: "December" |
848 | new: | 842 | new: |
849 | 843 | ||
850 | id: LANG_RESUME_SETTING_ASK_ONCE | ||
851 | desc: in settings_menu | ||
852 | eng: "Ask Once" | ||
853 | voice: "Ask Once" | ||
854 | new: | ||
855 | |||
856 | id: LANG_BATTERY_DISPLAY | 844 | id: LANG_BATTERY_DISPLAY |
857 | desc: Battery type title | 845 | desc: Battery type title |
858 | eng: "Battery Display" | 846 | eng: "Battery Display" |
diff --git a/apps/screens.c b/apps/screens.c index 04a32813d1..59ffd06c50 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -693,15 +693,15 @@ bool quick_screen(int context, int button) | |||
693 | break; | 693 | break; |
694 | 694 | ||
695 | case BUTTON_F3 | BUTTON_RIGHT: | 695 | case BUTTON_F3 | BUTTON_RIGHT: |
696 | // case BUTTON_F3 | BUTTON_RIGHT | BUTTON_REPEAT: | 696 | case BUTTON_F3 | BUTTON_RIGHT | BUTTON_REPEAT: |
697 | global_settings.statusbar = !global_settings.statusbar; | 697 | global_settings.statusbar = !global_settings.statusbar; |
698 | used = true; | 698 | used = true; |
699 | break; | 699 | break; |
700 | 700 | ||
701 | case BUTTON_F3 | BUTTON_DOWN: | 701 | case BUTTON_F3 | BUTTON_DOWN: |
702 | // case BUTTON_F3 | BUTTON_DOWN | BUTTON_REPEAT: | 702 | case BUTTON_F3 | BUTTON_DOWN | BUTTON_REPEAT: |
703 | case BUTTON_F3 | BUTTON_UP: | 703 | case BUTTON_F3 | BUTTON_UP: |
704 | // case BUTTON_F3 | BUTTON_UP | BUTTON_REPEAT: | 704 | case BUTTON_F3 | BUTTON_UP | BUTTON_REPEAT: |
705 | global_settings.flip_display = !global_settings.flip_display; | 705 | global_settings.flip_display = !global_settings.flip_display; |
706 | button_set_flip(global_settings.flip_display); | 706 | button_set_flip(global_settings.flip_display); |
707 | lcd_set_flip(global_settings.flip_display); | 707 | lcd_set_flip(global_settings.flip_display); |
diff --git a/apps/settings.c b/apps/settings.c index 60e41fcfdd..d40223bd78 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -197,7 +197,7 @@ static const struct bit_entry rtc_bits[] = | |||
197 | "stereo,mono,custom,mono left,mono right,karaoke" }, | 197 | "stereo,mono,custom,mono left,mono right,karaoke" }, |
198 | {8, S_O(stereo_width), 100, "stereo width", NULL}, | 198 | {8, S_O(stereo_width), 100, "stereo width", NULL}, |
199 | /* playback */ | 199 | /* playback */ |
200 | {2, S_O(resume), RESUME_ASK, "resume", "off,ask,ask once,on" }, | 200 | {2, S_O(resume), false, "resume", off_on }, |
201 | {1, S_O(playlist_shuffle), false, "shuffle", off_on }, | 201 | {1, S_O(playlist_shuffle), false, "shuffle", off_on }, |
202 | {16 | SIGNED, S_O(resume_index), -1, NULL, NULL }, | 202 | {16 | SIGNED, S_O(resume_index), -1, NULL, NULL }, |
203 | {16 | SIGNED, S_O(resume_first_index), 0, NULL, NULL }, | 203 | {16 | SIGNED, S_O(resume_first_index), 0, NULL, NULL }, |
diff --git a/apps/settings.h b/apps/settings.h index bb4f5fbf32..d630db7f35 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -78,11 +78,6 @@ | |||
78 | 78 | ||
79 | /* data structures */ | 79 | /* data structures */ |
80 | 80 | ||
81 | #define RESUME_OFF 0 | ||
82 | #define RESUME_ASK 1 | ||
83 | #define RESUME_ASK_ONCE 2 | ||
84 | #define RESUME_ON 3 | ||
85 | |||
86 | #define BOOKMARK_NO 0 | 81 | #define BOOKMARK_NO 0 |
87 | #define BOOKMARK_YES 1 | 82 | #define BOOKMARK_YES 1 |
88 | #define BOOKMARK_ASK 2 | 83 | #define BOOKMARK_ASK 2 |
@@ -211,7 +206,7 @@ struct user_settings | |||
211 | 206 | ||
212 | /* resume settings */ | 207 | /* resume settings */ |
213 | 208 | ||
214 | int resume; /* resume option: 0=off, 1=ask, 2=on */ | 209 | bool resume; /* resume option: 0=off, 1=on */ |
215 | int resume_index; /* index in playlist (-1 for no active resume) */ | 210 | int resume_index; /* index in playlist (-1 for no active resume) */ |
216 | int resume_first_index; /* index of first track in playlist */ | 211 | int resume_first_index; /* index of first track in playlist */ |
217 | int resume_offset; /* byte offset in mp3 file */ | 212 | int resume_offset; /* byte offset in mp3 file */ |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index b10c7d32ab..5dcf66789f 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -656,14 +656,7 @@ static bool sort_dir(void) | |||
656 | 656 | ||
657 | static bool resume(void) | 657 | static bool resume(void) |
658 | { | 658 | { |
659 | static const struct opt_items names[] = { | 659 | return set_bool( str(LANG_RESUME), &global_settings.resume); |
660 | { STR(LANG_SET_BOOL_NO) }, | ||
661 | { STR(LANG_RESUME_SETTING_ASK) }, | ||
662 | { STR(LANG_RESUME_SETTING_ASK_ONCE) }, | ||
663 | { STR(LANG_SET_BOOL_YES) } | ||
664 | }; | ||
665 | return set_option( str(LANG_RESUME), &global_settings.resume, INT, | ||
666 | names, 4, NULL ); | ||
667 | } | 660 | } |
668 | 661 | ||
669 | static bool autocreatebookmark(void) | 662 | static bool autocreatebookmark(void) |
diff --git a/apps/tree.c b/apps/tree.c index 6d25203eac..6dcb52d1a4 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -430,92 +430,6 @@ static int showdir(void) | |||
430 | return tc.filesindir; | 430 | return tc.filesindir; |
431 | } | 431 | } |
432 | 432 | ||
433 | static bool ask_resume(bool just_powered_on) | ||
434 | { | ||
435 | int button; | ||
436 | bool stop = false; | ||
437 | static bool ignore_power = true; | ||
438 | |||
439 | #ifdef HAVE_LCD_CHARCELLS | ||
440 | lcd_double_height(false); | ||
441 | #endif | ||
442 | |||
443 | #ifdef HAVE_ALARM_MOD | ||
444 | if ( rtc_check_alarm_started(true) ) { | ||
445 | rtc_enable_alarm(false); | ||
446 | return true; | ||
447 | } | ||
448 | #endif | ||
449 | |||
450 | /* always resume? */ | ||
451 | if ( global_settings.resume == RESUME_ON || ! just_powered_on) | ||
452 | return true; | ||
453 | |||
454 | lcd_clear_display(); | ||
455 | lcd_puts(0,0,str(LANG_RESUME_ASK)); | ||
456 | #ifdef HAVE_LCD_CHARCELLS | ||
457 | status_draw(false); | ||
458 | lcd_puts(0,1,str(LANG_RESUME_CONFIRM_PLAYER)); | ||
459 | #else | ||
460 | lcd_puts(0,1,str(LANG_CONFIRM_WITH_PLAY_RECORDER)); | ||
461 | lcd_puts(0,2,str(LANG_CANCEL_WITH_ANY_RECORDER)); | ||
462 | #endif | ||
463 | lcd_update(); | ||
464 | |||
465 | while (!stop) { | ||
466 | button = button_get(true); | ||
467 | switch (button) { | ||
468 | #ifdef TREE_RUN_PRE | ||
469 | case TREE_RUN_PRE: /* catch the press, not the release */ | ||
470 | #else | ||
471 | case TREE_RUN: | ||
472 | #endif | ||
473 | |||
474 | #ifdef TREE_RC_RUN_PRE | ||
475 | case TREE_RC_RUN_PRE: /* catch the press, not the release */ | ||
476 | #else | ||
477 | #ifdef TREE_RC_RUN | ||
478 | case TREE_RC_RUN: | ||
479 | #endif | ||
480 | #endif | ||
481 | ignore_power = false; | ||
482 | /* Don't ignore the power button for subsequent calls */ | ||
483 | return true; | ||
484 | |||
485 | #ifdef TREE_POWER_BTN | ||
486 | /* Initially ignore the button which powers on the box. It | ||
487 | * might still be pressed since booting. */ | ||
488 | case TREE_POWER_BTN: | ||
489 | case TREE_POWER_BTN | BUTTON_REPEAT: | ||
490 | if(!ignore_power) | ||
491 | stop = true; | ||
492 | break; | ||
493 | |||
494 | /* No longer ignore the power button after it was released */ | ||
495 | case TREE_POWER_BTN | BUTTON_REL: | ||
496 | ignore_power = false; | ||
497 | break; | ||
498 | #endif | ||
499 | |||
500 | /* Handle sys events, ignore button releases */ | ||
501 | default: | ||
502 | if(default_event_handler(button) == SYS_USB_CONNECTED || | ||
503 | (!IS_SYSEVENT(button) && !(button & BUTTON_REL))) | ||
504 | stop = true; | ||
505 | break; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | if ( global_settings.resume == RESUME_ASK_ONCE && just_powered_on) { | ||
510 | global_settings.resume_index = -1; | ||
511 | settings_save(); | ||
512 | } | ||
513 | |||
514 | ignore_power = false; | ||
515 | /* Don't ignore the power button for subsequent calls */ | ||
516 | return false; | ||
517 | } | ||
518 | |||
519 | /* load tracks from specified directory to resume play */ | 433 | /* load tracks from specified directory to resume play */ |
520 | void resume_directory(const char *dir) | 434 | void resume_directory(const char *dir) |
521 | { | 435 | { |
@@ -549,15 +463,26 @@ void reload_directory(void) | |||
549 | 463 | ||
550 | static void start_resume(bool just_powered_on) | 464 | static void start_resume(bool just_powered_on) |
551 | { | 465 | { |
552 | if ( ( global_settings.resume || ! just_powered_on ) && | 466 | bool do_resume = false; |
553 | global_settings.resume_index != -1 ) { | 467 | |
468 | if ( global_settings.resume_index != -1 ) { | ||
554 | DEBUGF("Resume index %X offset %X\n", | 469 | DEBUGF("Resume index %X offset %X\n", |
555 | global_settings.resume_index, | 470 | global_settings.resume_index, |
556 | global_settings.resume_offset); | 471 | global_settings.resume_offset); |
557 | 472 | ||
558 | if (!ask_resume(just_powered_on) ) | 473 | #ifdef HAVE_ALARM_MOD |
559 | return; | 474 | if ( rtc_check_alarm_started(true) ) { |
475 | rtc_enable_alarm(false); | ||
476 | do_resume = true; | ||
477 | } | ||
478 | #endif | ||
479 | |||
480 | /* always resume? */ | ||
481 | if ( global_settings.resume || ! just_powered_on) | ||
482 | do_resume = true; | ||
560 | 483 | ||
484 | if (! do_resume) return; | ||
485 | |||
561 | if (playlist_resume() != -1) | 486 | if (playlist_resume() != -1) |
562 | { | 487 | { |
563 | playlist_start(global_settings.resume_index, | 488 | playlist_start(global_settings.resume_index, |
diff --git a/apps/wps.c b/apps/wps.c index be0ad448dd..40c9194793 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -252,7 +252,6 @@ static bool update(void) | |||
252 | 252 | ||
253 | /* save resume data */ | 253 | /* save resume data */ |
254 | if ( id3 && | 254 | if ( id3 && |
255 | global_settings.resume && | ||
256 | global_settings.resume_offset != id3->offset ) { | 255 | global_settings.resume_offset != id3->offset ) { |
257 | 256 | ||
258 | if (!playlist_get_resume_info(&global_settings.resume_index)) | 257 | if (!playlist_get_resume_info(&global_settings.resume_index)) |
@@ -391,7 +390,7 @@ long wps_show(void) | |||
391 | 390 | ||
392 | /* if another thread paused audio, we are probably in car mode, | 391 | /* if another thread paused audio, we are probably in car mode, |
393 | about to shut down. lets save the settings. */ | 392 | about to shut down. lets save the settings. */ |
394 | if (paused && global_settings.resume) { | 393 | if (paused) { |
395 | settings_save(); | 394 | settings_save(); |
396 | #ifndef HAVE_RTC | 395 | #ifndef HAVE_RTC |
397 | ata_flush(); | 396 | ata_flush(); |
@@ -544,12 +543,10 @@ long wps_show(void) | |||
544 | fade(0); | 543 | fade(0); |
545 | else | 544 | else |
546 | audio_pause(); | 545 | audio_pause(); |
547 | if (global_settings.resume) { | 546 | settings_save(); |
548 | settings_save(); | ||
549 | #ifndef HAVE_RTC | 547 | #ifndef HAVE_RTC |
550 | ata_flush(); | 548 | ata_flush(); |
551 | #endif | 549 | #endif |
552 | } | ||
553 | } | 550 | } |
554 | break; | 551 | break; |
555 | 552 | ||
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index e644267b19..b2de8b8157 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -220,7 +220,8 @@ void button_init(void) | |||
220 | #endif /* CONFIG_KEYPAD */ | 220 | #endif /* CONFIG_KEYPAD */ |
221 | 221 | ||
222 | queue_init(&button_queue); | 222 | queue_init(&button_queue); |
223 | lastbtn = 0; | 223 | button_read(); |
224 | lastbtn = button_read(); | ||
224 | tick_add_task(button_tick); | 225 | tick_add_task(button_tick); |
225 | reset_poweroff_timer(); | 226 | reset_poweroff_timer(); |
226 | 227 | ||