From 53ebca47d9bd654ca50e360a8b61851ffce86439 Mon Sep 17 00:00:00 2001 From: Vitor de Miranda Henrique Date: Fri, 9 Dec 2016 14:12:10 -0600 Subject: [PATCH] Adding new functionality --- octoprint_enclosure/static/js/enclosure.js | 35 ++-------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/octoprint_enclosure/static/js/enclosure.js b/octoprint_enclosure/static/js/enclosure.js index 13f5ff3..500782f 100644 --- a/octoprint_enclosure/static/js/enclosure.js +++ b/octoprint_enclosure/static/js/enclosure.js @@ -77,42 +77,13 @@ $(function() { } return "off"; } - - self.turnFanOn = function(){ - $.ajax({ - type: "GET", - dataType: "json", - data: {"status": "on"}, - url: "/plugin/enclosure/handleFan", - async: false - }); - } - self.turnFanOff = function(){ + self.handleIO = function(pin, value){ $.ajax({ type: "GET", dataType: "json", - data: {"status": "off"}, - url: "/plugin/enclosure/handleFan", - async: false - }); - } - - self.turnLightOn = function(){ - $.ajax({ - type: "GET", - dataType: "json", - data: {"status":"on"}, - url: "/plugin/enclosure/handleLight", - async: false - }); - } - self.turnLightOff = function(){ - $.ajax({ - type: "GET", - dataType: "json", - data: {"status":"off"}, - url: "/plugin/enclosure/handleLight", + data: {"io": pin, "status": value}, + url: "/plugin/enclosure/handleIO", async: false }); }