-
+
+
+
+
- GPIO number that will be controlled.
+
-
- Attention Neopixel requires a microcontroller (ex: arduino)
- connected to I2C bus. This is the pin on the
- microcontroller that is connected to the Neopixel.
-
+
+
+
+
+
-
-
+
+
@@ -253,14 +253,14 @@
-
+
diff --git a/octoprint_enclosure/static/js/enclosure.js b/octoprint_enclosure/static/js/enclosure.js
index f9f6d9a..d34d400 100644
--- a/octoprint_enclosure/static/js/enclosure.js
+++ b/octoprint_enclosure/static/js/enclosure.js
@@ -1,8 +1,8 @@
$(function () {
- var cleanOutput = function () {
+ var cleanOutput = function (index_id) {
return {
- index_id: "",
+ index_id: index_id,
label: "",
output_type: "Regular",
gpio: {
@@ -15,18 +15,24 @@ $(function () {
var self = this;
self.isNew = ko.observable(false);
+ self.index_id = ko.observable();
self.label = ko.observable();
self.output_type = ko.observable();
self.gpio_pin = ko.observable();
+ self.enclosureOutputs = undefined;
self.fromOutputData = function (data) {
self.isNew(data === undefined);
if (data === undefined) {
- data = cleanOutput();
+ var arrRelaysLength = self.enclosureOutputs().length;
+ var nextIndex = arrRelaysLength == 0 ? 1 : self.enclosureOutputs()[arrRelaysLength - 1].index_id + 1;
+ data = cleanOutput(nextIndex);
}
+
+ self.index_id(data.index_id);
self.label(data.label);
self.output_type(data.output_type);
self.gpio_pin(data.gpio.pin_name);
@@ -46,7 +52,7 @@ $(function () {
};
// end of EnclosureOutputEditorViewModel
- };
+ };
function EnclosureViewModel(parameters) {
var self = this;
@@ -57,6 +63,15 @@ $(function () {
self.enclosureOutputs = ko.observableArray();
+ self.onBeforeBinding = function () {
+ self.enclosureOutputs(self.settingsViewModel.settings.plugins.enclosure.enclosureOutputs());
+ // console.log(self.settingsViewModel.settings.plugins.enclosure)
+ };
+
+ self.onEventSettingsUpdated = function () {
+ self.enclosureOutputs(self.settingsViewModel.settings.plugins.enclosure.enclosureOutputs());
+ };
+
self.createOutputEditor = function (data) {
var outputEditor = new EnclosureOutputEditorViewModel();
@@ -64,6 +79,7 @@ $(function () {
};
self.outputEditor = self.createOutputEditor();
+ self.outputEditor.enclosureOutputs = self.enclosureOutputs;
self.showOutputEditorDialog = function (data) {
@@ -87,10 +103,12 @@ $(function () {
self.addOutputs = function () {
var output = self.outputEditor.toOutputData();
+ self.settingsViewModel.settings.plugins.enclosure.enclosureOutputs.push(output);
};
- self.print = function () {
- console.log(self);
+ self.print_data = function () {
+ console.log(self.enclosureOutputs.root);
+ // console.log(self);
};
// end of EnclosureViewModel
diff --git a/octoprint_enclosure/templates/enclosureSettings.jinja2 b/octoprint_enclosure/templates/enclosureSettings.jinja2
deleted file mode 100644
index a6d0db4..0000000
--- a/octoprint_enclosure/templates/enclosureSettings.jinja2
+++ /dev/null
@@ -1,5 +0,0 @@
-
{{ _('Raspberry Pi Outputs') }}
-
-{% include "outputTable.jinja2" %}
-
-{% include "outputEditor.jinja2" %}
\ No newline at end of file
diff --git a/octoprint_enclosure/templates/enclosure_settings.jinja2 b/octoprint_enclosure/templates/enclosure_settings.jinja2
new file mode 100644
index 0000000..7db8ede
--- /dev/null
+++ b/octoprint_enclosure/templates/enclosure_settings.jinja2
@@ -0,0 +1,5 @@
+
{{ _('Raspberry Pi Outputs') }}
+
+{% include "output_table.jinja2" %}
+
+{% include "output_editor/main_screen.jinja2" %}
\ No newline at end of file
diff --git a/octoprint_enclosure/templates/outputEditor.jinja2 b/octoprint_enclosure/templates/outputEditor.jinja2
deleted file mode 100644
index ca5611c..0000000
--- a/octoprint_enclosure/templates/outputEditor.jinja2
+++ /dev/null
@@ -1,44 +0,0 @@
-