diff --git a/config/hyperion.config.json.commented b/config/hyperion.config.json.commented index d978a45f..783ddf86 100644 --- a/config/hyperion.config.json.commented +++ b/config/hyperion.config.json.commented @@ -133,6 +133,7 @@ "smoothing" : { + "enable" : true, "type" : "linear", "time_ms" : 200, "updateFrequency" : 20.0000, diff --git a/config/hyperion.config.json.default b/config/hyperion.config.json.default index 2a840fba..0615fccd 100644 --- a/config/hyperion.config.json.default +++ b/config/hyperion.config.json.default @@ -83,6 +83,7 @@ ], "smoothing" : { + "enable" : true, "type" : "linear", "time_ms" : 200, "updateFrequency" : 20.0000, diff --git a/libsrc/hyperion/Hyperion.cpp b/libsrc/hyperion/Hyperion.cpp index 5352fe04..e96c6713 100644 --- a/libsrc/hyperion/Hyperion.cpp +++ b/libsrc/hyperion/Hyperion.cpp @@ -482,28 +482,34 @@ LedString Hyperion::createLedString(const Json::Value& ledsConfig, const ColorOr LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig, LedDevice * ledDevice) { + Logger * log = Logger::getInstance("Core"); std::string type = smoothingConfig.get("type", "none").asString(); std::transform(type.begin(), type.end(), type.begin(), ::tolower); + if ( ! smoothingConfig.get("enable", true).asBool() ) + { + Info(log,"Smoothing disabled in config"); + return ledDevice; + } if (type == "none") { - std::cout << "HYPERION INFO: Not creating any smoothing" << std::endl; + Info(log, "Smoothing set to none"); return ledDevice; } else if (type == "linear") { if (!smoothingConfig.isMember("time_ms")) { - std::cout << "HYPERION ERROR: Unable to create smoothing of type linear because of missing parameter 'time_ms'" << std::endl; + Error(log, "Unable to create smoothing of type linear because of missing parameter 'time_ms'"); } else if (!smoothingConfig.isMember("updateFrequency")) { - std::cout << "HYPERION ERROR: Unable to create smoothing of type linear because of missing parameter 'updateFrequency'" << std::endl; + Error(log, "Unable to create smoothing of type linear because of missing parameter 'updateFrequency'"); } else { const unsigned updateDelay = smoothingConfig.get("updateDelay", Json::Value(0u)).asUInt(); - std::cout << "INFO: Creating linear smoothing" << std::endl; + Info(log, "Creating linear smoothing"); return new LinearColorSmoothing( ledDevice, smoothingConfig["updateFrequency"].asDouble(), @@ -513,7 +519,7 @@ LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig, } else { - std::cout << "HYPERION ERROR: Unable to create smoothing of type " << type << std::endl; + Error(log, "Unknown smoothing type %s.", type.c_str()); } return ledDevice; diff --git a/libsrc/hyperion/LinearColorSmoothing.cpp b/libsrc/hyperion/LinearColorSmoothing.cpp index 09f2b014..1a3e0acf 100644 --- a/libsrc/hyperion/LinearColorSmoothing.cpp +++ b/libsrc/hyperion/LinearColorSmoothing.cpp @@ -22,7 +22,8 @@ LinearColorSmoothing::LinearColorSmoothing( connect(&_timer, SIGNAL(timeout()), this, SLOT(updateLeds())); - std::cout << "HYPERION (CS) INFO: Created linear-smoothing(interval_ms=" << _updateInterval << ";settlingTime_ms=" << settlingTime_ms << ";updateDelay=" << _outputDelay << std::endl; + Info(Logger::getInstance("Smoothing"), "Created linear-smoothing with interval_ms: %d, settlingTime_ms: %d, updateDelay: %d", + _updateInterval, settlingTime_ms, _outputDelay ); } LinearColorSmoothing::~LinearColorSmoothing()