Hello, I am trying to create a wifi box. Using the available code, I made some modifications to use esp8266, I got it to work halfway. In the EOS terminal I see that it receives ping and subcrisciption of parameters. The problem is in the last part of the code when we ask that you receive parameters from EOS.
the original code says
// Then we check to see if any OSC commands have come from Eos | |
// and update the display accordingly. | |
size = SLIPSerial.available(); | |
if (size > 0) | |
{ | |
// Fill the msg with all of the available bytes | |
while (size--) | |
curMsg += (char)(SLIPSerial.read()); | |
} | |
if (SLIPSerial.endofPacket()) | |
{ | |
parseOSCMessage(curMsg); | |
lastMessageRxTime = millis(); | |
// We only care about the ping if we haven't heard recently | |
// Clear flag when we get any traffic | |
timeoutPingSent = false; | |
curMsg = String(); | |
} | |
if (lastMessageRxTime > 0) | |
{ | |
unsigned long diff = millis() - lastMessageRxTime; | |
//We first check if it's been too long and we need to time out | |
if (diff > TIMEOUT_AFTER_IDLE_INTERVAL) | |
{ | |
connectedToConsole = ConsoleNone; | |
lastMessageRxTime = 0; | |
updateDisplay = true; | |
timeoutPingSent = false; | |
} | |
//It could be the console is sitting idle. Send a ping once to | |
// double check that it's still there, but only once after 2.5s have passed | |
if (!timeoutPingSent && diff > PING_AFTER_IDLE_INTERVAL) | |
{ | |
OSCMessage ping("/eos/ping"); | |
ping.add(BOX_NAME_STRING "_hello"); // This way we know who is sending the ping | |
SLIPSerial.beginPacket(); | |
ping.send(SLIPSerial); | |
SLIPSerial.endPacket(); | |
timeoutPingSent = true; | |
} | |
} | |
if (updateDisplay) | |
displayStatus(); | |
} |
and I'm trying to do it that way
size = Udp.available();
if (size > 0)
{
// Fill the msg with all of the available bytes
while (size--)
curMsg += (char)(Udp.read());
}
if (Udp.endofPacket())
{
parseOSCMessage(curMsg);
lastMessageRxTime = millis();
// We only care about the ping if we haven't heard recently
// Clear flag when we get any traffic
timeoutPingSent = false;
curMsg = String();
}
if (lastMessageRxTime > 0)
{
unsigned long diff = millis() - lastMessageRxTime;
//We first check if it's been too long and we need to time out
if (diff > TIMEOUT_AFTER_IDLE_INTERVAL)
{
connectedToConsole = ConsoleNone;
lastMessageRxTime = 0;
updateDisplay = true;
timeoutPingSent = false;
}
//It could be the console is sitting idle. Send a ping once to
// double check that it's still there, but only once after 2.5s have passed
if (!timeoutPingSent && diff > PING_AFTER_IDLE_INTERVAL)
{
OSCMessage ping("/eos/ping");
ping.add(BOX_NAME_STRING "_hello"); // This way we know who is sending the ping
Udp.beginPacket(outIp, outPort);
ping.send(Udp);
Udp.endPacket();
timeoutPingSent = true;
}
}
if (updateDisplay)
displayStatus();
}
}
I have the problem in the line marked in red. what would be the correct way to translate this for "Udp"?
Thanks!!