Delay with Launchmode mode switch
I've got a live.observer monitoring the MAIN_MODES of the Launchpad so that I can restrict my device to only talking to the Launchpad when in 'user 2' mode.
When the LP is switched to 'user 2' mode from one of the other modes I need to refresh the button matrix. What I'm finding is that, although I'm sending the right set of messages to the Launchpad it's not updating the matrix. If I manually trigger an update that does work, and I confirmed that it's sending exactly the same messages as the update triggered by switching modes.
After a lot of head-scratching I put a Max delay
module between my patcher detecting a switch to 'user 2' mode and the code that updates the Launchpad button matrix. Even a 1ms delay was enough, and the code started working properly.
Now I know to put in there it's not such a big problem but I am puzzled that you can't update the LP when it's already signalled it's in 'user 2' mode.
Anyone else come across this?
Matt
It may be that you are trying to trigger an API change from another API change...that's a no-no. I think the delay is sometimes enough to prevent this safety feature. You might want to defer it, as well, as putting the delay on it places it in the high-priority thread (which I try to keep the Launchpad out of... just to reserve the cpu cycles for other more important stuff).
I might be wrong about that...