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/pidthread.cpp b/pid/pidthread.cpp
index 08fb513..f8d7fd9 100644
--- a/pid/pidthread.cpp
+++ b/pid/pidthread.cpp
@@ -17,6 +17,7 @@
#include "pidthread.hpp"
#include "pid/pidcontroller.hpp"
+#include "pid/tuning.hpp"
#include "sensors/sensor.hpp"
#include <chrono>
@@ -63,9 +64,11 @@
* TODO(venture): If the fan value is 0 should that loop just be skipped?
* Right now, a 0 value is ignored in FanController::inputProc()
*/
-#ifdef __TUNING_LOGGING__
- zone->initializeLog();
-#endif
+ if (tuningLoggingEnabled)
+ {
+ zone->initializeLog();
+ }
+
zone->initializeCache();
processThermals(zone);
@@ -93,10 +96,11 @@
// Run the fan PIDs every iteration.
zone->processFans();
-#ifdef __TUNING_LOGGING__
- zone->getLogHandle() << "," << zone->getFailSafeMode();
- zone->getLogHandle() << std::endl;
-#endif
+ if (tuningLoggingEnabled)
+ {
+ zone->getLogHandle() << "," << zone->getFailSafeMode();
+ zone->getLogHandle() << std::endl;
+ }
ms100cnt += 1;
}