mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
fm radio: new preset mode, new button assignment and remote support for iRiver,
misc clean up and improvements git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7849 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
061f38096a
commit
697e832bef
2 changed files with 330 additions and 74 deletions
|
|
@ -3370,3 +3370,21 @@ desc: in the recording settings
|
||||||
eng: "Monitor Mode"
|
eng: "Monitor Mode"
|
||||||
voice: "Monitor Mode"
|
voice: "Monitor Mode"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
|
id: LANG_RADIO_SCAN_MODE
|
||||||
|
desc: in radio screen
|
||||||
|
eng: "Scan Mode"
|
||||||
|
voice: ""
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_RADIO_PRESET_MODE
|
||||||
|
desc: in radio screen
|
||||||
|
eng: "Preset Mode"
|
||||||
|
voice: ""
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_FM_FREEZE
|
||||||
|
desc: error message when preset list is empty
|
||||||
|
eng: "Screen frozen!"
|
||||||
|
voice: ""
|
||||||
|
new:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include "lcd.h"
|
|
||||||
#include "mas.h"
|
#include "mas.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
|
|
@ -52,6 +51,10 @@
|
||||||
#include "hwcompat.h"
|
#include "hwcompat.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
#include "screen_access.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
#include "textarea.h"
|
||||||
|
#include "splash.h"
|
||||||
|
|
||||||
#ifdef CONFIG_TUNER
|
#ifdef CONFIG_TUNER
|
||||||
|
|
||||||
|
|
@ -66,15 +69,39 @@
|
||||||
#define FM_RECORD BUTTON_F3
|
#define FM_RECORD BUTTON_F3
|
||||||
#define FM_FREEZE BUTTON_PLAY
|
#define FM_FREEZE BUTTON_PLAY
|
||||||
#define FM_STOP BUTTON_OFF
|
#define FM_STOP BUTTON_OFF
|
||||||
|
#define FM_MODE (BUTTON_ON | BUTTON_REPEAT)
|
||||||
|
#define FM_EXIT_PRE BUTTON_ON
|
||||||
#define FM_EXIT (BUTTON_ON | BUTTON_REL)
|
#define FM_EXIT (BUTTON_ON | BUTTON_REL)
|
||||||
#define FM_PRESET_ADD BUTTON_F1
|
#define FM_PRESET_ADD BUTTON_F1
|
||||||
#define FM_PRESET_ACTION BUTTON_F3
|
#define FM_PRESET_ACTION BUTTON_F3
|
||||||
#elif CONFIG_KEYPAD == IRIVER_H100_PAD
|
#elif CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||||
#define FM_MENU BUTTON_MODE
|
/* pause/play - short PLAY */
|
||||||
#define FM_PRESET BUTTON_ON
|
#define FM_PLAY_PRE BUTTON_ON
|
||||||
|
#define FM_RC_PLAY_PRE BUTTON_RC_ON
|
||||||
|
#define FM_PLAY (BUTTON_ON | BUTTON_REL)
|
||||||
|
#define FM_RC_PLAY (BUTTON_RC_ON | BUTTON_REL)
|
||||||
|
/* preset/scan mode - long PLAY */
|
||||||
|
#define FM_MODE (BUTTON_ON | BUTTON_REPEAT)
|
||||||
|
#define FM_RC_MODE (BUTTON_RC_ON | BUTTON_REPEAT)
|
||||||
|
/* preset menu - short SELECT */
|
||||||
|
#define FM_PRESET_PRE BUTTON_SELECT
|
||||||
|
#define FM_RC_PRESET_PRE BUTTON_RC_MENU
|
||||||
|
#define FM_PRESET (BUTTON_SELECT | BUTTON_REL)
|
||||||
|
#define FM_RC_PRESET (BUTTON_RC_MENU | BUTTON_REL)
|
||||||
|
/* fm menu - long SELECT */
|
||||||
|
#define FM_MENU (BUTTON_SELECT | BUTTON_REPEAT)
|
||||||
|
#define FM_RC_MENU (BUTTON_RC_MENU | BUTTON_REPEAT)
|
||||||
|
/* main menu(exit radio while playing) - A-B */
|
||||||
|
#define FM_EXIT_PRE BUTTON_MODE
|
||||||
|
#define FM_EXIT (BUTTON_MODE | BUTTON_REL)
|
||||||
|
#define FM_RC_EXIT_PRE BUTTON_RC_MODE
|
||||||
|
#define FM_RC_EXIT (BUTTON_RC_MODE | BUTTON_REL)
|
||||||
|
/* prev/next preset on the remote - BITRATE/SOURCE */
|
||||||
|
#define FM_NEXT_PRESET (BUTTON_RC_BITRATE | BUTTON_REL)
|
||||||
|
#define FM_PREV_PRESET (BUTTON_RC_SOURCE | BUTTON_REL)
|
||||||
|
/* stop and exit radio - STOP */
|
||||||
#define FM_STOP BUTTON_OFF
|
#define FM_STOP BUTTON_OFF
|
||||||
#define FM_EXIT_PRE BUTTON_SELECT
|
#define FM_RC_STOP BUTTON_RC_STOP
|
||||||
#define FM_EXIT (BUTTON_SELECT | BUTTON_REL)
|
|
||||||
#elif CONFIG_KEYPAD == ONDIO_PAD /* restricted keypad */
|
#elif CONFIG_KEYPAD == ONDIO_PAD /* restricted keypad */
|
||||||
#define FM_MENU (BUTTON_MENU | BUTTON_REPEAT)
|
#define FM_MENU (BUTTON_MENU | BUTTON_REPEAT)
|
||||||
#define FM_RECORD_DBLPRE BUTTON_MENU
|
#define FM_RECORD_DBLPRE BUTTON_MENU
|
||||||
|
|
@ -87,10 +114,14 @@
|
||||||
#define MIN_FREQ (87500000)
|
#define MIN_FREQ (87500000)
|
||||||
#define FREQ_STEP 100000
|
#define FREQ_STEP 100000
|
||||||
|
|
||||||
|
#define RADIO_SCAN_MODE 0
|
||||||
|
#define RADIO_PRESET_MODE 1
|
||||||
|
|
||||||
static int curr_preset = -1;
|
static int curr_preset = -1;
|
||||||
static int curr_freq;
|
static int curr_freq;
|
||||||
|
static int radio_mode = RADIO_SCAN_MODE;
|
||||||
|
|
||||||
#define MAX_PRESETS 32
|
#define MAX_PRESETS 64
|
||||||
static bool presets_loaded = false;
|
static bool presets_loaded = false;
|
||||||
static struct fmstation presets[MAX_PRESETS];
|
static struct fmstation presets[MAX_PRESETS];
|
||||||
|
|
||||||
|
|
@ -173,12 +204,67 @@ static int find_preset(int freq)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int find_closest_preset(int freq)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int diff;
|
||||||
|
int min_diff = MAX_FREQ;
|
||||||
|
int preset = -1;
|
||||||
|
|
||||||
|
for(i = 0;i < MAX_PRESETS;i++)
|
||||||
|
{
|
||||||
|
diff = freq - presets[i].frequency;
|
||||||
|
if(diff==0)
|
||||||
|
return i;
|
||||||
|
if(diff < 0)
|
||||||
|
diff = -diff;
|
||||||
|
if(diff < min_diff)
|
||||||
|
{
|
||||||
|
preset = i;
|
||||||
|
min_diff = diff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return preset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void remember_frequency(void)
|
static void remember_frequency(void)
|
||||||
{
|
{
|
||||||
global_settings.last_frequency = (curr_freq - MIN_FREQ) / FREQ_STEP;
|
global_settings.last_frequency = (curr_freq - MIN_FREQ) / FREQ_STEP;
|
||||||
settings_save();
|
settings_save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void next_preset(int direction)
|
||||||
|
{
|
||||||
|
if (num_presets < 1)
|
||||||
|
return;
|
||||||
|
curr_preset = find_preset(curr_freq);
|
||||||
|
if(curr_preset == -1)
|
||||||
|
curr_preset = find_closest_preset(curr_freq);
|
||||||
|
else if ((curr_preset < (num_presets-1) && direction > 0) ||
|
||||||
|
((curr_preset > 0) && direction < 0))
|
||||||
|
{
|
||||||
|
if (direction > 0)
|
||||||
|
curr_preset++;
|
||||||
|
else
|
||||||
|
curr_preset--;
|
||||||
|
}
|
||||||
|
else if (num_presets > 1)
|
||||||
|
{
|
||||||
|
if (direction > 0)
|
||||||
|
curr_preset = 0;
|
||||||
|
else
|
||||||
|
curr_preset = num_presets - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
curr_freq = presets[curr_preset].frequency;
|
||||||
|
radio_set(RADIO_FREQUENCY, curr_freq);
|
||||||
|
remember_frequency();
|
||||||
|
}
|
||||||
|
|
||||||
bool radio_screen(void)
|
bool radio_screen(void)
|
||||||
{
|
{
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
|
|
@ -187,11 +273,11 @@ bool radio_screen(void)
|
||||||
#ifdef FM_RECORD_DBLPRE
|
#ifdef FM_RECORD_DBLPRE
|
||||||
unsigned long rec_lastclick = 0;
|
unsigned long rec_lastclick = 0;
|
||||||
#endif
|
#endif
|
||||||
int freq;
|
int freq, i;
|
||||||
bool tuned;
|
bool tuned;
|
||||||
bool stereo = false;
|
bool stereo = false;
|
||||||
int search_dir = 0;
|
int search_dir = 0;
|
||||||
int fw, fh;
|
int fh;
|
||||||
bool last_stereo_status = false;
|
bool last_stereo_status = false;
|
||||||
int top_of_screen = 0;
|
int top_of_screen = 0;
|
||||||
bool update_screen = true;
|
bool update_screen = true;
|
||||||
|
|
@ -202,14 +288,18 @@ bool radio_screen(void)
|
||||||
unsigned int last_seconds = 0;
|
unsigned int last_seconds = 0;
|
||||||
int hours, minutes;
|
int hours, minutes;
|
||||||
bool keep_playing = false;
|
bool keep_playing = false;
|
||||||
|
bool statusbar = global_settings.statusbar;
|
||||||
|
/* always display status bar in radio screen for now */
|
||||||
|
global_settings.statusbar = true;
|
||||||
|
|
||||||
lcd_clear_display();
|
FOR_NB_SCREENS(i){
|
||||||
lcd_setmargins(0, 8);
|
gui_textarea_clear(&screens[i]);
|
||||||
status_draw(true);
|
screen_set_xmargin(&screens[i],0);
|
||||||
radio_set_status(FMRADIO_PLAYING);
|
}
|
||||||
|
|
||||||
font_get(FONT_UI);
|
gui_syncstatusbar_draw(&statusbars,true);
|
||||||
lcd_getstringsize("M", &fw, &fh);
|
|
||||||
|
fh = font_get(FONT_UI)->height;
|
||||||
|
|
||||||
/* Adjust for font size, trying to center the information vertically */
|
/* Adjust for font size, trying to center the information vertically */
|
||||||
if(fh < 10)
|
if(fh < 10)
|
||||||
|
|
@ -250,7 +340,8 @@ bool radio_screen(void)
|
||||||
sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
|
sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
|
||||||
#else
|
#else
|
||||||
uda1380_enable_recording(false);
|
uda1380_enable_recording(false);
|
||||||
uda1380_set_recvol(10, 10, AUDIO_GAIN_LINEIN);
|
uda1380_set_recvol(10, 10, AUDIO_GAIN_ADC);
|
||||||
|
uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN);
|
||||||
uda1380_set_monitor(true);
|
uda1380_set_monitor(true);
|
||||||
|
|
||||||
/* Set the input multiplexer to FM */
|
/* Set the input multiplexer to FM */
|
||||||
|
|
@ -260,14 +351,21 @@ bool radio_screen(void)
|
||||||
|
|
||||||
curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ;
|
curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ;
|
||||||
|
|
||||||
|
if(radio_get_status() == FMRADIO_OFF){
|
||||||
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);
|
||||||
radio_set(RADIO_IF_MEASUREMENT, 0);
|
radio_set(RADIO_IF_MEASUREMENT, 0);
|
||||||
radio_set(RADIO_SENSITIVITY, 0);
|
radio_set(RADIO_SENSITIVITY, 0);
|
||||||
radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono);
|
radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono);
|
||||||
radio_set(RADIO_MUTE, 0);
|
radio_set(RADIO_MUTE, 0);
|
||||||
|
}
|
||||||
|
radio_set_status(FMRADIO_PLAYING);
|
||||||
|
|
||||||
curr_preset = find_preset(curr_freq);
|
curr_preset = find_preset(curr_freq);
|
||||||
|
#ifdef FM_MODE
|
||||||
|
if(curr_preset != -1)
|
||||||
|
radio_mode = RADIO_PRESET_MODE;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
buttonbar_set(str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS),
|
buttonbar_set(str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS),
|
||||||
|
|
@ -314,6 +412,9 @@ bool radio_screen(void)
|
||||||
button = button_get_w_tmo(HZ / PEAK_METER_FPS);
|
button = button_get_w_tmo(HZ / PEAK_METER_FPS);
|
||||||
switch(button)
|
switch(button)
|
||||||
{
|
{
|
||||||
|
#ifdef FM_RC_STOP
|
||||||
|
case FM_RC_STOP:
|
||||||
|
#endif
|
||||||
case FM_STOP:
|
case FM_STOP:
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
if(audio_status() == AUDIO_STATUS_RECORD)
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
||||||
|
|
@ -360,51 +461,84 @@ bool radio_screen(void)
|
||||||
break;
|
break;
|
||||||
#endif /* #ifdef FM_RECORD */
|
#endif /* #ifdef FM_RECORD */
|
||||||
|
|
||||||
|
#ifdef FM_RC_EXIT
|
||||||
|
case FM_RC_EXIT:
|
||||||
|
#endif
|
||||||
case FM_EXIT:
|
case FM_EXIT:
|
||||||
#ifdef FM_EXIT_PRE
|
#ifdef FM_EXIT_PRE
|
||||||
if(lastbutton != FM_EXIT_PRE)
|
if(lastbutton != FM_EXIT_PRE
|
||||||
|
#ifdef FM_RC_EXIT_PRE
|
||||||
|
&& lastbutton != FM_RC_EXIT_PRE
|
||||||
|
#endif
|
||||||
|
)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
if(audio_status() == AUDIO_STATUS_RECORD)
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
||||||
audio_stop();
|
audio_stop();
|
||||||
#endif
|
#endif
|
||||||
done = true;
|
|
||||||
keep_playing = true;
|
keep_playing = true;
|
||||||
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef BUTTON_RC_REW
|
||||||
|
case BUTTON_RC_REW:
|
||||||
|
#endif
|
||||||
case BUTTON_LEFT:
|
case BUTTON_LEFT:
|
||||||
|
if(radio_mode == RADIO_SCAN_MODE)
|
||||||
|
{
|
||||||
curr_freq -= FREQ_STEP;
|
curr_freq -= FREQ_STEP;
|
||||||
if(curr_freq < MIN_FREQ)
|
if(curr_freq < MIN_FREQ)
|
||||||
curr_freq = MAX_FREQ;
|
curr_freq = MAX_FREQ;
|
||||||
|
|
||||||
radio_set(RADIO_FREQUENCY, curr_freq);
|
radio_set(RADIO_FREQUENCY, curr_freq);
|
||||||
curr_preset = find_preset(curr_freq);
|
curr_preset = find_preset(curr_freq);
|
||||||
remember_frequency();
|
remember_frequency();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
next_preset(-1);
|
||||||
search_dir = 0;
|
search_dir = 0;
|
||||||
update_screen = true;
|
update_screen = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef BUTTON_RC_FF
|
||||||
|
case BUTTON_RC_FF:
|
||||||
|
#endif
|
||||||
case BUTTON_RIGHT:
|
case BUTTON_RIGHT:
|
||||||
|
if(radio_mode == RADIO_SCAN_MODE)
|
||||||
|
{
|
||||||
curr_freq += FREQ_STEP;
|
curr_freq += FREQ_STEP;
|
||||||
if(curr_freq > MAX_FREQ)
|
if(curr_freq > MAX_FREQ)
|
||||||
curr_freq = MIN_FREQ;
|
curr_freq = MIN_FREQ;
|
||||||
|
|
||||||
radio_set(RADIO_FREQUENCY, curr_freq);
|
radio_set(RADIO_FREQUENCY, curr_freq);
|
||||||
curr_preset = find_preset(curr_freq);
|
curr_preset = find_preset(curr_freq);
|
||||||
remember_frequency();
|
remember_frequency();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
next_preset(1);
|
||||||
search_dir = 0;
|
search_dir = 0;
|
||||||
update_screen = true;
|
update_screen = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef BUTTON_RC_REW
|
||||||
|
case BUTTON_RC_REW | BUTTON_REPEAT:
|
||||||
|
#endif
|
||||||
case BUTTON_LEFT | BUTTON_REPEAT:
|
case BUTTON_LEFT | BUTTON_REPEAT:
|
||||||
|
if(radio_mode == RADIO_SCAN_MODE)
|
||||||
search_dir = -1;
|
search_dir = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef BUTTON_RC_FF
|
||||||
|
case BUTTON_RC_FF | BUTTON_REPEAT:
|
||||||
|
#endif
|
||||||
case BUTTON_RIGHT | BUTTON_REPEAT:
|
case BUTTON_RIGHT | BUTTON_REPEAT:
|
||||||
|
if(radio_mode == RADIO_SCAN_MODE)
|
||||||
search_dir = 1;
|
search_dir = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef BUTTON_RC_VOL_UP
|
||||||
|
case BUTTON_RC_VOL_UP:
|
||||||
|
case BUTTON_RC_VOL_UP | BUTTON_REPEAT:
|
||||||
|
#endif
|
||||||
case BUTTON_UP:
|
case BUTTON_UP:
|
||||||
case BUTTON_UP | BUTTON_REPEAT:
|
case BUTTON_UP | BUTTON_REPEAT:
|
||||||
global_settings.volume++;
|
global_settings.volume++;
|
||||||
|
|
@ -415,6 +549,10 @@ bool radio_screen(void)
|
||||||
settings_save();
|
settings_save();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef BUTTON_RC_VOL_DOWN
|
||||||
|
case BUTTON_RC_VOL_DOWN:
|
||||||
|
case BUTTON_RC_VOL_DOWN | BUTTON_REPEAT:
|
||||||
|
#endif
|
||||||
case BUTTON_DOWN:
|
case BUTTON_DOWN:
|
||||||
case BUTTON_DOWN | BUTTON_REPEAT:
|
case BUTTON_DOWN | BUTTON_REPEAT:
|
||||||
global_settings.volume--;
|
global_settings.volume--;
|
||||||
|
|
@ -425,12 +563,46 @@ bool radio_screen(void)
|
||||||
settings_save();
|
settings_save();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef FM_PLAY
|
||||||
|
#ifdef FM_RC_PLAY
|
||||||
|
case FM_RC_PLAY:
|
||||||
|
#endif
|
||||||
|
case FM_PLAY:
|
||||||
|
#ifdef FM_PLAY_PRE
|
||||||
|
if(lastbutton != FM_PLAY_PRE
|
||||||
|
#ifdef FM_RC_PLAY_PRE
|
||||||
|
&& lastbutton != FM_RC_PLAY_PRE
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
if(radio_get_status() != FMRADIO_PLAYING)
|
||||||
|
{
|
||||||
|
radio_set(RADIO_SLEEP, 0);
|
||||||
|
radio_set(RADIO_FREQUENCY, curr_freq);
|
||||||
|
radio_set(RADIO_MUTE, 0);
|
||||||
|
radio_set_status(FMRADIO_PLAYING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
radio_set(RADIO_MUTE, 1);
|
||||||
|
radio_set(RADIO_SLEEP, 1);
|
||||||
|
radio_set_status(FMRADIO_POWERED);
|
||||||
|
}
|
||||||
|
update_screen = true;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#ifdef FM_MENU
|
#ifdef FM_MENU
|
||||||
|
#ifdef FM_RC_MENU
|
||||||
|
case FM_RC_MENU:
|
||||||
|
#endif
|
||||||
case FM_MENU:
|
case FM_MENU:
|
||||||
radio_menu();
|
radio_menu();
|
||||||
curr_preset = find_preset(curr_freq);
|
curr_preset = find_preset(curr_freq);
|
||||||
lcd_clear_display();
|
FOR_NB_SCREENS(i){
|
||||||
lcd_setmargins(0, 8);
|
gui_textarea_clear(&screens[i]);
|
||||||
|
screen_set_xmargin(&screens[i],0);
|
||||||
|
}
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
buttonbar_set(str(LANG_BUTTONBAR_MENU),
|
buttonbar_set(str(LANG_BUTTONBAR_MENU),
|
||||||
str(LANG_FM_BUTTONBAR_PRESETS),
|
str(LANG_FM_BUTTONBAR_PRESETS),
|
||||||
|
|
@ -440,12 +612,25 @@ bool radio_screen(void)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FM_RC_PRESET
|
||||||
|
case FM_RC_PRESET:
|
||||||
|
#endif
|
||||||
#ifdef FM_PRESET
|
#ifdef FM_PRESET
|
||||||
case FM_PRESET:
|
case FM_PRESET:
|
||||||
|
#ifdef FM_PRESET_PRE
|
||||||
|
if(lastbutton != FM_PRESET_PRE
|
||||||
|
#ifdef FM_RC_PRESET_PRE
|
||||||
|
&& lastbutton != FM_RC_PRESET_PRE
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
handle_radio_presets();
|
handle_radio_presets();
|
||||||
curr_preset = find_preset(curr_freq);
|
curr_preset = find_preset(curr_freq);
|
||||||
lcd_clear_display();
|
FOR_NB_SCREENS(i){
|
||||||
lcd_setmargins(0, 8);
|
gui_textarea_clear(&screens[i]);
|
||||||
|
screen_set_xmargin(&screens[i],0);
|
||||||
|
}
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
buttonbar_set(str(LANG_BUTTONBAR_MENU),
|
buttonbar_set(str(LANG_BUTTONBAR_MENU),
|
||||||
str(LANG_FM_BUTTONBAR_PRESETS),
|
str(LANG_FM_BUTTONBAR_PRESETS),
|
||||||
|
|
@ -459,8 +644,7 @@ bool radio_screen(void)
|
||||||
case FM_FREEZE:
|
case FM_FREEZE:
|
||||||
if(!screen_freeze)
|
if(!screen_freeze)
|
||||||
{
|
{
|
||||||
splash(0, true, "Screen frozen");
|
gui_syncsplash(HZ, true, str(LANG_FM_FREEZE));
|
||||||
lcd_update();
|
|
||||||
screen_freeze = true;
|
screen_freeze = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -481,6 +665,40 @@ bool radio_screen(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef FM_RC_MODE
|
||||||
|
case FM_RC_MODE:
|
||||||
|
#endif
|
||||||
|
#ifdef FM_MODE
|
||||||
|
case FM_MODE:
|
||||||
|
if(lastbutton != FM_MODE
|
||||||
|
#ifdef FM_RC_MODE
|
||||||
|
&& lastbutton != FM_RC_MODE
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(radio_mode == RADIO_SCAN_MODE)
|
||||||
|
radio_mode = RADIO_PRESET_MODE;
|
||||||
|
else
|
||||||
|
radio_mode = RADIO_SCAN_MODE;
|
||||||
|
update_screen = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef FM_NEXT_PRESET
|
||||||
|
case FM_NEXT_PRESET:
|
||||||
|
next_preset(1);
|
||||||
|
search_dir = 0;
|
||||||
|
update_screen = true;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef FM_PREV_PRESET
|
||||||
|
case FM_PREV_PRESET:
|
||||||
|
next_preset(-1);
|
||||||
|
search_dir = 0;
|
||||||
|
update_screen = true;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
default_event_handler(button);
|
default_event_handler(button);
|
||||||
break;
|
break;
|
||||||
|
|
@ -493,13 +711,12 @@ bool radio_screen(void)
|
||||||
|
|
||||||
if(!screen_freeze)
|
if(!screen_freeze)
|
||||||
{
|
{
|
||||||
lcd_setmargins(0, 8);
|
|
||||||
|
|
||||||
/* Only display the peak meter when not recording */
|
/* Only display the peak meter when not recording */
|
||||||
if(!audio_status())
|
if(!audio_status())
|
||||||
{
|
{
|
||||||
peak_meter_draw(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh);
|
/* just main screen for the time being */
|
||||||
lcd_update_rect(0, 8 + fh*(top_of_screen + 3), LCD_WIDTH, fh);
|
peak_meter_draw(0, STATUSBAR_HEIGHT + fh*(top_of_screen + 4), LCD_WIDTH, fh);
|
||||||
|
screens[SCREEN_MAIN].update_rect(0, STATUSBAR_HEIGHT + fh*(top_of_screen + 4), screens[SCREEN_MAIN].width, fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(TIME_AFTER(current_tick, timeout))
|
if(TIME_AFTER(current_tick, timeout))
|
||||||
|
|
@ -524,28 +741,36 @@ bool radio_screen(void)
|
||||||
{
|
{
|
||||||
last_seconds = seconds;
|
last_seconds = seconds;
|
||||||
|
|
||||||
lcd_setfont(FONT_UI);
|
FOR_NB_SCREENS(i)
|
||||||
|
screens[i].setfont(FONT_UI);
|
||||||
|
|
||||||
if (curr_preset >= 0 )
|
if (curr_preset >= 0 )
|
||||||
{
|
snprintf(buf, 128, "%d. %s",curr_preset + 1,
|
||||||
lcd_puts_scroll(0, top_of_screen,
|
|
||||||
presets[curr_preset].name);
|
presets[curr_preset].name);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
snprintf(buf, 128, " ");
|
||||||
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
FOR_NB_SCREENS(i)
|
||||||
lcd_fillrect(0, 8 + top_of_screen*fh, LCD_WIDTH, fh);
|
screens[i].puts_scroll(0, top_of_screen, buf);
|
||||||
lcd_set_drawmode(DRMODE_SOLID);
|
|
||||||
}
|
|
||||||
|
|
||||||
freq = curr_freq / 100000;
|
freq = curr_freq / 100000;
|
||||||
snprintf(buf, 128, str(LANG_FM_STATION), freq / 10, freq % 10);
|
snprintf(buf, 128, str(LANG_FM_STATION), freq / 10, freq % 10);
|
||||||
lcd_puts(0, top_of_screen + 1, buf);
|
FOR_NB_SCREENS(i)
|
||||||
|
screens[i].puts_scroll(0, top_of_screen + 1, buf);
|
||||||
|
|
||||||
snprintf(buf, 128,
|
strcat(buf, stereo?str(LANG_CHANNEL_STEREO):
|
||||||
stereo?str(LANG_CHANNEL_STEREO):
|
|
||||||
str(LANG_CHANNEL_MONO));
|
str(LANG_CHANNEL_MONO));
|
||||||
lcd_puts(0, top_of_screen + 2, buf);
|
|
||||||
|
snprintf(buf, 128, stereo?str(LANG_CHANNEL_STEREO):
|
||||||
|
str(LANG_CHANNEL_MONO));
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
screens[i].puts_scroll(0, top_of_screen + 2, buf);
|
||||||
|
|
||||||
|
#ifdef FM_MODE
|
||||||
|
snprintf(buf, 128, radio_mode?str(LANG_RADIO_PRESET_MODE):
|
||||||
|
str(LANG_RADIO_SCAN_MODE));
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
screens[i].puts_scroll(0, top_of_screen + 3, buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(audio_status() == AUDIO_STATUS_RECORD)
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
|
|
@ -554,7 +779,8 @@ bool radio_screen(void)
|
||||||
snprintf(buf, 32, "%s %02d:%02d:%02d",
|
snprintf(buf, 32, "%s %02d:%02d:%02d",
|
||||||
str(LANG_RECORDING_TIME),
|
str(LANG_RECORDING_TIME),
|
||||||
hours, minutes, seconds%60);
|
hours, minutes, seconds%60);
|
||||||
lcd_puts(0, top_of_screen + 3, buf);
|
FOR_NB_SCREENS(i)
|
||||||
|
screens[i].puts_scroll(0, top_of_screen + 4, buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -562,17 +788,19 @@ bool radio_screen(void)
|
||||||
{
|
{
|
||||||
snprintf(buf, 32, "%s %02d",
|
snprintf(buf, 32, "%s %02d",
|
||||||
str(LANG_RECORD_PRERECORD), seconds%60);
|
str(LANG_RECORD_PRERECORD), seconds%60);
|
||||||
lcd_puts(0, top_of_screen + 3, buf);
|
FOR_NB_SCREENS(i)
|
||||||
|
screens[i].puts_scroll(0, top_of_screen + 4, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
buttonbar_draw();
|
buttonbar_draw();
|
||||||
#endif
|
#endif
|
||||||
lcd_update();
|
FOR_NB_SCREENS(i)
|
||||||
|
gui_textarea_update(&screens[i]);
|
||||||
}
|
}
|
||||||
/* Only force the redraw if update_screen is true */
|
/* Only force the redraw if update_screen is true */
|
||||||
status_draw(update_screen);
|
gui_syncstatusbar_draw(&statusbars,true);
|
||||||
|
|
||||||
update_screen = false;
|
update_screen = false;
|
||||||
}
|
}
|
||||||
|
|
@ -587,8 +815,9 @@ bool radio_screen(void)
|
||||||
if(audio_status() & AUDIO_STATUS_ERROR)
|
if(audio_status() & AUDIO_STATUS_ERROR)
|
||||||
{
|
{
|
||||||
splash(0, true, str(LANG_DISK_FULL));
|
splash(0, true, str(LANG_DISK_FULL));
|
||||||
status_draw(true);
|
gui_syncstatusbar_draw(&statusbars,true);
|
||||||
lcd_update();
|
FOR_NB_SCREENS(i)
|
||||||
|
gui_textarea_update(&screens[i]);
|
||||||
audio_error_clear();
|
audio_error_clear();
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
|
|
@ -627,6 +856,9 @@ bool radio_screen(void)
|
||||||
|
|
||||||
cpu_idle_mode(false);
|
cpu_idle_mode(false);
|
||||||
|
|
||||||
|
/* restore status bar settings */
|
||||||
|
global_settings.statusbar = statusbar;
|
||||||
|
|
||||||
return have_recorded;
|
return have_recorded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -817,12 +1049,14 @@ int handle_radio_presets_cb(int key, int m)
|
||||||
key = BUTTON_NONE;
|
key = BUTTON_NONE;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if CONFIG_KEYPAD != IRIVER_H100_PAD
|
||||||
#ifdef FM_PRESET
|
#ifdef FM_PRESET
|
||||||
case FM_PRESET:
|
case FM_PRESET:
|
||||||
menu_draw(m);
|
menu_draw(m);
|
||||||
key = MENU_EXIT; /* Fake an exit */
|
key = MENU_EXIT; /* Fake an exit */
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef FM_PRESET_ACTION
|
#ifdef FM_PRESET_ACTION
|
||||||
case FM_PRESET_ACTION:
|
case FM_PRESET_ACTION:
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -950,15 +1184,19 @@ int radio_menu_cb(int key, int m)
|
||||||
(void)m;
|
(void)m;
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_KEYPAD != IRIVER_H100_PAD
|
||||||
#ifdef MENU_ENTER2
|
#ifdef MENU_ENTER2
|
||||||
case MENU_ENTER2:
|
case MENU_ENTER2:
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
case MENU_ENTER:
|
case MENU_ENTER:
|
||||||
key = BUTTON_NONE; /* eat the downpress, next menu reacts on release */
|
key = BUTTON_NONE; /* eat the downpress, next menu reacts on release */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if CONFIG_KEYPAD != IRIVER_H100_PAD
|
||||||
#ifdef MENU_ENTER2
|
#ifdef MENU_ENTER2
|
||||||
case MENU_ENTER2 | BUTTON_REL:
|
case MENU_ENTER2 | BUTTON_REL:
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
case MENU_ENTER | BUTTON_REL:
|
case MENU_ENTER | BUTTON_REL:
|
||||||
key = MENU_ENTER; /* fake downpress, next menu doesn't like release */
|
key = MENU_ENTER; /* fake downpress, next menu doesn't like release */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue