I've tested this by forcing my cube to listen for udp streaming at every call to cube.show(). The way I did this was to modify my Cube::show() function, like so:
/** Make changes to the cube visible.
Causes pixel data to be written to the LED strips.
*/
void Cube::show()
{
this->strip.show();
if(this->onlinePressed) {
Particle.process();
this->listen(); // we're forcing the cube to listen for UDP streaming
}
}
So my cube would be calling the listen function, and this one would be constantly listening for data that is coming in from port 2222 and is the same size as the cube's LED count (512, in case of an 8x8x8). If it finds nothing was received, it does nothing else.
(BTW, that array should be dimensioned according to the pixel count; instead, the array is always set to a fixed size (512) - OK for 8x8x8 cubes, but probably wrong for the bigger ones. I'd change the array definition to set the dimensions with the constant that's already been set in the header file.)
/** Listen for the start of UDP streaming. */
void Cube::listen() {
int32_t bytesrecv = this->udp.parsePacket();
// no data, nothing to do
if(bytesrecv == 0) return;
if(millis() - this->lastUpdated > 60000) {
//update the network settings every minute
this->updateNetworkInfo();
this->lastUpdated = millis();
}
if(bytesrecv == PIXEL_COUNT) {
char data[512];
this->udp.read(data, bytesrecv);
for(int x = 0; x < this->size; x++) {
for(int y = 0; y < this->size; y++) {
for(int z = 0; z < this->size; z++) {
int index = z*this->size + y*this->size + x;
Color pixelColor = Color((data[index]&0xE0)>>2, (data[index]&0x1C)<<1, (data[index]&0x03)<<4); //colors with max brightness set to 64
this->setVoxel(x, y, z, pixelColor);
}
}
}
}
this->show();
}
Even with that, testing streaming apps on cubetube still did not work. So I think it's definately something going wrong in the server.
-Werner