Chat freely about anything...

User avatar
By Trey
#40402 Hopefully someone can give me a logical explanation for this.

I have external code on 3 platforms. This code communicates with my ESP via UDP.

Right off I realized sending large packets caused the esp to reset/panic.

I changed my code to send smaller packets and it works great. Now to get to the issue.

The esp is getting getting 28 byte packages. That represent int's for settings.

What I can't figure out is why bytes 8 9 11 12 always return 0 on the receiving side, when I see that the data is being passed correctly from all external apps.

Example Code:

byte packetBuffer[] = "28";
Udp.read(packetBuffer,28);

ArrayToInteger converter;
converter.array[0] = packetBuffer[8];
converter.array[1] = packetBuffer[9];
converter.array[2] = packetBuffer[10];
converter.array[3] = packetBuffer[11];
data_between_8_and_11 = converter.integer;
yield();

Thanks in advance.
User avatar
By Trey
#40441 So I am able to get a value from 8,9,10 & 11 now. Thank you.
However my data is coming out with blanks still if i fill up the 8 bytes I have been leaving blank.

(1st set of 4 is packet id that gets sent in a response and checked before the next packet is sent
2nd Set of 4 bytes holds a pointer to the proper copy to index in a larger array that can not exceed 5080 bytes)

converter.array[0] = packetBuffer[4];
converter.array[1] = packetBuffer[5];
converter.array[2] = packetBuffer[6];
converter.array[3] = packetBuffer[7];
packet_index = converter.integer;

//before works bytes 16 thru 28
//std::copy(packetBuffer + 16, packetBuffer + 28, pixelData + packet_index );

This mangles data and is full of 0's
std::copy(packetBuffer + 8, packetBuffer + 28, pixelData + packet_index );

Same thing if I increase the packet size to 32 or 36 bytes