forked from M-Labs/ionpak-thermostat
config fixes
This commit is contained in:
parent
e5ea9a3918
commit
e8174f0773
|
@ -21,9 +21,10 @@ impl EepromReader {
|
||||||
if self.buffer[0] != MAGIC {
|
if self.buffer[0] != MAGIC {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let cksum = self.buffer[0] as u32 | (self.buffer[1] as u32) << 8 |
|
let len = self.buffer.len();
|
||||||
(self.buffer[2] as u32) << 16 | (self.buffer[3] as u32) << 24;
|
let cksum = self.buffer[len-4] as u32 | (self.buffer[len-3] as u32) << 8 |
|
||||||
if crc32::checksum_ieee(&self.buffer[0..self.buffer.len()-4]) != cksum {
|
(self.buffer[len-2] as u32) << 16 | (self.buffer[len-1] as u32) << 24;
|
||||||
|
if crc32::checksum_ieee(&self.buffer[0..len-4]) != cksum {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
|
@ -83,5 +84,6 @@ impl Config {
|
||||||
_ => panic!("unsupported network address")
|
_ => panic!("unsupported network address")
|
||||||
};
|
};
|
||||||
payload[0..4].copy_from_slice(&ip4);
|
payload[0..4].copy_from_slice(&ip4);
|
||||||
|
write_eeprom_payload(&payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue