add checksum verifications

master
Ondřej Hruška 6 years ago
parent ea97235c2c
commit fcdb66d53a
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 13
      main.c

@ -59,6 +59,16 @@ void main()
while (1) {
last_signal = signal;
signal = ow_reset(OW_PIN);
if (signal) {
ow_write(OW_PIN, 0x33);
ow_read_arr(OW_PIN, addr, 8);
// check if valid
if (addr[0] == 0x00 || (crc8(addr, 7) != addr[7])) {
signal = false;
}
}
if (!signal) {
if (last_signal) {
lcd_clear();
@ -70,9 +80,6 @@ void main()
lcd_clear();
}
ow_write(OW_PIN, 0x33);
ow_read_arr(OW_PIN, addr, 8);
// Show chip type
switch (addr[0]) {
case 0x10:

Loading…
Cancel
Save