This commit is contained in:
brbjr1
2017-12-04 17:55:30 -06:00
parent 1942e0965d
commit a611bdea38

View File

@@ -101,14 +101,16 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
@octoprint.plugin.BlueprintPlugin.route("/getOutputStatus", methods=["GET"])
def getOutputStatus(self):
getOutputStatusresult = ''
getOutputStatusresultDict = {}
for rpi_output in self.rpi_outputs:
pin = self.toInt(rpi_output['gpioPin'])
if rpi_output['outputType']=='regular':
val = GPIO.input(pin) if not rpi_output['activeLow'] else (not GPIO.input(pin))
getOutputStatusresult = getOutputStatusresult + str(pin) + ':' + str(val) + ', '
getOutputStatusresultDict[str(pin)] = str(val)
return flask.jsonify(getOutputStatusresult)
if (getOutputStatusresult != '')
getOutputStatusresult = getOutputStatusresult + ', '
getOutputStatusresult = getOutputStatusresult + '"' + str(pin) + '":"' + str(val) + '"'
return '{' + getOutputStatusresult + '}'
@octoprint.plugin.BlueprintPlugin.route("/getTest", methods=["GET"])