Limit on number of messages in an OSC bundle?
Up to Flash
In my tests using mchelper 2.2 and heavy 1.3.1 I have found that there is a limit of 5 messages that can be sent in each OSC bundle from Flash. Why does this limit exist?
The reason I ask is because I would like to set/reset all 8 digital outs on the make controller board at the same time...Can anyone confirm this and/or suggest a workaround?
Well, let's say I adapted the DigitalOut.fla AS2 code example as per below:
TEST 1 (sets first 4 digital outs, works OK):
import com.makingthings.makecontroller.*;
var mcflash:McFlashConnect = new McFlashConnect();
var OscBundle = [];
onLoad = function () {
mcflash.connect();
};
mcflash.onConnectError = function() {
trace("Connection to Mchelper did not succeed.");
trace("** Make sure it's running, and that nothing else is listening on port " +
mcflash.mchelperPort);
};
mcflash.onBoardArrived = function(board:Board) {
mcflash.setDefaultBoard(board);
};
function setDigitalOuts() {
for (i = 0; i < 4; i++) {
var currentState:Number = 1;
OscBundle.push(new OscMessage("/digitalout/" + i + "/value", [currentState]));
}
clearInterval(wait);
mcflash.sendBundle( OscBundle );
}
wait = setInterval(setDigitalOuts, 2000);
TEST 2 (if you reset the dig outs to 0, and try to set 5, works OK):
function setDigitalOuts() {
for (i = 0; i < 5; i++) {
var currentState:Number = 1;
OscBundle.push(new OscMessage("/digitalout/" + i + "/value", [currentState]));
}
clearInterval(wait);
mcflash.sendBundle( OscBundle );
}
TEST 3 (if you reset the dig outs to 0, and try to set 6 or more, it doesn't work, mchelper logs the send requests as per normal, but the board doesn't respond):
function setDigitalOuts() {
for (i = 0; i < 6; i++) {
var currentState:Number = 1;
OscBundle.push(new OscMessage("/digitalout/" + i + "/value", [currentState]));
}
clearInterval(wait);
mcflash.sendBundle( OscBundle );
}
Yes I'm sending the same value just for testing. The real app needs varying values sent. Like 01001000 and then a minute later 10000100 for instance.
I can confirm that sending /digitalout/*/value 1 will light up all 8 test LEDs. And /digitalout/*/value 0 will switch them all off. But if you try and send 6-8 separate messages in a bundle no change is registered.I also had this problem and followed up Nick's ticket. It turns out that you can easily fix this problem by editing the file osc.c and changing the value of #OSC_MAX_MESSAGE_IN
Then just open the Heavy Example in mcbuilder, rebuild it and upload.
I changed the value from 200 to 400 and this did the trick for me.
Cheers.

