Seems a little hackish maybe? Weād have to place teletype specific logic into the general purpose events logic.
Alternative idea. Add time stamps to events when they are posted. (Need to be wary of timer overflows though.) Downstream event handlers can use this information as they see fit. The trigger event handler could check and only allow a script to run if itās been 10ms since that script was last triggered.
It doesāt reduce the number of events, but it does help process them quicker when they are coming in too fast.
Could also be used to implement a BPM calculation on each trigger input (useful for clock multipliers) in downstream code rather than having to do it in libavr32.
Another idea. Multiple event queues with different properties. E.g. a UI queue thatās not time critical but where itās important that events arenāt dropped (so that we can guarantee the state of the system). And a āmusicalā queue for things that want to be done quickly, but where we will liberally drop events when the load gets too high.
Or as @scanner_darkly suggests, let the user know that the event queue had to drop events and gently advise them that they should reboot (due to non-determine system state) and try to ease back the load.
Back to i2c, Iāve modified the i2c_* functions in libavr32 to return the status. In the Teletype firmware Iām printing that out to serial when itās non-zero. I think thatās probably worth leaving in. Itās also possible we could try to feed that info back to users too. The UI code has been split up a lot so itās hopefully not too hard to do. We could also add a i2c tx icon to the activity bar that lights up for a second or so whenever there is an i2c transmission.