radio_new_ui.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:59k
- /* note: this program is for self tuned radio MV114, MV014, MV011 */
- /* PLL IC: LC72131, TUNER IC: LA1844 */
- /* state=FM AM mode */
- #include "regmap.h"
- #include "global.h"
- #include "func.h"
- #include "radio_mv114_kst.h"
- #include "radio_rds.h"
- #include "ircode.h"
- #include "osd.h"
- #include "dsp3_if.h"
- #include "set.h"
- #include "audctrl.h"
- #include "util.h"
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- #include "setup_def.h"
- #endif
- extern UINT16 check_sum(BYTE *data,BYTE len);
- #define NEW_AUTO_SEARCH_ALL
- #define TUNER_DBG
- /*
- #ifdef SUPPORT_TUNER_DBG
- #define TUNER_DBG
- #endif
- */
- /*
- #ifndef DVDRELEASE
- #define TUNER_DBG
- #endif
- #ifndef TUNER_DBG
- #undef printf
- #undef print_block
- #define printf(f, a...) do {} while (0)
- #define print_block(x,y) do {} while (0)
- #endif
- */
- #ifndef SUPPORT_OSD
- #undef PrintOsdMsg(x,y,z,w)
- #define PrintOsdMsg(x,y,z,w)
- #endif
- /*
- * declare extern function
- */
- extern void init_ir_num(void);
- extern void polling_vfdr(void);
- /*from lc72131.c*/
- extern void tuner_mute( BYTE );
- extern void set_band(BYTE);
- extern void set_mono_stereo(BYTE);
- extern void set_station(BYTE i);
- extern BYTE is_station();
- extern void init_tuner();
- extern BYTE test_tuner();
- extern void set_freq(UINT16 freq);
- extern BYTE is_stereo(void);
- BYTE search_station=0;
- static BYTE search_dir=0;
- BYTE write2mem=0;
- extern int rep_ir_times;
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- // color setup
- #define SBGCOLOR 11 //bule
- BYTE rds_radio_flag=0;
- BYTE radio_down_flag=0;
- BYTE radio_right_flag=0;
- BYTE am_radio_right_flag=0;
- extern BYTE prologic_val;
- #endif
- #include ".\Customers\Sunplus\vfd_gbmsample_l.h"
- #include "vfdfunc.h"
- extern void vfd_set_str();
- /*/////////////////////////
- Creator: xyy 2004-3-12
- Function:Auto search all station and save the station to e2prom
- //////////////////////////*/
- #ifndef NEW_AUTO_SEARCH_ALL
- void auto_search_all()
- {
- int i=0;
- search_dir = 1;
- if(tuner.bandswitch)//am
- {
- tuner.ambak=AM_FREQ_MIN+0x30;
- while(1)
- {
- if(tuner.ambak == AM_FREQ_MIN)
- {
- i = 0;
- search_station = 0;
- save_tuner_E2PROM();
- tuner.am_ch = 1;
- set_station(tuner.am_ch);
- break;
- }
- Amautosearch(AUTOSEARCHUP);
-
- if(search_station==1)
- {
- tuner.amfreq[i] = tuner.ambak;
- i++;
- //save station
- search_station = 0;
- search_dir = 1;
- }
- }
- }
- else //fm*/
- {
- tuner.fmbak=FM_FREQ_MIN+1;
- while(1)
- {
- if(tuner.fmbak == FM_FREQ_MIN)
- {
- i = 0;
- search_station = 0;
- save_tuner_E2PROM();
- tuner.fm_ch = 1;
- set_station(tuner.fm_ch);
- break;
- }
- Fmautosearch(AUTOSEARCHUP);
-
- if(search_station==1)
- {
- tuner.fmfreq[i] = tuner.fmbak;
- i++;
- //save station
- search_station = 0;
- search_dir = 1;
- }
- }
- }
- }
- #endif//NEW_AUTO_SEARCH_ALL
- #ifdef NEW_AUTO_SEARCH_ALL
- void auto_search_all_am()
- {
- BYTE ch;
- if(tuner.bandswitch == 0)
- {
- tuner.bandswitch=(!tuner.bandswitch);
- set_band(tuner.bandswitch);
- }
- //now is am
- tuner.ambak = AM_FREQ_MIN;
- tuner.am_ch = 0;
- for(ch = 0;ch < MAX_MEM_BAND;ch++)
- {
-
- while(1)
- {
- tuner.ambak = (tuner.ambak + 0x30); // 3*3k step
- if(tuner.ambak>AM_FREQ_MAX) //am max
- {
- break;
- }
-
- tuner.amfreq[tuner.am_ch] = tuner.ambak;
- disfreq();
-
- if(is_station())
- {
- break;
- }
- }
- if(tuner.ambak>AM_FREQ_MAX) //am max
- {
- break;
- }
- if(tuner.am_ch < (MAX_MEM_BAND-1))
- tuner.am_ch++;
- else
- tuner.am_ch = 0;
- }
- }
- void auto_search_all_fm()
- {
- BYTE ch;
- if(tuner.bandswitch == 1)
- {
- tuner.bandswitch=(!tuner.bandswitch);
- set_band(tuner.bandswitch);
- }
- //now is fm
- tuner.fmbak = FM_FREQ_MIN;
- tuner.fm_ch = 0;
- tuner.bandswitch = 0;//fm
- for(ch = 0;ch < MAX_MEM_BAND;ch++)
- {
-
- while(1)
- {
- tuner.fmbak=(tuner.fmbak+1); // 100K STEP, ref clock: 25k
- if(tuner.fmbak>FM_FREQ_MAX) //fm max 107.8MHZ
- {
- break;
- }
- tuner.fmfreq[tuner.fm_ch] =tuner.fmbak ;
- disfreq();
- if(is_station())
- break;
- }
- if(tuner.fmbak >FM_FREQ_MAX) //fm max 107.8MHZ
- {
- break;
- }
-
- if(tuner.fm_ch < (MAX_MEM_BAND-1))
- tuner.fm_ch++;
- else
- tuner.fm_ch = 0;
- }
- }
- #endif//NEW_AUTO_SEARCH_ALL
- /*
- char *capitalise(char *p)
- mode==0
- ----translate lowercase into capital
- mode==1
- ----translate capital into lowercase
- len ??????
- */
- void capitalize(char *p,BYTE mode,BYTE len)
- {
- while(len)
- {
- if(*p>='a'&&*p<='z')
- {
- if(mode)
- *p+=0x20;
- else
- *p-=0x20;
- }
- p++;
- len--;
- }
- }
- void str_filter(char *p,BYTE len)
- {
- //capitalize(p,len);
- while(len)
- {
- if(*p>='A'&&*p<='Z')
- {
- }
- else if((*p == '-')||(*p == ':'))
- {
- }
- else if(*p>='0'&&*p<='9')
- {
- }
- else
- {
- *p = ' ';
- }
- p++;
- len--;
- }
-
- }
- #ifdef XINGQIU_DVD_RECEIVER//xyy 2004-5-24 9:06
- void tuner_key(BYTE key)
- {
- static BYTE enter_flag=0;
- //return;
- switch(key)
- {
-
- /* case IRC_0:
- case IRC_1:
- printf("======== hello hello =======n");
- tuner_oper_mode = RECALL_OR_STORE;
- break;*/
- case IRC_MUTE:
- {
- int id;
- //rds_decoder_init();
- //return;
- //printf("size of :%dn",sizeof(tuner));
- user_mute=!user_mute;
- tuner_mute(user_mute);
-
- if(user_mute)
- {
- id=STR_OS_MUTE;
- PrintOsdMsg(id,REGION1,0,0);
- }
- else
- // id=STR_OS_SPACE;
- OSD_OnOffRegion(OSD_OFF,1);//xyy 2003-10-13 17:15
- break;
- }
-
- case IRC_GOTO:
- tuner_oper_mode = AUTO_SEARCH;
- timeout_vfd = 0;
- if(tuner.bandswitch == 1)
- {
- auto_search_all_am();
- tuner.am_ch = 0;
- set_station(tuner.am_ch);
- }
- else
- {
- auto_search_all_fm();
- tuner.fm_ch = 0;
- set_station(tuner.fm_ch);
- }
- save_tuner_E2PROM();
- tuner_oper_mode = NORMAL_TUNE;
- disfreq();
- break;
-
- case IRC_SETUP:
- search_station = 1;
- tuner_oper_mode = RECALL_OR_STORE;
- timeout_vfd = 6000;
- break;
-
- case IRC_AUD_LANGUAGE:
- if(!tuner.bandswitch)
- {
- tuner_st_mono();
- timeout_vfd = 4000;
- }
- break;
- case IRC_CLEAR:
- printf("====== clear ======n");
- break;
-
- case IRC_TITLEMENU:
- tuner_oper_mode = FREQ_DIRECT_CALL;
- timeout_vfd = 6000;
- erase_vfd_mem();
- if(tuner.bandswitch)
- {
- station_input_index = 1;
- psprintf(linebuf,"%02d 0000",tuner.am_ch);
- }
- else
- {
- psprintf(linebuf,"%02d 00000",tuner.fm_ch);
- vfd_set_dot(0x49);
- }
- vfd_set_str(0,0,0,linebuf);
- break;
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 13:54
- case IRC_SELECT:
- if(enter_flag == 0)
- {
- erase_vfd_mem();
- if(psReadyFlag == 0x0f)
- {
- rds_func_flag = PS_FUNC;
- psprintf(RegionValStr[REGION1],"PS : %s",programServiceBuf);
- PrintOsdMsg(0, REGION1, 0, 1);
- }
- else
- {
- //vfd_set_str(0,0,0," NO PS ");
- psprintf(RegionValStr[REGION1],"NO PS");
- PrintOsdMsg(0, REGION1, 0, 1);
- rds_func_flag = 0;
- }
- enter_flag++;
- }
- else if(enter_flag == 1)
- {
- erase_vfd_mem();
- if(ptyReadyFlag == 0xff)
- {
- rds_func_flag = PTY_FUNC;
- //printf( "PTY %s",programTypeBuf);
- //PrintOsdMsg(, y, z, w)
- psprintf(RegionValStr[REGION1],"PYP : %s",programTypeBuf);
- PrintOsdMsg(0, REGION1, 0, 1);
- }
- else
- {
- //vfd_set_str(0,0,0," NO PTY ");
- psprintf(RegionValStr[REGION1],"NO PYP");
- PrintOsdMsg(0, REGION1, 0, 1);
- rds_func_flag = 0;
- }
- enter_flag++;
- }
- else if(enter_flag == 2)
- {
- erase_vfd_mem();
- if((txtBreadyFlag == 0xffff)||(txtAreadyFlag == 0xffff))
- {
- rds_func_flag = RT_FUNC;
- //printf("%sn",radioTextBufA[0]);
- capitalize(radioTextBufA[radio_text_type], 0, 64);
- str_filter(radioTextBufA[radio_text_type], 64);
- //printf("%sn",radioTextBufA[0]);
- psprintf(RegionValStr[REGION1],"RT : %s",radioTextBufA[radio_text_type]);
- PrintOsdMsg(0, REGION1, 0, 1);
- }
- else
- {
- //vfd_set_str(0,0,0," NO RT ");
- psprintf(RegionValStr[REGION1],"NO RT");
- PrintOsdMsg(0, REGION1, 0, 1);
-
- rds_func_flag = 0;
- }
- enter_flag++;
- }
- else if(enter_flag == 3)
- {
- erase_vfd_mem();
- if(ctReadyFlag == 0xff)
- {
- rds_func_flag = CT_FUNC;
- //printf("CT %sn",clocktimeBuf);
- psprintf(RegionValStr[REGION1],"%s",clocktimeBuf);
- PrintOsdMsg(0, REGION1, 0, 1);
-
- }
- else
- {
- //vfd_set_str(0,0,0," NO CT ");
- psprintf(RegionValStr[REGION1],"NO CT");
- PrintOsdMsg(0, REGION1, 0, 1);
-
- rds_func_flag = 0;
- }
- enter_flag++;
- }
- else if(enter_flag == 4)
- {
-
- erase_vfd_mem();
- if(ptynReadyFlag == 0x0f)
- {
- rds_func_flag = PTYN_FUNC;
- capitalize(programTypeNameBuf, 0, 9);
- str_filter(programTypeNameBuf,9);
- psprintf(RegionValStr[REGION1],"PTYN:%s",programTypeNameBuf);
- PrintOsdMsg(0, REGION1, 0, 1);
- }
- else
- {
- //vfd_set_str(0,0,0," NO PTYN ");
- rds_func_flag = 0;
- psprintf(RegionValStr[REGION1],"NO PTYN");
- PrintOsdMsg(0, REGION1, 0, 1);
- }
- enter_flag = 0;
- }
- rdsinfo_dispindex = 0;
- timeout_vfd = 2000;
-
- break;
- #endif
- case IRC_FORWARD:/* auto search up */
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
- tuner_oper_mode = NORMAL_TUNE;
- tuner.Istuning[tuner.bandswitch]=1;
- timeout_vfd = 0;
- // to avoid the noise when enter auto search mode
- tuner_mute_flag = 0;
- search_dir=1;
- break;
- case IRC_BACKWARD: /* auto search down */
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
- // to avoid the noise when enter auto search mode
- tuner_oper_mode = NORMAL_TUNE;
- timeout_vfd = 0;
- tuner_mute_flag = 0;
- search_dir=2;
- break;
- case IRC_LEFT:
- search_dir = 0;
- search(SEARCHDEC);
- break;
- case IRC_RIGHT:
- search_dir = 0;
- search(SEARCHADD);
- break;
- case IRC_PREV:
- //printf("leftn");
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
-
- if(tuner.bandswitch)//am
- {
- if(tuner.am_ch>1)
- tuner.am_ch--;
- else
- tuner.am_ch = 1;
- set_station(tuner.am_ch);
-
- }
- else //fm
- {
- if(tuner.fm_ch>=1)
- tuner.fm_ch--;
- else
- // tuner.fm_ch = 1;
- tuner.fm_ch = 0;
- set_station(tuner.fm_ch);
- }
- write2mem =1;
- break;
- case IRC_NEXT:
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
-
- if(tuner.bandswitch) //am
- {
- if(tuner.am_ch<MAX_MEM_BAND)
- tuner.am_ch++;
- else
- tuner.am_ch = MAX_MEM_BAND;
- set_station(tuner.am_ch);
-
- }
- else //fm
- {
- if(tuner.fm_ch<MAX_MEM_BAND)
- tuner.fm_ch++;
- else
- tuner.fm_ch = MAX_MEM_BAND;
- set_station(tuner.fm_ch);
- }
- write2mem =1;
- break;
- case IRC_RCVR_BAND: /* serach- */
- {
- search_dir=0;
- tuner.bandswitch=(!tuner.bandswitch);
- //printf("bandn");
- set_band(tuner.bandswitch);
- write2mem=1;
- break;
- }
- #ifdef SUPPORT_APOGEE_AMP
- case IRC_VOLUME_UP:
- // ircmd_volume_up();
- // set_volume(1);
- break ;
- case IRC_VOLUME_DN:
- // ircmd_volume_down();
- // set_volume(0);
- break ;
- #endif
- default:
- break;
- }
- }
- #elif defined(ORITRON_DVD_RECEIVER)
- void tuner_key(BYTE key)
- {
- static BYTE enter_flag=0;
- //return;
- switch(key)
- {
-
- case IRC_MUTE:
- {
- int id;
-
- user_mute=!user_mute;
- tuner_mute(user_mute);
-
- if(user_mute)
- {
- id=STR_OS_MUTE;
- PrintOsdMsg(id,REGION1,0,0);
-
- }
- else
-
- OSD_OnOffRegion(OSD_OFF,1);//xyy 2003-10-13 17:15
- break;
- }
-
- case IRC_GOTO:
- tuner_oper_mode = AUTO_SEARCH;
- timeout_vfd = 0;
- if(tuner.bandswitch == 1)
- {
- auto_search_all_am();
- tuner.am_ch = 0;
- set_station(tuner.am_ch);
- }
- else
- {
- auto_search_all_fm();
- tuner.fm_ch = 0;
- set_station(tuner.fm_ch);
- }
- save_tuner_E2PROM();
- tuner_oper_mode = NORMAL_TUNE;
- disfreq();
- break;
-
- case IRC_SETUP:
- search_station = 1;
- tuner_oper_mode = RECALL_OR_STORE;
- timeout_vfd = 6000;
- break;
-
- case IRC_AUD_LANGUAGE:
- if(!tuner.bandswitch)
- {
- tuner_st_mono();
- timeout_vfd = 4000;
- }
- break;
-
- case IRC_FORWARD:/* auto search up */
- tuner_oper_mode = NORMAL_TUNE;
- tuner.Istuning[tuner.bandswitch]=1;
- timeout_vfd = 0;
- // to avoid the noise when enter auto search mode
- tuner_mute_flag = 0;
- search_dir=1;
- break;
- case IRC_BACKWARD: /* auto search down */
- // to avoid the noise when enter auto search mode
- tuner_oper_mode = NORMAL_TUNE;
- timeout_vfd = 0;
- tuner_mute_flag = 0;
- search_dir=2;
- break;
- case IRC_LEFT:
- search_dir = 0;
- search(SEARCHDEC);
- break;
- case IRC_RIGHT:
- search_dir = 0;
- search(SEARCHADD);
- break;
- case IRC_PREV:
- //printf("leftn");
- if(tuner.bandswitch)//am
- {
- if(tuner.am_ch>1)
- tuner.am_ch--;
- else
- tuner.am_ch = 1;
- set_station(tuner.am_ch);
-
- }
- else //fm
- {
- if(tuner.fm_ch>=1)
- tuner.fm_ch--;
- else
- // tuner.fm_ch = 1;
- tuner.fm_ch = 0;
- set_station(tuner.fm_ch);
- }
- write2mem =1;
- break;
- case IRC_NEXT:
-
- if(tuner.bandswitch) //am
- {
- if(tuner.am_ch<MAX_MEM_BAND)
- tuner.am_ch++;
- else
- tuner.am_ch = MAX_MEM_BAND;
- set_station(tuner.am_ch);
-
- }
- else //fm
- {
- if(tuner.fm_ch<MAX_MEM_BAND)
- tuner.fm_ch++;
- else
- tuner.fm_ch = MAX_MEM_BAND;
- set_station(tuner.fm_ch);
- }
- write2mem =1;
- break;
- case IRC_RCVR_BAND: /* serach- */
- {
- search_dir=0;
- tuner.bandswitch=(!tuner.bandswitch);
- //printf("bandn");
- set_band(tuner.bandswitch);
- write2mem=1;
- break;
- }
- default:
- break;
- }
- }
- #elif defined(SUPPORT_Radio_NEW_UI) //wuzhj add for new ui 2004/12/10
- void tuner_key(BYTE key) //wuzhj 2004/12/10
- {
- static BYTE enter_flag=0;
- //return;
- switch(key)
- {
- case IRC_MUTE:
- {
- user_mute=!user_mute;
- tuner_mute(user_mute);
-
- if(user_mute)
- {
- psprintf(RegionValStr[1]," MUTE ");
- osd_DrawString(SETUP_SUB_XSTART+8, SETUP_MENU_YSTART-2, RegionValStr[1], SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(416, 4, 100, 26, 4);
- if(tuner.st_mono == 1)
- {
- psprintf(RegionValStr[1]," ST ");
- }
- else
- {
- psprintf(RegionValStr[1]," MONO ");
- }
-
- osd_DrawString(SETUP_SUB_XSTART+8, SETUP_MENU_YSTART-2, RegionValStr[1], SFONTCOLOR, SBGCOLOR);
- }
- break;
- }
-
- case IRC_SELECT:
-
- if(rds_radio_flag==0)
- {
- if(tuner.bandswitch) //am
- {
- if(am_radio_right_flag==0)
- {
-
- tuner.am_ch=radio_down_flag;
- set_station(tuner.am_ch);
- write2mem =1;
- disfreq();
- }
- else
- {
- tuner.am_ch=radio_down_flag+10;
- set_station(tuner.am_ch);
- write2mem =1;
- disfreq();
- }
-
- }
- else //fm
- {
- if(radio_right_flag==0)
- {
-
- tuner.fm_ch=radio_down_flag;
- set_station(tuner.fm_ch);
- write2mem =1;
- disfreq();
- }
- else
- {
- tuner.fm_ch=radio_down_flag+10;
- set_station(tuner.fm_ch);
- write2mem =1;
- disfreq();
- }
- }
- }
- break;
- case IRC_UP:
-
- if(rds_radio_flag==0)
- {
- if(radio_down_flag <= 0)
- {
- radio_down_flag = 9;
- }
- else
- {
- radio_down_flag--;
- }
- //osd_init_Radio();
- DrawRadioup(radio_down_flag,radio_right_flag,am_radio_right_flag);
- }
- break;
-
- case IRC_DOWN:
-
- if(rds_radio_flag==0)
- {
- if(radio_down_flag >= 9)
- {
- radio_down_flag = 0;
- }
- else
- {
- radio_down_flag++;
- }
- //osd_init_Radio();
- DrawRadiodown(radio_down_flag,radio_right_flag,am_radio_right_flag);
- }
- break;
-
- case IRC_LEFT:
- if(rds_radio_flag==0)
- {
- if(tuner.bandswitch)
- {
- am_radio_right_flag=0;
- DrawRadiodown(radio_down_flag,radio_right_flag,am_radio_right_flag);
- }
- else
- {
- radio_right_flag=0;
- DrawRadiodown(radio_down_flag,radio_right_flag,am_radio_right_flag);
- }
- }
- break;
- case IRC_RIGHT:
- if(rds_radio_flag==0)
- {
- if(tuner.bandswitch)
- {
- am_radio_right_flag=1;
- DrawRadiodown(radio_down_flag,radio_right_flag,am_radio_right_flag);
- }
- else
- {
- radio_right_flag=1;
- DrawRadiodown(radio_down_flag,radio_right_flag,am_radio_right_flag);
- }
- }
- break;
- case IRC_FORMAT:
- if(tuner.st_mono == 1)
- {
- tuner.st_mono = 0;
- }
- else
- {
- tuner.st_mono = 1;
- }
- tuner_st_mono();
- break;
-
- case IRC_ZOOM: /* serach- */
- {
- search_dir=0;
- tuner.bandswitch=(!tuner.bandswitch);
- //printf("bandn");
- set_band(tuner.bandswitch);
- write2mem=1;
- osd_init_Radio_fm();
- disfreq();
- break;
- }
- case IRC_PROGRAM:
- #ifndef NEW_AUTO_SEARCH_ALL
- auto_search_all();
- #else
- // osd_init_Radio_fm();
- auto_search_all_am();
- auto_search_all_fm();
- //write2mem=1;
- tuner.fm_ch = 0;
- set_station(tuner.fm_ch); //goto the 1st station
- #endif //NEW_AUTO_SEARCH_ALL
- break;
- #ifdef SUPPORT_APOGEE_AMP
- case IRC_VOLUME_UP:
- Radio_vol_up();
- //subvol_time_out = 10;
- osd_draw_rect(416, 35, 132, 26, 11);
- osd_DrawString(SETUP_SUB_XSTART+8, SETUP_MENU_YSTART-1, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- // ircmd_volume_up();
- // set_volume(1);
- break ;
- case IRC_VOLUME_DN:
- Radio_vol_down();
- osd_draw_rect(416, 35, 132, 26, 11);
- //subvol_time_out = 10;
- osd_DrawString(SETUP_SUB_XSTART+8, SETUP_MENU_YSTART-1, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- // ircmd_volume_down();
- // set_volume(0);
- break ;
- #endif
- case IRC_PROLOGIC:
- {
- BYTE buf[40];
- AudioSetVolume(0); // cmhuang, 2003/8/28 11:58PM
- prologic_val++;
- if(prologic_val>2)
- prologic_val=0;
-
- switch(prologic_val)
- {
- case 0:
- //id=STR_OS_PL_MOVIE;
- psprintf(buf," PROLOGIC:[MOVIE MODE]");
- osd_draw_rect(14, 35, 360, 26, 11);
- osd_DrawString(1, SETUP_MENU_YSTART-1, buf, SFONTCOLOR, SBGCOLOR);
- break;
- case 1:
- //id=STR_OS_PL_MUSIC;
- psprintf(buf," PROLOGIC:[MUSIC MODE]");
- osd_draw_rect(14, 35, 360, 26, 11);
- osd_DrawString(1, SETUP_MENU_YSTART-1, buf, SFONTCOLOR, SBGCOLOR);
- break;
- case 2:
- //id=STR_OS_OFF;
- psprintf(buf," PROLOGIC:[ OFF ] ");
- osd_draw_rect(14, 35, 360, 26, 11);
- osd_DrawString(1, SETUP_MENU_YSTART-1, buf, SFONTCOLOR, SBGCOLOR);
- break;
- }
- //PrintOsdMsg(STR_OS_PROLOGIC|(id<<OSDSTR_ID_TOTL_BIT),REGION1,1,4);
-
-
- set_prologic_val(prologic_val);
- AudioDemute(); // cmhuang, 2003/8/28 11:58PM
- break;
- }
- case IRC_PAUSE:
-
- if(rds_radio_flag==0)
- {
- osd_init_Radio_rds();
- disp_rds_func();
- osd_DrawString(1, SETUP_MENU_YSTART-2, RegionValStr[2], SFONTCOLOR, SBGCOLOR);
- rds_radio_flag=1;
- }
- else
- {
- osd_init_Radio_fm();
- disfreq();
- rds_radio_flag=0;
- }
-
- break;
- case IRC_NEXT:/* auto search down */
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
- {
- tuner.Istuning[tuner.bandswitch]=1;
- if(search_dir&&(rep_ir_times<INC_SPEED_TIMES))
- {
- search_dir=0;
- //tuner_mute( 0 ); //demute when auto search
- tuner_mute_flag = 1; // auto demute after 500ms
- }else
- {
- if(rep_ir_times<INC_SPEED_TIMES)
- {
- #ifdef TUNER_DBG
- //printf("decn");
- #endif
- search(SEARCHDEC);
- }else
- {
- // to avoid the noise when enter auto search mode
- tuner_mute_flag = 0;
- search_dir=2;
- }
- }
- break;
- }
- case IRC_PREV:/* auto search up */
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
- {
- tuner.Istuning[tuner.bandswitch]=1;
- if(search_dir&&(rep_ir_times<INC_SPEED_TIMES))
- {
- search_dir=0;
- //tuner_mute( 0 ); // demute when auto search
- tuner_mute_flag = 1; // auto demute after 500ms
- }else
- {
- if(rep_ir_times<INC_SPEED_TIMES)
- {
- #ifdef TUNER_DBG
- //printf("addn");
- #endif
- search(SEARCHADD);
- }else
- {
- // to avoid the noise when enter auto search mode
- tuner_mute_flag = 0;
- search_dir=1;
- }
- }
- break;
- }
- default:
- break;
- }
- }
- #else
- void tuner_key(BYTE key)
- {
- static BYTE enter_flag=0;
- //return;
- switch(key)
- {
- case IRC_MUTE:
- {
- int id;
- //rds_decoder_init();
- //return;
- //printf("size of :%dn",sizeof(tuner));
- user_mute=!user_mute;
- tuner_mute(user_mute);
-
- if(user_mute)
- {
- id=STR_OS_MUTE;
- PrintOsdMsg(id,REGION1,0,0);
- }
- else
- {
- // id=STR_OS_SPACE;
- OSD_OnOffRegion(OSD_OFF,1);//xyy 2003-10-13 17:15
- }
- break;
- }
- #ifdef SUPPORT_RDS_FUNCTION
- case IRC_SELECT:
-
- if(rds_func_flag >= 4)
- {
- rds_func_flag = 0;
- }
- else
- {
- rds_func_flag++;
- }
- disp_rds_func(rds_func_flag);
- break;
- #endif /*SUPPORT_RDS_FUNCTION*/
- case IRC_UP:/* auto search up */
-
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
- {
- tuner.Istuning[tuner.bandswitch]=1;
- if(search_dir&&(rep_ir_times<INC_SPEED_TIMES))
- {
- search_dir=0;
- //tuner_mute( 0 ); // demute when auto search
- tuner_mute_flag = 1; // auto demute after 500ms
- }else
- {
- if(rep_ir_times<INC_SPEED_TIMES)
- {
- #ifdef TUNER_DBG
- //printf("addn");
- #endif
-
- search(SEARCHADD);
- }else
- {
- // to avoid the noise when enter auto search mode
- tuner_mute_flag = 0;
- search_dir=1;
- }
- }
- break;
- }
- case IRC_DOWN: /* auto search down */
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
- {
- tuner.Istuning[tuner.bandswitch]=1;
- if(search_dir&&(rep_ir_times<INC_SPEED_TIMES))
- {
- search_dir=0;
- //tuner_mute( 0 ); //demute when auto search
- tuner_mute_flag = 1; // auto demute after 500ms
- }else
- {
- if(rep_ir_times<INC_SPEED_TIMES)
- {
- #ifdef TUNER_DBG
- //printf("decn");
- #endif
-
- search(SEARCHDEC);
- }else
- {
- // to avoid the noise when enter auto search mode
- tuner_mute_flag = 0;
- search_dir=2;
- }
- }
- break;
- }
- case IRC_LEFT:
- //printf("leftn");
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
-
- if(tuner.bandswitch)//am
- {
- if(tuner.am_ch>0)
- tuner.am_ch--;
- else
- tuner.am_ch = 0;
- set_station(tuner.am_ch);
-
- }
- else //fm
- {
- if(tuner.fm_ch>0)
- tuner.fm_ch--;
- else
- tuner.fm_ch = 0;
- set_station(tuner.fm_ch);
- }
- write2mem =1;
- disfreq();
- break;
- case IRC_RIGHT:
- #ifdef SUPPORT_RDS_FUNCTION//xyy 2003-12-4 16:18
- rds_clear_var();
- #endif
-
- if(tuner.bandswitch) //am
- {
- if(tuner.am_ch<(MAX_MEM_BAND-1))
- tuner.am_ch++;
- else
- tuner.am_ch = (MAX_MEM_BAND-1);
- set_station(tuner.am_ch);
-
- }
- else //fm
- {
- if(tuner.fm_ch<(MAX_MEM_BAND-1))
- tuner.fm_ch++;
- else
- tuner.fm_ch = (MAX_MEM_BAND-1);
- set_station(tuner.fm_ch);
- }
- write2mem =1;
- disfreq();
- break;
- case IRC_FORMAT:
- tuner_st_mono();
- break;
-
- case IRC_ZOOM: /* serach- */
- {
- search_dir=0;
- tuner.bandswitch=(!tuner.bandswitch);
- //printf("bandn");
- set_band(tuner.bandswitch);
- write2mem=1;
- break;
- }
- case IRC_PROGRAM:
- #ifndef NEW_AUTO_SEARCH_ALL
- auto_search_all();
- #else
- auto_search_all_am();
- auto_search_all_fm();
- tuner.fm_ch = 0;
- set_station(tuner.fm_ch); //goto the 1st station
- #endif //NEW_AUTO_SEARCH_ALL
- break;
- #ifdef SUPPORT_APOGEE_AMP
- case IRC_VOLUME_UP:
- // ircmd_volume_up();
- // set_volume(1);
- break ;
- case IRC_VOLUME_DN:
- // ircmd_volume_down();
- // set_volume(0);
- break ;
- #endif
- default:
- break;
- }
- }
- #endif
- #include "sysmain2_inc.h"
- #include "kernel.h"
- #include "tvif.h"
- //#include "radio_rds.h"//xyy 2003-12-1 13:28
- void tuner_main(void)
- {
- #ifndef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- osd_init();//xyy 2003-9-23 16:36
- #endif
- #ifdef NEW_AUTO_SEARCH_ALL
- //change_system_clock(19);
- #endif
- //disable_video();
- //tv_dacoff(0x3f);
-
- load_tuner_E2PROM();//marked by xyy 2003-9-23 9:01
- tunerflag = 0;
- station_input_index = 0;
- tuner_oper_mode = NORMAL_TUNE;
-
- init_tuner();
-
- if(test_tuner())
- {
- psprintf(RegionValStr[2],"TUNER NOT READY");
- PrintOsdMsg(STR_OS_SPACE,0x2,0,1);
- #ifdef XINGQIU_RECEIVER_PANNEL //xyy 2004-8-5
- vfd_set_str(0,0,0,"NOT READY");
- #endif
- while (system_state != SYSTEM_OPEN)
- {
- polling();
- }
- }
- else //wuzhj 2005/01/18 debug not tuner bug
- {
- erase_vfd_mem();
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- osd_init_Radio(); //wuzhj 2004/12/04
- disfreq();
- ShowRadioTitle(); //wuzhj 2004/12/04
- #else
- disfreq();
-
- #endif
- while (system_state != SYSTEM_OPEN)
- {
- #ifdef SUPPORT_RDS_FUNCTION //xyy
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- //rds display wuzhj 2004/12/06
- if(rds_radio_flag==1)
- {
- rds_collect_data();
- disp_rds();
- }
- #else
- rds_collect_data();
- disp_rds(rds_func_flag);
- #endif
- #endif
- polling();//i=keyscan()
- #if 0
- if(RDS_PS_RDY())
- {
- //printf("ps:%sn",rds_get_ps());
- psprintf(RegionValStr[REGION1],"PS : %s",rds_get_ps());
- PrintOsdMsg(0, REGION1, 1, 1);
- RDS_PS_CLR_RDY();
- }
- #endif
- #ifdef SUPPORT_STEREO_DETECT
- if(is_stereo())
- {
- printf("stereon");
- }
- else
- {
- printf("monon");
- }
- #endif //SUPPORT_STEREO_DETECT
- if(search_dir)
- {
- tuner_auto_search();
- }
-
- if(write2mem)
- {
- write2mem=0;
- tuner.memory_status=MEM_MODE;
- save_tuner_E2PROM();//xyy 2003-9-23 9:02
- //printf("writen");
- }
- }
- }
- }
- void tuner_auto_search( void )
- {
- if( search_dir == 1 ) //auto search up
- {
- if( tuner.bandswitch )//am
- {//am auto search up
- //Amautosearchup();
- Amautosearch( AUTOSEARCHUP );
- } else
- { // fm auto search up
- //Fmautosearchup();
- Fmautosearch( AUTOSEARCHUP );
- }
- } else // search_dir == 2, auto search down
- {
- if( tuner.bandswitch )//am
- { //am auto search down
- //Amautosearchdown();
- Amautosearch( AUTOSEARCHDOWN );
- } else
- {// fm auto search down
- //Fmautosearchdown();
- Fmautosearch( AUTOSEARCHDOWN );
- }
- }
-
- }
- void d_ms(BYTE ms)
- {
- delay_1ms(ms);
- }
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- void disfreq(void)
- {
- if(tuner.bandswitch)
- {
- psprintf(RegionValStr[2]," AM CH:%d %03d KHZ ",tuner.am_ch+1,(tuner.ambak>>4)*3-450); //ITEM number
- if(tuner.am_ch<=9)
- {
- radio_down_flag=tuner.am_ch;
- }
- else
- {
- radio_down_flag=tuner.am_ch-10;
- }
- }
- else
- {
- //int x=tuner.fmbak*5-1070;
- int x = tuner.fmfreq[tuner.fm_ch]*5-1070;
- psprintf(RegionValStr[2]," FM CH:%d %d.%02d MHZ ",tuner.fm_ch+1,x/100,x%100); //ITEM number
- if(tuner.fm_ch<=9)
- {
- radio_down_flag=tuner.fm_ch;
-
- }
- else
- {
- radio_down_flag=tuner.fm_ch-10;
-
- }
- }
-
- // osd_init_Radio();
- ShowRadioMsg();
-
- DrawRadiodown(radio_down_flag,radio_right_flag,am_radio_right_flag);
- vfd_set_power_state(0);
- }
- #else
- void disfreq(void)
- {
- if(tuner.bandswitch)
- {
- psprintf(RegionValStr[2],"AM CH:%d %03d KHZ",tuner.am_ch+1,(tuner.ambak>>4)*3-450); //ITEM number
- }
- else
- {
- //int x=tuner.fmbak*5-1070;
- int x = tuner.fmfreq[tuner.fm_ch]*5-1070;
- psprintf(RegionValStr[2],"FM CH:%d %d.%02d MHZ",tuner.fm_ch+1,x/100,x%100); //ITEM number
- }
- PrintOsdMsg(STR_OS_SPACE,0x2,0,1);
- vfd_set_power_state(0);
- }
- #endif
- void search(BYTE search_status)
- {
- tuner_mute(1);
-
- if(tuner.bandswitch)
- {
- if(search_status==SEARCHADD)
- {
- tuner.ambak=(tuner.ambak+0x30);
- if(tuner.ambak>AM_FREQ_MAX) tuner.ambak=AM_FREQ_MIN;
- }
- else if(search_status==SEARCHDEC)
- {
- tuner.ambak=(tuner.ambak-0x30);
- if(tuner.ambak<AM_FREQ_MIN) tuner.ambak=AM_FREQ_MAX;
- }
- tuner.amfreq[tuner.am_ch] = tuner.ambak;
- set_freq(tuner.ambak);
- }
- else
- {
- if(search_status==SEARCHADD)
- {
- tuner.fmbak=(tuner.fmbak+1);
- if(tuner.fmbak>FM_FREQ_MAX) tuner.fmbak=FM_FREQ_MIN;
- }
- else if(search_status==SEARCHDEC)
- {
- tuner.fmbak=(tuner.fmbak-1);
- if(tuner.fmbak<FM_FREQ_MIN) tuner.fmbak=FM_FREQ_MAX;
- }
- tuner.fmfreq[tuner.fm_ch] = tuner.fmbak;
- set_freq(tuner.fmbak);
- }
- disfreq();
- tuner_mute_flag = 1; // auto demute after 500ms
- output_vfd_msg();
- write2mem = 1;
- }
- void output_vfd_msg(void)
- {
- int i;
-
- polling();
-
- #ifndef NEW_AUTO_SEARCH_ALL
- for(i=0;i<10000;i++)
- #endif
- {
- polling_vfdr();
- //polling_vfd();
- }
- }
- void Fmautosearch( BYTE autosearch_status )
- {
- #ifdef NEW_AUTO_SEARCH_ALL
- psprintf(RegionValStr[1],"AUTO SCAN");
- #ifndef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- PrintOsdMsg(STR_OS_SPACE,0x1,1,1);
- #endif
- #endif
- if(!tuner.bandswitch)
- {
- while(1)
- {
- output_vfd_msg();
- if( autosearch_status == AUTOSEARCHUP )
- {
- if(search_dir!=1) //up
- return;
-
- tuner.fmbak=(tuner.fmbak+1); // 100K STEP, ref clock: 25k
-
- if(tuner.fmbak>FM_FREQ_MAX) //fm max 107.8MHZ
- {
- tuner.fmbak=FM_FREQ_MIN;//87.8Mhz,ref= 25khz
- tuner_mute_flag=1; // auto demute after 500 ms
-
- break;
- }
- }else if( autosearch_status == AUTOSEARCHDOWN )
- {
- if(search_dir!=2) //down
- return;
-
- tuner.fmbak=(tuner.fmbak-1); //gap = 2. 100K STEP
-
-
- if(tuner.fmbak<FM_FREQ_MIN)//fm min
- {
- tuner.fmbak=FM_FREQ_MAX;
- tuner_mute_flag = 1;
- break;
- }
-
- }
- tuner.fmfreq[tuner.fm_ch] = tuner.fmbak;
- disfreq();
- if(is_station())
- {
- write2mem = 1;
- search_station = 1;//xyy 2004-3-12
- #if defined(SUPPORT_STATION_INPUT)//xyy 2004-5-26
- tuner_oper_mode = RECALL_OR_STORE;
- timeout_vfd = 6000;
- #endif
- break;
- }
- }
-
- disfreq();
- }
- search_dir=0;
- }
- void Amautosearch( BYTE autosearch_status )
- {
- #ifdef NEW_AUTO_SEARCH_ALL
- psprintf(RegionValStr[1],"AUTO SCAN");
- #ifndef SUPPORT_Radio_NEW_UI //wuzhj 2004/12/10
- PrintOsdMsg(STR_OS_SPACE,0x1,1,1);
- #endif
- #endif
- if(tuner.bandswitch)//am
- {
- while(1)
- {
- output_vfd_msg();
-
- if( autosearch_status == AUTOSEARCHUP )
- {
- if(search_dir!=1) //up
- return;
-
- tuner.ambak = (tuner.ambak + 0x30); // 3*3k step
-
- if(tuner.ambak>AM_FREQ_MAX) //am max
- {
- tuner.ambak=AM_FREQ_MIN;
- tuner_mute_flag=1; // auto demute after 500 ms
-
- break;
- }
- }else if( autosearch_status == AUTOSEARCHDOWN )
- {
- if(search_dir!=2) //down
- return;
-
- tuner.ambak=(tuner.ambak-0x30); //gap = 3; 3*3K step
-
- if(tuner.ambak<AM_FREQ_MIN)//Am min
- {
- tuner.ambak=AM_FREQ_MAX;
- tuner_mute_flag=1; // auto demute after 500 ms
-
- break;
- }
- }
- tuner.amfreq[tuner.am_ch] = tuner.ambak;
- disfreq();
-
- if(is_station())
- {
- write2mem = 1;
- search_station = 1;
- #if defined(SUPPORT_STATION_INPUT)//xyy 2004-8-5
- tuner_oper_mode = RECALL_OR_STORE;
- timeout_vfd = 6000;
- #endif
- break;
- }
- }
- disfreq();
- }
- search_dir=0;
- }
-
-
-
- void save_tuner_E2PROM(void)
- {
- int test;
- BYTE *p;
-
-
- #ifdef TUNER_DBG
- //printf("!!!run save_tuner_setup ,size:%dn",sizeof(t_tuner));
- #endif
-
- p=(BYTE *)&tuner;
- tuner.checksum = check_sum(p, (sizeof(tuner)-2));
- test=WriteToI2c(0xa0, TUNER_START,p, sizeof(t_tuner));
-
- #ifdef TUNER_DBG
- printf("save checksum %xn",tuner.checksum);
- #endif
- }
- void load_tuner_E2PROM(void)
- {
- int iRts;
- BYTE *p;
-
- //printf("load tuner e2promn");
- p=(BYTE *)&tuner;
- iRts = ReadFromI2c(0xa0, TUNER_START,p, sizeof(t_tuner));
- if(iRts<0)
- {
- init_tuner_var();
- return;
- }
- if(tuner.checksum != check_sum(p, (sizeof(t_tuner)-2)))
- {
- #ifdef TUNER_DBG
- //printf("checksum err! load defaultn");
- #endif
- init_tuner_var();
- save_tuner_E2PROM();
- }
-
- }
- /*****************
- Changed by xyy 2004-5-26
- ******************/
- #if defined(SUPPORT_STATION_INPUT)//xyy 2004-8-5
- void init_tuner_var(void)
- {
- int i;
- printf("init varn");
- for(i=0;i<MAX_MEM_BAND;i++)
- {
- tuner.fmfreq[i]=0x7de;
- tuner.amfreq[i]=0x1470;
- }
- //tuner.memory_band_id[0]=1;
- //tuner.memory_band_id[1]=1;
- tuner.memory_status=NO_MEM_MODE;
- tuner.bandswitch=0; //0:fm, 1:am
- tuner.Istuning[0]=1;
- tuner.Istuning[1]=1;
- tuner.ambak=0x1440;
- tuner.fmbak=0x7b2;
- // tuner.in2_data1=0x00;
- //p = (BYTE *)&tuner;
- //tuner.checksum = check_sum(p,sizeof(tuner));
-
- #ifdef TUNER_DBG
- //report_tuner_info();
- #endif
- }
- #else
- void init_tuner_var(void)
- {
- const UINT16 fmfreq[MAX_MEM_BAND]={0x7de,0x802,0x86c,0x87e,0x91e,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922,0x922};// 90.0 91.8 97.1 98.0 106.0 106.2
- const UINT16 amfreq[MAX_MEM_BAND]={0x1470,0x15f0,0x1e30,0x26a0,0x2ac0,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20,0x2b20};//531 603 999 1404 1602 1620
- int i;
- //BYTE *p;
- printf("init varn");
- for(i=0;i<MAX_MEM_BAND;i++)
- {
- tuner.fmfreq[i]=fmfreq[i];
- tuner.amfreq[i]=amfreq[i];
- }
-
- //tuner.memory_band_id[0]=1;
- //tuner.memory_band_id[1]=1;
- tuner.memory_status=NO_MEM_MODE;
- tuner.bandswitch=0; //0:fm, 1:am
- tuner.Istuning[0]=1;
- tuner.Istuning[1]=1;
- tuner.ambak=0x1440;
- tuner.fmbak=0x7b2;
- // tuner.in2_data1=0x00;
- //p = (BYTE *)&tuner;
- //tuner.checksum = check_sum(p,sizeof(tuner));
-
- #ifdef TUNER_DBG
- //report_tuner_info();
- #endif
- }
- #endif
- #if defined(SUPPORT_STATION_INPUT)
- /**********************
- Changed by xyy 2004-5-24
- **********************/
- void tuner_func_input(void) //xyy 2003-11-3 11:20
- {
- // if(tuner.memory_status==MEM_MODE)
- if(tuner_oper_mode == RECALL_OR_STORE)
- {
- vfd_set_stationNm();
- }
- #if defined(SUPPORT_FREQ_DIRECT_CALL)
- else if(tuner_oper_mode == FREQ_DIRECT_CALL)//xyy 2004-7-28
- {
- if(tuner.bandswitch)
- vfd_set_amFreq_input();
- else
- vfd_set_fmFreq_input();
- }
- #endif
- }
- #endif
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj add for new ui 2004/12/10
- void tuner_st_mono(void)
- {
- if(tuner.st_mono == 1)
- {
- psprintf(RegionValStr[1]," ST ");
- }
- else
- {
- psprintf(RegionValStr[1]," MONO ");
- }
- osd_DrawString(SETUP_SUB_XSTART+8, SETUP_MENU_YSTART-2, RegionValStr[1], SFONTCOLOR, SBGCOLOR);
- set_mono_stereo(tuner.st_mono);
- write2mem=1;
- }
- #else
- void tuner_st_mono(void)
- {
- if(tuner.st_mono == 1)
- {
- tuner.st_mono = 0;
- psprintf(RegionValStr[1],"MONO");
- }
- else
- {
- tuner.st_mono = 1;
- psprintf(RegionValStr[1],"ST");
- }
- PrintOsdMsg(STR_OS_SPACE,0x1,1,1);
- set_mono_stereo(tuner.st_mono);
- write2mem=1;
- }
- #endif
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj add for new ui 2004/12/10
- #ifdef SUPPORT_RDS_FUNCTION
- void disp_rds_func(void)
- {
-
- psprintf(RegionValStr[REGION1],"PS :");
- osd_DrawString(1, SETUP_MENU_YSTART, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
-
- psprintf(RegionValStr[REGION1],"PTY :");
- osd_DrawString(1, SETUP_MENU_YSTART+1, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
-
- psprintf(RegionValStr[REGION1],"RT :");
- osd_DrawString(1, SETUP_MENU_YSTART+2, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
-
-
- psprintf(RegionValStr[REGION1],"CT :");
- osd_DrawString(1, SETUP_MENU_YSTART+3, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- psprintf(RegionValStr[REGION1],"PTYN :");
- osd_DrawString(1, SETUP_MENU_YSTART+4, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
-
- }
- void disp_rds(BYTE enter_flag)
- {
- enter_flag = enter_flag;
- char rds_disp_buf[65];
-
- if(RDS_PS_RDY())
- {
- psprintf(RegionValStr[REGION1],"PS : %s",rds_get_ps());
- osd_DrawString(1, SETUP_MENU_YSTART, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- RDS_PS_CLR_RDY();
- }
-
- if(RDS_PTY_RDY())
- {
- psprintf(RegionValStr[REGION1],"PTY : %s",rds_get_pty());
- osd_DrawString(1, SETUP_MENU_YSTART+1, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- RDS_PTY_CLR_RDY();
- }
-
- if(RDS_RTA_RDY()||RDS_RTB_RDY())
- {
- memcpy(rds_disp_buf,rds_get_rt(RDS_RT_TYPE()),64);
- capitalize(rds_disp_buf, 0, 64);
- str_filter(rds_disp_buf, 64);
- psprintf(RegionValStr[REGION1],"RT : %s",rds_disp_buf);
- osd_DrawString(1, SETUP_MENU_YSTART+2, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- RDS_RTA_CLR_RDY();
- RDS_RTB_CLR_RDY();
- }
-
- if(RDS_CT_RDY())
- {
- psprintf(RegionValStr[REGION1],"%s",rds_get_ct());
- osd_DrawString(1, SETUP_MENU_YSTART+3, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- RDS_CT_CLR_RDY();
- }
- if(RDS_PTYN_RDY())
- {
- psprintf(RegionValStr[REGION1],"PTYN:%s",rds_get_ptyn());
- osd_DrawString(1, SETUP_MENU_YSTART+4, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- RDS_PTYN_CLR_RDY();
- }
-
- }
- #endif /*rds func*/
- #else
- #ifdef SUPPORT_RDS_FUNCTION
- disp_rds_func(BYTE enter_flag)
- {
- printf("flag %dn",enter_flag);
- if(enter_flag == 0)
- {
- psprintf(RegionValStr[REGION1],"PS :");
- PrintOsdMsg(0, REGION1, 1, 1);
- }
-
- else if(enter_flag == 1)
- {
- psprintf(RegionValStr[REGION1],"PTY :");
- PrintOsdMsg(0, REGION1, 1, 1);
- }
-
- else if(enter_flag == 2)
- {
- psprintf(RegionValStr[REGION1],"RT :");
- PrintOsdMsg(0, REGION1, 1, 1);
- }
- else if(enter_flag == 3)
- {
- psprintf(RegionValStr[REGION1],"CT :");
- PrintOsdMsg(0, REGION1, 1, 1);
- }
- else if(enter_flag == 4)
- {
- psprintf(RegionValStr[REGION1],"PTYN :");
- PrintOsdMsg(0, REGION1, 1, 1);
- }
- }
- void disp_rds(BYTE enter_flag)
- {
- char rds_disp_buf[65];
-
- if(enter_flag == 0)
- {
- if(RDS_PS_RDY())
- {
- psprintf(RegionValStr[REGION1],"PS : %s",rds_get_ps());
- PrintOsdMsg(0, REGION1, 1, 1);
- RDS_PS_CLR_RDY();
- }
- }
-
- else if(enter_flag == 1)
- {
- if(RDS_PTY_RDY())
- {
- psprintf(RegionValStr[REGION1],"PTY : %s",rds_get_pty());
- PrintOsdMsg(0, REGION1, 1, 1);
- RDS_PTY_CLR_RDY();
- }
- }
-
- else if(enter_flag == 2)
- {
- if(RDS_RTA_RDY()||RDS_RTB_RDY())
- {
- memcpy(rds_disp_buf,rds_get_rt(RDS_RT_TYPE()),64);
- capitalize(rds_disp_buf, 0, 64);
- str_filter(rds_disp_buf, 64);
- psprintf(RegionValStr[REGION1],"RT : %s",rds_disp_buf);
- PrintOsdMsg(0, REGION1, 1, 1);
- RDS_RTA_CLR_RDY();
- RDS_RTB_CLR_RDY();
- }
- }
- else if(enter_flag == 3)
- {
- if(RDS_CT_RDY())
- {
- psprintf(RegionValStr[REGION1],"%s",rds_get_ct());
- PrintOsdMsg(0, REGION1, 1, 1);
- RDS_CT_CLR_RDY();
- }
- }
- else if(enter_flag == 4)
- {
- if(RDS_PTYN_RDY())
- {
- psprintf(RegionValStr[REGION1],"PTYN:%s",rds_get_ptyn());
- PrintOsdMsg(0, REGION1, 1, 1);
- RDS_PTYN_CLR_RDY();
- }
- }
-
- }
- #endif /*rds func*/
- #endif
- #ifdef SUPPORT_Radio_NEW_UI //wuzhj add for new ui 2004/12/10
- void ShowRadioMsg(void)
- {
- BYTE buf[40];
-
- //Right leve1 wuzhj 2004/11/27
-
-
- int i;
- for (i=0;i<10;i++)
- {
- if(tuner.bandswitch) //show am all frqu
- {
- psprintf(buf,"CH:%d %03d KHZ",(1+i),(tuner.amfreq[i]>>4)*3-450);
- osd_DrawString(1, SETUP_MENU_YSTART+i, buf, SFONTCOLOR, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(11+i),(tuner.amfreq[10+i]>>4)*3-450);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+i, buf, SFONTCOLOR, SBGCOLOR);
- }
- else //show fm all frqu
- {
- // psprintf(linebuf," ");
- //osd_DrawString(1, SETUP_MENU_YSTART, buf, SFONTCOLOR, 12);
-
- int xi = tuner.fmfreq[10+i]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(11+i),xi/100,xi%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+i, buf, SFONTCOLOR, SBGCOLOR);
- int yi = tuner.fmfreq[i]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+i),yi/100,yi%100);
- osd_DrawString(1, SETUP_MENU_YSTART+i, buf, SFONTCOLOR, SBGCOLOR);
- }
- }
-
- // show fm and am frqu
- osd_DrawString(1, SETUP_MENU_YSTART-2, RegionValStr[2], SFONTCOLOR, SBGCOLOR);
- }
- void ShowRadioTitle (void)
- {
- BYTE buf[40];
- //show st and mono
- if(tuner.st_mono == 1)
- {
- psprintf(RegionValStr[1]," MONO ");
- }
- else
- {
- psprintf(RegionValStr[1]," ST ");
- }
- osd_DrawString(SETUP_SUB_XSTART+8, SETUP_MENU_YSTART-2, RegionValStr[1], SFONTCOLOR, SBGCOLOR);
- //show prologic
- switch(prologic_val)
- {
- case 0:
- psprintf(buf," PROLOGIC:[MOVIE MODE]");
- break;
- case 1:
- psprintf(buf," PROLOGIC:[MUSIC MODE]");
- break;
- case 2:
- psprintf(buf," PROLOGIC:[ OFF ] ");
- break;
- }
- osd_draw_rect(14, 35, 360, 26, 11);
- osd_DrawString(1, SETUP_MENU_YSTART-1, buf, SFONTCOLOR, SBGCOLOR);
- //show main vol
- //BYTE volum_list[0];
- Radio_main_vol();
- // psprintf(RegionValStr[REGION1], " MAIN %d",volum_list[0]);
- osd_draw_rect(416, 35, 132, 26, 11);
- osd_DrawString(SETUP_SUB_XSTART+8, SETUP_MENU_YSTART-1, RegionValStr[REGION1], SFONTCOLOR, SBGCOLOR);
- }
- extern BYTE header_id;
- void osd_init_Radio(void)
- {
- UINT16 screen_h,screen_w;
- __osd_init();
- #define RADIO_REGION_WIDTH 8*35
- #define RADIO_REGION_HEIGHT 12*32
- #define SETUP_BGCOLOR 9
- header_id = SETUP_HEADER;
- region[0].osd_w = RADIO_REGION_WIDTH; //35 English Characters
- region[0].osd_h = RADIO_REGION_HEIGHT; //12 lines
- if(TV_FORMAT_PAL==tv_format)
- {
- screen_h=288;
- screen_w=352;
- //screen_h=288;
- //screen_w=352;
- }
- else
- {
- screen_h=240;
- screen_w=360;
- }
- osd_create_region1(®ion[0],(screen_w-RADIO_REGION_WIDTH)/2,(screen_h-RADIO_REGION_HEIGHT/2)/2, NULL, OSD_FORMAT_16COLOR, OSD_INTERLACED);
- //osd_create_region1(®ion[SETUP_REGION], SETUP_REGION_X, SETUP_REGION_Y, NULL, OSD_FORMAT_16COLOR, OSD_INTERLACED);
- osd_draw_rect(0,0,RADIO_REGION_WIDTH<<1,RADIO_REGION_HEIGHT,SETUP_BGCOLOR);
- osd_draw_rect(0, 0, RADIO_REGION_WIDTH<<1, 32, 4);//ONE
- osd_draw_rect(0, 32, RADIO_REGION_WIDTH<<1, 32, 6);//TOW
- // osd_draw_rect(12, 68, 250, 26, 11);
- //osd_draw_rect(282, 68, 250, 26, 11);
- int i;
- for (i=0;i<10;i++)
- {
- osd_draw_rect(14, 68+32*i, 258, 26, 11);
- osd_draw_rect(288, 68+32*i, 258, 26, 11);
- }
- osd_draw_rect(278, 64, 4, 320, 12);//red vertical
- //osd_draw_rect(0, RADIO_REGION_HEIGHT, RADIO_REGION_WIDTH<<1,2, 12);
- // osd_draw_rect(560, SETUP_MENU_YSTART, 2, 560, 12);
- osd_active_regions = 1;
- ENABLE_OSD();
- //for(screen_w=0;screen_w<16;screen_w++)
- // {
- // psprintf(linebuf,"%02d",screen_w);
- // osd_DrawString(screen_w*2+2, 1, linebuf,16-screen_w,screen_w);
- // }
- }
- void osd_init_Radio_fm(void)
- {
- //draw yellow icon
- osd_draw_rect(0,64,8*35<<1,12*32-64,SETUP_BGCOLOR);
- int i;
- for (i=0;i<10;i++)
- {
- osd_draw_rect(14, 68+32*i, 258, 26, 11);
- osd_draw_rect(288, 68+32*i, 258, 26, 11);
- }
- //draw fm and am blue icon
- osd_draw_rect(14, 3, 324, 26, 11);
- //draw red vertical
- osd_draw_rect(278, 64, 4, 320, 12);
- }
- void osd_init_Radio_rds(void)
- {
- osd_draw_rect(278, 64, 4, 320, SETUP_BGCOLOR);
- int i;
- for (i=0;i<9;i++)
- {
- osd_draw_rect(12, 68+32*i, 536, 26, 11);
- // osd_draw_rect(298, 68+32*i, 250, 26, 11);
- }
-
- osd_draw_rect(0, 32*11, (8*35)<<1, 32, 4); //low
-
- }
- void DrawRadiodown(BYTE radio_down_flag,BYTE radio_right_flag,BYTE am_radio_right_flag)
- {
- BYTE buf[40];
- if(tuner.bandswitch) //am ui
- {
- if(am_radio_right_flag==0)//left am ui
- {
- //draw vertical left blue icon
- if(radio_down_flag==0)
- {
- osd_draw_rect(14, 68+32*9, 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",10,(tuner.amfreq[9]>>4)*3-450);
- osd_DrawString(1, SETUP_MENU_YSTART+9, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(14, 68+32*(radio_down_flag-1), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(radio_down_flag),(tuner.amfreq[(radio_down_flag-1)]>>4)*3-450);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag-1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level right blue icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)+10),(tuner.amfreq[(radio_down_flag)+10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
- //draw leve left red icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, 12);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)),(tuner.amfreq[radio_down_flag]>>4)*3-450);
-
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
-
- }
- else //right am ui
- {
- //draw vertical right blue icon
- if(radio_down_flag==0)
- {
- osd_draw_rect(12+276, 68+32*9, 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(10+10),(tuner.amfreq[9+10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+9, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(12+276, 68+32*(radio_down_flag-1), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(radio_down_flag+10),(tuner.amfreq[(radio_down_flag-1)+10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag-1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level left blue icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)),(tuner.amfreq[(radio_down_flag)]>>4)*3-450);
-
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
- //draw level right red icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, 12);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)+10),(tuner.amfreq[(radio_down_flag)+10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
-
- }
- }
- else //fm ui
- {
-
- if(radio_right_flag==0)//left fm ui
- {
- //draw left vertical blue icon
- if(radio_down_flag==0)
- {
- osd_draw_rect(14, 68+32*9, 258, 26, SBGCOLOR);
- int yi = tuner.fmfreq[9]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",10,yi/100,yi%100);
- osd_DrawString(1, SETUP_MENU_YSTART+9, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(14, 68+32*(radio_down_flag-1), 258, 26, SBGCOLOR);
- int yi = tuner.fmfreq[(radio_down_flag-1)]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(radio_down_flag),yi/100,yi%100);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag-1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level right blue icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- int xi = tuner.fmfreq[(radio_down_flag)+10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)+10),xi/100,xi%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
- //draw level left red icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, 12);
- int zi = tuner.fmfreq[(radio_down_flag)]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)),zi/100,zi%100);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
-
- }
- else //right fm ui
- {
- //draw vertical right blue icon
- if(radio_down_flag==0)
- {
- osd_draw_rect(12+276, 68+32*9, 258, 26, SBGCOLOR);
- int yi = tuner.fmfreq[9+10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",10+10,yi/100,yi%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+9, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(12+276, 68+32*(radio_down_flag-1), 258, 26, SBGCOLOR);
- int yi = tuner.fmfreq[(radio_down_flag-1)+10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(radio_down_flag+10),yi/100,yi%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag-1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level left blue icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- int xi = tuner.fmfreq[(radio_down_flag)]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)),xi/100,xi%100);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
- //draw level right red icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, 12);
- int zi = tuner.fmfreq[(radio_down_flag)+10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)+10),zi/100,zi%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
-
- }
- }
- //show fm and am frqu
- osd_DrawString(1, SETUP_MENU_YSTART-2, RegionValStr[2], SFONTCOLOR, SBGCOLOR);
- }
- void DrawRadioup(BYTE radio_down_flag,BYTE radio_right_flag,BYTE am_radio_right_flag)
- {
- BYTE buf[40];
- if(tuner.bandswitch) //am ui
- {
- if(am_radio_right_flag==0)//left am ui
- {
- //draw level left red icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, 12);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)),(tuner.amfreq[radio_down_flag]>>4)*3-450);
-
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
-
- //draw vertical left blue icon
- if(radio_down_flag==9)
- {
- osd_draw_rect(14, 68, 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",1,(tuner.amfreq[0]>>4)*3-450);
- osd_DrawString(1, SETUP_MENU_YSTART, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(14, 68+32*(radio_down_flag+1), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(radio_down_flag+2),(tuner.amfreq[(radio_down_flag+1)]>>4)*3-450);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag+1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level right blue icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)+10),(tuner.amfreq[(radio_down_flag)+10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- else //right am ui
- {
- //draw level right red icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, 12);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)+10),(tuner.amfreq[(radio_down_flag)+10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
- //draw vertical right blue icon
- if(radio_down_flag==9)
- {
- osd_draw_rect(12+276, 68, 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(1+10),(tuner.amfreq[10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(12+276, 68+32*(radio_down_flag+1), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(radio_down_flag+2+10),(tuner.amfreq[(radio_down_flag+1)+10]>>4)*3-450);
-
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag+1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level left blue icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- psprintf(buf,"CH:%d %03d KHZ",(1+(radio_down_flag)),(tuner.amfreq[(radio_down_flag)]>>4)*3-450);
-
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
-
-
- }
- }
- else //fm ui
- {
-
- if(radio_right_flag==0)//left fm ui
- {
- //draw level left red icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, 12);
- int z = tuner.fmfreq[(radio_down_flag)]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)),z/100,z%100);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
- //draw vertical left blue icon
- if(radio_down_flag==9)
- {
- osd_draw_rect(14, 68, 258, 26, SBGCOLOR);
- int y = tuner.fmfreq[0]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",1,y/100,y%100);
- osd_DrawString(1, SETUP_MENU_YSTART, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(14, 68+32*(radio_down_flag+1), 258, 26, SBGCOLOR);
- int y = tuner.fmfreq[(radio_down_flag+1)]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(radio_down_flag+2),y/100,y%100);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag+1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level right blue icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- int x = tuner.fmfreq[(radio_down_flag)+10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)+10),x/100,x%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
-
-
- }
- else //right fm ui
- {
- //draw level right red icon
- osd_draw_rect(12+276, 68+32*(radio_down_flag), 258, 26, 12);
- int z = tuner.fmfreq[(radio_down_flag)+10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)+10),z/100,z%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, 12);
- //draw vertical right blue icon
- if(radio_down_flag==9)
- {
- osd_draw_rect(12+276, 68, 258, 26, SBGCOLOR);
- int y = tuner.fmfreq[10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",10+1,y/100,y%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART, buf, SFONTCOLOR, SBGCOLOR);
- }
- else
- {
- osd_draw_rect(12+276, 68+32*(radio_down_flag+1), 258, 26, SBGCOLOR);
- int y = tuner.fmfreq[(radio_down_flag+1)+10]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(2+radio_down_flag+10),y/100,y%100);
- osd_DrawString(SETUP_SUB_XSTART, SETUP_MENU_YSTART+(radio_down_flag+1), buf, SFONTCOLOR, SBGCOLOR);
-
- }
- //draw level left blue icon
- osd_draw_rect(14, 68+32*(radio_down_flag), 258, 26, SBGCOLOR);
- int x = tuner.fmfreq[(radio_down_flag)]*5-1070;
- psprintf(buf,"CH:%d %d.%02d MHZ",(1+(radio_down_flag)),x/100,x%100);
- osd_DrawString(1, SETUP_MENU_YSTART+(radio_down_flag), buf, SFONTCOLOR, SBGCOLOR);
-
-
- }
- }
- //show fm and am frqu
- osd_DrawString(1, SETUP_MENU_YSTART-2, RegionValStr[2], SFONTCOLOR, SBGCOLOR);
- }
- #endif