Merge branch 'fix/commTimeoutOnSupressedScriptCommands' into devel

Conflicts:
	CHANGELOG.md
	src/octoprint/plugins/softwareupdate/__init__.py
	src/octoprint/plugins/virtual_printer/virtual.py
	src/octoprint/util/comm.py
This commit is contained in:
Gina Häußge 2015-12-02 11:13:25 +01:00
commit 111cf2c140
11 changed files with 1431 additions and 908 deletions

View file

@ -69,6 +69,74 @@
* [#1047](https://github.com/foosel/OctoPrint/issues/1047) - Fixed 90 degree
webcam rotation for iOS Safari.
## 1.2.8 (2015-12-01)
### Improvements
* Version numbering now follows [PEP440](https://www.python.org/dev/peps/pep-0440/).
* Prepared some things for publishing OctoPrint on [PyPi](https://pypi.python.org/pypi)
in the future.
* [BlueprintPlugin mixin](http://docs.octoprint.org/en/master/plugins/mixins.html#blueprintplugin)
now has an `errorhandler` decorator that serves the same purpose as
[Flask's](http://flask.pocoo.org/docs/0.10/patterns/errorpages/#error-handlers)
([#1059](https://github.com/foosel/OctoPrint/pull/1059))
* Interpret `M25` in a GCODE file that is being streamed from OctoPrint as
indication to pause, like `M0` and `M1`.
* Cache rendered page and translation files indefinitely. That should
significantly improve performance on reloads of the web interface.
* Added the string "unknown command" to the list of ignored printer errors.
This should help with general firmware compatibility in case a firmware
lacks features.
* The "CuraEngine" plugin now makes it more obvious that it only targets
CuraEngine versions up to and including 15.04 and also links to the plugin's
homepage with more information right within the settings dialog.
* Browser tab visibility is now tracked by the web interface, disabling the
webcam and the GCODE viewer if the tab containing OctoPrint is not active.
That should reduce the amount of resource utilized by the web interface on
the client when it is not actively monitored. Might also help to mitigate
[#1065](https://github.com/foosel/OctoPrint/issues/1065), the final verdict
on that one is still out though.
* The printer log in the terminal tab will now be cut off after 3000 lines
even if autoscroll is disabled. If the limit is reached, no more log lines
will be added to the client's buffer. That ensures that the log will not
scroll and the current log excerpt will stay put while also not causing
the browser to run into memory errors due to trying to buffer an endless
amount of log lines.
* Added a couple of unit tests
### Bug Fixes
* [#1120](https://github.com/foosel/OctoPrint/issues/1120) - Made the watchdog
that monitors and handles the `watched` folder more resilient towards errors.
* [#1125](https://github.com/foosel/OctoPrint/issues/1125) - Fixed OctoPrint
displaying bed temperature and controls and allowing the sending of GCODE
commands targeting the bed (`M140`, `M190`) if the printer profile doesn't
have a heated bed configured.
* Fix: Current filename in job data should never be prefixed with `/`
* Only persist plugin settings that differ from the defaults. This way the
`config.yaml` won't be filled with lots of redundant data. It's the
responsibility of the plugin authors to responsibly handle changes in default
settings of their plugins and add data migration where necessary.
* Fixed a documentation bug ([#1067](https://github.com/foosel/OctoPrint/pull/1067))
* Fixed a conflict with bootstrap-responsive, e.g. when using the
[ScreenSquish Plugin](http://plugins.octoprint.org/plugins/screensquish/)
([#1103](https://github.com/foosel/OctoPrint/pull/1067))
* Fixed OctoPrint still sending SD card related commands to the printer even
if SD card support is disabled (e.g. `M21`).
* Hidden files are no longer visible to the template engine, neither as (GCODE)
scripts nor as interface templates.
* The hostname and URL prefix via which the OctoPrint web interface is accessed
is now part of the cache key. Without that being the case the cache could
be created referring to something like `/octoprint/prefix/api/` for its API
endpoint (if accessed via `http://somehost:someport/octoprint/prefix/` first
time), which would then cause the interface to not work if accessed later
via another route (e.g. `http://someotherhost/`).
* Fixed a JavaScript error on finishing streaming of a file to SD.
* Fixed version reporting on detached HEADs (when the branch detection
reported "HEAD" instead of "(detached"
([Commits](https://github.com/foosel/OctoPrint/compare/1.2.7...1.2.8))
## 1.2.7 (2015-10-20)
### Improvements

View file

@ -6,24 +6,30 @@ or **[creating pull requests](#pull-requests)**.
## Contents
* [Issues, Tickets, however you may call them](#issues-tickets-however-you-may-call-them)
* [How to file a bug report](#how-to-file-a-bug-report)
* [How to file a bug report](#how-to-file-a-bug-report)
* [What should I do before submitting a bug report?](#what-should-i-do-before-submitting-a-bug-report)
* [What should I include in a bug report?](#what-should-i-include-in-a-bug-report)
* [Where can I find which version and branch I'm on?](#where-can-i-find-which-version-and-branch-im-on)
* [Where can I find those log files you keep talking about?](#where-can-i-find-those-log-files-you-keep-talking-about)
* [Where can I find my browser's error console?](#where-can-i-find-my-browsers-error-console)
* [Pull requests](#pull-requests)
* [History](#history)
* [Footnotes](#footnotes)
## Issues, Tickets, however you may call them
Please read the following short instructions fully and follow them. This helps
the maintainers to address problems in a timely manner and without taking away
unnecessary time from actual bug fixing and feature addition. You can therefore
help the project tremendously by just following these few points.
Please read the following short instructions fully and follow them. You can
help the project tremendously this way: not only do you help the maintainers
to **address problems in a timely manner** but also keep it possible for them
to **fix bugs, add new and improve on existing functionality** instead of doing
nothing but ticket management.
![Ticket flow chart](http://i.imgur.com/VS8D0Kw.png)
![Ticket flow chart](http://i.imgur.com/qYSZyuw.png)
- **[Read the FAQ](https://github.com/foosel/OctoPrint/wiki/FAQ)**
- If you want to report a **bug**, [see below for information on how to file a bug report](#how-to-file-a-bug-report)
and *use the provided template*. You do not need to do anything else with
your ticket.
- If you want to report a **bug**, [read "How to file a bug report" below](#how-to-file-a-bug-report)
and *[use the provided template](#what-should-i-include-in-a-ticket)*.
You do not need to do anything else with your ticket.
- If you want to post a **request** of any kind (feature request, documentation
request, ...), add `[Request]` to your issue's title (e.g. `[Request] Awesome new feature`).
- If you are a **developer** that wants to brainstorm a pull request or possible
@ -48,15 +54,15 @@ available for the maintainers to directly start tackling that problem.
----
### How to file a bug report
## How to file a bug report
If you encounter an issue with OctoPrint, you are welcome to
[submit a bug report](https://goo.gl/GzkGv9).
Before you do so for the first time though please take a moment to read the
Before you do that for the first time though please take a moment to read the
following section *completely*. Thank you! :)
#### What should I do before submitting a ticket?
### What should I do before submitting a bug report?
1. **Make sure you are at the right location**. This is the Github repository
of the official version of OctoPrint, which is the 3D print server and
@ -83,6 +89,7 @@ following section *completely*. Thank you! :)
If you are feeling up to it you might also want to try the current development
version of OctoPrint (if you aren't already). Refer to the [FAQ](https://github.com/foosel/OctoPrint/wiki/FAQ)
for information on how to do this.
3. The problem still exists? Then please **look through the
[existing tickets](https://github.com/foosel/OctoPrint/issues?state=open)
(use the [search](https://github.com/foosel/OctoPrint/search?q=&ref=cmdform&type=Issues))**
@ -93,7 +100,7 @@ following section *completely*. Thank you! :)
(e.g. do not only search for "webcam" if you happen to run into an issue
with your webcam, also search for "timelapse" etc).
#### What should I include in a ticket?
### What should I include in a bug report?
Always use the following template (you can remove what's within `[...]`, that's
only provided here as some additional information for you):
@ -142,7 +149,7 @@ only provided here as some additional information for you):
I have read the FAQ.
#### Where can I find which version and branch I'm on?
### Where can I find which version and branch I'm on?
You can find out all of them by taking a look into the lower left corner of the
OctoPrint UI:
@ -157,7 +164,7 @@ in OctoPrint's folder will tell you the version of OctoPrint you are running
the branch you are on with a little *. `git rev-parse HEAD` will tell you the
current commit.
#### Where can I find those log files you keep talking about?
### Where can I find those log files you keep talking about?
OctoPrint by default provides two log outputs, a third one can be enabled if
more information is needed.
@ -166,13 +173,14 @@ One is contained in the **"Terminal" tab** within OctoPrint's UI and is a log
of the last 300 lines of communication with the printer. Please copy-paste
this somewhere (disable auto scroll to make copying the contents easier) -
e.g. http://pastebin.com or http://gist.github.com - and include a link in
your ticket.
your bug report.
There is also **OctoPrint's application log file** or in short `octoprint.log`,
which is by default located at `~/.octoprint/logs/octoprint.log` on Linux,
`%APPDATA%\OctoPrint\logs\octoprint.log` on Windows and
`~/Library/Application Support/OctoPrint/logs/octoprint.log` on MacOS. Please
copy-paste this to pastebin or gist as well and include a link in your ticket.
copy-paste this to pastebin or gist as well and include a link in your bug
report.
It might happen that you are asked to provide a more **thorough log of the
communication with the printer** if you haven't already done so, the `serial.log`.
@ -181,13 +189,13 @@ it in the settings dialog. After enabling that log, please reproduce the problem
again (connect to the printer, do whatever triggers it), then copy-paste
`~/.octoprint/logs/serial.log` (Windows: `%APPDATA%\OctoPrint\logs\serial.log`,
MacOS: `~/Library/Application Support/OctoPrint/logs/serial.log`) to pastebin
or gist and include the link in the ticket.
or gist and include the link in the bug report.
You might also be asked to provide a log with an increased log level. You can
find information on how to do just that in the
[docs](http://docs.octoprint.org/en/master/configuration/logging_yaml.html).
#### Where can I find my browser's error console?
### Where can I find my browser's error console?
See [How to open the Javascript Console in different browsers](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers)
@ -212,7 +220,6 @@ See [How to open the Javascript Console in different browsers](https://webmaster
per feature/bug fix**. If your PR contains an important bug fix, we will
make sure to backport it to the `maintenance` branch to also include it in
the next release.
your pull request.
4. Make sure you **follow the current coding style**. This means:
* Tabs instead of spaces in the Python files[2]
* Spaces instead of tabs in the Javascript sources
@ -233,7 +240,7 @@ See [How to open the Javascript Console in different browsers](https://webmaster
as in, what feature does it implement, what bug does it fix. The more
thoroughly you explain your intent behind the PR here, the higher the
chances it will get merged fast.
7. Important: Don't forget to **add yourself to the [AUTHORS](../AUTHORS.md)
7. Important: Don't forget to **add yourself to the [AUTHORS](./AUTHORS.md)
file** :)
## History
@ -242,7 +249,7 @@ See [How to open the Javascript Console in different browsers](https://webmaster
redirected to Mailinglist/G+ community
* 2015-01-27: Added another explicit link to the FAQ
* 2015-07-07: Added step to add yourself to AUTHORS when creating a PR :)
* 2015-11-30: Heavily reworked to include examples, better structure and
* 2015-12-01: Heavily reworked to include examples, better structure and
all information in one document.
## Footnotes

View file

@ -516,19 +516,28 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
"""
checks = self._get_configured_checks()
populated_checks = dict()
for target, check in checks.items():
try:
populated_checks[target] = self._populated_check(target, check)
except exceptions.UnknownCheckType:
self._logger.debug("Ignoring unknown check type for target {}".format(target))
except:
self._logger.exception("Error while populating check prior to update for target {}".format(target))
if check_targets is None:
check_targets = checks.keys()
to_be_updated = sorted(set(check_targets) & set(checks.keys()))
check_targets = populated_checks.keys()
to_be_updated = sorted(set(check_targets) & set(populated_checks.keys()))
if "octoprint" in to_be_updated:
to_be_updated.remove("octoprint")
tmp = ["octoprint"] + to_be_updated
to_be_updated = tmp
updater_thread = threading.Thread(target=self._update_worker, args=(checks, to_be_updated, force))
updater_thread = threading.Thread(target=self._update_worker, args=(populated_checks, to_be_updated, force))
updater_thread.daemon = False
updater_thread.start()
check_data = dict((key, self._populated_check(key, check)["displayName"]) for key, check in checks.items() if key in to_be_updated)
check_data = dict((key, check["displayName"] if "displayName" in check else key) for key, check in populated_checks.items() if key in to_be_updated)
return to_be_updated, check_data
def _update_worker(self, checks, check_targets, force):

View file

@ -81,6 +81,8 @@ class VirtualPrinter(object):
self._sendWait = settings().getBoolean(["devel", "virtualPrinter", "sendWait"])
self._waitInterval = settings().getFloat(["devel", "virtualPrinter", "waitInterval"])
self._echoOnM117 = settings().getBoolean(["devel", "virtualPrinter", "echoOnM117"])
self.currentLine = 0
self.lastN = 0
@ -306,7 +308,8 @@ class VirtualPrinter(object):
def _gcode_M117(self, data):
# we'll just use this to echo a message, to allow playing around with pause triggers
self._send("echo:%s" % re.search("M117\s+(.*)", data).group(1))
if self._echoOnM117:
self._send("echo:%s" % re.search("M117\s+(.*)", data).group(1))
def _gcode_M400(self, data):
self.buffered.join()

View file

@ -309,7 +309,8 @@ default_settings = {
"commandBuffer": 4,
"sendWait": True,
"waitInterval": 1.0,
"supportM112": True
"supportM112": True,
"echoOnM117": True
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1189,20 +1189,9 @@ class MachineCom(object):
elif "ok" in line or (self._state == self.STATE_PRINTING and supportWait and "wait" in line):
# a wait while printing means our printer's buffer ran out, probably due to some ok getting
# swallowed, so we treat it the same as an ok here teo take up communication again
if self._resendSwallowNextOk:
self._resendSwallowNextOk = False
# swallowed, so we treat it the same as an ok here to take up communication again
self._handle_ok()
elif self._resendDelta is not None:
self._resendNextCommand()
else:
if self._sendFromQueue():
pass
elif self._state == self.STATE_PRINTING and not self.isSdPrinting():
self._sendNext()
# resend -> start resend procedure from requested line
elif line.lower().startswith("resend") or line.lower().startswith("rs"):
self._handleResendRequest(line)
except:
@ -1215,6 +1204,24 @@ class MachineCom(object):
eventManager().fire(Events.ERROR, {"error": self.getErrorString()})
self._log("Connection closed, closing down monitor")
def _handle_ok(self):
if not self._state in (self.STATE_PRINTING, self.STATE_OPERATIONAL, self.STATE_PAUSED):
return
if self._resendSwallowNextOk:
self._resendSwallowNextOk = False
elif self._resendDelta is not None:
self._resendNextCommand()
else:
self._continue_sending()
def _continue_sending(self):
if self._state == self.STATE_PRINTING:
if not self._sendFromQueue() and not self.isSdPrinting():
self._sendNext()
elif self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PAUSED:
self._sendFromQueue()
def _process_registered_message(self, line, feedback_matcher, feedback_controls, feedback_errors):
feedback_match = feedback_matcher.search(line)
if feedback_match is None:
@ -1307,20 +1314,29 @@ class MachineCom(object):
return get_interval("temperature", default_value=busy_default)
def _sendFromQueue(self):
if not self._commandQueue.empty() and not self.isStreaming():
# We loop here to make sure that if we do NOT send the first command
# from the queue, we'll send the second (if there is one). We do not
# want to get stuck here by throwing away commands.
while True:
if self._commandQueue.empty() or self.isStreaming():
# no command queue or irrelevant command queue => return
return False
entry = self._commandQueue.get()
if isinstance(entry, tuple):
if not len(entry) == 2:
return False
# something with that entry is broken, ignore it and fetch
# the next one
continue
cmd, cmd_type = entry
else:
cmd = entry
cmd_type = None
self._sendCommand(cmd, cmd_type=cmd_type)
return True
else:
return False
if self._sendCommand(cmd, cmd_type=cmd_type):
# we actually did add this cmd to the send queue, so let's
# return, we are done here
return True
def _detectPort(self, close):
programmer = stk500v2.Stk500v2()
@ -1566,7 +1582,7 @@ class MachineCom(object):
# Make sure we are only handling one sending job at a time
with self._sendingLock:
if self._serial is None:
return
return False
gcode = None
if not self.isStreaming():
@ -1575,7 +1591,7 @@ class MachineCom(object):
if cmd is None:
# command is no more, return
return
return False
if gcode and gcode in gcodeToEvent:
# if this is a gcode bound to an event, trigger that now
@ -1588,6 +1604,8 @@ class MachineCom(object):
# trigger the "queued" phase only if we are not streaming to sd right now
self._process_command_phase("queued", cmd, cmd_type, gcode=gcode)
return True
##~~ send loop handling
def _enqueue_for_sending(self, command, linenumber=None, command_type=None):
@ -1641,11 +1659,23 @@ class MachineCom(object):
command, _, gcode = self._process_command_phase("sending", command, command_type, gcode=gcode)
if command is None:
# so no, we are not going to send this, that was a last-minute bail, let's fetch the next item from the queue
# No, we are not going to send this, that was a last-minute bail.
# However, since we already are in the send queue, our _monitor
# loop won't be triggered with the reply from this unsent command
# now, so we try to tickle the processing of any active
# command queues manually
self._continue_sending()
# and now let's fetch the next item from the queue
continue
if command.strip() == "":
self._logger.info("Refusing to send an empty line to the printer")
# same here, tickle the queues manually
self._continue_sending()
# and fetch the next item
continue
# now comes the part where we increase line numbers and send stuff - no turning back now

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff