diff --git a/esphome/components/pulse_counter_ulp/pulse_counter_ulp_sensor.cpp b/esphome/components/pulse_counter_ulp/pulse_counter_ulp_sensor.cpp index 617251424b..8101b71463 100644 --- a/esphome/components/pulse_counter_ulp/pulse_counter_ulp_sensor.cpp +++ b/esphome/components/pulse_counter_ulp/pulse_counter_ulp_sensor.cpp @@ -1,10 +1,11 @@ #include "pulse_counter_ulp_sensor.h" -#include "esphome/core/log.h" -#include "esp32/ulp.h" -#include "soc/rtc_periph.h" #include "driver/rtc_io.h" +#include "esp32/ulp.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" +#include "soc/rtc_periph.h" +#include "ulp_main.h" #include -#include namespace esphome { namespace pulse_counter_ulp { @@ -71,7 +72,7 @@ std::unique_ptr UlpProgram::start(const Config &config) { return nullptr; } - return std::unique_ptr(new UlpProgram()); + return make_unique(); } UlpProgram::State UlpProgram::pop_state() { @@ -107,7 +108,7 @@ void PulseCounterUlpSensor::setup() { this->storage_ = UlpProgram::start(this->config_); } else { ESP_LOGD(TAG, "Woke up from sleep, skipping set-up of ULP program"); - this->storage_ = std::unique_ptr(new UlpProgram); + this->storage_ = make_unique(); UlpProgram::State state = this->storage_->peek_state(); this->last_time_ = clock::now() - state.run_count_ * state.mean_exec_time_; }