mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
fe3cfcc9b2
commit
0f17532c9d
9 changed files with 47 additions and 53 deletions
|
@ -445,7 +445,7 @@ int ft_enter(struct tree_context* c)
|
||||||
{
|
{
|
||||||
set_file(buf, global_settings.fmr_file, MAX_FILENAME);
|
set_file(buf, global_settings.fmr_file, MAX_FILENAME);
|
||||||
radio_load_presets(global_settings.fmr_file);
|
radio_load_presets(global_settings.fmr_file);
|
||||||
if(!global_status.in_radio_screen)
|
if(!in_radio_screen())
|
||||||
radio_screen();
|
radio_screen();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -258,7 +258,8 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
/* turn off volume display in recording screen */
|
/* turn off volume display in recording screen */
|
||||||
if (!global_status.in_recording_screen)
|
bool recscreen_on = in_recording_screen();
|
||||||
|
if (!recscreen_on)
|
||||||
#endif
|
#endif
|
||||||
bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume);
|
bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume);
|
||||||
gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play);
|
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)
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
/* If in recording screen, replace repeat mode, volume
|
/* If in recording screen, replace repeat mode, volume
|
||||||
and shuffle icons with recording info */
|
and shuffle icons with recording info */
|
||||||
if (global_status.in_recording_screen)
|
if (recscreen_on)
|
||||||
gui_statusbar_icon_recording_info(display);
|
gui_statusbar_icon_recording_info(display);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -114,6 +114,9 @@ static int curr_preset = -1;
|
||||||
static int curr_freq;
|
static int curr_freq;
|
||||||
static int radio_mode = RADIO_SCAN_MODE;
|
static int radio_mode = RADIO_SCAN_MODE;
|
||||||
|
|
||||||
|
static int radio_status = FMRADIO_OFF;
|
||||||
|
static bool in_screen = false;
|
||||||
|
|
||||||
#define MAX_PRESETS 64
|
#define MAX_PRESETS 64
|
||||||
static bool presets_loaded = false, presets_changed = false;
|
static bool presets_loaded = false, presets_changed = false;
|
||||||
static struct fmstation presets[MAX_PRESETS];
|
static struct fmstation presets[MAX_PRESETS];
|
||||||
|
@ -186,7 +189,12 @@ void radio_init(void)
|
||||||
the global_status structure directly. */
|
the global_status structure directly. */
|
||||||
int get_radio_status(void)
|
int get_radio_status(void)
|
||||||
{
|
{
|
||||||
return global_status.radio_status;
|
return radio_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool in_radio_screen(void)
|
||||||
|
{
|
||||||
|
return in_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* secret flag for starting paused - prevents unmute */
|
/* secret flag for starting paused - prevents unmute */
|
||||||
|
@ -196,14 +204,14 @@ void radio_start(void)
|
||||||
bool start_paused;
|
bool start_paused;
|
||||||
int mute_timeout;
|
int mute_timeout;
|
||||||
|
|
||||||
if(global_status.radio_status == FMRADIO_PLAYING)
|
if(radio_status == FMRADIO_PLAYING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
start_paused = global_status.radio_status & FMRADIO_START_PAUSED;
|
start_paused = radio_status & FMRADIO_START_PAUSED;
|
||||||
/* clear flag before any yielding */
|
/* clear flag before any yielding */
|
||||||
global_status.radio_status &= ~FMRADIO_START_PAUSED;
|
radio_status &= ~FMRADIO_START_PAUSED;
|
||||||
|
|
||||||
if(global_status.radio_status == FMRADIO_OFF)
|
if(radio_status == FMRADIO_OFF)
|
||||||
radio_power(true);
|
radio_power(true);
|
||||||
|
|
||||||
curr_freq = global_status.last_frequency
|
curr_freq = global_status.last_frequency
|
||||||
|
@ -213,7 +221,7 @@ void radio_start(void)
|
||||||
radio_set(RADIO_SLEEP, 0); /* wake up the tuner */
|
radio_set(RADIO_SLEEP, 0); /* wake up the tuner */
|
||||||
radio_set(RADIO_FREQUENCY, curr_freq);
|
radio_set(RADIO_FREQUENCY, curr_freq);
|
||||||
|
|
||||||
if(global_status.radio_status == FMRADIO_OFF)
|
if(radio_status == FMRADIO_OFF)
|
||||||
{
|
{
|
||||||
radio_set(RADIO_IF_MEASUREMENT, 0);
|
radio_set(RADIO_IF_MEASUREMENT, 0);
|
||||||
radio_set(RADIO_SENSITIVITY, 0);
|
radio_set(RADIO_SENSITIVITY, 0);
|
||||||
|
@ -242,34 +250,34 @@ void radio_start(void)
|
||||||
if(!start_paused)
|
if(!start_paused)
|
||||||
radio_set(RADIO_MUTE, 0);
|
radio_set(RADIO_MUTE, 0);
|
||||||
|
|
||||||
global_status.radio_status = FMRADIO_PLAYING;
|
radio_status = FMRADIO_PLAYING;
|
||||||
} /* radio_start */
|
} /* radio_start */
|
||||||
|
|
||||||
void radio_pause(void)
|
void radio_pause(void)
|
||||||
{
|
{
|
||||||
if(global_status.radio_status == FMRADIO_PAUSED)
|
if(radio_status == FMRADIO_PAUSED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(global_status.radio_status == FMRADIO_OFF)
|
if(radio_status == FMRADIO_OFF)
|
||||||
{
|
{
|
||||||
global_status.radio_status |= FMRADIO_START_PAUSED;
|
radio_status |= FMRADIO_START_PAUSED;
|
||||||
radio_start();
|
radio_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
radio_set(RADIO_MUTE, 1);
|
radio_set(RADIO_MUTE, 1);
|
||||||
radio_set(RADIO_SLEEP, 1);
|
radio_set(RADIO_SLEEP, 1);
|
||||||
|
|
||||||
global_status.radio_status = FMRADIO_PAUSED;
|
radio_status = FMRADIO_PAUSED;
|
||||||
} /* radio_pause */
|
} /* radio_pause */
|
||||||
|
|
||||||
void radio_stop(void)
|
void radio_stop(void)
|
||||||
{
|
{
|
||||||
if(global_status.radio_status == FMRADIO_OFF)
|
if(radio_status == FMRADIO_OFF)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
radio_set(RADIO_MUTE, 1);
|
radio_set(RADIO_MUTE, 1);
|
||||||
radio_set(RADIO_SLEEP, 1); /* low power mode, if available */
|
radio_set(RADIO_SLEEP, 1); /* low power mode, if available */
|
||||||
global_status.radio_status = FMRADIO_OFF;
|
radio_status = FMRADIO_OFF;
|
||||||
radio_power(false); /* status update, power off if avail. */
|
radio_power(false); /* status update, power off if avail. */
|
||||||
} /* radio_stop */
|
} /* radio_stop */
|
||||||
|
|
||||||
|
@ -391,7 +399,7 @@ bool radio_screen(void)
|
||||||
gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
|
gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
|
||||||
#endif
|
#endif
|
||||||
/* change status to "in screen" */
|
/* change status to "in screen" */
|
||||||
global_status.in_radio_screen = true;
|
in_screen = true;
|
||||||
|
|
||||||
/* always display status bar in radio screen for now */
|
/* always display status bar in radio screen for now */
|
||||||
global_settings.statusbar = true;
|
global_settings.statusbar = true;
|
||||||
|
@ -416,7 +424,7 @@ bool radio_screen(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
if(global_status.radio_status == FMRADIO_OFF)
|
if(radio_status == FMRADIO_OFF)
|
||||||
audio_stop();
|
audio_stop();
|
||||||
|
|
||||||
#if CONFIG_CODEC != SWCODEC
|
#if CONFIG_CODEC != SWCODEC
|
||||||
|
@ -444,10 +452,10 @@ bool radio_screen(void)
|
||||||
/* turn on radio */
|
/* turn on radio */
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
rec_set_source(AUDIO_SRC_FMRADIO,
|
rec_set_source(AUDIO_SRC_FMRADIO,
|
||||||
(global_status.radio_status == FMRADIO_PAUSED) ?
|
(radio_status == FMRADIO_PAUSED) ?
|
||||||
SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING);
|
SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING);
|
||||||
#else
|
#else
|
||||||
if (global_status.radio_status == FMRADIO_OFF)
|
if (radio_status == FMRADIO_OFF)
|
||||||
radio_start();
|
radio_start();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -671,7 +679,7 @@ bool radio_screen(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_FM_PLAY:
|
case ACTION_FM_PLAY:
|
||||||
if (global_status.radio_status == FMRADIO_PLAYING)
|
if (radio_status == FMRADIO_PLAYING)
|
||||||
radio_pause();
|
radio_pause();
|
||||||
else
|
else
|
||||||
radio_start();
|
radio_start();
|
||||||
|
@ -814,7 +822,7 @@ bool radio_screen(void)
|
||||||
timeout = current_tick + HZ;
|
timeout = current_tick + HZ;
|
||||||
|
|
||||||
/* keep "mono" from always being displayed when paused */
|
/* keep "mono" from always being displayed when paused */
|
||||||
if (global_status.radio_status != FMRADIO_PAUSED)
|
if (radio_status != FMRADIO_PAUSED)
|
||||||
{
|
{
|
||||||
stereo = radio_get(RADIO_STEREO) &&
|
stereo = radio_get(RADIO_STEREO) &&
|
||||||
!global_settings.fm_force_mono;
|
!global_settings.fm_force_mono;
|
||||||
|
@ -957,7 +965,7 @@ bool radio_screen(void)
|
||||||
/* restore status bar settings */
|
/* restore status bar settings */
|
||||||
global_settings.statusbar = statusbar;
|
global_settings.statusbar = statusbar;
|
||||||
|
|
||||||
global_status.in_radio_screen = false;
|
in_screen = false;
|
||||||
|
|
||||||
return have_recorded;
|
return have_recorded;
|
||||||
} /* radio_screen */
|
} /* radio_screen */
|
||||||
|
|
|
@ -31,6 +31,7 @@ void radio_start(void);
|
||||||
void radio_pause(void);
|
void radio_pause(void);
|
||||||
void radio_stop(void);
|
void radio_stop(void);
|
||||||
bool radio_hardware_present(void);
|
bool radio_hardware_present(void);
|
||||||
|
bool in_radio_screen(void);
|
||||||
|
|
||||||
#define MAX_FMPRESET_LEN 27
|
#define MAX_FMPRESET_LEN 27
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,13 @@
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
|
|
||||||
|
static bool in_screen = false;
|
||||||
|
|
||||||
|
bool in_recording_screen(void)
|
||||||
|
{
|
||||||
|
return in_screen;
|
||||||
|
}
|
||||||
|
|
||||||
#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1)
|
#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1)
|
||||||
|
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
|
@ -794,7 +801,7 @@ bool recording_screen(bool no_source)
|
||||||
|
|
||||||
struct audio_recording_options rec_options;
|
struct audio_recording_options rec_options;
|
||||||
|
|
||||||
global_status.in_recording_screen = true;
|
in_screen = true;
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
||||||
ata_set_led_enabled(false);
|
ata_set_led_enabled(false);
|
||||||
|
@ -1764,7 +1771,7 @@ bool recording_screen(bool no_source)
|
||||||
peak_meter_trigger(false);
|
peak_meter_trigger(false);
|
||||||
peak_meter_set_trigger_listener(NULL);
|
peak_meter_set_trigger_listener(NULL);
|
||||||
|
|
||||||
global_status.in_recording_screen = false;
|
in_screen = false;
|
||||||
sound_settings_apply();
|
sound_settings_apply();
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#define RECORDING_H
|
#define RECORDING_H
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
|
bool in_recording_screen(void);
|
||||||
bool recording_screen(bool no_source);
|
bool recording_screen(bool no_source);
|
||||||
char *rec_create_filename(char *buf);
|
char *rec_create_filename(char *buf);
|
||||||
int rec_create_directory(void);
|
int rec_create_directory(void);
|
||||||
|
|
|
@ -74,21 +74,7 @@
|
||||||
void dac_line_in(bool enable);
|
void dac_line_in(bool enable);
|
||||||
#endif
|
#endif
|
||||||
struct user_settings global_settings;
|
struct user_settings global_settings;
|
||||||
|
struct system_status global_status;
|
||||||
/* Initial values for globally needed state data that shouldn't be saved
|
|
||||||
or reset should be defined here and not in settings_list */
|
|
||||||
|
|
||||||
struct system_status global_status =
|
|
||||||
{
|
|
||||||
.runtime = 0, /* this will be overwritten when nvram settings are loaded */
|
|
||||||
#ifdef CONFIG_TUNER
|
|
||||||
.in_radio_screen = false,
|
|
||||||
.radio_status = FMRADIO_OFF,
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_RECORDING
|
|
||||||
.in_recording_screen = false,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
const char rec_base_directory[] = REC_BASE_DIR;
|
const char rec_base_directory[] = REC_BASE_DIR;
|
||||||
|
@ -919,9 +905,6 @@ void settings_reset(void) {
|
||||||
#if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
|
#if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
|
||||||
enc_global_settings_reset();
|
enc_global_settings_reset();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_RECORDING
|
|
||||||
global_status.in_recording_screen = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Changing setting values **/
|
/** Changing setting values **/
|
||||||
|
|
|
@ -268,14 +268,6 @@ struct system_status
|
||||||
#ifdef CONFIG_TUNER
|
#ifdef CONFIG_TUNER
|
||||||
int last_frequency; /* Last frequency for resuming, in FREQ_STEP units,
|
int last_frequency; /* Last frequency for resuming, in FREQ_STEP units,
|
||||||
relative to MIN_FREQ */
|
relative to MIN_FREQ */
|
||||||
bool in_radio_screen; /* Currently in radio screen?
|
|
||||||
Set by radio_screen. */
|
|
||||||
int radio_status; /* Current radio status (off, playing, paused)
|
|
||||||
Set by radio control functions. */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_RECORDING
|
|
||||||
bool in_recording_screen; /* Currently in recording screen?
|
|
||||||
Set by recording_screen. */
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,11 @@ int current_playmode(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TUNER
|
#ifdef CONFIG_TUNER
|
||||||
if(global_status.radio_status & FMRADIO_PLAYING)
|
audio_stat = get_radio_status();
|
||||||
|
if(audio_stat & FMRADIO_PLAYING)
|
||||||
return STATUS_RADIO;
|
return STATUS_RADIO;
|
||||||
|
|
||||||
if(global_status.radio_status & FMRADIO_PAUSED)
|
if(audio_stat & FMRADIO_PAUSED)
|
||||||
return STATUS_RADIO_PAUSE;
|
return STATUS_RADIO_PAUSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue