Well, I am still having this basic problem. I am losing a lot of notes. It happens fairly consistently, though there is no consistent reason why. In some cases, if I add a delay within the loop where I’m updating, things are fine. But the delay has to be 10 millis or so, which is really not usable when you have 128 buttons to update.
There are some inconsistencies. For example, I have a couple of different places where I color all 128 central buttons. One call works consistently, while the other almost always causes problems. The codepath is basically the same.
The one that breaks is in a “clear” function. it sets the central buttons and some of the surrounding buttons to off. if I comment out the calls to the surrounding buttons, then the central buttons clear fine, even without a 10ms delay. if I leave those calls in, but have a delay, the central buttons clear fine. Without a delay, it breaks. If I comment out the central buttons, I can run the outer buttons fine without a delay. Weirdly, these problems aren’t non-determistic – when it doesn’t work, it always fails in the same way, in terms of which buttons are on and off.
I also still have issues like if I try to clear all the buttons before the program exits, it often doesn’t work, even if I add a delay.