Skip to content

Commit 41003e0

Browse files
committed
Correct return values for actions
1 parent 2803fa4 commit 41003e0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

components/sen5x/sen5x.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,15 +1005,15 @@ namespace esphome
10051005
return result;
10061006
}
10071007

1008-
void SEN5XComponent::set_ambient_pressure_compensation(float pressure_in_hpa)
1008+
bool SEN5XComponent::set_ambient_pressure_compensation(float pressure_in_hpa)
10091009
{
10101010
if (this->model_.value() == SEN63C || this->model_.value() == SEN66)
10111011
{
10121012
uint16_t new_ambient_pressure = (uint16_t)pressure_in_hpa;
10131013
if (!this->initialized_)
10141014
{
10151015
this->co2_ambient_pressure_ = new_ambient_pressure;
1016-
return;
1016+
return false;
10171017
}
10181018
// Only send pressure value if it has changed since last update
10191019
if (new_ambient_pressure != this->co2_ambient_pressure_)
@@ -1026,6 +1026,7 @@ namespace esphome
10261026
{
10271027
ESP_LOGD(TAG, "Ambient Pressure compensation skipped - no change required");
10281028
}
1029+
return true;
10291030
}
10301031
else
10311032
{
@@ -1043,7 +1044,7 @@ namespace esphome
10431044
{
10441045
ESP_LOGE(TAG, ESP_LOG_MSG_FAN_CLEAN_FAIL);
10451046
this->initialized_ = true;
1046-
return true;
1047+
return false;
10471048
}
10481049
this->set_timeout(1000, [this]()
10491050
{
@@ -1093,7 +1094,7 @@ namespace esphome
10931094
{
10941095
ESP_LOGE(TAG, ESP_LOG_MSG_ACT_SHT_HEATER_FAIL);
10951096
this->initialized_ = true;
1096-
return true;
1097+
return false;
10971098
}
10981099
this->set_timeout(1000, [this]()
10991100
{
@@ -1139,7 +1140,7 @@ namespace esphome
11391140
{
11401141
ESP_LOGE(TAG, ESP_LOG_MSG_CO2_CAL_FAIL);
11411142
this->initialized_ = true;
1142-
return true;
1143+
return false;
11431144
}
11441145
this->set_timeout(1000, [this, co2]()
11451146
{

components/sen5x/sen5x.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class SEN5XComponent : public PollingComponent, public sensirion_common::Sensiri
107107
bool start_fan_cleaning();
108108
bool activate_heater();
109109
bool perform_forced_co2_calibration(uint16_t co2);
110-
void set_ambient_pressure_compensation(float pressure_in_hpa);
110+
bool set_ambient_pressure_compensation(float pressure_in_hpa);
111111

112112
protected:
113113
bool is_sen5x();

0 commit comments

Comments
 (0)