private static void ReadConfigurationFromEeprom() { // Loop through the six antennas and load the name and mask into memory. for (var i = 0; i < 6; i++) { var address = (i + 1) * 100; // Starting address. _antennas[i] = new Antenna { Name = Eeprom.ReadString(address, MAX_ANTENNA_NAME_LENGTH), BandMask = new BandMask(Eeprom.ReadString((address + MAX_ANTENNA_NAME_LENGTH + 1), MAX_ANTENNA_MASK_LENGTH)) }; } // Loop through the two radios and load their config. for (var i = 0; i < 2; i++) { var address = (i + 1) * 10; _radios[i].BandDecodingMethod = (BandDecodingMethod)Eeprom.ReadInt16(address); _radios[i].BandPassFilterType = (BandPassFilterType)Eeprom.ReadInt16(address + 1); // Read the BandDecodingMethod in the eeprom. Eeprom.WriteInt16(address, (int)_radios[i].BandDecodingMethod); // Read the BandPassFilterType in the eeprom. Eeprom.WriteInt16((address + 1), (int)_radios[i].BandPassFilterType); } }
private static void FactoryReset() { _antennas = new Antenna[6]; for (var i = 0; i < _antennas.Length; i++) { _antennas[i] = new Antenna { Name = "ANTENNA " + (i + 1), BandMask = new BandMask("000000") }; var address = (i + 1) * 100; //Eeprom.WriteString((address), _antennas[i].Name); //Eeprom.WriteString((address + MAX_ANTENNA_NAME_LENGTH + 1), _antennas[i].BandMask.ToString()); } _radios = new[] { new Radio { BandDecodingMethod = BandDecodingMethod.YaesuBcd, BandPassFilterType = BandPassFilterType.None }, new Radio { BandDecodingMethod = BandDecodingMethod.YaesuBcd, BandPassFilterType = BandPassFilterType.None }, }; for (var i = 0; i < _radios.Length; i++) { var address = (i + 1) * 10; // Store the BandDecodingMethod in the eeprom. //Eeprom.WriteInt16(address, (int)_radios[i].BandDecodingMethod); // Store the BandPassFilterType in the eeprom. //Eeprom.WriteInt16(address + 1, (int)_radios[i].BandPassFilterType); } // Write 255 to address zero on the eeprom to confirm it has been configured. //Eeprom.WriteByte(0, 255); }