@@ -134,15 +134,15 @@ int16_t SoyosourceVirtualMeter::calculate_power_demand_negative_measurements_(in
134
134
ESP_LOGD (TAG, " '%s': Oscillation prevention, keeping previous demand: %d; reducing compensation" ,
135
135
this ->get_modbus_name (), last_power_demand);
136
136
} 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;
138
138
// if not really compensating at the moment and demand changes a bit more, update current time stamp: helps to
139
139
// 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 );
143
143
this ->power_demand_compensation_timestamp_ = millis ();
144
144
}
145
- this ->power_demand_compensation_ = new_demand ;
145
+ this ->power_demand_compensation_ = next_demand_compensation ;
146
146
}
147
147
ESP_LOGD (TAG, " '%s': updated power_demand_compensation_ to %d" , this ->get_modbus_name (),
148
148
this ->power_demand_compensation_ );
0 commit comments