#include #include #include #include "main.h" #include "ds18b20.h" #include "1wire.h" union { signed int t; unsigned char owbuffer[9]; } t; #define MAX_ERRORS 5 unsigned char rom_num; unsigned char rom_tab[MAX_SENSOR_NUM][8]; unsigned char temp_ok; signed int temps[MAX_SENSOR_NUM]; unsigned char find_1wire(void){ unsigned char rom[8]; unsigned char i=0, rv=0, j; unsigned char crc = 0; do { rv = _1WireSearch(rv, rom); memcpy(rom_tab[i], rom, 8); for(j=0;j<8;j++){ crc = _crc_ibutton_update(crc, rom[j]); } if(crc) return 1; i++; } while(rv && i>= 4; if(t.owbuffer[2] <= MAX_SENSOR_NUM){ temps[t.owbuffer[2]] = temp; temp_ok_out |= 1< MAX_ERRORS){ temp_ok &= ~(1<