Code:
case RECEIVING_T_PACKET:
if(packet_buffer_index < sizeof(T_Packet_Data_Type)) // still building the packet?
{
// move packet character to our buffer
packet_buffer[packet_buffer_index] = byte;
packet_buffer_index++;
}
if(packet_buffer_index == sizeof(T_Packet_Data_Type)) // complete packet?
{
T_Packet_Data.mx = packet_buffer[0];
T_Packet_Data.my = packet_buffer[1];
T_Packet_Data.x1 = packet_buffer[2];
T_Packet_Data.y1 = packet_buffer[3];
T_Packet_Data.x2 = packet_buffer[4];
T_Packet_Data.y2 = packet_buffer[5];
T_Packet_Data.pixels = packet_buffer[6];
T_Packet_Data.confidence = packet_buffer[7];
camera_t_packets++;
state = UNSYNCHRONIZED; // we're done; go back to the unsynchronized state
This is one of the switch-cases of the Camera_State_Machine function.
I'd like to understand how it determains the blob size given in the terminal so I can also use it in autonomous mode(T_Packet_Data.pixels = packet_buffer[6];, what happens in that code line).