From 8df46788bcd234442e39342f54bf085ff9b63946 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sun, 3 Oct 2021 19:28:12 +0200 Subject: [PATCH] removed more arduino bullshit functions --- CMakeLists.txt | 1 + DHT.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2067b9a..5b16092 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ set(sources set(dependencies arduino-esp32 Adafruit_Sensor + espcpputils ) idf_component_register( diff --git a/DHT.cpp b/DHT.cpp index 73112d7..2c10f97 100644 --- a/DHT.cpp +++ b/DHT.cpp @@ -26,6 +26,7 @@ #include "DHT.h" #include +#include using namespace std::chrono_literals; @@ -261,7 +262,7 @@ const std::optional> &DHT::read(bool force) { // Go into high impedence state to let pull-up raise data line level and // start the reading process. pinMode(_pin, INPUT_PULLUP); - delay(1); + espcpputils::delay(1ms); // First set data line low for a period according to sensor type pinMode(_pin, OUTPUT); @@ -273,7 +274,7 @@ const std::optional> &DHT::read(bool force) { break; case DHT11: default: - delay(20); // data sheet says at least 18ms, 20ms just to be safe + espcpputils::delay(20ms); // data sheet says at least 18ms, 20ms just to be safe break; }