From fc8a6632d515fa36aa14e95bb1bbde57a10fd43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sun, 19 Apr 2020 22:50:57 +0200 Subject: Add untested version of Powermap with all features. --- src/powermap.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/powermap.h') diff --git a/src/powermap.h b/src/powermap.h index 8dcccc9..589573f 100644 --- a/src/powermap.h +++ b/src/powermap.h @@ -26,34 +26,41 @@ */ #pragma once +#include +#include + class Powermap { +public: using Power = float; + using Powers = std::vector; struct PowerPair { Power in; Power out; + + bool operator!=(PowerPair const& other) { + return in != other.in || out != other.out; + } }; -public: - Powermap() = default; + Powermap(); - Power map(Power in) const; + Power map(Power in); void reset(); - // set parameters - void setMinInput(Power min_input); - void setMaxInput(Power max_input); - void setFixed(PowerPair fixed); + void setFixed0(PowerPair new_value); + void setFixed1(PowerPair new_value); + void setFixed2(PowerPair new_value); + void setShelf(bool enable); private: - // input parameters - Power min_input; - Power max_input; - PowerPair fixed; + // input parameters (state of this class) + std::array fixed; + bool shelf; - // spline parameters - float a1, b1, c1, d1; - float a2, b2, c2, d2; + // spline parameters (deterministically computed from the input parameters) + std::array m; + bool spline_needs_update; void updateSpline(); }; -- cgit v1.2.3