From e86ade632dfe9d9a3d640bd37f698de0f743868d Mon Sep 17 00:00:00 2001 From: brisk Date: Mon, 7 Oct 2024 23:17:42 +1030 Subject: [PATCH] pulse_counter_ulp: Clang tidy --- .../pulse_counter_ulp/pulse_counter_ulp_sensor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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_; }