Skip to content

Commit e2263e2

Browse files
committed
Refactor for consistency - use PolledTimeout throughout or don't use at all - don't use at all.
1 parent f78ab66 commit e2263e2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cores/esp8266/HardwareSerial.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <stdio.h>
2828
#include <string.h>
2929
#include <inttypes.h>
30-
#include <PolledTimeout.h>
3130
#include "Arduino.h"
3231
#include "HardwareSerial.h"
3332
#include "Esp.h"
@@ -139,9 +138,9 @@ size_t HardwareSerial::readBytes(char* buffer, size_t size)
139138

140139
while (got < size)
141140
{
142-
esp8266::polledTimeout::oneShotFastMs timeOut(_timeout);
141+
time_t startMillis = millis();
143142
size_t avail;
144-
while ((avail = available()) == 0 && !timeOut);
143+
while ((avail = available()) == 0 && ((time_t) millis() - startMillis) < _timeout);
145144
if (avail == 0)
146145
break;
147146
got += read(buffer + got, std::min(size - got, avail));

0 commit comments

Comments
 (0)