Dev #7
@@ -13,7 +13,7 @@ import os
|
||||
scheduler = sched.scheduler(time.time, time.sleep)
|
||||
|
||||
class EnclosureGPIO():
|
||||
def __init__(self, pinNumber, label, activeLow, enable, autoShutDown,isOutput,timeDelay,autoStartup):
|
||||
def __init__(self, pinNumber, label, activeLow, enable,autoStartup, autoShutDown,isOutput,timeDelay,timeOffDelay):
|
||||
self.pinNumber = pinNumber
|
||||
self.label = label
|
||||
self.activeLow = activeLow
|
||||
@@ -22,6 +22,7 @@ class EnclosureGPIO():
|
||||
self.autoStartup = autoStartup
|
||||
self.isOutput = isOutput
|
||||
self.timeDelay = timeDelay
|
||||
self.timeOffDelay = timeOffDelay
|
||||
|
||||
def configureGPIO(self):
|
||||
try:
|
||||
@@ -43,7 +44,6 @@ class EnclosureGPIO():
|
||||
def write(self,active):
|
||||
if self.activeLow:
|
||||
active = not active
|
||||
|
||||
GPIO.output(self.pinNumber, active)
|
||||
|
||||
class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
@@ -58,6 +58,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
enclosureSetTemperature=0.0
|
||||
enclosureCurrentTemperature=0.0
|
||||
enclosureCurrentHumidity=0.0
|
||||
lastFilamentEndDetected=0
|
||||
def startGPIO(self):
|
||||
if self._settings.get(["useBoardPinNumber"]):
|
||||
GPIO.cleanup()
|
||||
@@ -68,26 +69,31 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
GPIO.setwarnings(False)
|
||||
|
||||
self.io1 = EnclosureGPIO(self._settings.get_int(["io1Pin"]),self._settings.get(["io1Label"]),self._settings.get(["io1ActiveLow"]),
|
||||
self._settings.get(["io1Enable"]),self._settings.get(["io1AutoShutDown"]),True,self._settings.get(["io1TimeDelay"]),
|
||||
self._settings.get(["io1AutoStartup"]))
|
||||
self._settings.get(["io1Enable"]),self._settings.get(["io1AutoStartup"]),
|
||||
self._settings.get(["io1AutoShutDown"]),True,self._settings.get(["io1TimeDelay"]),
|
||||
self._settings.get(["io1OffTimeDelay"]))
|
||||
|
||||
self.io2 = EnclosureGPIO(self._settings.get_int(["io2Pin"]),self._settings.get(["io2Label"]),self._settings.get(["io2ActiveLow"]),
|
||||
self._settings.get(["io2Enable"]),self._settings.get(["io2AutoShutDown"]),True,self._settings.get(["io2TimeDelay"]),
|
||||
self._settings.get(["io2AutoStartup"]))
|
||||
self._settings.get(["io2Enable"]),self._settings.get(["io2AutoStartup"]),
|
||||
self._settings.get(["io2AutoShutDown"]),True,self._settings.get(["io2TimeDelay"]),
|
||||
self._settings.get(["io2OffTimeDelay"]))
|
||||
|
||||
self.io3 = EnclosureGPIO(self._settings.get_int(["io3Pin"]),self._settings.get(["io3Label"]),self._settings.get(["io3ActiveLow"]),
|
||||
self._settings.get(["io3Enable"]),self._settings.get(["io3AutoShutDown"]),True,self._settings.get(["io3TimeDelay"]),
|
||||
self._settings.get(["io3AutoStartup"]))
|
||||
self._settings.get(["io3Enable"]),self._settings.get(["io3AutoStartup"]),
|
||||
self._settings.get(["io3AutoShutDown"]),True,self._settings.get(["io3TimeDelay"]),
|
||||
self._settings.get(["io3OffTimeDelay"]))
|
||||
|
||||
self.io4 = EnclosureGPIO(self._settings.get_int(["io4Pin"]),self._settings.get(["io4Label"]),self._settings.get(["io4ActiveLow"]),
|
||||
self._settings.get(["io4Enable"]),self._settings.get(["io4AutoShutDown"]),True,self._settings.get(["io4TimeDelay"]),
|
||||
self._settings.get(["io4AutoStartup"]))
|
||||
self._settings.get(["io4Enable"]),self._settings.get(["io4AutoStartup"]),
|
||||
self._settings.get(["io4AutoShutDown"]),True,self._settings.get(["io4TimeDelay"]),
|
||||
self._settings.get(["io4OffTimeDelay"]))
|
||||
|
||||
self.heater = EnclosureGPIO(self._settings.get_int(["heaterPin"]),"heater",self._settings.get(["heaterActiveLow"]),
|
||||
self._settings.get(["heaterEnable"]),True,True,0,False)
|
||||
self._settings.get(["heaterEnable"]),False,True,True,0,0)
|
||||
|
||||
self.filamentSensor = EnclosureGPIO(self._settings.get_int(["filamentSensorPin"]),"filamentSensor",self._settings.get(["filamentSensorActiveLow"]),
|
||||
self._settings.get(["filamentSensorEnable"]),False,False,0,False)
|
||||
self.filamentSensor = EnclosureGPIO(self._settings.get_int(["filamentSensorPin"]),"filamentSensor",
|
||||
self._settings.get(["filamentSensorActiveLow"]),self._settings.get(["filamentSensorEnable"]),
|
||||
False,False,False,0,0)
|
||||
|
||||
self.io1.configureGPIO()
|
||||
self.io2.configureGPIO()
|
||||
@@ -141,7 +147,9 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
|
||||
def heaterHandler(self):
|
||||
if self._settings.get(["heaterEnable"]):
|
||||
self.currrentHeaterStatus = self.enclosureCurrentTemperature<float(self.enclosureSetTemperature)
|
||||
self.currentHeaterStatus = self.enclosureCurrentTemperature<float(self.enclosureSetTemperature)
|
||||
if self._settings.get(["debug"]) == True:
|
||||
self._logger.info("DEBUG -> Current heater status: %s previous heater status %s",self.currentHeaterStatus,self.previousHeaterStatus)
|
||||
if self.currentHeaterStatus != self.previousHeaterStatus:
|
||||
if self.currentHeaterStatus and self.heater.enable:
|
||||
self._logger.info("Turning heater on.")
|
||||
@@ -149,7 +157,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
else:
|
||||
self._logger.info("Turning heater off.")
|
||||
self.heater.write(False)
|
||||
self.previousHeaterStatus = self.currentHeaterStatus
|
||||
self.previousHeaterStatus = self.currentHeaterStatus
|
||||
|
||||
def startFilamentDetection(self):
|
||||
if not GPIO.input(self.filamentSensor.pinNumber):
|
||||
@@ -174,11 +182,15 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
if self._settings.get(["debug"]) == True:
|
||||
self._logger.info("DEBUG -> Filament detection active low: %s gpio status: %s",activeLow,gpioStatus)
|
||||
if activeLow ^ gpioStatus:
|
||||
self._logger.info("Detected end of filament.")
|
||||
for line in self._settings.get(["filamentSensorGcode"]).split(';'):
|
||||
if line:
|
||||
self._printer.commands(line.strip().capitalize())
|
||||
self._logger.info("Sending GCODE command: %s",line.strip().capitalize())
|
||||
if time.time() - lastFilamentEndDetected > self._settings.get(["filamentSensorTimeout"]):
|
||||
self._logger.info("Detected end of filament.")
|
||||
lastFilamentEndDetected = time.time()
|
||||
for line in self._settings.get(["filamentSensorGcode"]).split(';'):
|
||||
if line:
|
||||
self._printer.commands(line.strip().capitalize())
|
||||
self._logger.info("Sending GCODE command: %s",line.strip().capitalize())
|
||||
else:
|
||||
self._logger.info("Prevented end of filament detection, filament sensor timeout not elapsed.")
|
||||
|
||||
def stopFilamentDetection(self):
|
||||
try:
|
||||
@@ -194,6 +206,8 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
@octoprint.plugin.BlueprintPlugin.route("/setEnclosureTemperature", methods=["GET"])
|
||||
def setEnclosureTemperature(self):
|
||||
self.enclosureSetTemperature = flask.request.values["enclosureSetTemp"]
|
||||
if self._settings.get(["debug"]) == True:
|
||||
self._logger.info("DEBUG -> Seting enclosure temperature: %s",self.enclosureSetTemperature)
|
||||
self.heaterHandler()
|
||||
return flask.jsonify(enclosureSetTemperature=self.enclosureSetTemperature,enclosureCurrentTemperature=self.enclosureCurrentTemperature)
|
||||
|
||||
@@ -250,13 +264,13 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
self.enclosureSetTemperature = 0
|
||||
|
||||
if self.io1.autoShutDown and self.io1.enable:
|
||||
scheduler.enter(self.toFloat(self.io1.timeDelay), 1, self.io1.write, (False,))
|
||||
scheduler.enter(self.toFloat(self.io1.timeOffDelay), 1, self.io1.write, (False,))
|
||||
if self.io2.autoShutDown and self.io2.enable:
|
||||
scheduler.enter(self.toFloat(self.io2.timeDelay), 1, self.io2.write, (False,))
|
||||
scheduler.enter(self.toFloat(self.io2.timeOffDelay), 1, self.io2.write, (False,))
|
||||
if self.io3.autoShutDown and self.io3.enable:
|
||||
scheduler.enter(self.toFloat(self.io3.timeDelay), 1, self.io3.write, (False,))
|
||||
scheduler.enter(self.toFloat(self.io3.timeOffDelay), 1, self.io3.write, (False,))
|
||||
if self.io4.autoShutDown and self.io4.enable:
|
||||
scheduler.enter(self.toFloat(self.io4.timeDelay), 1, self.io4.write, (False,))
|
||||
scheduler.enter(self.toFloat(self.io4.timeOffDelay), 1, self.io4.write, (False,))
|
||||
scheduler.run()
|
||||
|
||||
#~~ SettingsPlugin mixin
|
||||
@@ -279,6 +293,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
filamentSensorEnable=True,
|
||||
filamentSensorActiveLow=True,
|
||||
filamentSensorGcode="M600;",
|
||||
filamentSensorTimeout=120,
|
||||
dhtModel=2302,
|
||||
io1Pin=18,
|
||||
io2Pin=23,
|
||||
@@ -308,6 +323,10 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
io2TimeDelay=0,
|
||||
io3TimeDelay=0,
|
||||
io4TimeDelay=0,
|
||||
io1OffTimeDelay=0,
|
||||
io2OffTimeDelay=0,
|
||||
io3OffTimeDelay=0,
|
||||
io4OffTimeDelay=0,
|
||||
getTempScript="~/.octoprint/plugins/OctoPrint-Enclosure/extras/GetTemperature.py",
|
||||
getHumiScript="~/.octoprint/plugins/OctoPrint-Enclosure/extras/GetHumidity.py"
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ $(function() {
|
||||
self.enclosureHumidity = ko.observable();
|
||||
|
||||
self.onStartupComplete = function () {
|
||||
correctCheckBoxStatus();
|
||||
fixUI();
|
||||
};
|
||||
|
||||
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
||||
@@ -100,11 +100,49 @@ function isNumeric(n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
}
|
||||
|
||||
function correctCheckBoxStatus() {
|
||||
function fixUI() {
|
||||
if($('#enableTemperatureReading').is(':checked')){
|
||||
$('#enableHeater').prop('disabled', false);
|
||||
$('#temperature_reading_content').show("blind");
|
||||
}else{
|
||||
$('#enableHeater').prop('disabled', true);
|
||||
$('#enableHeater').prop('checked', false);
|
||||
$('#temperature_reading_content').hide("blind");
|
||||
}
|
||||
|
||||
if($('#enableHeater').is(':checked')){
|
||||
$('#heater_content').show("blind");
|
||||
}else{
|
||||
$('#heater_content').hide("blind");
|
||||
}
|
||||
|
||||
if($('#io1_enabled').is(':checked')){
|
||||
$('#io1_content').show("blind");
|
||||
}else{
|
||||
$('#io1_content').hide("blind");
|
||||
}
|
||||
|
||||
if($('#io2_enabled').is(':checked')){
|
||||
$('#io2_content').show("blind");
|
||||
}else{
|
||||
$('#io2_content').hide("blind");
|
||||
}
|
||||
|
||||
if($('#io3_enabled').is(':checked')){
|
||||
$('#io3_content').show("blind");
|
||||
}else{
|
||||
$('#io3_content').hide("blind");
|
||||
}
|
||||
|
||||
if($('#io4_enabled').is(':checked')){
|
||||
$('#io4_content').show("blind");
|
||||
}else{
|
||||
$('#io4_content').hide("blind");
|
||||
}
|
||||
|
||||
if($('#filament_sensor_enable').is(':checked')){
|
||||
$('#filament_sensor_content').show("blind");
|
||||
}else{
|
||||
$('#filament_sensor_content').hide("blind");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,45 @@
|
||||
<form class="form-horizontal" id="enclosure_settings_temperature">
|
||||
<h4>{{ _('Temperature Sensor') }}</h4>
|
||||
Available options are: 11 for DHT11; 22 for DHT22; 2302 for AM2302; 1820 for DS18B20 1-wire temperature sensor
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input id="enableTemperatureReading" type="checkbox" onclick="correctCheckBoxStatus()" data-bind="checked: settings.plugins.enclosure.temperatureReadingEnable"> {{ _('Temperature Reading') }}
|
||||
<input id="enableTemperatureReading" type="checkbox" onclick="fixUI()" data-bind="checked: settings.plugins.enclosure.temperatureReadingEnable"> {{ _('Temperature Reading') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-dhtPin">{{ _('Sensor Pin') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.dhtPin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-dhtModel">{{ _('Sensor Type') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.dhtModel">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-getTempScript">{{ _('Get Temperature Script') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.getTempScript">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-getHumiScript">{{ _('Get Humidity Script') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.getHumiScript">
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.useFahrenheit"> {{ _('Use Fahrenheit Unit') }}
|
||||
</label>
|
||||
<div id="temperature_reading_content">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-dhtPin">{{ _('Sensor Pin') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.dhtPin">
|
||||
<span class="help-inline">GPIO pin for temperature sensor, recommended to use 4 as DS18B20 only works on pin 4</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-dhtModel">{{ _('Sensor Type') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.dhtModel">
|
||||
<span class="help-inline">Available options are: 11 for DHT11; 22 for DHT22; 2302 for AM2302; 1820 for DS18B20 1-wire temperature sensor</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-getTempScript">{{ _('Get Temperature Script') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.getTempScript">
|
||||
<span class="help-inline">Location of script that reads temperature</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-getHumiScript">{{ _('Get Humidity Script') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.getHumiScript">
|
||||
<span class="help-inline">Location of script that reads humidity</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.useFahrenheit"> {{ _('Use Fahrenheit Unit') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if you want to work with Celsius or Fahrenheit</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -42,20 +48,24 @@ Available options are: 11 for DHT11; 22 for DHT22; 2302 for AM2302; 1820 for DS1
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input id="enableHeater" type="checkbox" data-bind="checked: settings.plugins.enclosure.heaterEnable"> {{ _('Enable Heater') }}
|
||||
<input id="enableHeater" onclick="fixUI()" type="checkbox" data-bind="checked: settings.plugins.enclosure.heaterEnable"> {{ _('Enable Heater') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-heaterpin">{{ _('Heater Pin') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.heaterPin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.heaterActiveLow"> {{ _('Heater Active Low') }}
|
||||
</label>
|
||||
<div id="heater_content">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-heaterpin">{{ _('Heater Pin') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.heaterPin">
|
||||
<span class="help-inline">GPIO pin used to control Heater. You can not use GPIO 4 here</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.heaterActiveLow"> {{ _('Heater Active Low') }}
|
||||
</label>
|
||||
<span class="help-inline">Active low means that the heater will turn on when receive a low signal (groud) from Raspbery PI</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -64,38 +74,63 @@ Available options are: 11 for DHT11; 22 for DHT22; 2302 for AM2302; 1820 for DS1
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io1Enable"> {{ _('Enable IO 1') }}
|
||||
<input id="io1_enabled" onclick="fixUI()" type="checkbox" data-bind="checked: settings.plugins.enclosure.io1Enable"> {{ _('Enable IO 1') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-group" id="io1_content">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('IO 1 Label') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io1Label">
|
||||
<span class="help-inline">Name displayed on Enclosure Tab</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('IO 1 Number') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io1Pin">
|
||||
<span class="help-inline">GPIO number that will be controlled. You can not use GPIO 4 here</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io1ActiveLow"> {{ _('Active Low') }}
|
||||
</label>
|
||||
<span class="help-inline">Active low means that the GPIO will turn on when receive a low signal (groud) from Raspbery PI</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io1AutoStartup"> {{ _('Auto Startup') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn on automatomatically when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('Startup Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io1TimeDelay">
|
||||
<span class="help-inline">Time delay to turn on GPIO when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io1AutoShutDown"> {{ _('Auto Shutdown') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn off automatomatically when print finishes</span>
|
||||
</div>
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('Delay (Seconds)') }}</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('Shutdown Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io1TimeDelay">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io1OffTimeDelay">
|
||||
<span class="help-inline">Time delay to turn off GPIO when print finishes</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -104,78 +139,129 @@ Available options are: 11 for DHT11; 22 for DHT22; 2302 for AM2302; 1820 for DS1
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io2Enable"> {{ _('Enable IO 2') }}
|
||||
<input id="io2_enabled" onclick="fixUI()" type="checkbox" data-bind="checked: settings.plugins.enclosure.io2Enable"> {{ _('Enable IO 2') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-group" id="io2_content">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io2">{{ _('IO 2 Label') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io2Label">
|
||||
<span class="help-inline">Name displayed on Enclosure Tab</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io2">{{ _('IO 2 Number') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io2Pin">
|
||||
<span class="help-inline">GPIO number that will be controlled. You can not use GPIO 4 here</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io2ActiveLow"> {{ _('Active Low') }}
|
||||
</label>
|
||||
<span class="help-inline">Active low means that the GPIO will turn on when receive a low signal (groud) from Raspbery PI</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io2AutoStartup"> {{ _('Auto Startup') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn on automatomatically when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io2">{{ _('Startup Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io2TimeDelay">
|
||||
<span class="help-inline">Time delay to turn on GPIO when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io2AutoShutDown"> {{ _('Auto Shutdown') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn off automatomatically when print finishes</span>
|
||||
</div>
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('Delay (Seconds)') }}</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io2">{{ _('Shutdown Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io2TimeDelay">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io2OffTimeDelay">
|
||||
<span class="help-inline">Time delay to turn off GPIO when print finishes</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<h4>{{ _('IO 3') }}</h4>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io3Enable"> {{ _('Enable IO 3') }}
|
||||
<input id="io3_enabled" onclick="fixUI()" type="checkbox" data-bind="checked: settings.plugins.enclosure.io3Enable"> {{ _('Enable IO 3') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-group" id="io3_content">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io3">{{ _('IO 3 Label') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io3Label">
|
||||
<span class="help-inline">Name displayed on Enclosure Tab</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io3">{{ _('IO 3 Number') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io3Pin">
|
||||
<span class="help-inline">GPIO number that will be controlled. You can not use GPIO 4 here</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io3ActiveLow"> {{ _('Active Low') }}
|
||||
</label>
|
||||
<span class="help-inline">Active low means that the GPIO will turn on when receive a low signal (groud) from Raspbery PI</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io3AutoStartup"> {{ _('Auto Startup') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn on automatomatically when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io3">{{ _('Startup Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io3TimeDelay">
|
||||
<span class="help-inline">Time delay to turn on GPIO when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io3AutoShutDown"> {{ _('Auto Shutdown') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn off automatomatically when print finishes</span>
|
||||
</div>
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('Delay (Seconds)') }}</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io3">{{ _('Shutdown Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io3TimeDelay">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io3OffTimeDelay">
|
||||
<span class="help-inline">Time delay to turn off GPIO when print finishes</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -184,84 +270,128 @@ Available options are: 11 for DHT11; 22 for DHT22; 2302 for AM2302; 1820 for DS1
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io4Enable"> {{ _('Enable IO 4') }}
|
||||
<input id="io4_enabled" onclick="fixUI()" type="checkbox" data-bind="checked: settings.plugins.enclosure.io4Enable"> {{ _('Enable IO 4') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-group" id="io4_content">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io4">{{ _('IO 4 Label') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io4Label">
|
||||
<span class="help-inline">Name displayed on Enclosure Tab</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io4">{{ _('IO 4 Number') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io4Pin">
|
||||
<span class="help-inline">GPIO number that will be controlled. You can not use GPIO 4 here</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io4ActiveLow"> {{ _('Active Low') }}
|
||||
</label>
|
||||
<span class="help-inline">Active low means that the GPIO will turn on when receive a low signal (groud) from Raspbery PI</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io4AutoStartup"> {{ _('Auto Startup') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn on automatomatically when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io4">{{ _('Startup Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io4TimeDelay">
|
||||
<span class="help-inline">Time delay to turn on GPIO when print starts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.io4AutoShutDown"> {{ _('Auto Shutdown') }}
|
||||
</label>
|
||||
<span class="help-inline">Choose if GPIO should turn off automatomatically when print finishes</span>
|
||||
</div>
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('Delay (Seconds)') }}</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-io4">{{ _('Shutdown Delay (Seconds)') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io4TimeDelay">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.io4OffTimeDelay">
|
||||
<span class="help-inline">Time delay to turn off GPIO when print finishes</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<h4>{{ _('Filament Sensor') }}</h4>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.filamentSensorEnable"> {{ _('Enable Filament Sensor') }}
|
||||
<input id="filament_sensor_enable" onclick="fixUI()" type="checkbox" data-bind="checked: settings.plugins.enclosure.filamentSensorEnable"> {{ _('Enable Filament Sensor') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-filament-sensor">{{ _('Sensor Pin') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.filamentSensorPin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.filamentSensorActiveLow"> {{ _('Active Low') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-filament-sensor">{{ _('Filament Change Gcode') }}</label>
|
||||
<div id="filament_sensor_content">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-filament-sensor">{{ _('Sensor Pin') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.filamentSensorPin">
|
||||
<span class="help-inline">GPIO number that will be used to sense end of filament. You can not use GPIO 4 here</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<textarea rows="4" class="block" data-bind="value: settings.plugins.enclosure.filamentSensorGcode"></textarea>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.filamentSensorActiveLow"> {{ _('Active Low') }}
|
||||
</label>
|
||||
<span class="help-inline">Active low means that end of the filament was detected when receive a low signal (groud) from filament sensor</span>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-enclosure-filament-sensor">{{ _('Filament Change Gcode') }}</label>
|
||||
<div class="controls">
|
||||
<textarea rows="4" class="block" data-bind="value: settings.plugins.enclosure.filamentSensorGcode"></textarea>
|
||||
<span class="help-inline">GCODE that will be sent to the printer to pause and allow filament to be changed.
|
||||
You should add <code>;</code> on the end of every line sent to the printer</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h4>{{ _('Debug / Other') }}</h4>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.debug"> {{ _('Enable debug info') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.useBoardPinNumber"> {{ _('Use Board Pin #') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#advanced_enclosure">
|
||||
<h4>{{ _('Advanced') }}</h4>
|
||||
</a>
|
||||
|
||||
<div id="advanced_enclosure" class="accordion-body collapse">
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.debug"> {{ _('Enable debug info') }}
|
||||
</label>
|
||||
<span class="help-inline">Log adcitional information on octoprint log to help trouble shoot the plugin</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.enclosure.useBoardPinNumber"> {{ _('Use Board Pin #') }}
|
||||
</label>
|
||||
<span class="help-inline">Use BOARD pin numbers instead of BCM pin numbers</span>
|
||||
</div>
|
||||
</div>
|
||||
<label class="control-label" for="settings-enclosure-io1">{{ _('Filament Detection Timeout') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.enclosure.filamentSensorTimeout">
|
||||
<span class="help-inline">Time that filament sensor will be inactive after sensing end of filament. This is to avoid sending multiple M600
|
||||
commands to the printer.</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,38 +1,40 @@
|
||||
<h4>{{ _('Heater') }}</h4>
|
||||
<table class="table table-bordered table-hover" style="table-layout: fixed; width: 100%; margin-top: 20px">
|
||||
<tr>
|
||||
<th style="width: 18%"></th>
|
||||
<th style="width: 12%; text-align: right">{{ _('Actual') }}</th>
|
||||
<th style="width: 35%">{{ _('Target') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="vertical-align: middle">{{ _('Enclosure') }}</th>
|
||||
<td style="text-align: right; vertical-align: middle" data-bind="html: enclosureTemp"></td>
|
||||
<td style="vertical-align: middle; overflow: visible">
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-mini text-right tempInput" id="enclosureSetTemp" data-bind="attr: {placeholder: cleanTemperature(requestEnclosureSetTemperature())}">
|
||||
<span class="add-on" data-bind="visible: settings.settings.plugins.enclosure.useCelsius">°C</span>
|
||||
<span class="add-on" data-bind="visible: settings.settings.plugins.enclosure.useFahrenheit">°F</span>
|
||||
<div class="btn-group">
|
||||
<button type="submit" data-bind="click: setTemperature, enable: settings.settings.plugins.enclosure.heaterEnable && isConnected()" class="btn">{{ _('Set') }}</button>
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown" data-bind="enable: settings.settings.plugins.enclosure.heaterEnable && isConnected()">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#" data-bind="click: turnOffHeater">{{ _('Off') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="vertical-align: middle">{{ _('Humidity') }}</th>
|
||||
<td style="text-align: right; vertical-align: middle" data-bind="html: enclosureHumidity"></td>
|
||||
<th></th>
|
||||
</tr>
|
||||
</table>
|
||||
<div data-bind="visible: settings.settings.plugins.enclosure.temperatureReadingEnable">
|
||||
<h4>{{ _('Heater') }}</h4>
|
||||
<table class="table table-bordered table-hover" style="table-layout: fixed; width: 100%; margin-top: 20px">
|
||||
<tr>
|
||||
<th style="width: 18%"></th>
|
||||
<th style="width: 12%; text-align: right">{{ _('Actual') }}</th>
|
||||
<th style="width: 35%">{{ _('Target') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="vertical-align: middle">{{ _('Enclosure') }}</th>
|
||||
<td style="text-align: right; vertical-align: middle" data-bind="html: enclosureTemp"></td>
|
||||
<td style="vertical-align: middle; overflow: visible">
|
||||
<div class="input-append" data-bind="visible: settings.settings.plugins.enclosure.heaterEnable">
|
||||
<input type="text" class="input-mini text-right tempInput" id="enclosureSetTemp" data-bind="attr: {placeholder: cleanTemperature(requestEnclosureSetTemperature())}">
|
||||
<span class="add-on" data-bind="visible: settings.settings.plugins.enclosure.useCelsius">°C</span>
|
||||
<span class="add-on" data-bind="visible: settings.settings.plugins.enclosure.useFahrenheit">°F</span>
|
||||
<div class="btn-group" >
|
||||
<button type="submit" data-bind="click: setTemperature, enable: settings.settings.plugins.enclosure.heaterEnable && isConnected()" class="btn">{{ _('Set') }}</button>
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown" data-bind="enable: settings.settings.plugins.enclosure.heaterEnable && isConnected()">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#" data-bind="click: turnOffHeater">{{ _('Off') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="vertical-align: middle">{{ _('Humidity') }}</th>
|
||||
<td style="text-align: right; vertical-align: middle" data-bind="html: enclosureHumidity"></td>
|
||||
<th></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div data-bind="visible: settings.settings.plugins.enclosure.io1Enable">
|
||||
<h4><p data-bind="html: settings.settings.plugins.enclosure.io1Label"></p></h4>
|
||||
|
||||
2
setup.py
2
setup.py
@@ -14,7 +14,7 @@ plugin_package = "octoprint_enclosure"
|
||||
plugin_name = "OctoPrint-Enclosure"
|
||||
|
||||
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
||||
plugin_version = "2.2"
|
||||
plugin_version = "2.3"
|
||||
|
||||
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||
# module
|
||||
|
||||
Reference in New Issue
Block a user