mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Fix optimistic_yield usage (#588)
This commit is contained in:
parent
a9d5ef198a
commit
11594b1340
@ -122,6 +122,12 @@ int WiFiUDP::available() {
|
||||
result = static_cast<int>(_ctx->getSize());
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
// yielding here will not make more data "available",
|
||||
// but it will prevent the system from going into WDT reset
|
||||
optimistic_yield(1000);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,9 @@ int TwoWire::available(void){
|
||||
int result = rxBufferLength - rxBufferIndex;
|
||||
|
||||
if (!result) {
|
||||
optimistic_yield();
|
||||
// yielding here will not make more data "available",
|
||||
// but it will prevent the system from going into WDT reset
|
||||
optimistic_yield(1000);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -242,4 +244,3 @@ void TwoWire::onRequest( void (*function)(void) ){
|
||||
// Preinstantiate Objects //////////////////////////////////////////////////////
|
||||
|
||||
TwoWire Wire = TwoWire();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user