diff --git a/octoprint_enclosure/static/js/enclosure.js b/octoprint_enclosure/static/js/enclosure.js index b62e4fd..2fc0512 100644 --- a/octoprint_enclosure/static/js/enclosure.js +++ b/octoprint_enclosure/static/js/enclosure.js @@ -8,9 +8,10 @@ $(function () { return { index_id: index_id, label: "", - input_type: "", + input_type: "regular_gpio", + action_type: "output_control", gpio: { - pin_name: "regular_gpio", + pin_name: "", pull_resistor: "input_pull_up", linked_action: "output_control", edge_detection: "fall", @@ -25,9 +26,9 @@ $(function () { output_set_value: "low", }, temperature_sensor: { - type: "DS18B20", + type: "si7021", address: "", - unit: "C", + unit: "celsius", } } }; @@ -106,6 +107,7 @@ $(function () { self.index_id = ko.observable(); self.label = ko.observable(); self.input_type = ko.observable(); + self.action_type = ko.observable(); // gpio output self.gpio_pin = ko.observable(); self.pull_resistor = ko.observable(); @@ -115,7 +117,7 @@ $(function () { self.controlled_output = ko.observable(); self.controlled_output_set_value = ko.observable(); // printer action on linked action - self.printed_action = ko.observable(); + self.printer_action = ko.observable(); self.filament_sensor_enabled = ko.observable(); self.filament_sensor_timeout = ko.observable(); // temperature sensor @@ -154,6 +156,7 @@ $(function () { self.index_id(data.index_id); self.label(data.label); self.input_type(data.input_type); + self.action_type(data.action_type); // gpio output self.gpio_pin(data.gpio.pin_name); self.pull_resistor(data.gpio.pull_resistor); @@ -163,7 +166,7 @@ $(function () { self.controlled_output(data.linked_output_action.output_index_id); self.controlled_output_set_value(data.linked_output_action.output_set_value); // printer action on linked action - self.printed_action(data.linked_printer_action.action); + self.printer_action(data.linked_printer_action.action); self.filament_sensor_enabled(data.linked_printer_action.filament_sensor_enabled); self.filament_sensor_timeout(data.linked_printer_action.filament_sensor_timeout); // temperature sensor @@ -178,6 +181,7 @@ $(function () { index_id: self.index_id(), label: self.label(), input_type: self.input_type(), + action_type: self.action_type(), gpio: { pin_name: self.gpio_pin(), pull_resistor: self.pull_resistor(), @@ -185,7 +189,7 @@ $(function () { edge_detection: self.edge_detection(), }, linked_printer_action: { - action: self.printed_action(), + action: self.printer_action(), filament_sensor_enabled: self.filament_sensor_enabled(), filament_sensor_timeout: self.filament_sensor_timeout(), }, diff --git a/octoprint_enclosure/templates/input_editor/action.jinja2 b/octoprint_enclosure/templates/input_editor/action.jinja2 new file mode 100644 index 0000000..2ff3f9b --- /dev/null +++ b/octoprint_enclosure/templates/input_editor/action.jinja2 @@ -0,0 +1,110 @@ +
+ +
+ +
+ {{ _('Output Control') }} +
+
+ {{ _('Printer') }} +
+
+ + + +
+
+ + Info: PRINTER actions when a condition is met, that can be a + filament sensor, button, etc. Actions can + be Pause \ Resume \ Cancel a printer_control job, change the filament or disable Temperature Control. + You can + use the "change filament" action and set up the input GPIO according to your sensor, for example, if your + filament + sensor connects to ground when detects the end of the filament, you should choose PULL UP resistors and + detect + the event on the falling edge. + +
+
+ + + +
+
+ + Info: Action 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 being able to control your + lights / fan + / printer using mechanical buttons buttons instead of the Octoprint interface. You can only control + REGULAR outputs. + +
+
+ +
+ +
+ + When the event happen, you want control which OUTPUT? +
+
+ +
+ +
+ + When the event happen, you want to turn the controlled IO HIGH or LOW? +
+
+ + + + + + +
+ +
+ + You can use filament change on your filament detectors and add buttons to resume and pause the print job. +
+
+ +
+
+ + Enable and disable filament sensors +
+
+
+ +
+ + Time in seconds that filament sensor will be inactive after sensing end of filament. This is to avoid sending multiple + commands to the printer. + +
+
+ + + + +
\ No newline at end of file diff --git a/octoprint_enclosure/templates/input_editor/general_info.jinja2 b/octoprint_enclosure/templates/input_editor/general_info.jinja2 index 3007933..a1a6bf0 100644 --- a/octoprint_enclosure/templates/input_editor/general_info.jinja2 +++ b/octoprint_enclosure/templates/input_editor/general_info.jinja2 @@ -19,37 +19,25 @@
- {{ _('GPIO Input') }} + {{ _('GPIO Input') }}
- {{ _('Temperature Sensor') }} + {{ _('Temp Sensor') }}
- + Info: GPIO will input status of the pin (HIGH or LOW) to trigger actions on configured outputs or printer events - - + + Info: Temperature Sensors will input temperature and humidity data. - +
- -
- -
- {{ _('Output Control') }} -
-
- {{ _('Printer') }} -
-
- - \ No newline at end of file diff --git a/octoprint_enclosure/templates/input_editor/main_screen.jinja2 b/octoprint_enclosure/templates/input_editor/main_screen.jinja2 index 04f30e1..e05bf12 100644 --- a/octoprint_enclosure/templates/input_editor/main_screen.jinja2 +++ b/octoprint_enclosure/templates/input_editor/main_screen.jinja2 @@ -11,16 +11,19 @@
  • {{ _('General') }}
  • +
  • {{ _('IO Settings') }}
  • + -
  • {{ _('Printer Action') }}
  • - -
  • {{ _('Output Action') }} -
  • + +
  • {{ _('Action') }}
  • + +
  • {{ _('Temperature Sensor') }}
  • + data-toggle="tab">{{ _('Sensor') }} +
    @@ -32,19 +35,13 @@ {% include "input_editor/io_output.jinja2" %}
    -
    - {% include "input_editor/printer_action.jinja2" %} +
    + {% include "input_editor/action.jinja2" %}
    -
    - {% include "input_editor/output_action.jinja2" %} -
    - -
    {% include "input_editor/temperature_sensor.jinja2" %}
    -
    diff --git a/octoprint_enclosure/templates/input_editor/output_action.jinja2 b/octoprint_enclosure/templates/input_editor/output_action.jinja2 deleted file mode 100644 index 49485cd..0000000 --- a/octoprint_enclosure/templates/input_editor/output_action.jinja2 +++ /dev/null @@ -1,39 +0,0 @@ -
    - -
    -
    - - Info: Action 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 being able to control your - lights / fan - / printer using mechanical buttons buttons instead of the Octoprint interface. You can only control - REGULAR outputs. - -
    -
    - -
    - -
    - - When the event happen, you want control which OUTPUT? -
    -
    - -
    - -
    - - When the event happen, you want to turn the controlled IO HIGH or LOW? -
    -
    - - - -
    \ No newline at end of file diff --git a/octoprint_enclosure/templates/input_editor/printer_action.jinja2 b/octoprint_enclosure/templates/input_editor/printer_action.jinja2 deleted file mode 100644 index dcbcc45..0000000 --- a/octoprint_enclosure/templates/input_editor/printer_action.jinja2 +++ /dev/null @@ -1,20 +0,0 @@ -
    - -
    -
    - - Info: PRINTER actions when a condition is met, that can be a - filament sensor, button, etc. Actions can - be Pause \ Resume \ Cancel a printer_control job, change the filament or disable Temperature Control. - You can - use the "change filament" action and set up the input GPIO according to your sensor, for example, if your - filament - sensor connects to ground when detects the end of the filament, you should choose PULL UP resistors and - detect - the event on the falling edge. - -
    -
    - - -
    \ No newline at end of file diff --git a/octoprint_enclosure/templates/input_editor/temperature_sensor.jinja2 b/octoprint_enclosure/templates/input_editor/temperature_sensor.jinja2 index 17d1d8a..5522f50 100644 --- a/octoprint_enclosure/templates/input_editor/temperature_sensor.jinja2 +++ b/octoprint_enclosure/templates/input_editor/temperature_sensor.jinja2 @@ -5,7 +5,6 @@
    +