UdpProto: fixed data offset

This commit is contained in:
Thomas Kolb 2021-02-23 22:31:31 +01:00
parent 5da4548e25
commit 45475cb89d

View file

@ -43,10 +43,10 @@ impl UdpProto
return Ok( () ); return Ok( () );
} }
self.packet_offset = 0;
self.socket.send(&self.packet[0..self.packet_offset])?; self.socket.send(&self.packet[0..self.packet_offset])?;
self.packet_offset = 0;
Ok( () ) Ok( () )
} }
@ -58,7 +58,7 @@ impl UdpProto
self.packet[self.packet_offset + 2] = led; self.packet[self.packet_offset + 2] = led;
for i in 0 .. data.len() { for i in 0 .. data.len() {
self.packet[self.packet_offset + i] = data[i]; self.packet[self.packet_offset + i + 3] = data[i];
} }
self.packet_offset += 7; self.packet_offset += 7;