(…) and send them if there is “less traffic on the line”…
Whats the best place to send those messages?
Display_Tick()?
Timer()?
Tick()?
That clearly depends:
Tick() is called every tick (as the name sais), so this will be quite often, so to speak a lot more often than AIN_Receive
Display_Tick() depends on how often it’s called. If you call it every time AIN changes, it will be the same as in AIN. So except having unordered code no gain.
Why do you want to encode MIDI Messages? When you split faders and pots over multiple Midiboxes, I think you don’t have different cases but two Core Modules in the same housing. So you need a Core-to-Core-Link as described in the link I posted above. You can send every message you like from Core1 to Core2.
MIOS is taking care for marking the messages, so they do not leave the last Core!
Timer() would be a bad choice, because it interrupts the main task, and could therefore also interrupt a MIDI stream; this could result into sporadically sent invalid MIDI events.
So, if timed transactions are required, the Timer should request a send, and Tick() should check for this request flag, clear it and send the events (similar to the approach used for DISPLAY_Tick())