From fb6bc758e10d9fcda57fd0b134e369b17048a739 Mon Sep 17 00:00:00 2001 From: kh90909 Date: Sat, 25 Jun 2016 02:56:45 -0400 Subject: [PATCH] Restore blink during OTA update 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. --- cores/oak/OakParticle/particle_core.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cores/oak/OakParticle/particle_core.cpp b/cores/oak/OakParticle/particle_core.cpp index 65ec0d9..3f84451 100644 --- a/cores/oak/OakParticle/particle_core.cpp +++ b/cores/oak/OakParticle/particle_core.cpp @@ -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; }