Chat here about code rewrites, mods, etc... with respect to the github project https://github.com/esp8266/Arduino

Moderator: igrr

User avatar
By rudy
#78311 My understanding is that callbacks are not the same as interrupts. The task is scheduled to run. It does not interrupt the currently running code so I see no reason for ICACHE_RAM_ATTR.

(My understanding = I think)
User avatar
By McChubby007
#78315 I don't use the ticker library so I don't know its internals, but I assume it uses the esp8266/espressif timer api etc. Which triggers ticker's own callback function. In some (non-esp8266) architectures this timer would have been caused by a hardware interrupt and therefore the callback would be part of the code called during this hardware interrupt and so each api/function/callback in that chain of calls must adhere to any rules regarding ram/flash location etc.

However, I know for sure that the esp8266/espressif timer api does not use the hardware timer, it uses a 'soft' timer and so the requirements of having all interrupt routines resident in ram does not apply to the calling chain for timers. There is the possibility of using a hardware/interrupt timer in the esp8266 but it has strict limitations and so I don't believe it is generally used anywhere, as it can upset other things (can't remember the specifics of that right now, sorry).
User avatar
By mrburnette
#78332 IMO, using ticker is not necessary if you can keep the loop() code recycling every 30mS or so.
Good programming is to understand your code timing, if any function of section runs > 30mS, then you should utilize yield() or delay(0) to allow non-OS to refresh pending tasks in the RF section of the chip.

When you observe good timing within your code, the Arduino+Espressif code can coexist without conflict.

Ray