__bitops_t f;
__bitops_t mode3k;
unsigned char band;
+ unsigned int start, stop;
f.byte = akc6955_readcmd(AKC6955_POWER);
if(f.b6) { // FM
akc6955_get_fmband(band);
// band &= 7;
- if(freq < fmbands[band].start) freq = fmbands[band].start;
- if(freq >= fmbands[band].end) freq = fmbands[band].end - 1;
+ if(band == AKC6955_BAND_FMUSER){
+ start = fm_usrbands[fm_userbandnum].start * 32;
+ stop = fm_usrbands[fm_userbandnum].stop * 32;
+ } else {
+ start = fmbands[band].start;
+ stop = fmbands[band].end;
+ }
ch = freq - 3000;
ch = (ch * 4) / 10;
} else {
akc6955_get_amband(band);
// if(band >= AKC6955_BAND_AMEND) band = AKC6955_BAND_AMEND - 1;
- if(freq < ambands[band].start) freq = ambands[band].start;
- if(freq >= ambands[band].end) freq = ambands[band].end - 1;
+ if(band == AKC6955_BAND_AMUSER){
+ start = am_usrbands[am_userbandnum].start * 32;
+ stop = am_usrbands[am_userbandnum].stop * 32;
+ } else {
+ start = ambands[band].start;
+ stop = ambands[band].end;
+ }
mode3k.byte = akc6955_readcmd(AKC6955_CNR_AM);
if(band == AKC6955_BAND_MW2) {
ch = (freq / 9) * 3; // See datasheet.
ch = freq / 5;
}
}
+ if(freq < start) freq = start;
+ if(freq >= stop) freq = stop - 1;
akc6955_set_tune(mode3k.b7, ch);
}
void set_stereo(void)
{
+
if(stereo == 0xff) {// Force Mono
stereo = 0x00;
} else if(stereo == 0x00) { //Mono->Stereo
if(volume < 23) volume = 23;
break;
case charcode_f:
+ _CLS();
return;
case charcode_a:
fact = 0xff;
} else {
if((scanflag != 0) && (akc6955_chk_donescan() != 0)) {
scanflag = 0;
- _LOCATE(0,0);
+ _HOME();
printstr("Scan F/A/4/6");
update_status();
print_freq(1);
if(fm != 0){
printstr("Set Band:FM#");
band = fmband & 7;
+ fmfreq_bank[fmband] = amfreq;
fmband = read_numeric(band, 2, 7, 1);
akc6955_set_fmband(fmband);
akc6955_do_tune();
+ fmfreq = fmfreq_bank[fmband];
+ akc6955_set_freq(fmfreq);
} else {
printstr("Set Band:AM#");
band = amband & 0x1f;
+ amfreq_bank[amband] = amfreq;
amband = read_numeric(band, 2, 7, 1);
+ amfreq = amfreq_bank[amband];
akc6955_set_amband(amband);
akc6955_do_tune();
+ akc6955_set_freq(amfreq);
}
}
{
unsigned int freq;
unsigned int ch;
+ unsigned char start;
+ unsigned char end;
+ unsigned char mode3k;
+ unsigned char freq2;
+
if(num >= USER_BAND_NUM) return;
if(fm != 0){
freq = fm_usrbands[num].freq;
- ch = ((freq - 3000) / 25) * 10;
- akc6955_set_userband(fm_usrbands[num].start, fm_usrbands[num].stop, ch,
- fm_usrbands[num].mode3k);
- fmband = AKC6955_BAND_AMUSER;
+ ch = ((freq - 3000) / 5) * 2;
+ start = fm_usrbands[num].start;
+ end = fm_usrbands[num].stop;
+ mode3k = fm_usrbands[num].mode3k;
+ fmband = AKC6955_BAND_FMUSER;
} else {
unsigned int p = 5;
if(am_usrbands[num].mode3k != 0) p = 3;
freq = am_usrbands[num].freq;
ch = freq / p;
- akc6955_set_userband(am_usrbands[num].start, am_usrbands[num].stop, ch,
- am_usrbands[num].mode3k);
+ start = am_usrbands[num].start;
+ end = am_usrbands[num].stop;
+ mode3k = am_usrbands[num].mode3k;
amband = AKC6955_BAND_AMUSER;
}
+
+ if(start > end) {
+ unsigned char tmp;
+ tmp = start;
+ start = end;
+ end = tmp;
+ }
+
+ freq2 = ch / 32;
+ if(freq2 > end) {
+ ch = end * 32;
+ }
+ if(freq2 < start){
+ ch = start * 32;
+ }
+ akc6955_set_userband(start, end, ch, mode3k);
}
void set_userband(void)
to = fm_usrbands[c].stop * 80 + 3000;
_CLS();
_LOCATE(0,0);
+ _LOCATE(0,0);
printstr("FM#");
print_numeric_nosupress(c, 1);
+ _LOCATE(0,1);
printstr(" From:");
from = read_numeric(from, 5, 7, 1);
- _LOCATE(6,1);
- printstr("To:");
+ _LOCATE(0,1);
+ printstr(" To: ");
to = read_numeric(to, 5, 7, 1);
fm_usrbands[c].start = (from - 3000) / 80;
fm_usrbands[c].stop = (to - 3000) / 80;
_LOCATE(0,0);
printstr("AM#");
print_numeric_nosupress(c, 1);
+ _LOCATE(0,1);
printstr(" From:");
from = read_numeric(from, 5, 7, 1);
- _LOCATE(6, 1);
- printstr(" To:");
+ _LOCATE(0,1);
+ printstr(" To: ");
to = read_numeric(to, 5, 7, 1);
am_usrbands[c].start = from / p;
am_usrbands[c].stop = to / p;
am_userbandnum = c;
}
call_userband(c);
+ _CLS();
}
void input_userband(void)
unsigned char band;
if(fm == 0){ // MW
band = amband + 1;
+ if(amband == AKC6955_BAND_AMUSER){
+ am_usrbands[am_userbandnum].freq = amfreq;
+ }
amfreq_bank[amband] = amfreq;
if(updown == 0) { // down
if(band <= 1) {
- band = AKC6955_BAND_AMEND + 1;
+ band = AKC6955_BAND_AMEND - 1;
}
band -= 2;
}
amband = band;
+ if(amband == AKC6955_BAND_AMUSER){
+// amfreq = am_usrbands[am_userbandnum].freq;
+ call_userband(am_userbandnum);
+ }
setfreq_updown_amsub();
} else { // FM
+ if(fmband == AKC6955_BAND_FMUSER){
+ fm_usrbands[fm_userbandnum].freq = fmfreq;
+ }
band = fmband + 1;
fmfreq_bank[fmband] = fmfreq;
if(updown == 0) { // down
if(band <= 1) {
- band = AKC6955_BAND_FMEND + 1;
+ band = AKC6955_BAND_FMEND - 1;
}
band -= 2;
}
fmband = band;
+ if(fmband == AKC6955_BAND_FMUSER){
+ // fmfreq = fm_usrbands[fm_userbandnum].freq;
+ call_userband(fm_userbandnum);
+ }
setfreq_updown_fmsub();
}
}