blob: cfea2781ea1654be0e58a080e87db4b1ec4a1f91 [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
Patrick Venturee6206562018-03-08 15:36:53 -080010/*
11 * General sensor structure used for configuration.
12 */
Patrick Venturef3252312018-10-30 08:42:53 -070013struct SensorConfig
Patrick Venturee6206562018-03-08 15:36:53 -080014{
Patrick Venture69c51062019-02-11 09:46:03 -080015 /* Used for listen if readPath is passive. */
Patrick Venturee6206562018-03-08 15:36:53 -080016 std::string type;
17 /* Can be a sensor path or a dbus path. */
Patrick Venture69c51062019-02-11 09:46:03 -080018 std::string readPath;
19 std::string writePath;
Patrick Venturee6206562018-03-08 15:36:53 -080020 /* min/max values for writing a percentage or error checking. */
21 int64_t min;
22 int64_t max;
23 int64_t timeout;
24};
25
26/*
27 * Structure for holding the configuration of a PID.
28 */
Patrick Venturef3252312018-10-30 08:42:53 -070029struct ControllerInfo
Patrick Venturee6206562018-03-08 15:36:53 -080030{
31 std::string type; // fan or margin or temp?
32 std::vector<std::string> inputs; // one or more sensors.
Patrick Venture5f59c0f2018-11-11 12:55:14 -080033 double setpoint; // initial setpoint for thermal.
James Feist22c257a2018-08-31 14:07:12 -070034 union
35 {
36 ec::pidinfo pidInfo; // pid details
37 ec::StepwiseInfo stepwiseInfo;
38 };
Patrick Venturee6206562018-03-08 15:36:53 -080039};
40
41/*
42 * General zone structure used for configuration. A zone is a list of PIDs
43 * and a set of configuration settings. This structure gets filled out with
44 * the zone configuration settings and not the PID details.
45 */
Patrick Venturef3252312018-10-30 08:42:53 -070046struct ZoneConfig
Patrick Venturee6206562018-03-08 15:36:53 -080047{
48 /* The minimum RPM value we would ever want. */
Patrick Venture8e2fdb32019-02-11 09:39:59 -080049 double minThermalRpm;
Patrick Venturee6206562018-03-08 15:36:53 -080050
51 /* If the sensors are in fail-safe mode, this is the percentage to use. */
Patrick Venture8e2fdb32019-02-11 09:39:59 -080052 double failsafePercent;
Patrick Venturee6206562018-03-08 15:36:53 -080053};
54
Patrick Venturef3252312018-10-30 08:42:53 -070055using PIDConf = std::map<std::string, struct ControllerInfo>;