WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit f05cb54

Browse files
committed
Returning max delay value that is uint-wrap around safe.
1 parent 261fd96 commit f05cb54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp8266/Schedule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn,
143143

144144
uint32_t get_scheduled_recurrent_delay_us()
145145
{
146-
if (!rFirst) return ~static_cast<uint32_t>(0);
146+
if (!rFirst) return ~static_cast<decltype(micros())>(0) >> 1;
147147
// handle already expired rTarget.
148148
const int32_t remaining = rTarget - micros();
149149
return (remaining > 0) ? static_cast<uint32_t>(remaining) : 0;

0 commit comments

Comments
 (0)