add tuning enable variable
Add a variable that when set, enables tuning logging. This variable is
set to false.
Tuning can be enabled via "-t" "--tuning" on the command line.
With a parameter is the path where to write the logging information.
Change-Id: I6eb8035d56cc3301face21e9375c02fc9fcc5b31
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/pid/zone.hpp b/pid/zone.hpp
index 94082e9..a458011 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -5,6 +5,7 @@
#include "pidcontroller.hpp"
#include "sensors/manager.hpp"
#include "sensors/sensor.hpp"
+#include "tuning.hpp"
#include <fstream>
#include <map>
@@ -51,9 +52,10 @@
_minThermalOutputSetPt(minThermalOutput),
_failSafePercent(failSafePercent), _mgr(mgr)
{
-#ifdef __TUNING_LOGGING__
- _log.open("/tmp/swampd.log");
-#endif
+ if (tuningLoggingEnabled && !tuningLoggingPath.empty())
+ {
+ _log.open(tuningLoggingPath);
+ }
}
double getMaxRPMRequest(void) const override;
@@ -87,10 +89,8 @@
void addFanInput(const std::string& fan);
void addThermalInput(const std::string& therm);
-#ifdef __TUNING_LOGGING__
void initializeLog(void);
std::ofstream& getLogHandle(void);
-#endif
/* Method for setting the manual mode over dbus */
bool manual(bool value) override;
@@ -98,9 +98,7 @@
bool failSafe() const override;
private:
-#ifdef __TUNING_LOGGING__
std::ofstream _log;
-#endif
const int64_t _zoneId;
double _maximumRPMSetPt = 0;