Skip to content

Commit

Permalink
Restore blink during OTA update
Browse files Browse the repository at this point in the history
The previous change to event_loop() to process all events accumulated
in the buffer, rather than one per call, had the inadvertently prevented
the OTA update blink. During the OTA update, data comes in fast enough
that the buffer never empties, so the first call to event_loop() doesn't
finish until the update is done. As a result, the blink loop at the end
of handle_update_begin() only runs for one iteration.

This commit adds a 20 ms time limit after which event_loop() will stop
processing further events and return.
  • Loading branch information
kh90909 committed Jun 25, 2016
1 parent c6f63b8 commit fb6bc75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cores/oak/OakParticle/particle_core.cpp
Expand Up @@ -2408,10 +2408,11 @@ bool event_loop()
{
CoAPMessageType::Enum message;
bool res;
uint32_t start = millis();
do {
res = event_loop(message);
yield();
}while(res && pClient.available() >= 2);
}while(res && pClient.available() >= 2 && (millis()-start) < 20);

return res;
}
Expand Down

0 comments on commit fb6bc75

Please sign in to comment.