Skip to content

Commit

Permalink
Merge pull request #34 from trombik/bugfix_33
Browse files Browse the repository at this point in the history
bugfix: decrease log level of statistics and individual ping results
  • Loading branch information
trombik authored Jan 30, 2023
2 parents 1310809 + 077ebf9 commit 7248312
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
- latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.8'
python-version: '3.10'

- name: Install pipenv
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.10'

- name: Install pipenv
run: |
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ flake8 = "3.9.2"
black = "21.7b0"

[requires]
python_version = "3.8"
python_version = "3.10"

[pipenv]
allow_prereleases = true
10 changes: 5 additions & 5 deletions components/ping/ping_esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PingSensorESP32 : public PingSensor {
esp_ping_get_profile(hdl, ESP_PING_PROF_IPADDR, &target_addr, sizeof(target_addr));
esp_ping_get_profile(hdl, ESP_PING_PROF_SIZE, &recv_len, sizeof(recv_len));
esp_ping_get_profile(hdl, ESP_PING_PROF_TIMEGAP, &elapsed_time, sizeof(elapsed_time));
ESP_LOGI(TAG, "%d bytes from %s icmp_seq=%d ttl=%d time=%d ms", recv_len, ipaddr_ntoa((ip_addr_t *) &target_addr),
ESP_LOGV(TAG, "%d bytes from %s icmp_seq=%d ttl=%d time=%d ms", recv_len, ipaddr_ntoa((ip_addr_t *) &target_addr),
seqno, ttl, elapsed_time);
this->incr_total_success_time(elapsed_time);
}
Expand All @@ -101,11 +101,11 @@ class PingSensorESP32 : public PingSensor {
}

if (IP_IS_V4(&target_addr)) {
ESP_LOGI(TAG, "--- %s ping statistics ---", inet_ntoa(*ip_2_ip4(&target_addr)));
ESP_LOGD(TAG, "--- %s ping statistics ---", inet_ntoa(*ip_2_ip4(&target_addr)));
} else {
ESP_LOGI(TAG, "--- %s ping statistics ---", inet6_ntoa(*ip_2_ip6(&target_addr)));
ESP_LOGD(TAG, "--- %s ping statistics ---", inet6_ntoa(*ip_2_ip6(&target_addr)));
}
ESP_LOGI(TAG, "%d packets transmitted, %d received, %d%% packet loss, total time %dms avg time %dms", transmitted,
ESP_LOGD(TAG, "%d packets transmitted, %d received, %d%% packet loss, total time %dms avg time %dms", transmitted,
received, loss, total_time_ms, mean);

this->set_latest_loss(loss);
Expand All @@ -119,7 +119,7 @@ class PingSensorESP32 : public PingSensor {
ip_addr_t target_addr;
esp_ping_get_profile(hdl, ESP_PING_PROF_SEQNO, &seqno, sizeof(seqno));
esp_ping_get_profile(hdl, ESP_PING_PROF_IPADDR, &target_addr, sizeof(target_addr));
ESP_LOGI(TAG, "From %s icmp_seq=%d timeout", ipaddr_ntoa((ip_addr_t *) &target_addr), seqno);
ESP_LOGV(TAG, "From %s icmp_seq=%d timeout", ipaddr_ntoa((ip_addr_t *) &target_addr), seqno);
}

protected:
Expand Down
6 changes: 3 additions & 3 deletions components/ping/ping_esp8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class PingSensorESP8266 : public PingSensor {
void setup() override {
ping.on(EACH_RESULT, [this](const AsyncPingResponse &response) {
if (response.answer) {
ESP_LOGI(TAG, "%d bytes from %s: icmp_seq=%d ttl=%d time=%d ms", response.size, target.c_str(),
ESP_LOGV(TAG, "%d bytes from %s: icmp_seq=%d ttl=%d time=%d ms", response.size, target.c_str(),
response.icmp_seq, response.ttl, response.time);

this->incr_total_success_time(response.time);
} else {
ESP_LOGI(TAG, "no reply from %s", target.c_str());
ESP_LOGV(TAG, "no reply from %s", target.c_str());
}
return false;
});
Expand All @@ -58,7 +58,7 @@ class PingSensorESP8266 : public PingSensor {
this->set_latest_loss(loss * 100);
this->set_latest_latency(mean);

ESP_LOGI(TAG, "packet loss: %0.1f %% latency: %d ms", loss * 100, mean);
ESP_LOGD(TAG, "packet loss: %0.1f %% latency: %d ms", loss * 100, mean);
this->reset();
return true;
});
Expand Down

0 comments on commit 7248312

Please sign in to comment.