ofxOscMessage makes photon restart

when sending OSC message from OF to particle Photon device.
it include 3 r,g,b values as Int.

it’s pretty works fine by processing but with oF, photon reboot.
quite embarrasing… it should be super hard to fix easily.

is there anything differenct between ofxOscMessage and processing oscMessage?

for more information,
this is the photon’s osc parsing codes.
it’s rely on simple-osc library
I guess simple-OSC is not error checking (like size of args).
anyway at the moment, I’m gonna write processing app as “osc message router”.

// OSC MESSAGE
void checkOSCMessage(){
	OSCMessage inMessage;

	// if the incoming OSC packet is larger than 0 bytes
	int size = 0;
	size = osc.parsePacket();
	if (size > 0) {	
		// copy each byte from the incoming packet to the message object
		while (size > 0) {
			inMessage.fill(osc.read());
			size--;
		}
		
		// if the message can be parsed
		if (inMessage.parse()) {	
			// Serial.println("Message Received");
			// register callback function with OSC address
			inMessage.route("/core1", saveColor);
			inMessage.route("/easing", setEasing);
		}
	}
}


// callBack function
void saveColor(OSCMessage &inMessage){
	// Serial.println("got message from /core1");
	tR = inMessage.getInt(0);
	tG = inMessage.getInt(1);
	tB = inMessage.getInt(2);
	// Serial.print(R)
}

void setEasing(OSCMessage &inMessage){
	ease = inMessage.getFloat(0);
}

simple-OSC::getInt()

int OSCMessage::getInt(int offset)
{
	return (inputDatas[4*offset] << 24) | (inputDatas[4*offset+1] << 16) | (inputDatas[4*offset+2] << 8) | inputDatas[4*offset+3];
}

some ideas to debug this:

  • oF is sending osc messages as bundles by default, maybe that could be an issue
  • could it be that it is caused by the amount of messages sent to the photon?
  • could you replace simple-osc by something like cnmat/osc?

here is a little tool which i usually use to debug osc communications. you can easily send single messages or record multiple messages and replay them.

1 Like

thank you!!! sending message as bundle is the reason!

sender.sendMessage(message, false);            // <- disable as bundle