1 #pragma once 2 3 #include "conf.hpp" 4 #include "pid/ec/pid.hpp" 5 6 #include <cstdint> 7 #include <limits> 8 #include <map> 9 #include <string> 10 #include <vector> 11 12 namespace pid_control 13 { 14 15 void tryRestartControlLoops(bool first = true); 16 17 /* 18 * Given a configuration structure, fill out the information we use within the 19 * PID loop. 20 */ 21 void initializePIDStruct(ec::pid_info_t* info, const ec::pidinfo& initial); 22 23 void dumpPIDStruct(ec::pid_info_t* info); 24 25 struct SensorThresholds 26 { 27 double lowerThreshold = std::numeric_limits<double>::quiet_NaN(); 28 double upperThreshold = std::numeric_limits<double>::quiet_NaN(); 29 }; 30 31 /* 32 * Given a path that optionally has a glob portion, fill it out. 33 */ 34 std::string FixupPath(std::string original); 35 36 /* 37 * Splice together two vectors, "Inputs" and "TempToMargin" from JSON, 38 * into one vector of SensorInput structures containing info from both. 39 */ 40 std::vector<conf::SensorInput> spliceInputs( 41 const std::vector<std::string>& inputNames, 42 const std::vector<double>& inputTempToMargin, 43 const std::vector<std::string>& missingAcceptableNames); 44 45 /* 46 * Recovers the original "Inputs" vector from spliceInputs(). 47 */ 48 std::vector<std::string> splitNames( 49 const std::vector<conf::SensorInput>& sensorInputs); 50 51 /* 52 * Dump active configuration. 53 */ 54 void debugPrint(const std::map<std::string, conf::SensorConfig>& sensorConfig, 55 const std::map<int64_t, conf::PIDConf>& zoneConfig, 56 const std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig); 57 58 } // namespace pid_control 59