diff options
Diffstat (limited to 'apps/status.c')
-rw-r--r-- | apps/status.c | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/apps/status.c b/apps/status.c index 5ff7a92e75..af6eaa4e2a 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "settings.h" | 25 | #include "settings.h" |
26 | #include "status.h" | 26 | #include "status.h" |
27 | #include "mp3_playback.h" | 27 | #include "mp3_playback.h" |
28 | #include "mpeg.h" | ||
28 | #include "wps.h" | 29 | #include "wps.h" |
29 | #ifdef HAVE_RTC | 30 | #ifdef HAVE_RTC |
30 | #include "timefuncs.h" | 31 | #include "timefuncs.h" |
@@ -35,7 +36,7 @@ | |||
35 | #endif | 36 | #endif |
36 | #include "powermgmt.h" | 37 | #include "powermgmt.h" |
37 | 38 | ||
38 | static enum playmode current_mode = STATUS_STOP; | 39 | static enum playmode ff_mode; |
39 | 40 | ||
40 | static long switch_tick; | 41 | static long switch_tick; |
41 | static int battery_charge_step = 0; | 42 | static int battery_charge_step = 0; |
@@ -57,15 +58,47 @@ struct status_info { | |||
57 | 58 | ||
58 | void status_init(void) | 59 | void status_init(void) |
59 | { | 60 | { |
60 | status_set_playmode(STATUS_STOP); | 61 | ff_mode = 0; |
61 | } | 62 | } |
62 | 63 | ||
63 | void status_set_playmode(enum playmode mode) | 64 | void status_set_ffmode(enum playmode mode) |
64 | { | 65 | { |
65 | current_mode = mode; | 66 | ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */ |
66 | status_draw(false); | 67 | status_draw(false); |
67 | } | 68 | } |
68 | 69 | ||
70 | int current_playmode(void) | ||
71 | { | ||
72 | int mpeg_stat = mpeg_status(); | ||
73 | |||
74 | /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD | ||
75 | and that supercedes the other modes */ | ||
76 | if(ff_mode) | ||
77 | return ff_mode; | ||
78 | |||
79 | if(mpeg_stat & MPEG_STATUS_PLAY) | ||
80 | { | ||
81 | if(mpeg_stat & MPEG_STATUS_PAUSE) | ||
82 | return STATUS_PAUSE; | ||
83 | else | ||
84 | return STATUS_PLAY; | ||
85 | } | ||
86 | #ifdef HAVE_MAS3587F | ||
87 | else | ||
88 | { | ||
89 | if(mpeg_stat & MPEG_STATUS_RECORD) | ||
90 | { | ||
91 | if(mpeg_stat & MPEG_STATUS_PAUSE) | ||
92 | return STATUS_RECORD_PAUSE; | ||
93 | else | ||
94 | return STATUS_RECORD; | ||
95 | } | ||
96 | } | ||
97 | #endif | ||
98 | |||
99 | return STATUS_STOP; | ||
100 | } | ||
101 | |||
69 | #if defined(HAVE_LCD_CHARCELLS) | 102 | #if defined(HAVE_LCD_CHARCELLS) |
70 | static bool record = false; | 103 | static bool record = false; |
71 | static bool audio = false; | 104 | static bool audio = false; |
@@ -120,7 +153,7 @@ void status_draw(bool force_redraw) | |||
120 | info.shuffle = global_settings.playlist_shuffle; | 153 | info.shuffle = global_settings.playlist_shuffle; |
121 | info.keylock = keys_locked; | 154 | info.keylock = keys_locked; |
122 | info.repeat = global_settings.repeat_mode; | 155 | info.repeat = global_settings.repeat_mode; |
123 | info.playmode = current_mode; | 156 | info.playmode = current_playmode(); |
124 | 157 | ||
125 | /* only redraw if forced to, or info has changed */ | 158 | /* only redraw if forced to, or info has changed */ |
126 | if (force_redraw || | 159 | if (force_redraw || |
@@ -181,7 +214,7 @@ void status_draw(bool force_redraw) | |||
181 | statusbar_icon_battery(info.battlevel, plug_state); | 214 | statusbar_icon_battery(info.battlevel, plug_state); |
182 | 215 | ||
183 | statusbar_icon_volume(info.volume); | 216 | statusbar_icon_volume(info.volume); |
184 | statusbar_icon_play_state(current_mode + Icon_Play); | 217 | statusbar_icon_play_state(current_playmode() + Icon_Play); |
185 | switch (info.repeat) { | 218 | switch (info.repeat) { |
186 | case REPEAT_ONE: | 219 | case REPEAT_ONE: |
187 | statusbar_icon_play_mode(Icon_RepeatOne); | 220 | statusbar_icon_play_mode(Icon_RepeatOne); |
@@ -218,8 +251,8 @@ void status_draw(bool force_redraw) | |||
218 | lcd_icon(ICON_VOLUME_4, info.volume > 70); | 251 | lcd_icon(ICON_VOLUME_4, info.volume > 70); |
219 | lcd_icon(ICON_VOLUME_5, info.volume > 90); | 252 | lcd_icon(ICON_VOLUME_5, info.volume > 90); |
220 | 253 | ||
221 | lcd_icon(ICON_PLAY, current_mode == STATUS_PLAY); | 254 | lcd_icon(ICON_PLAY, current_playmode() == STATUS_PLAY); |
222 | lcd_icon(ICON_PAUSE, current_mode == STATUS_PAUSE); | 255 | lcd_icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE); |
223 | 256 | ||
224 | lcd_icon(ICON_REPEAT, global_settings.repeat_mode != REPEAT_OFF); | 257 | lcd_icon(ICON_REPEAT, global_settings.repeat_mode != REPEAT_OFF); |
225 | lcd_icon(ICON_1, global_settings.repeat_mode == REPEAT_ONE); | 258 | lcd_icon(ICON_1, global_settings.repeat_mode == REPEAT_ONE); |