FM radio: fix by Antonius Hellman, no more crash when loading preset files with more than 32 entries
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7398 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 67306ac..fa083f2 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -639,7 +639,6 @@
char *freq;
char *name;
bool done = false;
- int i;
int f;
if(!presets_loaded)
@@ -650,8 +649,7 @@
fd = open(default_filename, O_RDONLY);
if(fd >= 0)
{
- i = 0;
- while(!done && i < MAX_PRESETS)
+ while(!done && num_presets < MAX_PRESETS)
{
rc = read_line(fd, buf, 128);
if(rc > 0)
diff --git a/firmware/tuner_philips.c b/firmware/tuner_philips.c
index 72dbf9d..59c6d21 100644
--- a/firmware/tuner_philips.c
+++ b/firmware/tuner_philips.c
@@ -37,7 +37,7 @@
/* init values */
write_bytes[0] = 0x80; /* mute */
write_bytes[1] = 0x00;
- write_bytes[2] = 0x00;
+ write_bytes[2] = 0x10;
#if CONFIG_TUNER_XTAL == 32768000
write_bytes[3] = 0x1A; /* 32.768MHz, soft mute,
stereo noise cancelling */
@@ -55,9 +55,9 @@
{
int n;
#if CONFIG_TUNER_XTAL == 32768000
- n = (4 * (value - 225000)) / 32768;
+ n = (4 * (value + 225000)) / 32768;
#else
- n = (4 * (value - 225000)) / 50000;
+ n = (4 * (value + 225000)) / 50000;
#endif
write_bytes[0] = (write_bytes[0] & 0xC0) | (n >> 8);
write_bytes[1] = n & 0xFF;