From 67e980e9f7dc3ad42a9df695d40f800ca61605cf Mon Sep 17 00:00:00 2001 From: Benjamin Salchow Date: Sun, 15 Mar 2020 13:15:38 +0100 Subject: [PATCH 1/7] adds python 3.7 compatibility --- octoprint_enclosure/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index f74aff4..863e038 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -1857,6 +1857,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP __plugin_name__ = "Enclosure Plugin" +__plugin_pythoncompat__ = ">=2.7,<4" def __plugin_load__(): -- 2.39.5 From d6e6de594640287e02db0be58ebfedd58a1ef3fd Mon Sep 17 00:00:00 2001 From: Piranit Date: Sat, 25 Apr 2020 15:30:03 +0300 Subject: [PATCH 2/7] forgotten parameter 'LED_BRIGHTNESS' for initialize Adafruit_NeoPixel added --- octoprint_enclosure/neopixel_direct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octoprint_enclosure/neopixel_direct.py b/octoprint_enclosure/neopixel_direct.py index 3af63f9..6259377 100644 --- a/octoprint_enclosure/neopixel_direct.py +++ b/octoprint_enclosure/neopixel_direct.py @@ -17,7 +17,7 @@ else: print("fail") sys.exit(1) -strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT) +strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS) strip.begin() color = Color(red, green, blue) -- 2.39.5 From cccf74bcf8c2a8fb5f5748186db6869f945d05d2 Mon Sep 17 00:00:00 2001 From: Bryan Mayland Date: Tue, 12 May 2020 15:32:16 +0100 Subject: [PATCH 3/7] Do not uppercase user-supplied gcode --- octoprint_enclosure/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index f01f06c..6aff8a1 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -100,7 +100,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP for command in command_string.split(' '): index = command.upper().find(gcode.upper()) if not index == -1: - return command.replace(gcode, '').upper() + return command.replace(gcode, '') return -1 # ~~ StartupPlugin mixin @@ -1261,8 +1261,8 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP item['time'] = time_now for line in self._settings.get(["filament_sensor_gcode"]).split('\n'): if line: - self._printer.commands(line.strip().upper()) - self._logger.info("Sending GCODE command: %s", line.strip().upper()) + self._printer.commands(line.strip()) + self._logger.info("Sending GCODE command: %s", line.strip()) time.sleep(0.2) for notification in self.notifications: if notification['filamentChange']: @@ -1378,8 +1378,8 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP def send_gcode_command(self, command): for line in command.split('\n'): if line: - self._printer.commands(line.strip().upper()) - self._logger.info("Sending GCODE command: %s", line.strip().upper()) + self._printer.commands(line.strip()) + self._logger.info("Sending GCODE command: %s", line.strip()) time.sleep(0.2) def handle_printer_action(self, channel): @@ -1890,4 +1890,4 @@ def __plugin_load__(): __plugin_hooks__ = { "octoprint.comm.protocol.gcode.queuing" : __plugin_implementation__.hook_gcode_queuing, "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information - } \ No newline at end of file + } -- 2.39.5 From 397ad4deadd08496a3d62ca40f6f3552db1450ad Mon Sep 17 00:00:00 2001 From: ameixler Date: Wed, 13 May 2020 18:49:40 -0400 Subject: [PATCH 4/7] testing adding i2cbus settings --- octoprint_enclosure/static/js/enclosure.js | 3 ++- octoprint_enclosure/templates/enclosure_settings.jinja2 | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/octoprint_enclosure/static/js/enclosure.js b/octoprint_enclosure/static/js/enclosure.js index b7a96e5..66e6a31 100644 --- a/octoprint_enclosure/static/js/enclosure.js +++ b/octoprint_enclosure/static/js/enclosure.js @@ -455,7 +455,8 @@ $(function () { printer_action: ko.observable("filament"), temp_sensor_navbar: ko.observable(true), filament_sensor_timeout: ko.observable(120), - filament_sensor_enabled: ko.observable(true) + filament_sensor_enabled: ko.observable(true), + temp_sensor_i2cbus: ko.observable("1") }); }; diff --git a/octoprint_enclosure/templates/enclosure_settings.jinja2 b/octoprint_enclosure/templates/enclosure_settings.jinja2 index 45a2b8a..508232c 100644 --- a/octoprint_enclosure/templates/enclosure_settings.jinja2 +++ b/octoprint_enclosure/templates/enclosure_settings.jinja2 @@ -582,6 +582,14 @@ i2cdetect -y 1 on your Raspberry Pi +
+ +
+ + This value should remain 1 unless you've used dtoverlay=i2c-gpio. + +
+
-- 2.39.5 From 3b6233a731de4e90929148bbde71f837857f0d0c Mon Sep 17 00:00:00 2001 From: ameixler Date: Wed, 13 May 2020 20:38:04 -0400 Subject: [PATCH 5/7] Working changes Confirmed works with 2 Si7021 modules. --- octoprint_enclosure/SI7021.py | 8 ++++++-- octoprint_enclosure/__init__.py | 8 ++++---- octoprint_enclosure/static/js/enclosure.js | 4 ++-- octoprint_enclosure/templates/enclosure_settings.jinja2 | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/octoprint_enclosure/SI7021.py b/octoprint_enclosure/SI7021.py index 6b352f1..3e1eb60 100644 --- a/octoprint_enclosure/SI7021.py +++ b/octoprint_enclosure/SI7021.py @@ -3,14 +3,18 @@ import time import sys -if len(sys.argv) == 2: +if len(sys.argv) == 2 or len(sys.argv) == 3: address = int(sys.argv[1],16) + if len(sys.argv) == 3: + busNum = int(sys.argv[2],16) + else: + busNum = 1 else: print('-1 | -1') sys.exit(1) # Get I2C bus -bus = smbus.SMBus(1) +bus = smbus.SMBus(busNum) # SI7021 address, 0x40(64) # 0xF5(245) Select Relative Humidity NO HOLD master mode diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index f01f06c..6e388d9 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -800,7 +800,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP elif sensor['temp_sensor_type'] == "am2320": temp, hum = self.read_am2320_temp() # sensor has fixed address elif sensor['temp_sensor_type'] == "si7021": - temp, hum = self.read_si7021_temp(sensor['temp_sensor_address']) + temp, hum = self.read_si7021_temp(sensor['temp_sensor_address'], sensor['temp_sensor_i2cbus']) elif sensor['temp_sensor_type'] == "tmp102": temp = self.read_tmp102_temp(sensor['temp_sensor_address']) hum = 0 @@ -933,14 +933,14 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP self.log_error(ex) return (0, 0) - def read_si7021_temp(self, address): + def read_si7021_temp(self, address, i2cbus): try: script = os.path.dirname(os.path.realpath(__file__)) + "/SI7021.py " if self._settings.get(["use_sudo"]): sudo_str = "sudo " else: sudo_str = "" - cmd = sudo_str + "python " + script + str(address) + cmd = sudo_str + "python " + script + str(address) + " " + str(i2cbus) if self._settings.get(["debug_temperature_log"]) is True: self._logger.debug("Temperature SI7021 cmd: %s", cmd) stdout = (Popen(cmd, shell=True, stdout=PIPE).stdout).read() @@ -1890,4 +1890,4 @@ def __plugin_load__(): __plugin_hooks__ = { "octoprint.comm.protocol.gcode.queuing" : __plugin_implementation__.hook_gcode_queuing, "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information - } \ No newline at end of file + } diff --git a/octoprint_enclosure/static/js/enclosure.js b/octoprint_enclosure/static/js/enclosure.js index 66e6a31..e9c4847 100644 --- a/octoprint_enclosure/static/js/enclosure.js +++ b/octoprint_enclosure/static/js/enclosure.js @@ -456,7 +456,7 @@ $(function () { temp_sensor_navbar: ko.observable(true), filament_sensor_timeout: ko.observable(120), filament_sensor_enabled: ko.observable(true), - temp_sensor_i2cbus: ko.observable("1") + temp_sensor_i2cbus: ko.observable(1) }); }; @@ -707,4 +707,4 @@ $(function () { elements: ["#tab_plugin_enclosure", "#settings_plugin_enclosure", "#navbar_plugin_enclosure_1", "#navbar_plugin_enclosure_2"] }); -}); \ No newline at end of file +}); diff --git a/octoprint_enclosure/templates/enclosure_settings.jinja2 b/octoprint_enclosure/templates/enclosure_settings.jinja2 index 508232c..a30ca69 100644 --- a/octoprint_enclosure/templates/enclosure_settings.jinja2 +++ b/octoprint_enclosure/templates/enclosure_settings.jinja2 @@ -909,4 +909,4 @@
- \ No newline at end of file + -- 2.39.5 From d74c302af7e8cb95453e8252bba81ac090b726cb Mon Sep 17 00:00:00 2001 From: Christian Lorenz Date: Tue, 25 Aug 2020 00:37:17 +0200 Subject: [PATCH 6/7] fixed issues #254 from the original code see https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/254 --- octoprint_enclosure/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index f01f06c..9ffff73 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -835,7 +835,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP for rpi_controlled_output in self.rpi_outputs: if self.to_int(temperature_alarm['controlled_io']) == self.to_int( rpi_controlled_output['index_id']): - val = GPIO.LOW if rpi_controlled_output['active_low'] else GPIO.HIGH + val = GPIO.LOW if temperature_alarm['controlled_io_set_value'] == 'low' else GPIO.HIGH self.write_gpio(self.to_int(rpi_controlled_output['gpio_pin']), val) for notification in self.notifications: if notification['temperatureAction']: @@ -1890,4 +1890,4 @@ def __plugin_load__(): __plugin_hooks__ = { "octoprint.comm.protocol.gcode.queuing" : __plugin_implementation__.hook_gcode_queuing, "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information - } \ No newline at end of file + } -- 2.39.5 From 456497f7e67067514e1711b0566db8988037897c Mon Sep 17 00:00:00 2001 From: Vitor de Miranda Henrique Date: Tue, 15 Sep 2020 09:58:50 -0500 Subject: [PATCH 7/7] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index f09f270..5e75eba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ -# QUICK NOTE: I suffered an injury last Sunday (06/20/20) and broke both bones on my left forearm, it will be impossible to work on on this plugin in the near future, I'm struggling to make it work with a full time job + masters in computers science. This plugin is not abandoned but it is on vacation mode. - - Find the plugin useful? Buy me a coffee [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/VitorHenrique/2) -- 2.39.5