WARDuino icon indicating copy to clipboard operation
WARDuino copied to clipboard

Unsubscribe callback handlers when updating a module

Open carllocos opened this issue 1 year ago • 2 comments

When updating a module, we should unsubscribe the callback handlers and this also means that for a MCU we should unsubscribe the service routine.

However, I believe that this may not even be necessary. The reason is that normally when we would update a module. The module should be persisted on the MCU so to survive potential reboots (I already opened an issue for this https://github.com/TOPLLab/WARDuino/issues/121). If we persist a module and we decide to reboot the device, then the ISR get automatically unsubscribed. Meaning that this issue becomes irrelevant. However, I believe as long as we do not have the persisting feature yet, we should manually unsubscribe the ISRs.

What do you think @tolauwae?

carllocos avatar May 10 '23 07:05 carllocos

I agree. The callback system should definitely be reset completely when a new module gets loaded. Except for the event queue imo.

For the persistant module. When that feature is implemented, I still wouldn't reboot the device on a module update because that is pretty slow. So I would still reset the callback system manually on module update.

tolauwae avatar May 11 '23 09:05 tolauwae

Actually, the decision of rebooting or not is dependent on the use case and should come from the developers. As of that, both options should be possible.

carllocos avatar May 11 '23 14:05 carllocos