mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Merge branch 'dev' into features/dfrobot_sn0395/targets-tracking
This commit is contained in:
commit
800c044e44
1 changed files with 4 additions and 2 deletions
|
@ -94,13 +94,15 @@ bool HOT IRAM_ATTR GPIOOneWireBus::read_bit_() {
|
||||||
|
|
||||||
// measure from start value directly, to get best accurate timing no matter
|
// measure from start value directly, to get best accurate timing no matter
|
||||||
// how long pin_mode/delayMicroseconds took
|
// how long pin_mode/delayMicroseconds took
|
||||||
delayMicroseconds(12 - (micros() - start));
|
uint32_t now = micros();
|
||||||
|
if (now - start < 12)
|
||||||
|
delayMicroseconds(12 - (now - start));
|
||||||
|
|
||||||
// sample bus to read bit from peer
|
// sample bus to read bit from peer
|
||||||
bool r = pin_.digital_read();
|
bool r = pin_.digital_read();
|
||||||
|
|
||||||
// read slot is at least 60µs; get as close to 60µs to spend less time with interrupts locked
|
// read slot is at least 60µs; get as close to 60µs to spend less time with interrupts locked
|
||||||
uint32_t now = micros();
|
now = micros();
|
||||||
if (now - start < 60)
|
if (now - start < 60)
|
||||||
delayMicroseconds(60 - (now - start));
|
delayMicroseconds(60 - (now - start));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue