Added logging
This commit is contained in:
committed by
Peter Poetzi
parent
f48bf8b6b6
commit
65a77fee44
@@ -168,13 +168,13 @@ void initESPNow()
|
|||||||
|
|
||||||
void handle()
|
void handle()
|
||||||
{
|
{
|
||||||
if (!ledtimer || espchrono::ago(*ledtimer) > 3s) {
|
if (!ledtimer || espchrono::ago(*ledtimer) > 3s) {
|
||||||
digitalWrite(PIN_RELAY, LOW);
|
digitalWrite(PIN_RELAY, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!last_send_ms || espchrono::ago(*last_send_ms) > 1s) {
|
if (!last_send_ms || espchrono::ago(*last_send_ms) > 1s) {
|
||||||
const auto message = fmt::format("T:{}", espchrono::utc_clock::now().time_since_epoch().count());
|
const auto message = fmt::format("T:{}", espchrono::utc_clock::now().time_since_epoch().count());
|
||||||
espnow::send_espnow_message(message);
|
send_espnow_message(message);
|
||||||
last_send_ms = espchrono::millis_clock::now();
|
last_send_ms = espchrono::millis_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +339,7 @@ esp_err_t send_espnow_message(std::string_view message)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto timeAfter = espchrono::millis_clock::now();
|
const auto timeAfter = espchrono::millis_clock::now();
|
||||||
ESP_LOGI(TAG, "Successfully executed esp_now_send(): Took %lldms", std::chrono::milliseconds{timeAfter-timeBefore}.count());
|
ESP_LOGI(TAG, "Successfully executed esp_now_send() with message %.*s (Took %lldms)", message.size(), message.data(), std::chrono::milliseconds{timeAfter-timeBefore}.count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
Reference in New Issue
Block a user