diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-05-04 13:05:30 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-05-04 13:05:30 +0000 |
commit | 8d8b8d1a7b0987aa578620e594e9c8a9a3b8c975 (patch) | |
tree | f4ece206efd5c3ea6023946a3df0914da8657e8c /apps/recorder/radio.c | |
parent | ce9294476e4cdec77244231221b3380d13b2c8a6 (diff) |
Fixed problem with non-existing fm_presets.txt, now clears the station name when retuning
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3651 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/radio.c')
-rw-r--r-- | apps/recorder/radio.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 8dc14f2493..5b8f3d5b07 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -79,13 +79,10 @@ void fm_set_frequency(int freq) static int find_preset(int freq) { int i; - if(presets_loaded) + for(i = 0;i < MAX_PRESETS;i++) { - for(i = 0;i < MAX_PRESETS;i++) - { - if(freq == presets[i].frequency) - return i; - } + if(freq == presets[i].frequency) + return i; } return -1; @@ -102,11 +99,13 @@ bool radio_screen(void) bool lock; bool stereo; int search_dir = 0; + int fw, fh; lcd_clear_display(); lcd_setmargins(0, 8); status_draw(false); fmradio_set_status(FMRADIO_PLAYING); + lcd_getstringsize("A", &fw, &fh); fm_load_presets(); @@ -167,6 +166,10 @@ bool radio_screen(void) { lcd_puts_scroll(0, 1, presets[curr_preset].name); } + else + { + lcd_clearrect(0, 8+fh*1, LCD_WIDTH, fh); + } lcd_update(); @@ -287,7 +290,7 @@ void fm_save_presets(void) int fd; int i; - fd = open("/.rockbox/fm_presets.txt", O_WRONLY); + fd = creat("/.rockbox/fm_presets.txt", O_WRONLY); if(fd >= 0) { for(i = 0;i < MAX_PRESETS;i++) @@ -332,7 +335,6 @@ void fm_load_presets(void) strncpy(presets[i].name, name, 27); presets[i].name[27] = 0; i++; - presets_loaded = true; if(num_presets == MAX_PRESETS) done = true; } @@ -343,6 +345,7 @@ void fm_load_presets(void) close(fd); } } + presets_loaded = true; } bool fm_preset_select(void) |