From f38727054d672a73be52e2dd1c2234c616a0442f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D0=B5=D0=B3=20=D0=91=D0=BE=D1=80=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Tue, 27 Aug 2024 11:29:20 +0200 Subject: [PATCH] update --- contr.c | 2 +- temp.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) 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; }