minor fixes

This commit is contained in:
Trent Houliston 2024-05-17 13:00:59 +10:00
parent 537af5fa3b
commit 2fa3f97144
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View File

@ -52,6 +52,7 @@ void PulseMeterSensor::loop() {
} else if (this->filter_mode_ == FILTER_PULSE && current != this->last_pin_val_) {
PulseMeterSensor::pulse_intr(this);
}
this->last_pin_val_ = current;
// Swap out set and get to get the latest state from the ISR
std::swap(this->set_, this->get_);

View File

@ -49,7 +49,7 @@ class PulseMeterSensor : public sensor::Sensor, public Component {
// This struct (and the two pointers) are used to pass data between the ISR and loop.
// These two pointers are exchanged each loop.
// Use these to send data from the ISR to the loop not the other way around (except for resetting the values).
// Use these to send data from the ISR to the loop not the other way around (except for resetting the values).
struct State {
uint32_t last_detected_edge_us_ = 0;
uint32_t last_rising_edge_us_ = 0;