Merge pull request #3337 from CapnBry/allowbackanal

Setting to allow gcode analysis to continue during printing
This commit is contained in:
Gina Häußge authored and GitHub committed 2019-11-12 17:24:14 +01:00
commit 766a64c8f6
7 files changed
+36 -3

No files matched your search

+5
View File
@@ -225,6 +225,7 @@ class FileManager(object):
import octoprint.settings
self._recovery_file = os.path.join(octoprint.settings.settings().getBaseFolder("data"), "print_recovery_data.yaml")
self._analyzeGcode = octoprint.settings.settings().get(["gcodeAnalysis", "runAt"])
def initialize(self, process_backlog=False):
self.reload_plugins()
@@ -232,6 +233,10 @@ class FileManager(object):
self.process_backlog()
def process_backlog(self):
# only check for a backlog if gcodeAnalysis is 'idle' or 'always'
if self._analyzeGcode == "never":
return
def worker():
self._logger.info("Adding backlog items from all storage types to analysis queue...".format(**locals()))
for storage_type, storage_manager in self._storage_managers.items():
+4 -1
View File
@@ -176,7 +176,10 @@ class AbstractAnalysisQueue(object):
(False, default)
"""
if high_priority:
if settings().get(["gcodeAnalysis", "runAt"]) == "never":
self._logger.debug("Ignoring entry {entry} for analysis queue".format(entry=entry))
return
elif high_priority:
self._logger.debug("Adding entry {entry} to analysis queue with high priority".format(entry=entry))
prio = self.__class__.HIGH_PRIO
else:
+2 -1
View File
@@ -1099,7 +1099,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
self._analysisQueue.resume() # printing done, put those cpu cycles to good use
elif state == comm.MachineCom.STATE_PRINTING:
self._analysisQueue.pause() # do not analyse files while printing
if settings().get(["gcodeAnalysis", "runAt"]) == "idle":
self._analysisQueue.pause() # only analyse files while idle
if state == comm.MachineCom.STATE_CLOSED or state == comm.MachineCom.STATE_CLOSED_WITH_ERROR:
if self._comm is not None:
+6
View File
@@ -134,6 +134,9 @@ def getSettings():
"g90InfluencesExtruder": s.getBoolean(["feature", "g90InfluencesExtruder"]),
"autoUppercaseBlacklist": s.get(["feature", "autoUppercaseBlacklist"])
},
"gcodeAnalysis": {
"runAt": s.get(["gcodeAnalysis", "runAt"])
},
"serial": {
"port": connectionOptions["portPreference"],
"baudrate": connectionOptions["baudratePreference"],
@@ -428,6 +431,9 @@ def _saveSettings(data):
if "g90InfluencesExtruder" in data["feature"]: s.setBoolean(["feature", "g90InfluencesExtruder"], data["feature"]["g90InfluencesExtruder"])
if "autoUppercaseBlacklist" in data["feature"] and isinstance(data["feature"]["autoUppercaseBlacklist"], (list, tuple)): s.set(["feature", "autoUppercaseBlacklist"], data["feature"]["autoUppercaseBlacklist"])
if "gcodeAnalysis" in data:
if "runAt" in data["gcodeAnalysis"]: s.set(["gcodeAnalysis", "runAt"], data["gcodeAnalysis"]["runAt"])
if "serial" in data:
if "autoconnect" in data["serial"]: s.setBoolean(["serial", "autoconnect"], data["serial"]["autoconnect"])
if "port" in data["serial"]: s.set(["serial", "port"], data["serial"]["port"])
+2 -1
View File
@@ -258,7 +258,8 @@ default_settings = {
"maxExtruders": 10,
"throttle_normalprio": 0.01,
"throttle_highprio": 0.0,
"throttle_lines": 100
"throttle_lines": 100,
"runAt": "idle" # 'never', 'idle', 'always'
},
"feature": {
"temperatureGraph": True,
@@ -154,6 +154,8 @@ $(function() {
self.feature_g90InfluencesExtruder = ko.observable(undefined);
self.feature_autoUppercaseBlacklist = ko.observable(undefined);
self.gcodeAnalysis_runAt = ko.observable(undefined);
self.serial_port = ko.observable();
self.serial_baudrate = ko.observable();
self.serial_exclusive = ko.observable();
@@ -56,4 +56,19 @@
<span class="help-block">{{ _('Use this to specify the commands that should not have their parameters automatically uppercased in the terminal tab. Just the G or M code, comma separated.') }}</span>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Analyze gcode for time and model size estimates')}}</label>
<div class="controls">
<label class="radio">
<input type="radio" name="analysisRunAtGroup" value="always" data-bind="checked: gcodeAnalysis_runAt" id="settings-gcodeAnalysis_runAtAlways"> {{ _('Always ') }}
</label>
<label class="radio">
<input type="radio" name="analysisRunAtGroup" value="idle" data-bind="checked: gcodeAnalysis_runAt" id="settings-gcodeAnalysis_runAtIdle"> {{ _('Only when idle (not printing)') }}
</label>
<label class="radio">
<input type="radio" name="analysisRunAtGroup" value="never" data-bind="checked: gcodeAnalysis_runAt" id="settings-gcodeAnalysis_runAtNever"> {{ _('Never') }}
</label>
</div>
</div>
</form>