Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 1 | ## This file is a template. The comment below is emitted |
| 2 | ## into the rendered file; feel free to edit this file. |
| 3 | |
| 4 | // !!! WARNING: This is GENERATED Code... Please do NOT edit !!! |
| 5 | |
| 6 | #include <map> |
| 7 | #include "conf.hpp" |
| 8 | |
| 9 | std::map<std::string, struct sensor> SensorConfig = { |
| 10 | % for key in sensorDict.iterkeys(): |
| 11 | % if key: |
| 12 | <% |
| 13 | sensor = sensorDict[key] |
| 14 | type = sensor["type"] |
| 15 | readpath = sensor["readpath"] |
| 16 | writepath = sensor.get("writepath", "") |
| 17 | min = sensor.get("min", 0) |
| 18 | max = sensor.get("max", 0) |
| 19 | # Presently only thermal inputs have their timeout |
| 20 | # checked, but we should default it as 2s, which is |
| 21 | # the previously hard-coded value. |
| 22 | # If it's a fan sensor though, let's set the default |
| 23 | # to 0. |
| 24 | if type == "fan": |
| 25 | timeout = sensor.get("timeout", 0) |
| 26 | else: |
| 27 | timeout = sensor.get("timeout", 2) |
| 28 | %> |
| 29 | {"${key}", |
| 30 | {"${type}","${readpath}","${writepath}", ${min}, ${max}, ${timeout}}, |
| 31 | }, |
| 32 | % endif |
| 33 | % endfor |
| 34 | }; |
| 35 | |
| 36 | |