[components][netdev] Fix ping maximum & minimum latency counting

This commit is contained in:
Huoyanlifusu authored and Rbb666 committed 2026-10-29 09:33:44 +08:00
1 parent b88861d285
commit 6040d6cf2c
1 file changed
+5 -1
+5 -1
View File
@@ -1400,7 +1400,11 @@ int netdev_cmd_ping(char* target_name, char *netdev_name, rt_uint32_t times, rt_
ping_resp.data_len, inet_ntoa(ping_resp.ip_addr), index + 1, ping_resp.ttl, ping_resp.ticks);
}
received += 1;
if (ping_resp.ticks > max_time)
if (received == 1)
{
max_time = min_time = ping_resp.ticks;
}
else if (ping_resp.ticks > max_time)
{
max_time = ping_resp.ticks;
}