unsigned int sum;
// Pass 0 Calc checksum
- userband.magic = EEPROM_FREQSET_MAGIC;
+ userband.magic = EEPROM_BANDSET_MAGIC;
userband.version = 0x0001;
sum = calcsum_userband(&userband, 0x5a5a);
userband.checksum = sum;
for(i = 0; i < USER_BAND_NUM; i++) {
userband.am_usrbands[i].start = 0x19;
userband.am_usrbands[i].stop = 0x32;
- userband.am_usrbands[i].freq = 1216; //0x32 - (0x32-0x19) / 2 *32
+ userband.am_usrbands[i].freq = 5600; //(0x32 - (0x32-0x19) / 2 *32) * 5
userband.am_usrbands[i].mode3k = 0;
- }
- for(i = 0; i < USER_BAND_NUM; i++) {
+ //
userband.fm_usrbands[i].start = 0x19;
userband.fm_usrbands[i].stop = 0x32;
- userband.fm_usrbands[i].freq = 1216; //0x32 - (0x32-0x19) / 2 *32
+ userband.fm_usrbands[i].freq = 8600;
userband.fm_usrbands[i].mode3k = 0;
}
+ save_userbands(); // Re-init
}
/*
*
*/
+void setdefault_userband(void)
+{
+ char i;
+#if 0
+ for(i = 0; i < USER_BAND_NUM; i++){
+ userband.am_usrbands[i].start = 0x19;
+ userband.am_usrbands[i].stop = 0x32;
+ userband.am_usrbands[i].freq = (0x0a + 0x19) << 5;
+ userband.am_usrbands[i].mode3k = 0;
+ userband.fm_usrbands[i].start = 0x19;
+ userband.fm_usrbands[i].stop = 0x32;
+ userband.fm_usrbands[i].freq = ((0x0a + 0x19) << 5) + 3000;
+ }
+#endif
+}
+
+
void setdefault(void)
{
char i;
setup.threshold_fmcnr = 0;
setup.threshold_fmstereo = 0;
setup.threshold_width = 0;
- for(i = 0; i < USER_BAND_NUM; i++){
- userband.am_usrbands[i].start = 0x19;
- userband.am_usrbands[i].stop = 0x32;
- userband.fm_usrbands[i].start = 0x19;
- userband.fm_usrbands[i].stop = 0x32;
- }
for(i =0; i < AKC6955_BAND_AMEND; i++){
setup.amfreq_bank[i] = ((ambands[i].end - ambands[i].start) / 2) + ambands[i].start;
}
}
setup.memorynum = 0x00;
setup.pagenum = 0x00;
+#if 0
for(i = 0; i < USER_MEMORY_NUM; i++) {
freqset.memoryfreqs[i].band = AKC6955_BAND_MW2;
freqset.memoryfreqs[i].fm = 0;
freqset.memoryfreqs[i].freq = 594; // NHK1 Tokyo.
}
-
+#endif
setup.fmfreq = setup.fmfreq_bank[setup.fmband];
setup.amfreq = setup.amfreq_bank[setup.amband];
setup.stereo = 0xff; // Auto
void set_userband(void)
{
- unsigned long from,to, tmp;
+ unsigned long from,to;
unsigned char c;
unsigned char pp;
unsigned char mode3k;
- char cc;
+ unsigned int freq;
+ unsigned int _from, _to, tmp;
+ unsigned char cc;
+ unsigned char fm = setup.fm;
_CLS();
_LOCATE(0,0);
c = pollkey_numeric(c);
if(c >= USER_BAND_NUM) return;
- if(setup.fm != 0){
+ if(fm != 0){
from = userband.fm_usrbands[c].start * 80 + 3000; // 32*25/10
to = userband.fm_usrbands[c].stop * 80 + 3000;
_CLS();
_LOCATE(0,0);
printstr("FM#");
print_numeric_nosupress(c, 1);
- _LOCATE(0,1);
- printstr(" From:");
- from = read_numeric(from, 5, 7, 1);
- if((from & 0x80000000) != 0) goto _l0;
- _LOCATE(0,1);
- printstr(" To: ");
- to = read_numeric(to, 5, 7, 1);
- if((to & 0x80000000) != 0) goto _l0;
- if(from > to){
- tmp = to;
- to = from;
- from = tmp;
- }
- userband.fm_usrbands[c].start = (from - 3000) / 80;
- userband.fm_usrbands[c].stop = (to - 3000) / 80 + 1;
- userband.fm_usrbands[c].freq = from;
- setup.fm_userbandnum = c;
} else {
mode3k = userband.am_usrbands[c].mode3k;
pp = 96; // 3*32
printstr("AM#");
print_numeric_nosupress(c, 1);
printstr(" Step:");
+ if(mode3k == 0){
+ printstr("5K->");
+ } else {
+ printstr("3K->");
+ }
_LOCATE(0,1);
printstr("0=3k 1=5k");
cc = pollkey_single();
} else if(cc == charcode_1) {
pp = 160;
mode3k = 0;
+ } else {
+ goto _l0;
}
- _CLS();
- _LOCATE(0,0);
- printstr("AM#");
- print_numeric_nosupress(c, 1);
- _LOCATE(0,1);
- printstr(" From:");
- from = read_numeric(from, 5, 7, 1);
- if((from & 0x80000000) != 0) goto _l0;
- _LOCATE(0,1);
- printstr(" To: ");
- to = read_numeric(to, 5, 7, 1);
- if((to & 0x80000000) != 0) goto _l0;
- if(from > to){
- tmp = to;
- to = from;
- from = tmp;
+ _LOCATE(11,0);
+ if(mode3k == 0){
+ printstr("5K ");
+ } else {
+ printstr("3K ");
}
- userband.am_usrbands[c].start = from / pp;
- userband.am_usrbands[c].stop = to / pp + 1;
+ }
+
+ _LOCATE(0,1);
+ printstr("From:");
+ from = read_numeric(from, 5, 7, 1);
+ if((from & 0xffff0000) != 0) goto _l0;
+ _LOCATE(0,1);
+ printstr("To: ");
+ to = read_numeric(to, 5, 7, 1);
+ if((to & 0xffff0000) != 0) goto _l0;
+
+ _from = (unsigned int)from;
+ _to = (unsigned int)to;
+ if(_from > _to){
+ tmp = _to;
+ _to = _from;
+ _from = tmp;
+ }
+ freq = (_to - _from) / 2 + _from;
+
+ _CLS();
+ if(fm != 0){
+ printstr("FM");
+ } else {
+ printstr("AM");
+ }
+ _PUTCHAR('#');
+ _PUTCHAR('0' + c);
+ printstr(" A=OK");
+ _LOCATE(0,1);
+ print_numeric_nosupress(_from, 5);
+ printstr("->");
+ print_numeric_nosupress(_to, 5);
+ cc = pollkey_single();
+ if(cc != charcode_a) goto _l0;
+ if(fm != 0)
+ {
+ if((_from <= 3000) || (_from >= 28000)) goto _l0;
+ if((_to <= 3000) || (_to >= 28000)) goto _l0;
+ userband.fm_usrbands[c].start = (_from - 3000) / 80;
+ userband.fm_usrbands[c].stop = (_to - 3000) / 80 + 1;
+ userband.fm_usrbands[c].freq = freq;
+ userband.fm_usrbands[c].mode3k = 0;
+ setup.fm_userbandnum = c;
+ } else {
+ if((_from <100) || (_from >= 28000)) goto _l0;
+ if((_to < 100) || (_to >= 28000)) goto _l0;
+ userband.am_usrbands[c].start = _from / pp;
+ userband.am_usrbands[c].stop = _to / pp + 1;
userband.am_usrbands[c].mode3k = mode3k;
- userband.am_usrbands[c].freq = from;
+ userband.am_usrbands[c].freq = freq;
setup.am_userbandnum = c;
}
save_userbands();