Skip to content

Commit 8e6d851

Browse files
committed
ping: change state after ping start
1 parent 5ee97c3 commit 8e6d851

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

UNOR4USBBridge/ping.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ ping_statistics execute_ping(const char* address, uint8_t ttl, uint8_t count) {
6868
cbs.on_ping_end = ping_end;
6969
cbs.cb_args = NULL;
7070

71-
_stats.status = ping_status::RUNNING;
72-
7371
if(esp_ping_new_session(&ping_config, &cbs, &esp_ping_handle) != ESP_OK) {
7472
_stats.status = ping_status::ERROR;
7573
return _stats;
@@ -81,6 +79,8 @@ ping_statistics execute_ping(const char* address, uint8_t ttl, uint8_t count) {
8179
return _stats;
8280
}
8381

82+
_stats.status = ping_status::RUNNING;
83+
8484
// wait for the end of ping session
8585
while(_stats.status == ping_status::RUNNING) {
8686
delay(10);

0 commit comments

Comments
 (0)