diff --git a/contr.c b/contr.c index 629c933..8c45af7 100644 --- a/contr.c +++ b/contr.c @@ -548,7 +548,7 @@ void contr_main(void) { contr_tx_handle(); counter++; _delay_ms(1); - if ((counter % 10) == 1) buzzer_onoff(); + //if ((counter % 10) == 1) buzzer_onoff(); } } diff --git a/temp.c b/temp.c index 5c40868..85f7b32 100644 --- a/temp.c +++ b/temp.c @@ -12,11 +12,12 @@ uint8_t ds18b20_reset() { uint8_t error; REG_SETDOWN_BIT(DS18B20_PORT, DS18B20_PB); REG_SETUP_BIT(DS18B20_DDR, DS18B20_PB); - _delay_us(340); + _delay_us(480); REG_SETDOWN_BIT(DS18B20_DDR, DS18B20_PB); - _delay_us(64); + _delay_us(60); error = REG_BIT_VALUE(DS18B20_PIN, DS18B20_PB); - _delay_us(320); + _delay_us(420); + return error; } @@ -27,7 +28,7 @@ void ds18b20_write_bit(uint8_t bit) { if (bit) { REG_SETDOWN_BIT(DS18B20_DDR, DS18B20_PB); } - _delay_us(40); + _delay_us(60); REG_SETDOWN_BIT(DS18B20_DDR, DS18B20_PB); } @@ -62,7 +63,7 @@ uint8_t ds18b20_read_byte(void) { return byte; } -#define TEMP_MEASURE_SCALE 63 +#define TEMP_SCALE 63 uint16_t ds18b20_get_temp() { uint8_t ltemp; uint8_t htemp; @@ -81,6 +82,6 @@ uint16_t ds18b20_get_temp() { ltemp = ds18b20_read_byte(); htemp = ds18b20_read_byte(); - temp = (((htemp << 8) | ltemp) * TEMP_MEASURE_SCALE) / 10; + temp = ((htemp << 8) | ltemp) * TEMP_SCALE / 10; return temp; }