Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 3 | #include "pid/ec/pid.hpp" |
| 4 | |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 5 | #include <map> |
| 6 | #include <string> |
| 7 | #include <vector> |
| 8 | |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 9 | /* |
| 10 | * General sensor structure used for configuration. |
| 11 | */ |
| 12 | struct sensor |
| 13 | { |
| 14 | /* Used for listen if readpath is passive. */ |
| 15 | std::string type; |
| 16 | /* Can be a sensor path or a dbus path. */ |
| 17 | std::string readpath; |
| 18 | std::string writepath; |
| 19 | /* min/max values for writing a percentage or error checking. */ |
| 20 | int64_t min; |
| 21 | int64_t max; |
| 22 | int64_t timeout; |
| 23 | }; |
| 24 | |
| 25 | /* |
| 26 | * Structure for holding the configuration of a PID. |
| 27 | */ |
| 28 | struct controller_info |
| 29 | { |
| 30 | std::string type; // fan or margin or temp? |
| 31 | std::vector<std::string> inputs; // one or more sensors. |
| 32 | float setpoint; // initial setpoint for thermal. |
| 33 | ec::pidinfo info; // pid details |
| 34 | }; |
| 35 | |
| 36 | /* |
| 37 | * General zone structure used for configuration. A zone is a list of PIDs |
| 38 | * and a set of configuration settings. This structure gets filled out with |
| 39 | * the zone configuration settings and not the PID details. |
| 40 | */ |
| 41 | struct zone |
| 42 | { |
| 43 | /* The minimum RPM value we would ever want. */ |
| 44 | float minthermalrpm; |
| 45 | |
| 46 | /* If the sensors are in fail-safe mode, this is the percentage to use. */ |
| 47 | float failsafepercent; |
| 48 | }; |
| 49 | |
| 50 | using PIDConf = std::map<std::string, struct controller_info>; |