File tree 2 files changed +14
-7
lines changed 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,12 @@ int WiFiUDP::available() {
122
122
result = static_cast <int >(_ctx->getSize ());
123
123
}
124
124
125
+ if (!result) {
126
+ // yielding here will not make more data "available",
127
+ // but it will prevent the system from going into WDT reset
128
+ optimistic_yield (1000 );
129
+ }
130
+
125
131
return result;
126
132
}
127
133
Original file line number Diff line number Diff line change @@ -161,13 +161,15 @@ size_t TwoWire::write(const uint8_t *data, size_t quantity){
161
161
}
162
162
163
163
int TwoWire::available (void ){
164
- int result = rxBufferLength - rxBufferIndex;
164
+ int result = rxBufferLength - rxBufferIndex;
165
165
166
- if (!result) {
167
- optimistic_yield ();
168
- }
166
+ if (!result) {
167
+ // yielding here will not make more data "available",
168
+ // but it will prevent the system from going into WDT reset
169
+ optimistic_yield (1000 );
170
+ }
169
171
170
- return result;
172
+ return result;
171
173
}
172
174
173
175
int TwoWire::read (void ){
@@ -209,7 +211,7 @@ void TwoWire::onReceiveService(uint8_t* inBytes, int numBytes)
209
211
// // copy twi rx buffer into local read buffer
210
212
// // this enables new reads to happen in parallel
211
213
// for(uint8_t i = 0; i < numBytes; ++i){
212
- // rxBuffer[i] = inBytes[i];
214
+ // rxBuffer[i] = inBytes[i];
213
215
// }
214
216
// // set rx iterator vars
215
217
// rxBufferIndex = 0;
@@ -242,4 +244,3 @@ void TwoWire::onRequest( void (*function)(void) ){
242
244
// Preinstantiate Objects //////////////////////////////////////////////////////
243
245
244
246
TwoWire Wire = TwoWire();
245
-
You can’t perform that action at this time.
0 commit comments