diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-02-08 10:36:49 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-02-08 10:36:49 +0000 |
commit | 0f17532c9ddb2282c385ce6ad501a2e5d94acbe5 (patch) | |
tree | 02df2cb3f274e9106c21abf1926441bd7f3429c3 /apps | |
parent | fe3cfcc9b2b0ce5f0862f891762794ddf42bb6ab (diff) | |
download | rockbox-0f17532c9ddb2282c385ce6ad501a2e5d94acbe5.tar.gz rockbox-0f17532c9ddb2282c385ce6ad501a2e5d94acbe5.zip |
Revert the changes using global status for the screen states. It should wait for a more comprehensive plan to maximize benefit if any can be had.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12231 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetree.c | 2 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 5 | ||||
-rw-r--r-- | apps/recorder/radio.c | 48 | ||||
-rw-r--r-- | apps/recorder/radio.h | 1 | ||||
-rw-r--r-- | apps/recorder/recording.c | 11 | ||||
-rw-r--r-- | apps/recorder/recording.h | 1 | ||||
-rw-r--r-- | apps/settings.c | 19 | ||||
-rw-r--r-- | apps/settings.h | 8 | ||||
-rw-r--r-- | apps/status.c | 5 |
9 files changed, 47 insertions, 53 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 4a68d00f8b..10174dbb31 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -445,7 +445,7 @@ int ft_enter(struct tree_context* c) | |||
445 | { | 445 | { |
446 | set_file(buf, global_settings.fmr_file, MAX_FILENAME); | 446 | set_file(buf, global_settings.fmr_file, MAX_FILENAME); |
447 | radio_load_presets(global_settings.fmr_file); | 447 | radio_load_presets(global_settings.fmr_file); |
448 | if(!global_status.in_radio_screen) | 448 | if(!in_radio_screen()) |
449 | radio_screen(); | 449 | radio_screen(); |
450 | } | 450 | } |
451 | /* | 451 | /* |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index f1943f3356..d3f4813e37 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -258,7 +258,8 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
258 | #endif | 258 | #endif |
259 | #ifdef HAVE_RECORDING | 259 | #ifdef HAVE_RECORDING |
260 | /* turn off volume display in recording screen */ | 260 | /* turn off volume display in recording screen */ |
261 | if (!global_status.in_recording_screen) | 261 | bool recscreen_on = in_recording_screen(); |
262 | if (!recscreen_on) | ||
262 | #endif | 263 | #endif |
263 | bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume); | 264 | bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume); |
264 | gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play); | 265 | gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play); |
@@ -266,7 +267,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
266 | #ifdef HAVE_RECORDING | 267 | #ifdef HAVE_RECORDING |
267 | /* If in recording screen, replace repeat mode, volume | 268 | /* If in recording screen, replace repeat mode, volume |
268 | and shuffle icons with recording info */ | 269 | and shuffle icons with recording info */ |
269 | if (global_status.in_recording_screen) | 270 | if (recscreen_on) |
270 | gui_statusbar_icon_recording_info(display); | 271 | gui_statusbar_icon_recording_info(display); |
271 | else | 272 | else |
272 | #endif | 273 | #endif |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 97d6266a02..a1821de58f 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -114,6 +114,9 @@ static int curr_preset = -1; | |||
114 | static int curr_freq; | 114 | static int curr_freq; |
115 | static int radio_mode = RADIO_SCAN_MODE; | 115 | static int radio_mode = RADIO_SCAN_MODE; |
116 | 116 | ||
117 | static int radio_status = FMRADIO_OFF; | ||
118 | static bool in_screen = false; | ||
119 | |||
117 | #define MAX_PRESETS 64 | 120 | #define MAX_PRESETS 64 |
118 | static bool presets_loaded = false, presets_changed = false; | 121 | static bool presets_loaded = false, presets_changed = false; |
119 | static struct fmstation presets[MAX_PRESETS]; | 122 | static struct fmstation presets[MAX_PRESETS]; |
@@ -186,9 +189,14 @@ void radio_init(void) | |||
186 | the global_status structure directly. */ | 189 | the global_status structure directly. */ |
187 | int get_radio_status(void) | 190 | int get_radio_status(void) |
188 | { | 191 | { |
189 | return global_status.radio_status; | 192 | return radio_status; |
190 | } | 193 | } |
191 | 194 | ||
195 | bool in_radio_screen(void) | ||
196 | { | ||
197 | return in_screen; | ||
198 | } | ||
199 | |||
192 | /* secret flag for starting paused - prevents unmute */ | 200 | /* secret flag for starting paused - prevents unmute */ |
193 | #define FMRADIO_START_PAUSED 0x8000 | 201 | #define FMRADIO_START_PAUSED 0x8000 |
194 | void radio_start(void) | 202 | void radio_start(void) |
@@ -196,14 +204,14 @@ void radio_start(void) | |||
196 | bool start_paused; | 204 | bool start_paused; |
197 | int mute_timeout; | 205 | int mute_timeout; |
198 | 206 | ||
199 | if(global_status.radio_status == FMRADIO_PLAYING) | 207 | if(radio_status == FMRADIO_PLAYING) |
200 | return; | 208 | return; |
201 | 209 | ||
202 | start_paused = global_status.radio_status & FMRADIO_START_PAUSED; | 210 | start_paused = radio_status & FMRADIO_START_PAUSED; |
203 | /* clear flag before any yielding */ | 211 | /* clear flag before any yielding */ |
204 | global_status.radio_status &= ~FMRADIO_START_PAUSED; | 212 | radio_status &= ~FMRADIO_START_PAUSED; |
205 | 213 | ||
206 | if(global_status.radio_status == FMRADIO_OFF) | 214 | if(radio_status == FMRADIO_OFF) |
207 | radio_power(true); | 215 | radio_power(true); |
208 | 216 | ||
209 | curr_freq = global_status.last_frequency | 217 | curr_freq = global_status.last_frequency |
@@ -213,7 +221,7 @@ void radio_start(void) | |||
213 | radio_set(RADIO_SLEEP, 0); /* wake up the tuner */ | 221 | radio_set(RADIO_SLEEP, 0); /* wake up the tuner */ |
214 | radio_set(RADIO_FREQUENCY, curr_freq); | 222 | radio_set(RADIO_FREQUENCY, curr_freq); |
215 | 223 | ||
216 | if(global_status.radio_status == FMRADIO_OFF) | 224 | if(radio_status == FMRADIO_OFF) |
217 | { | 225 | { |
218 | radio_set(RADIO_IF_MEASUREMENT, 0); | 226 | radio_set(RADIO_IF_MEASUREMENT, 0); |
219 | radio_set(RADIO_SENSITIVITY, 0); | 227 | radio_set(RADIO_SENSITIVITY, 0); |
@@ -242,34 +250,34 @@ void radio_start(void) | |||
242 | if(!start_paused) | 250 | if(!start_paused) |
243 | radio_set(RADIO_MUTE, 0); | 251 | radio_set(RADIO_MUTE, 0); |
244 | 252 | ||
245 | global_status.radio_status = FMRADIO_PLAYING; | 253 | radio_status = FMRADIO_PLAYING; |
246 | } /* radio_start */ | 254 | } /* radio_start */ |
247 | 255 | ||
248 | void radio_pause(void) | 256 | void radio_pause(void) |
249 | { | 257 | { |
250 | if(global_status.radio_status == FMRADIO_PAUSED) | 258 | if(radio_status == FMRADIO_PAUSED) |
251 | return; | 259 | return; |
252 | 260 | ||
253 | if(global_status.radio_status == FMRADIO_OFF) | 261 | if(radio_status == FMRADIO_OFF) |
254 | { | 262 | { |
255 | global_status.radio_status |= FMRADIO_START_PAUSED; | 263 | radio_status |= FMRADIO_START_PAUSED; |
256 | radio_start(); | 264 | radio_start(); |
257 | } | 265 | } |
258 | 266 | ||
259 | radio_set(RADIO_MUTE, 1); | 267 | radio_set(RADIO_MUTE, 1); |
260 | radio_set(RADIO_SLEEP, 1); | 268 | radio_set(RADIO_SLEEP, 1); |
261 | 269 | ||
262 | global_status.radio_status = FMRADIO_PAUSED; | 270 | radio_status = FMRADIO_PAUSED; |
263 | } /* radio_pause */ | 271 | } /* radio_pause */ |
264 | 272 | ||
265 | void radio_stop(void) | 273 | void radio_stop(void) |
266 | { | 274 | { |
267 | if(global_status.radio_status == FMRADIO_OFF) | 275 | if(radio_status == FMRADIO_OFF) |
268 | return; | 276 | return; |
269 | 277 | ||
270 | radio_set(RADIO_MUTE, 1); | 278 | radio_set(RADIO_MUTE, 1); |
271 | radio_set(RADIO_SLEEP, 1); /* low power mode, if available */ | 279 | radio_set(RADIO_SLEEP, 1); /* low power mode, if available */ |
272 | global_status.radio_status = FMRADIO_OFF; | 280 | radio_status = FMRADIO_OFF; |
273 | radio_power(false); /* status update, power off if avail. */ | 281 | radio_power(false); /* status update, power off if avail. */ |
274 | } /* radio_stop */ | 282 | } /* radio_stop */ |
275 | 283 | ||
@@ -391,7 +399,7 @@ bool radio_screen(void) | |||
391 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); | 399 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); |
392 | #endif | 400 | #endif |
393 | /* change status to "in screen" */ | 401 | /* change status to "in screen" */ |
394 | global_status.in_radio_screen = true; | 402 | in_screen = true; |
395 | 403 | ||
396 | /* always display status bar in radio screen for now */ | 404 | /* always display status bar in radio screen for now */ |
397 | global_settings.statusbar = true; | 405 | global_settings.statusbar = true; |
@@ -416,7 +424,7 @@ bool radio_screen(void) | |||
416 | } | 424 | } |
417 | 425 | ||
418 | #ifndef SIMULATOR | 426 | #ifndef SIMULATOR |
419 | if(global_status.radio_status == FMRADIO_OFF) | 427 | if(radio_status == FMRADIO_OFF) |
420 | audio_stop(); | 428 | audio_stop(); |
421 | 429 | ||
422 | #if CONFIG_CODEC != SWCODEC | 430 | #if CONFIG_CODEC != SWCODEC |
@@ -444,10 +452,10 @@ bool radio_screen(void) | |||
444 | /* turn on radio */ | 452 | /* turn on radio */ |
445 | #if CONFIG_CODEC == SWCODEC | 453 | #if CONFIG_CODEC == SWCODEC |
446 | rec_set_source(AUDIO_SRC_FMRADIO, | 454 | rec_set_source(AUDIO_SRC_FMRADIO, |
447 | (global_status.radio_status == FMRADIO_PAUSED) ? | 455 | (radio_status == FMRADIO_PAUSED) ? |
448 | SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); | 456 | SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); |
449 | #else | 457 | #else |
450 | if (global_status.radio_status == FMRADIO_OFF) | 458 | if (radio_status == FMRADIO_OFF) |
451 | radio_start(); | 459 | radio_start(); |
452 | #endif | 460 | #endif |
453 | 461 | ||
@@ -671,7 +679,7 @@ bool radio_screen(void) | |||
671 | break; | 679 | break; |
672 | 680 | ||
673 | case ACTION_FM_PLAY: | 681 | case ACTION_FM_PLAY: |
674 | if (global_status.radio_status == FMRADIO_PLAYING) | 682 | if (radio_status == FMRADIO_PLAYING) |
675 | radio_pause(); | 683 | radio_pause(); |
676 | else | 684 | else |
677 | radio_start(); | 685 | radio_start(); |
@@ -814,7 +822,7 @@ bool radio_screen(void) | |||
814 | timeout = current_tick + HZ; | 822 | timeout = current_tick + HZ; |
815 | 823 | ||
816 | /* keep "mono" from always being displayed when paused */ | 824 | /* keep "mono" from always being displayed when paused */ |
817 | if (global_status.radio_status != FMRADIO_PAUSED) | 825 | if (radio_status != FMRADIO_PAUSED) |
818 | { | 826 | { |
819 | stereo = radio_get(RADIO_STEREO) && | 827 | stereo = radio_get(RADIO_STEREO) && |
820 | !global_settings.fm_force_mono; | 828 | !global_settings.fm_force_mono; |
@@ -957,7 +965,7 @@ bool radio_screen(void) | |||
957 | /* restore status bar settings */ | 965 | /* restore status bar settings */ |
958 | global_settings.statusbar = statusbar; | 966 | global_settings.statusbar = statusbar; |
959 | 967 | ||
960 | global_status.in_radio_screen = false; | 968 | in_screen = false; |
961 | 969 | ||
962 | return have_recorded; | 970 | return have_recorded; |
963 | } /* radio_screen */ | 971 | } /* radio_screen */ |
diff --git a/apps/recorder/radio.h b/apps/recorder/radio.h index 0bfda3bccf..a4f9f1a978 100644 --- a/apps/recorder/radio.h +++ b/apps/recorder/radio.h | |||
@@ -31,6 +31,7 @@ void radio_start(void); | |||
31 | void radio_pause(void); | 31 | void radio_pause(void); |
32 | void radio_stop(void); | 32 | void radio_stop(void); |
33 | bool radio_hardware_present(void); | 33 | bool radio_hardware_present(void); |
34 | bool in_radio_screen(void); | ||
34 | 35 | ||
35 | #define MAX_FMPRESET_LEN 27 | 36 | #define MAX_FMPRESET_LEN 27 |
36 | 37 | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index a0a929f3a6..eb6f9b20ca 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -70,6 +70,13 @@ | |||
70 | #include "radio.h" | 70 | #include "radio.h" |
71 | #ifdef HAVE_RECORDING | 71 | #ifdef HAVE_RECORDING |
72 | 72 | ||
73 | static bool in_screen = false; | ||
74 | |||
75 | bool in_recording_screen(void) | ||
76 | { | ||
77 | return in_screen; | ||
78 | } | ||
79 | |||
73 | #define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) | 80 | #define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) |
74 | 81 | ||
75 | #if CONFIG_KEYPAD == RECORDER_PAD | 82 | #if CONFIG_KEYPAD == RECORDER_PAD |
@@ -794,7 +801,7 @@ bool recording_screen(bool no_source) | |||
794 | 801 | ||
795 | struct audio_recording_options rec_options; | 802 | struct audio_recording_options rec_options; |
796 | 803 | ||
797 | global_status.in_recording_screen = true; | 804 | in_screen = true; |
798 | cursor = 0; | 805 | cursor = 0; |
799 | #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) | 806 | #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) |
800 | ata_set_led_enabled(false); | 807 | ata_set_led_enabled(false); |
@@ -1764,7 +1771,7 @@ bool recording_screen(bool no_source) | |||
1764 | peak_meter_trigger(false); | 1771 | peak_meter_trigger(false); |
1765 | peak_meter_set_trigger_listener(NULL); | 1772 | peak_meter_set_trigger_listener(NULL); |
1766 | 1773 | ||
1767 | global_status.in_recording_screen = false; | 1774 | in_screen = false; |
1768 | sound_settings_apply(); | 1775 | sound_settings_apply(); |
1769 | 1776 | ||
1770 | FOR_NB_SCREENS(i) | 1777 | FOR_NB_SCREENS(i) |
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h index e78af50671..1921074d26 100644 --- a/apps/recorder/recording.h +++ b/apps/recorder/recording.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #define RECORDING_H | 20 | #define RECORDING_H |
21 | #include "audio.h" | 21 | #include "audio.h" |
22 | 22 | ||
23 | bool in_recording_screen(void); | ||
23 | bool recording_screen(bool no_source); | 24 | bool recording_screen(bool no_source); |
24 | char *rec_create_filename(char *buf); | 25 | char *rec_create_filename(char *buf); |
25 | int rec_create_directory(void); | 26 | int rec_create_directory(void); |
diff --git a/apps/settings.c b/apps/settings.c index 42a66ace8b..8c92b84dad 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -74,21 +74,7 @@ | |||
74 | void dac_line_in(bool enable); | 74 | void dac_line_in(bool enable); |
75 | #endif | 75 | #endif |
76 | struct user_settings global_settings; | 76 | struct user_settings global_settings; |
77 | 77 | struct system_status global_status; | |
78 | /* Initial values for globally needed state data that shouldn't be saved | ||
79 | or reset should be defined here and not in settings_list */ | ||
80 | |||
81 | struct system_status global_status = | ||
82 | { | ||
83 | .runtime = 0, /* this will be overwritten when nvram settings are loaded */ | ||
84 | #ifdef CONFIG_TUNER | ||
85 | .in_radio_screen = false, | ||
86 | .radio_status = FMRADIO_OFF, | ||
87 | #endif | ||
88 | #ifdef HAVE_RECORDING | ||
89 | .in_recording_screen = false, | ||
90 | #endif | ||
91 | }; | ||
92 | 78 | ||
93 | #ifdef HAVE_RECORDING | 79 | #ifdef HAVE_RECORDING |
94 | const char rec_base_directory[] = REC_BASE_DIR; | 80 | const char rec_base_directory[] = REC_BASE_DIR; |
@@ -919,9 +905,6 @@ void settings_reset(void) { | |||
919 | #if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC | 905 | #if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC |
920 | enc_global_settings_reset(); | 906 | enc_global_settings_reset(); |
921 | #endif | 907 | #endif |
922 | #ifdef HAVE_RECORDING | ||
923 | global_status.in_recording_screen = false; | ||
924 | #endif | ||
925 | } | 908 | } |
926 | 909 | ||
927 | /** Changing setting values **/ | 910 | /** Changing setting values **/ |
diff --git a/apps/settings.h b/apps/settings.h index 21fd341cd4..0411f6e7db 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -268,14 +268,6 @@ struct system_status | |||
268 | #ifdef CONFIG_TUNER | 268 | #ifdef CONFIG_TUNER |
269 | int last_frequency; /* Last frequency for resuming, in FREQ_STEP units, | 269 | int last_frequency; /* Last frequency for resuming, in FREQ_STEP units, |
270 | relative to MIN_FREQ */ | 270 | relative to MIN_FREQ */ |
271 | bool in_radio_screen; /* Currently in radio screen? | ||
272 | Set by radio_screen. */ | ||
273 | int radio_status; /* Current radio status (off, playing, paused) | ||
274 | Set by radio control functions. */ | ||
275 | #endif | ||
276 | #ifdef HAVE_RECORDING | ||
277 | bool in_recording_screen; /* Currently in recording screen? | ||
278 | Set by recording_screen. */ | ||
279 | #endif | 271 | #endif |
280 | }; | 272 | }; |
281 | 273 | ||
diff --git a/apps/status.c b/apps/status.c index d03cb98157..3f46607ed1 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -97,10 +97,11 @@ int current_playmode(void) | |||
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | #ifdef CONFIG_TUNER | 99 | #ifdef CONFIG_TUNER |
100 | if(global_status.radio_status & FMRADIO_PLAYING) | 100 | audio_stat = get_radio_status(); |
101 | if(audio_stat & FMRADIO_PLAYING) | ||
101 | return STATUS_RADIO; | 102 | return STATUS_RADIO; |
102 | 103 | ||
103 | if(global_status.radio_status & FMRADIO_PAUSED) | 104 | if(audio_stat & FMRADIO_PAUSED) |
104 | return STATUS_RADIO_PAUSE; | 105 | return STATUS_RADIO_PAUSE; |
105 | #endif | 106 | #endif |
106 | 107 | ||