return;
}
+char save_frequencies_page(unsigned char page)
+{
+ unsigned char c;
+ unsigned int addr = (page <<7) + EEPROM_FREQSET_ADDR;
+ __freqset_t *p = &freqset_temp;
+ unsigned char i;
+ unsigned int sum;
+
+ if(page > USER_MEMORY_BANKS) return -3; // Address Error
+ // Pass 0 Calc checksum
+ if(p->magic != EEPROM_FREQSET_MAGIC) return -1; // Data error
+ sum = calcsum_frequencies(p, 0xa5a5);
+ if(p->checksum != sum) return -2; // Sum error
+ // Pass 1 write to rom.
+ c = i2c_eeprom_burstwrite(I2CEEPROM_ADDR, addr, (unsigned char *)p, sizeof(__freqset_t));
+ return 0;
+}
+
+
void format_frequencies(unsigned int page)
{
unsigned char i;
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
}
static void check_eeprom_sub(void)
{
_CLS();
- _LOCATE(0,0);
+ _LOCATE_0_0();
printstr("Formatting... ");
format_eeprom(2,250);
- _LOCATE(0,0);
+ _LOCATE_0_0();
printstr("Save defaults ");
setdefault();
save_eeprom();
switch(load_eeprom()) {
case 0x01: // No magic-word
- idle_time_ms(2000);
+// idle_time_ms(2000);
c = printhelp_2lines("EEPROM FORMAT", "Press any key");
check_eeprom_sub();
break;
case 0x00: // Checksum error
- idle_time_ms(2000);
+// idle_time_ms(2000);
c = printhelp_2lines("X-) Sum error", "Press any key");
check_eeprom_sub();
break;