blob: 95bdeaab0d2b4b43f6ff50ca774298ab8b4dc239 [file] [log] [blame]
Patrick Venturee6206562018-03-08 15:36:53 -08001#pragma once
2
Patrick Ventureda4a5dd2018-08-31 09:42:48 -07003#include "pid/ec/pid.hpp"
James Feist22c257a2018-08-31 14:07:12 -07004#include "pid/ec/stepwise.hpp"
Patrick Ventureda4a5dd2018-08-31 09:42:48 -07005
Patrick Venturee6206562018-03-08 15:36:53 -08006#include <map>
7#include <string>
8#include <vector>
9
James Feist75eb7692019-02-25 12:50:02 -080010namespace conf
11{
James Feistf81f2882019-02-26 11:26:36 -080012
Patrick Venturee6206562018-03-08 15:36:53 -080013/*
14 * General sensor structure used for configuration.
15 */
Patrick Venturef3252312018-10-30 08:42:53 -070016struct SensorConfig
Patrick Venturee6206562018-03-08 15:36:53 -080017{
Patrick Venture69c51062019-02-11 09:46:03 -080018 /* Used for listen if readPath is passive. */
Patrick Venturee6206562018-03-08 15:36:53 -080019 std::string type;
20 /* Can be a sensor path or a dbus path. */
Patrick Venture69c51062019-02-11 09:46:03 -080021 std::string readPath;
22 std::string writePath;
Patrick Venturee6206562018-03-08 15:36:53 -080023 /* min/max values for writing a percentage or error checking. */
24 int64_t min;
25 int64_t max;
26 int64_t timeout;
27};
28
29/*
30 * Structure for holding the configuration of a PID.
31 */
Patrick Venturef3252312018-10-30 08:42:53 -070032struct ControllerInfo
Patrick Venturee6206562018-03-08 15:36:53 -080033{
34 std::string type; // fan or margin or temp?
35 std::vector<std::string> inputs; // one or more sensors.
Patrick Venture5f59c0f2018-11-11 12:55:14 -080036 double setpoint; // initial setpoint for thermal.
James Feist22c257a2018-08-31 14:07:12 -070037 union
38 {
39 ec::pidinfo pidInfo; // pid details
40 ec::StepwiseInfo stepwiseInfo;
41 };
Patrick Venturee6206562018-03-08 15:36:53 -080042};
43
44/*
45 * General zone structure used for configuration. A zone is a list of PIDs
46 * and a set of configuration settings. This structure gets filled out with
47 * the zone configuration settings and not the PID details.
48 */
Patrick Venturef3252312018-10-30 08:42:53 -070049struct ZoneConfig
Patrick Venturee6206562018-03-08 15:36:53 -080050{
Patrick Venturef7a2dd52019-07-16 14:31:13 -070051 /* The minimum set-point value we would ever want (typically in RPM) */
James Feist3484bed2019-02-25 13:28:18 -080052 double minThermalOutput;
Patrick Venturee6206562018-03-08 15:36:53 -080053
54 /* If the sensors are in fail-safe mode, this is the percentage to use. */
Patrick Venture8e2fdb32019-02-11 09:39:59 -080055 double failsafePercent;
Patrick Venturee6206562018-03-08 15:36:53 -080056};
57
Patrick Venturef3252312018-10-30 08:42:53 -070058using PIDConf = std::map<std::string, struct ControllerInfo>;
James Feistf81f2882019-02-26 11:26:36 -080059
60} // namespace conf