summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-12 13:28:44 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-12 13:28:44 +0000
commit3e92dbecc820d6ba4e31b6a4a766ed27c6e7b64b (patch)
tree3fda8523fd02e1e87dab69c78b63d100ef8f7a51
parent7c0cdf19188081dba006d2df0334cf75ca0a471e (diff)
downloadrockbox-3e92dbecc820d6ba4e31b6a4a766ed27c6e7b64b.tar.gz
rockbox-3e92dbecc820d6ba4e31b6a4a766ed27c6e7b64b.tar.bz2
rockbox-3e92dbecc820d6ba4e31b6a4a766ed27c6e7b64b.zip
The FM radio screen now remembers the last used frequency
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4865 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/radio.c14
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings.h2
3 files changed, 17 insertions, 2 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index ce4bc8b4d6..00223a070e 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -68,7 +68,7 @@ static int fm_in1 = DEFAULT_IN1;
static int fm_in2 = DEFAULT_IN2;
static int curr_preset = -1;
-static int curr_freq = 99400000;
+static int curr_freq;
static int pll_cnt;
#define MAX_PRESETS 32
@@ -159,6 +159,12 @@ static int find_preset(int freq)
return -1;
}
+static void remember_frequency(void)
+{
+ global_settings.last_frequency = (curr_freq - MIN_FREQ) / FREQ_STEP;
+ settings_save();
+}
+
bool radio_screen(void)
{
char buf[MAX_PATH];
@@ -224,6 +230,8 @@ bool radio_screen(void)
mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN),
mpeg_sound_default(SOUND_RIGHT_GAIN), false);
#endif
+
+ curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ;
fmradio_set(1, DEFAULT_IN1);
fmradio_set(2, DEFAULT_IN2);
@@ -266,6 +274,7 @@ bool radio_screen(void)
{
search_dir = 0;
curr_preset = find_preset(curr_freq);
+ remember_frequency();
}
update_screen = true;
@@ -322,6 +331,7 @@ bool radio_screen(void)
radio_set(RADIO_FREQUENCY, curr_freq);
curr_preset = find_preset(curr_freq);
+ remember_frequency();
search_dir = 0;
update_screen = true;
break;
@@ -333,6 +343,7 @@ bool radio_screen(void)
radio_set(RADIO_FREQUENCY, curr_freq);
curr_preset = find_preset(curr_freq);
+ remember_frequency();
search_dir = 0;
update_screen = true;
break;
@@ -765,6 +776,7 @@ bool handle_radio_presets(void)
i = menu_cursor(preset_menu);
curr_freq = presets[i].frequency;
radio_set(RADIO_FREQUENCY, curr_freq);
+ remember_frequency();
}
}
diff --git a/apps/settings.c b/apps/settings.c
index 8434d3e211..925da81526 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -222,9 +222,10 @@ static struct bit_entry rtc_bits[] =
/* If values are just added to the end, no need to bump the version. */
#ifdef HAVE_FMRADIO
{1, S_O(fm_force_mono), false, "force fm mono", off_on },
+ {8, S_O(last_frequency), 994, NULL, NULL },
#endif
- /* Current sum of bits: 271 (worst case) */
+ /* Current sum of bits: 286 (worst case) */
/* Sum of all bit sizes must not grow beyond 288! */
};
diff --git a/apps/settings.h b/apps/settings.h
index b7b0864b4c..0ca0e7d7f2 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -195,6 +195,8 @@ struct user_settings
bool fm_force_mono; /* Forces Mono mode if true */
bool fm_full_range; /* Enables full 10MHz-160MHz range if true, else
only 88MHz-108MHz */
+ int last_frequency; /* Last frequency for resuming, in FREQ_STEP units,
+ relative to MIN_FREQ */
#endif
int max_files_in_dir; /* Max entries in directory (file browser) */