mirror of
https://github.com/esphome/esphome.git
synced 2026-09-21 12:08:38 +00:00
Merge remote-tracking branch 'upstream/sensor_calibrate_linear_static_array' into integration
This commit is contained in:
@@ -539,12 +539,7 @@ optional<float> calibrate_linear_compute(const std::array<float, 3> *functions,
|
||||
template<size_t N> class CalibrateLinearFilter : public Filter {
|
||||
public:
|
||||
explicit CalibrateLinearFilter(std::initializer_list<std::array<float, 3>> linear_functions) {
|
||||
size_t i = 0;
|
||||
for (const auto &f : linear_functions) {
|
||||
if (i >= N)
|
||||
break;
|
||||
this->linear_functions_[i++] = f;
|
||||
}
|
||||
init_array_from(this->linear_functions_, linear_functions);
|
||||
}
|
||||
optional<float> new_value(float value) override {
|
||||
return calibrate_linear_compute(this->linear_functions_.data(), N, value);
|
||||
|
||||
Reference in New Issue
Block a user