Sections
You are here: Home Forum Flash Limit on number of messages in an OSC bundle?

Limit on number of messages in an OSC bundle?

Up to Flash

Limit on number of messages in an OSC bundle?

Posted by Nick Gascoigne at May 13. 2008

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?

Re: Limit on number of messages in an OSC bundle?

Posted by Liam Staskawicz at May 13. 2008
How did you determine this? There's nothing purposefully imposing this limit as far as I know...

Re: Limit on number of messages in an OSC bundle?

Posted by Nick Gascoigne at May 13. 2008

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 );
}

Re: Limit on number of messages in an OSC bundle?

Posted by Liam Staskawicz at May 14. 2008
First off, even before looking further into it, are you always sending the same value to all the digital outs or is that just for testing? If that's the case, you could just send /digitalout/*/value 1, for example. Otherwise, off the top of my head, there may be an upper bound on the amount of data received in a single UDP packet on the board...this would be a bit more of a pain to fix.

Re: Limit on number of messages in an OSC bundle?

Posted by Nick Gascoigne at May 15. 2008

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.



Re: Limit on number of messages in an OSC bundle?

Posted by Nick Gascoigne at May 15. 2008

Could any of the jumper configurations on the board be causing this behaviour?

Re: Limit on number of messages in an OSC bundle?

Posted by Liam Staskawicz at May 15. 2008
No, the jumpers are unrelated. I think this might require further investigation... I would add an issue to the tracker - http://dev.makingthings.com And in the meantime, I would probably send out 2 bundles of 4 messages each to work around it. Sorry bout that.

Re: Limit on number of messages in an OSC bundle?

Posted by Nick Gascoigne at May 17. 2008

Thanks Liam, I've added that issue for further investigation.

Re: Limit on number of messages in an OSC bundle?

Posted by Scott Jackman at September 18. 2008

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.

Powered by Ploneboard
Document Actions