Add verbose logging for pulse width calculation in pulse_meter (#8124)

This commit is contained in:
Djordje Mandic 2025-01-23 00:07:26 +01:00 committed by GitHub
parent 0c032bc431
commit d4857a1727
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,6 +75,8 @@ void PulseMeterSensor::loop() {
case MeterState::RUNNING: {
uint32_t delta_us = this->get_->last_detected_edge_us_ - this->last_processed_edge_us_;
float pulse_width_us = delta_us / float(this->get_->count_);
ESP_LOGV(TAG, "New pulse, delta: %" PRIu32 " µs, count: %" PRIu32 ", width: %.5f µs", delta_us,
this->get_->count_, pulse_width_us);
this->publish_state((60.0f * 1000000.0f) / pulse_width_us);
} break;
}