1 #pragma once 2 3 #include "pid/ec/pid.hpp" 4 #include "pid/ec/stepwise.hpp" 5 6 #include <map> 7 #include <string> 8 #include <vector> 9 10 namespace pid_control 11 { 12 namespace conf 13 { 14 15 /* 16 * General sensor structure used for configuration. 17 */ 18 struct SensorConfig 19 { 20 /* Used for listen if readPath is passive. */ 21 std::string type; 22 /* Can be a sensor path or a dbus path. */ 23 std::string readPath; 24 std::string writePath; 25 /* min/max values for writing a percentage or error checking. */ 26 int64_t min; 27 int64_t max; 28 int64_t timeout; 29 bool ignoreDbusMinMax; 30 bool unavailableAsFailed; 31 }; 32 33 /* 34 * Structure for holding the configuration of a PID. 35 */ 36 struct ControllerInfo 37 { 38 std::string type; // fan or margin or temp? 39 std::vector<std::string> inputs; // one or more sensors. 40 double setpoint; // initial setpoint for thermal. 41 union 42 { 43 ec::pidinfo pidInfo; // pid details 44 ec::StepwiseInfo stepwiseInfo; 45 }; 46 }; 47 48 /* 49 * General zone structure used for configuration. A zone is a list of PIDs 50 * and a set of configuration settings. This structure gets filled out with 51 * the zone configuration settings and not the PID details. 52 */ 53 struct ZoneConfig 54 { 55 /* The minimum set-point value we would ever want (typically in RPM) */ 56 double minThermalOutput; 57 58 /* If the sensors are in fail-safe mode, this is the percentage to use. */ 59 double failsafePercent; 60 }; 61 62 using PIDConf = std::map<std::string, ControllerInfo>; 63 64 constexpr bool DEBUG = false; // enable to print found configuration 65 66 } // namespace conf 67 } // namespace pid_control 68