From 7a445e04136ef66390ad7d176716aeb929311495 Mon Sep 17 00:00:00 2001 From: Keir Rice Date: Sun, 25 Sep 2022 21:18:02 +1300 Subject: [PATCH] Clean up the logging to respect settings. Re-enable the use of SUDO when set. --- octoprint_enclosure/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index ea7d033..07e5773 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -1144,8 +1144,8 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP try: script = os.path.dirname(os.path.realpath(__file__)) + "/SHTC3.py" cmd = [sys.executable, script, str(i2cbus), str(address)] - # if self._settings.get(["use_sudo"]): - # cmd.insert(0, "sudo") + if self._settings.get(["use_sudo"]): + cmd.insert(0, "sudo") if self._settings.get(["debug_temperature_log"]) is True: self._logger.debug("Temperature SHTC3 cmd: %s", " ".join(cmd)) @@ -1153,7 +1153,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP stdout = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) output, errors = stdout.communicate() - if True or self._settings.get(["debug_temperature_log"]) is True: + if self._settings.get(["debug_temperature_log"]) is True: if len(errors) > 0: self._logger.error("SHTC3 error: %s", errors) else: