瀏覽代碼

añadido 10% error en tiempo

dacowars 1 月之前
父節點
當前提交
d1d373a08d
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      main/main.c

+ 3 - 3
main/main.c

@@ -59,9 +59,9 @@ static inline esp_err_t dht_communication(gpio_num_t pin, uint32_t *data){
     esp_rom_delay_us(1500); // Pull low for at least 1ms
     gpio_set_level(pin, 1); // Release the line
 
-    CHECK_LOGE(get_change_time(pin, 40, 1, &low_time), "Failed to get dht response"); // Wait for the sensor to pull low 20-40us
-    CHECK_LOGE(get_change_time(pin, 80, 0, &high_time), "Failed to get dht response"); // Wait for the sensor to pull high 80us
-    CHECK_LOGE(get_change_time(pin, 80, 1, &low_time), "Failed to get dht response"); // Wait for the sensor to pull low 80us
+    CHECK_LOGE(get_change_time(pin, 44, 1, &low_time), "Failed to get dht response"); // Wait for the sensor to pull low 20-40us
+    CHECK_LOGE(get_change_time(pin, 88, 0, &high_time), "Failed to get dht response"); // Wait for the sensor to pull high 80us
+    CHECK_LOGE(get_change_time(pin, 88, 1, &low_time), "Failed to get dht response"); // Wait for the sensor to pull low 80us
 
     for (uint8_t i = DHT_DATA_BITS; i > 0; i--){