diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index dc89f00..e1bb2d7 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -23,6 +23,8 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.BlueprintPlugin, octoprint.plugin.EventHandlerPlugin): + + previous_temp_control_status = False current_temp_control_status = False enclosure_set_temperature = 0.0 diff --git a/octoprint_enclosure/static/css/bootstrap-colorpicker.css b/octoprint_enclosure/static/css/bootstrap-colorpicker.css old mode 100644 new mode 100755 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/alpha-horizontal.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/alpha-horizontal.png old mode 100644 new mode 100755 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/alpha.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/alpha.png old mode 100644 new mode 100755 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/hue-horizontal.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/hue-horizontal.png old mode 100644 new mode 100755 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/hue.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/hue.png old mode 100644 new mode 100755 diff --git a/octoprint_enclosure/static/img/bootstrap-colorpicker/saturation.png b/octoprint_enclosure/static/img/bootstrap-colorpicker/saturation.png old mode 100644 new mode 100755 diff --git a/octoprint_enclosure/static/js/bootstrap-colorpicker.min.js b/octoprint_enclosure/static/js/bootstrap-colorpicker.min.js old mode 100644 new mode 100755 diff --git a/octoprint_enclosure/static/js/enclosure.js b/octoprint_enclosure/static/js/enclosure.js index fa6fd69..199e4f7 100644 --- a/octoprint_enclosure/static/js/enclosure.js +++ b/octoprint_enclosure/static/js/enclosure.js @@ -112,8 +112,8 @@ $(function () { self.getCleanTemperature = function (temp) { - if (temp === undefined || !_.isNumber(temp)) return "-"; - if (temp < 10) return gettext("off"); + if (temp === undefined || isNaN(parseFloat(temp))) return "-"; + if (temp < 10) return String("off"); return temp; } @@ -168,7 +168,8 @@ $(function () { data: { "enclosureSetTemp": Number($("#enclosureSetTemp").val()) }, success: function (data) { $("#enclosureSetTemp").val(''); - $("#enclosureSetTemp").attr("placeholder", self.getStatusHeater(data.enclosureSetTemperature, data.enclosureCurrentTemperature)); + cleanTemperature = self.getCleanTemperature(data.enclosureSetTemperature); + $("#enclosureSetTemp").attr("placeholder", cleanTemperature); } }); } else { @@ -212,7 +213,7 @@ $(function () { data: { "enclosureSetTemp": 0 }, success: function (data) { $("#enclosureSetTemp").val(''); - $("#enclosureSetTemp").attr("placeholder", self.getStatusHeater(data.enclosureSetTemperature, data.enclosureCurrentTemperature)); + $("#enclosureSetTemp").attr("placeholder", self.getCleanTemperature(data.enclosureSetTemperature)); } }); }; @@ -252,13 +253,6 @@ $(function () { }).responseText; }; - self.getStatusHeater = function (setTemp, currentTemp) { - if (parseFloat(setTemp) > 0.0) { - return self.getCleanTemperature(setTemp); - } - return "off"; - }; - self.handleIO = function (data, event) { $.ajax({ type: "GET", diff --git a/octoprint_enclosure/templates/enclosure_settings.jinja2 b/octoprint_enclosure/templates/enclosure_settings.jinja2 index 6b6bdb5..d9247aa 100644 --- a/octoprint_enclosure/templates/enclosure_settings.jinja2 +++ b/octoprint_enclosure/templates/enclosure_settings.jinja2 @@ -3,11 +3,10 @@
-
+
@@ -21,8 +20,10 @@ - Attention You need to install and configure the necessary - libraries for the temperature sensor, check the documentation on github page + + Attention You need to install and configure the necessary libraries for the temperature sensor, check + the documentation on + github page
@@ -39,14 +40,16 @@
- GPIO pin for temperature sensor need to connect the sensor to I2C. SCL Clock to GPIO 3 (SCL) and SDA Data to GPIO 2 (SDA) + GPIO pin for temperature sensor need to connect the sensor to I2C. SCL Clock to GPIO 3 (SCL) and SDA Data to GPIO + 2 (SDA)
- Sensor address in HEX value, you can find it by runing i2cdetect -y 1 on your Raspberry Pi + Sensor address in HEX value, you can find it by runing + i2cdetect -y 1 on your Raspberry Pi
@@ -61,24 +64,25 @@
Choose if you want to work with Celsius or Fahrenheit
+

{{ _('Temperature Control') }}

-
+
@@ -89,7 +93,7 @@
Active low means that the heater will turn on when receive a low signal (ground) from Raspbery PI
@@ -97,16 +101,18 @@
- +
- +
Choose if you want to automatically startup temperature control when the print starts
@@ -129,152 +135,178 @@ -
- -
- - Name displayed on Enclosure Tab -
-
-
- -
- - - GPIO number that will be controlled. - - - Attention Neopixel requires a microcontroler (ex: arduino) connected to I2C bus. - This is the pin on the microcontroler that is connected to the Neopixel. - -
-
-
-
- - Choose if GPIO should turn on automatomatically when print starts -
-
- -
- +
- - Time delay to turn on GPIO when print starts + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+ + Name displayed on Enclosure Tab +
+
+
+ +
+ + + GPIO number that will be controlled. + + + + Attention Neopixel requires a microcontroler (ex: arduino) connected to I2C bus. This is the pin on the + microcontroler that is connected to the Neopixel. + +
+
+
+ +
+ + When the event happen, you want control which IO? +
+
+
+
+ + Choose if GPIO should turn on automatomatically when print starts +
+
+ +
+
+ +
+ + Time delay to turn on GPIO when print starts +
+
+
+ +
+
+ + Choose if GPIO should turn off automatomatically when print finishes +
+
+ +
+
+ +
+ + Time delay to turn off GPIO when print finishes +
+
+
+ + +
+
+ + Active low means that the GPIO will turn on when receive a low signal (ground) from Raspbery PI +
+
+ + +
+ +
+ + Value is in Hz +
+
+
+ +
+ + Value is in percentage, between 0 and 100 +
+
+ + +
+ +
+ + Microcontroller address in HEX value, you can find it by runing + i2cdetect -y 1 on your Raspberry Pi +
+
+ + +
+ +
+ + Number of led's on strip +
+
+
+ +
+ + Value between 0 and 255 +
+
+
+ +
+ + Value needs to follow the format rgb(value_red,value_green,value_blue) where values should be between 0 and 255 +
+
+ +
+ + + +
+
+
+
-
-
- - Choose if GPIO should turn off automatomatically when print finishes -
+
- -
-
- -
- - Time delay to turn off GPIO when print finishes -
-
-
- -
- -
- -
-
- -
-
- -
-
- -
-
- - Active low means that the GPIO will turn on when receive a low signal (ground) from Raspbery PI -
-
- - -
- -
- - Value is in Hz -
-
-
- -
- - Value is in percentage, between 0 and 100 -
-
- - -
- -
- - Microcontroller address in HEX value, you can find it by runing i2cdetect -y 1 on your Raspberry Pi -
-
-
- -
- - Number of led's on strip -
-
-
- -
- - Value between 0 and 255 -
-
-
- -
- - Value needs to follow the format rgb(value_red,value_green,value_blue) where values should be between - 0 and 255 -
-
- -
- -
-
-
-
-
-
-
-
- -

{{ _('Raspberry Pi Inputs') }}

@@ -290,49 +322,54 @@
- {{ _('Temperature') }} + {{ _('Temperature') }}
-
- {{ _('GPIO Control') }} + {{ _('Printer') }} +
+
+ {{ _('GPIO Control') }}
- Info: Events will run actions when a certain temperature of the sensor is hit. - You can control a OUTPUT pin and set that to a LOW or HIGH value when that happens. - You can use this as a safety measure and trigger alarm lights for example. Warning - You should always have proper smoke detector on your house. DO NOT use this as your only safety device. + + Info: Events will run actions when a certain temperature of the sensor is hit. You can control a OUTPUT + pin and set that to a LOW or HIGH value when that happens. You can use this as a safety measure and trigger alarm + lights for example. + Warning + You should always have proper smoke detector on your house. DO NOT use this as your only safety device. - Info: Events will run PRINTER actions when a condition is met, that can be a filament sensor, button, etc. - Actions can be Pause \ Resume \ Cancel a printer job, change the filament or disable Temperature Control. You can use the "change filament" action and set up the input - GPIO acording to your sensor, for example, if your filament sensor conects to ground when detects the end of the filament, - you should choose PULL UP resistors and detect the event on the falling edge. + + Info: Events will run PRINTER actions when a condition is met, that can be a filament sensor, button, etc. + Actions can be Pause \ Resume \ Cancel a printer job, change the filament or disable Temperature Control. You can + use the "change filament" action and set up the input GPIO acording to your sensor, for example, if your filament + sensor conects to ground when detects the end of the filament, you should choose PULL UP resistors and detect the + event on the falling edge. - Info: Events will control GPIO outputs when a condition is met, for example detect a press of a button. - You can use this to control any previous configured OUTPUTS, basically beeing able to control your lights / fan / pritner - using mechanical buttons buttons instead of the octoprint interface. You can only control REGULAR outputs. - - + + Info: Events will control GPIO outputs when a condition is met, for example detect a press of a button. + You can use this to control any previous configured OUTPUTS, basically beeing able to control your lights / fan + / pritner using mechanical buttons buttons instead of the octoprint interface. You can only control REGULAR outputs. + + +
-
- -
-
- -
- - Input GPIO that will detect the event that should trigger the action. For example if you have a filament - sensor you put the GPIO pin that the sensor is connected. This can also be a press of a button or any other signal that you want to detect. - You can not use GPIO 4 here if you are using temeprature sensor DS18B20 + +
+
+ +
+ + Input GPIO that will detect the event that should trigger the action. For example if you have a filament sensor + you put the GPIO pin that the sensor is connected. This can also be a press of a button or any other signal that + you want to detect. You can not use GPIO 4 here if you are using temeprature sensor DS18B20
@@ -342,60 +379,60 @@ - Choose what type of pull resistors that you want on the output. If you signal is active low, - that means it should run the action when receive a low signal (ground), you should choose PULL UP resistors. -
+ Choose what type of pull resistors that you want on the output. If you signal is active low, that means it should + run the action when receive a low signal (ground), you should choose PULL UP resistors.
- - -
-
- -
- - Do you want thrigger the event on the rise or falling edge? If you signal is active low, - that means it should run the action when receive a low signal (ground), you should choose FALLING EDGE. -
-
-
- -
- + + + + Do you want thrigger the event on the rise or falling edge? If you signal is active low, that means it should run + the action when receive a low signal (ground), you should choose FALLING EDGE. +
+
+
+ +
+ - When the event happen, you want control which IO? -
-
-
- -
- - When the event happen, you want to turn the controlled IO HIGH or LOW? -
+ + When the event happen, you want control which IO?
- - -
-
- -
- - Set temperature that will trigger the event -
+
+ +
+ + When the event happen, you want to turn the controlled IO HIGH or LOW?
-
- -
- + Set temperature that will trigger the event +
+
+
+ +
+ When the event happen, you want control which IO? @@ -422,140 +459,142 @@ - Do you want thrigger the event on the rise or falling edge? If you signal is active low, - that means it should run the action when receive a low signal (ground), you should choose FALLING EDGE. -
-
-
-
- -
- - You can use filament change on your filament detectors and add buttons to resume and pause the print job. -
-
- - -
- -
-
-
-
+ Do you want thrigger the event on the rise or falling edge? If you signal is active low, that means it should run + the action when receive a low signal (ground), you should choose FALLING EDGE.
- + +
+ + You can use filament change on your filament detectors and add buttons to resume and pause the print job. +
+ + +
+ + + +
+
+
+
+
+
+
+
+ +
+ + + + Advanced options + +
+
+
+
+ + Log additional information on octoprint log to help trouble shoot the plugin +
+
+
+
+ + Display enclosure temperature and humidity on navbar +
+
+
+
+ + Use BOARD pin numbers instead of BCM pin numbers +
+
+
+
+ + This will clear any GPIO configuration that might exist on your system, use with caution, it might break other plugins + that use GPIO +
+
+ +
+ + Time that filament sensor will be inactive after sensing end of filament. This is to avoid sending multiple M600 commands + to the printer. +
+
+ +
+ + GCODE that will be sent to the printer to pause and allow filament to be changed. You should add + ; on the end of every line sent to the printer +
+
+
+ +
+ +
+
+ +
+ +
+ + Event name that was configured on the maker chanel of IFTTT, don't use space between the words +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
- - - Advanced options - -
-
-
-
- - Log additional information on octoprint log to help trouble shoot the plugin -
-
-
-
- - Display enclosure temperature and humidity on navbar -
-
-
-
- - Use BOARD pin numbers instead of BCM pin numbers -
-
-
-
- - This will clear any GPIO configuration that might exist on your system, use with caution, - it might break other plugins that use GPIO -
-
- -
- - Time that filament sensor will be inactive after sensing end of filament. This is to avoid sending multiple M600 - commands to the printer. -
-
- -
- - GCODE that will be sent to the printer to pause and allow filament to be changed. - You should add ; on the end of every line sent to the printer -
-
-
- -
- -
-
- -
- -
- - Event name that was configured on the maker chanel of IFTTT, don't use space between the words -
-
-
- -
- -
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
+
\ No newline at end of file diff --git a/octoprint_enclosure/templates/enclosure_tab.jinja2 b/octoprint_enclosure/templates/enclosure_tab.jinja2 index 9c4553e..47ae6b7 100644 --- a/octoprint_enclosure/templates/enclosure_tab.jinja2 +++ b/octoprint_enclosure/templates/enclosure_tab.jinja2 @@ -18,7 +18,7 @@
+ data-bind="attr: {placeholder:$root.getCleanTemperature($root.requestEnclosureSetTemperature())}"> °F °C