[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
fd43050842
commit
eee6f5e4d5
|
@ -7,7 +7,8 @@ namespace ratgdo {
|
|||
|
||||
static const char* TAG = "ratgdo.output";
|
||||
|
||||
void RATGDOOutput::setup(){
|
||||
void RATGDOOutput::setup()
|
||||
{
|
||||
ESP_LOGD(TAG, "Output was setup");
|
||||
|
||||
if (this->output_type_ == OutputType::RATGDO_BEEPER) {
|
||||
|
@ -27,25 +28,29 @@ void RATGDOOutput::setup(){
|
|||
this->repeat_ = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void RATGDOOutput::play(){
|
||||
void RATGDOOutput::play()
|
||||
{
|
||||
this->beeper_->play(this->rtttlSong_);
|
||||
}
|
||||
|
||||
void RATGDOOutput::finished_playback(){
|
||||
if(this->repeat_) this->play();
|
||||
void RATGDOOutput::finished_playback()
|
||||
{
|
||||
if (this->repeat_)
|
||||
this->play();
|
||||
}
|
||||
|
||||
void RATGDOOutput::dump_config() {
|
||||
void RATGDOOutput::dump_config()
|
||||
{
|
||||
if (this->output_type_ == OutputType::RATGDO_BEEPER) {
|
||||
ESP_LOGCONFIG(TAG, " Type: Beeper");
|
||||
}
|
||||
}
|
||||
|
||||
void RATGDOOutput::set_output_type(OutputType output_type_) {
|
||||
void RATGDOOutput::set_output_type(OutputType output_type_)
|
||||
{
|
||||
this->output_type_ = output_type_;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "../ratgdo.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/rtttl/rtttl.h"
|
||||
#include "esphome/core/component.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ratgdo {
|
||||
|
|
|
@ -361,13 +361,15 @@ namespace ratgdo {
|
|||
this->closing_duration = duration;
|
||||
}
|
||||
|
||||
void RATGDOComponent::set_target_distance_measurement(int16_t distance){
|
||||
void RATGDOComponent::set_target_distance_measurement(int16_t distance)
|
||||
{
|
||||
this->target_distance_measurement = distance;
|
||||
}
|
||||
|
||||
void RATGDOComponent::set_distance_measurement(int16_t distance)
|
||||
{
|
||||
if(distance > 0 && distance < MIN_DISTANCE) return;
|
||||
if (distance > 0 && distance < MIN_DISTANCE)
|
||||
return;
|
||||
|
||||
this->last_distance_measurement = distance;
|
||||
|
||||
|
@ -395,8 +397,10 @@ namespace ratgdo {
|
|||
}
|
||||
}
|
||||
|
||||
if(all_in_range) this->vehicle_detected_state = VehicleDetectedState::YES;
|
||||
if(all_out_of_range) this->vehicle_detected_state = VehicleDetectedState::NO;
|
||||
if (all_in_range)
|
||||
this->vehicle_detected_state = VehicleDetectedState::YES;
|
||||
if (all_out_of_range)
|
||||
this->vehicle_detected_state = VehicleDetectedState::NO;
|
||||
|
||||
// auto k = this->distance_measurement;
|
||||
// ESP_LOGD(TAG,"measure: %i,%i,%i,%i,%i,%i,%i,%i,%i,%i; target: %i; all_in: %s; all_out: %s;", k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9], *this->target_distance_measurement, all_in_range ? "y" : "n", all_out_of_range ? "y" : "n");
|
||||
|
|
|
@ -39,4 +39,3 @@ async def to_code(config):
|
|||
if CONF_PIN in config:
|
||||
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||
cg.add(var.set_pin(pin))
|
||||
|
||||
|
|
Loading…
Reference in New Issue