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 ec::pidinfo pidInfo; // pid details 42 ec::StepwiseInfo stepwiseInfo; 43 }; 44 45 struct CycleTime 46 { 47 /* The time interval every cycle. 0.1 seconds by default */ 48 uint64_t cycleIntervalTimeMS = 100; // milliseconds 49 50 /* The interval of updating thermals. 1 second by default */ 51 uint64_t updateThermalsTimeMS = 1000; // milliseconds 52 }; 53 54 /* 55 * General zone structure used for configuration. A zone is a list of PIDs 56 * and a set of configuration settings. This structure gets filled out with 57 * the zone configuration settings and not the PID details. 58 */ 59 struct ZoneConfig 60 { 61 /* The minimum set-point value we would ever want (typically in RPM) */ 62 double minThermalOutput; 63 64 /* If the sensors are in fail-safe mode, this is the percentage to use. */ 65 double failsafePercent; 66 67 /* Customize time settings for every cycle */ 68 CycleTime cycleTime; 69 }; 70 71 using PIDConf = std::map<std::string, ControllerInfo>; 72 73 constexpr bool DEBUG = false; // enable to print found configuration 74 75 } // namespace conf 76 } // namespace pid_control 77