nqd / esp8266-dev

ESP8266 Wifi SoC dev, with OTA made easy
44 stars 12 forks source link

Add user's timer callback #5

Closed frco9 closed 9 years ago

frco9 commented 9 years ago

Add a callback to fota in order to disable user's timers during FOTA update.

nqd commented 9 years ago

Quick question: Why do we need to disable user's timer?

frco9 commented 9 years ago

I'm not sure that it's linked, but I have two timers triggered every 100ms (Button sampling and RTC update) and as long as they were enabled, my FOTA update was failing (the firmware download was extremely slow and timed out). Now it's working great.

nqd commented 9 years ago

I suggest that this is not good way for the system to run. FOTA should run in background, and have least interaction with the rest of the system.

How about disable the interrupt when downloading new image?

/* disable all interrupts */
#define ETS_INTR_LOCK() ets_intr_lock()
/* enable all interrupts */
#define ETS_INTR_UNLOCK() ets_intr_unlock()
frco9 commented 9 years ago

Indeed, this is what I was looking for !