*/
#include "menu.h"
+#include "menu_memoryfreq.h"
#include "power.h"
#include "commondef.h"
-
+#include "backlight.h"
void toggle_amfm(void)
{
{
unsigned char c;
unsigned char d;
- unsigned char p;
unsigned char fact;
+ unsigned char dispf = 0xff;
_CLS();
do {
- _LOCATE(0,0);
- d = akc6955_getvolumemode();
- if(d == 0){
- _PUTCHAR('D');
- } else {
- _PUTCHAR('K');
- }
- printstr(" Vol:");
- print_numeric_nosupress(setup.volume, 2);
- printstr(" F:Exit");
- _LOCATE(0,1);
- printstr("Pre:");
- _PUTCHAR('0' + (setup.prevolume & 3));
- _LOCATE(16-4, 1);
- if(setup.lowboost == 0x00){
- printstr(" ");
- } else {
- printstr("LOW");
- }
- _HOME();
- c = pollkeys(pollkeybuf, 5, 1);
- p = 0;
- while(c > 0) {
- switch(pollkeybuf[p]) {
+ if(dispf != 0) {
+ _LOCATE(0,0);
+ d = akc6955_getvolumemode();
+ if(d == 0){
+ _PUTCHAR('D');
+ } else {
+ _PUTCHAR('K');
+ }
+ printstr(" Vol:");
+ print_numeric_nosupress(setup.volume, 2);
+ printstr(" F:Exit");
+ _LOCATE(0,1);
+ printstr("Pre:");
+ _PUTCHAR('0' + (setup.prevolume & 3));
+ _LOCATE(16-4, 1);
+ if(setup.lowboost == 0x00){
+ printstr(" ");
+ } else {
+ printstr("LOW");
+ }
+ _HOME();
+ }
+ c = pollkey_single_timeout(41, 1); // 943ms
+ backlight_reset(c);
+ dispf = backlight_dec(dispf);
+
+ switch(c) {
case charcode_6:
setup.volume++;
if(setup.volume > 63) setup.volume = 63;
+ akc6955_setvolume(setup.volume);
break;
case charcode_4:
setup.volume--;
if(setup.volume < 23) setup.volume = 23;
+ akc6955_setvolume(setup.volume);
break;
case charcode_f:
_CLS();
fact = 0x00;
}
akc6955_setvolumemode(fact);
+ akc6955_setvolume(setup.volume);
break;
case charcode_b:
setup.prevolume++;
if(setup.prevolume > 3) setup.prevolume = 0;
akc6955_set_prevolume(setup.prevolume);
+ akc6955_setvolume(setup.volume);
break;
case charcode_d:
fact = 0x00;
}
setup.lowboost = fact;
akc6955_set_lowboost(setup.lowboost);
+ akc6955_setvolume(setup.volume);
break;
default:
break;
}
- c--;
- p++;
+ if(setup.volume < 24){
+ set_examp_mute(1);
+ } else {
+ set_examp_mute(0);
}
- if(setup.volume < 24){
- set_examp_mute(1);
- } else {
- set_examp_mute(0);
- }
- akc6955_setvolume(setup.volume);
-// _HOME();
+ idle_time_ms(9); // Pad.
} while(1);
}
+
void scan_start(void)
{
unsigned char c;
unsigned char cc;
+ unsigned char n;
_CLS();
scanflag = 0;
- c = 0;
do {
do {
- c = pollkeys(pollkeybuf, 20, 0); // 23*20 = 460ms
+ c = pollkey_single_timeout(20, 0) ; // 23*20 = 460ms
+ if(chk_powerbutton() != 0) shutdown(1);
update_status();
-// _HOME();
-// _LOCATE(0,0);
cc = ' ';
if((akc6955_chk_donescan() == 0) && (scanflag != 0)){
cc = '>';
}
_PUTCHAR(cc);
- printstr("Scan A/4/6");
+ printstr("Scan A/4/6/F");
print_freq(1);
_HOME();
- } while(c == 0);
-
+ } while(c == charcode_null);
// New Scan
- switch(pollkeybuf[0]){
+ switch(c){
case charcode_6:
scanflag = 0xff;
akc6955_do_scan(0xff);
akc6955_do_scan(0);
break;
case charcode_a:
+ akc6955_abort_scan();
+ goto _l0;
+ break;
+ case charcode_f:
goto _l0;
break;
default:
setup.amfreq_bank[setup.amband] = setup.amfreq;
setup.amband = read_numeric(band, 2, 7, 1);
setup.amfreq = setup.amfreq_bank[setup.amband];
+ switch(band) {
+ case AKC6955_BAND_LW:
+ case AKC6955_BAND_MW2:
+ setup.am_mode3k = 0xff;
+ break;
+ case AKC6955_BAND_MW1:
+ case AKC6955_BAND_MW3:
+ case AKC6955_BAND_MW4:
+ setup.am_mode3k = 0x00;
+ break;
+ default:
+ break;
+ }
+
akc6955_set_amband(setup.amband);
freq = setup.amfreq;
}
{
unsigned char c;
do{
- _CLS();
- _LOCATE(0,0);
- printstr("User Band");
- _LOCATE(0,1);
- printstr(" #");
- c = pollkey_single();
+ c = printhelp_2lines("User Band", " #");
- if((c >= charcode_a) && (c <= charcode_f)){
- break;
- }
- if(c == charcode_0) {
- _PUTCHAR('0');
- if(setup.fm != 0){
- setup.fm_userbandnum = 0;
- } else {
- setup.am_userbandnum = 0;
- }
- call_userband(0);
- } else {
- c = c - charcode_1 + 1;
- if(c < USER_BAND_NUM) {
- _PUTCHAR(c + '0');
- if(setup.fm != 0){
+
+ if((c >= charcode_a) && (c <= charcode_f)){
+ break;
+ }
+ if(c == charcode_0) {
+ _PUTCHAR('0');
+ if(setup.fm != 0){
+ setup.fm_userbandnum = 0;
+ } else {
+ setup.am_userbandnum = 0;
+ }
+ call_userband(0);
+ } else {
+ c = c - charcode_1 + 1;
+ if(c < USER_BAND_NUM) {
+ _PUTCHAR(c + '0');
+ if(setup.fm != 0){
setup.fm_userbandnum = c;
} else {
- setup.am_userbandnum = c;
+ setup.am_userbandnum = c;
}
call_userband(c);
}
- }
- idle(setup.ui_idlecount);
+ }
+ idle(setup.ui_idlecount);
} while(1);
_CLS();
}
void main_menu(void)
{
unsigned char c;
- unsigned char p;
- unsigned char n;
unsigned int val;
- _CLS();
- _HOME();
- _LOCATE(0,0);
- printstr("Menu:F=HELP");
- _LOCATE(0,1);
- printstr("B=CANCEL");
- do {
- n = pollkeys(pollkeybuf, 5, 1);
- } while(n == 0);
- p = 0;
- c = pollkeybuf[0];
+ printhelp_2lines("Menu:F=HELP", "B=CANCEL");
+ c = pollkey_single(); // 1012ms
if(c == charcode_1){
// Band
setband_direct();
} else if(c == charcode_3){
// Band
setfreq_direct();
+ }else if(c == charcode_4){
+ on_call_userfreq();
+ // Scan
}else if(c == charcode_5){
- scan_start();
+ // scan_start();
+ // Scan
+ }else if(c == charcode_6){
+ on_set_userfreq();
// Scan
} else if(c == charcode_7){
menu_poweroff();