Skip to content

Commit bbf3343

Browse files
author
Kevin Hübner
committed
renamed variable
1 parent c3069c2 commit bbf3343

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

components/soyosource_virtual_meter/soyosource_virtual_meter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ int16_t SoyosourceVirtualMeter::calculate_power_demand_negative_measurements_(in
134134
ESP_LOGD(TAG, "'%s': Oscillation prevention, keeping previous demand: %d; reducing compensation",
135135
this->get_modbus_name(), last_power_demand);
136136
} else {
137-
int16_t new_demand = this->power_demand_compensation_ + power_demand - last_power_demand;
137+
int16_t next_demand_compensation = this->power_demand_compensation_ + power_demand - last_power_demand;
138138
// if not really compensating at the moment and demand changes a bit more, update current time stamp: helps to
139139
// reduce false time-outs
140-
if (abs(this->power_demand_compensation_) <= 15 && abs(new_demand) > 30) {
141-
ESP_LOGD(TAG, "'%s': resetting only timeout: power_demand_compensation_: %d; new_deman: %d",
142-
this->get_modbus_name(), this->power_demand_compensation_, new_demand);
140+
if (abs(this->power_demand_compensation_) <= 15 && abs(next_demand_compensation) > 30) {
141+
ESP_LOGD(TAG, "'%s': resetting only timeout: power_demand_compensation_: %d; next_demand_compensation: %d",
142+
this->get_modbus_name(), this->power_demand_compensation_, next_demand_compensation);
143143
this->power_demand_compensation_timestamp_ = millis();
144144
}
145-
this->power_demand_compensation_ = new_demand;
145+
this->power_demand_compensation_ = next_demand_compensation;
146146
}
147147
ESP_LOGD(TAG, "'%s': updated power_demand_compensation_ to %d", this->get_modbus_name(),
148148
this->power_demand_compensation_);

0 commit comments

Comments
 (0)