Skip to content

Commit e942bcc

Browse files
committed
Remove alwaysExpired, it is identical to 0 and obfuscates the code.
1 parent ed920df commit e942bcc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cores/esp8266/PolledTimeout.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ class timeoutTemplate
145145
using timeType = typename TimePolicyT::timeType;
146146
static_assert(std::is_unsigned<timeType>::value == true, "timeType must be unsigned");
147147

148-
static constexpr timeType alwaysExpired = 0;
149148
static constexpr timeType neverExpires = std::numeric_limits<timeType>::max();
150149
static constexpr timeType rangeCompensate = TimePolicyT::rangeCompensate; //debug
151150

@@ -176,7 +175,7 @@ class timeoutTemplate
176175

177176
bool canWait () const
178177
{
179-
return _timeout != alwaysExpired && !_oneShotExpired;
178+
return _timeout != 0 && !_oneShotExpired;
180179
}
181180

182181
// Resets, will trigger after this new timeout.
@@ -215,7 +214,7 @@ class timeoutTemplate
215214

216215
void resetToNeverExpires ()
217216
{
218-
_timeout = alwaysExpired + 1; // because canWait() has precedence
217+
_timeout = 1; // because canWait() has precedence
219218
_neverExpires = true;
220219
}
221220

cores/esp8266/Stream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Stream: public Print {
168168

169169
// transfers already buffered / immediately available data (no timeout)
170170
// returns number of transfered bytes
171-
size_t sendAvailable (Print* to) { return sendGeneric(to, -1, -1, oneShotMs::alwaysExpired); }
171+
size_t sendAvailable (Print* to) { return sendGeneric(to, -1, -1, 0); }
172172
size_t sendAvailable (Print& to) { return sendAvailable(&to); }
173173

174174
// transfers data until timeout

0 commit comments

Comments
 (0)