Skip to content

Commit 062cc79

Browse files
committed
Improve readability of received data.
1 parent ab2deef commit 062cc79

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

Diff for: examples/UDP_Client/UDP_Client.ino

+4-6
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,15 @@ void loop()
147147
if (rx_packet_size)
148148
{
149149
/* Print some metadata from received UDP packet. */
150-
Serial.print("Received ");
150+
Serial.print("[");
151+
Serial.print(millis());
152+
Serial.print("] Received ");
151153
Serial.print(rx_packet_size);
152154
Serial.print(" bytes from ");
153155
Serial.print(udp_client.remoteIP());
154156
Serial.print(" port ");
155157
Serial.print(udp_client.remotePort());
156-
Serial.println();
157-
158-
Serial.print("[");
159-
Serial.print(millis());
160-
Serial.print("] UDP_Client received packet content: \"");
158+
Serial.print(", data = \"");
161159

162160
/* Read from received UDP packet. */
163161
size_t const UDP_RX_MSG_BUF_SIZE = 16 + 1; /* Reserve the last byte for the '\0' termination. */

Diff for: examples/UDP_Server/UDP_Server.ino

+4-7
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,15 @@ void loop()
130130
uint16_t const destination_port = udp_server.remotePort();
131131

132132
/* Print some metadata from received UDP packet. */
133-
Serial.print("Received ");
133+
Serial.print("[");
134+
Serial.print(millis());
135+
Serial.print("] Received ");
134136
Serial.print(rx_packet_size);
135137
Serial.print(" bytes from ");
136138
Serial.print(udp_server.remoteIP());
137139
Serial.print(" port ");
138140
Serial.print(udp_server.remotePort());
139-
Serial.println();
140-
141-
Serial.print("[");
142-
Serial.print(millis());
143-
Serial.print("] UDP_Server received packet content: \"");
141+
Serial.print(", data = \"");
144142

145143
/* Read from received UDP packet. */
146144
size_t const UDP_RX_MSG_BUF_SIZE = 16 + 1; /* Reserve the last byte for the '\0' termination. */
@@ -170,7 +168,6 @@ void loop()
170168
}
171169
}
172170

173-
174171
static void OnPlcaStatus(bool success, bool plcaStatus)
175172
{
176173
if (!success)

0 commit comments

Comments
 (0)