Compare commits

...
13 Commits
Author SHA1 Message Date
Gina Häußge e5caa3d0bf Preparing release of 1.3.7rc4 2018-04-04 11:10:45 +02:00
Gina Häußge a821346b07 Don't trigger PRINT_FAILED twice on disconnect
Fixes #2546
2018-04-04 11:10:43 +02:00
Gina Häußge 0ac9ea518c SWU: Update "How to use release channels" link 2018-04-03 17:47:23 +02:00
Gina Häußge 9f80aefcc9 thaw_frozendict should be fully recursive
So far it was only deep-diving into frozendicts, not dicts (which might
contain frozendicts).

In principle we probably should also dive into tuples and lists and
other containers, but in our current application we don't put
frozendicts into those so let's not overdo it.
2018-04-03 16:56:59 +02:00
Gina Häußge c1fe8f5a35 Fix RawWebsocketTransport of sockjs
Ran into issues due to session wrapping in order to support custom
Json encoding.

We now make sure to

  * only wrap non-raw sessions (since only those have send_jsonified
    defined which we overwrite)
  * overwrite tornado.escape.json_encode to use our custom encoder as
    fallback, since that is used for RawWebsocketTransport

Fixes an issue with the /sockjs/websocket endpoint hinted at in #2529
2018-04-03 16:45:14 +02:00
Gina Häußge fcecb5c0f0 Fix heatup flag not resetting on external SD print start
If the start of the SD print could only be verified after the blocking
heatup was through, the start time was reset to None and hence the
heatup flag was not cleared on receival of the first ok, causing no
commands to be sent out and things to run into a timeout.

Fixes #2536
2018-04-03 15:41:13 +02:00
Gina Häußge 25005b547c Virtual: Add some debug commands for sd printing 2018-04-03 15:38:43 +02:00
Gina Häußge dbfe7fece1 staging/maintenance is now 1.3.7rc4.dev 2018-03-29 16:58:55 +02:00
Gina Häußge 9c5d996ea2 Preparing release of 1.3.7rc3 2018-03-29 15:47:35 +02:00
Gina Häußge b8e7cfb506 "Where to find versions" is not on the FAQ 2018-03-29 14:24:58 +02:00
Gina Häußge 822f757f9d Ignore wait if job is on hold
See #2524
2018-03-29 14:23:17 +02:00
Gina Häußge b04aff7d5e Fix command expansion for non-gcode commands 2018-03-28 15:24:50 +02:00
Gina Häußge 028425542f staging/maintenance is now 1.3.7rc3.dev 2018-03-23 16:28:47 +01:00
18 changed files with 105 additions and 58 deletions

No files matched your search

+3 -3
View File
@@ -23,10 +23,10 @@ maintenance 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
fix/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
improve/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
# staging/maintenance is currently the branch for preparation of 1.3.7rc2
# staging/maintenance is currently the branch for preparation of 1.3.7rc4
# so is regressionfix/...
staging/maintenance 1.3.7rc2 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
regressionfix/.* 1.3.7rc2 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
staging/maintenance 1.3.7rc4 9c5d996ea2b66a085392981a5e6e0ee341013674 pep440-dev
regressionfix/.* 1.3.7rc4 9c5d996ea2b66a085392981a5e6e0ee341013674 pep440-dev
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
+18
View File
@@ -1,5 +1,23 @@
# OctoPrint Changelog
## 1.3.7rc4 (2018-04-04)
### Bugfixes
* [#2536](https://github.com/foosel/OctoPrint/issues/2536) - Fix a wrong state tracking when starting an SD print through the controller, causing a disconnect due to a timeout.
* [#2544](https://github.com/foosel/OctoPrint/issues/2544) - Fix an exception when connecting to the raw websocket at `/sockjs/websocket` (instead of `/sockjs/<server_id>/<session_id>/websocket`).
* [#2546](https://github.com/foosel/OctoPrint/issues/2546) - Fix the `PRINT_FAILED` event getting triggered twice on print failure due to disconnect
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.7rc3...1.3.7rc4))
## 1.3.7rc3 (2018-03-29)
### Bugfixes
* [#2524](https://github.com/foosel/OctoPrint/issues/2524) Ignore `wait` while job is on hold.
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.7rc2...1.3.7rc3))
## 1.3.7rc2 (2018-03-23)
### Bugfixes
+3 -13
View File
@@ -275,22 +275,11 @@ all requested information or your ticket will be closed.
### 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:
![Current version and git branch info in OctoPrint's UI](http://i.imgur.com/HyHMlY2.png)
If you don't have access to the UI you can find out that information via the
command line as well. Either `octoprint --version` or `python setup.py version`
in OctoPrint's folder will tell you the version of OctoPrint you are running
(note: if it doesn't then you are running a version older than 1.1.0,
*upgrade now*). A `git branch` in your OctoPrint installation folder will mark
the branch you are on with a little *. `git rev-parse HEAD` will tell you the
current commit.
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/how-can-i-find-out-the-version-of-octoprint-or-octopi-i-am-running/204/1).
### Where can I find those log files you keep talking about?
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/where-can-i-find-octoprints-log-files/299).
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299/1).
### Where can I find my browser's error console?
@@ -483,6 +472,7 @@ the local version identifier to allow for an exact determination of the active c
* 2017-11-22: Added note on how to run the unit tests
* 2018-03-15: Link to new community forum and some clarifications re bug
reporting
* 2018-03-29: "Where to find version numbers" is now located on the FAQ
## Footnotes
* [1] - If you are wondering why, the problem is that anything that you add
+3 -4
View File
@@ -6,11 +6,8 @@ thanks to everyone who contributed!
## Patreon Patrons
* 3D Moniak
* Aleph Objects, Inc.
* Andrew Moorby
* Arnljot Arntsen
* BEEVERYCREATIVE
* Boris Hussein
* Brad Jackson
* Brian E. Tyler
@@ -33,7 +30,9 @@ thanks to everyone who contributed!
* Kale Stedman
* Kazuhiro Ogura
* Kodama Inc.
* LulzBot®
* Makespace Madrid
* Mark Walker
* Martin Beattie
* Michael Aumock
* Miles Flavel
@@ -55,4 +54,4 @@ thanks to everyone who contributed!
* Thomas Hatley
* Trent Shumay
and 1199 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 1217 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
@@ -2,6 +2,6 @@
<label class="control-label">{{ _('OctoPrint Release Channel') }}</label>
<div class="controls">
<select data-bind="value: config_releaseChannel, options: config_availableReleaseChannels, optionsText: 'name', optionsValue: 'key'"></select>
<span class="help-inline">{{ _('Make sure you have read <a href="%(url)s" target="_blank" rel="noreferrer noopener">"Using Release Channels"</a> before switching to a release channel other than "Stable"', url="https://github.com/foosel/OctoPrint/wiki/Using-Release-Channels") }}</span>
<span class="help-inline">{{ _('Make sure you have read <a href="%(url)s" target="_blank" rel="noreferrer noopener">"How to use the release channels to help test release candidates"</a> before switching to a release channel other than "Stable"', url="https://faq.octoprint.org/using-release-channels") }}</span>
</div>
</div>
@@ -29,6 +29,7 @@ class VirtualPrinter(object):
prepare_ok_regex = re.compile("prepare_ok (.*)")
send_regex = re.compile("send (.*)")
set_ambient_regex = re.compile("set_ambient ([-+]?[0-9]*\.?[0-9]+)")
start_sd_regex = re.compile("start_sd (.*)")
def __init__(self, seriallog_handler=None, read_timeout=5.0, write_timeout=10.0):
import logging
@@ -266,6 +267,10 @@ class VirtualPrinter(object):
while self.incoming is not None and not self._killed:
self._simulateTemps()
if self._heatingUp:
time.sleep(1)
continue
try:
data = self.incoming.get(timeout=0.01)
self.incoming.task_done()
@@ -729,6 +734,13 @@ class VirtualPrinter(object):
sleep_after_next <str:command> <int:seconds>
| Sleeps <seconds> s after execution of next <command>
# SD printing
start_sd <str:file>
| Start printing file <file> from SD
cancel_sd
| Cancels an ongoing SD print
# Misc
send <str:message>
@@ -765,6 +777,13 @@ class VirtualPrinter(object):
elif data == "go_awol":
self._send("// Going AWOL")
self._debug_awol = True
elif data == "cancel_sd":
if self._sdPrinting and self._sdPrinter:
self._pauseSdPrint()
self._sdPrinting = False
self._sdPrintingSemaphore.set()
self._sdPrinter.join()
self._finishSdPrint()
else:
try:
sleep_match = VirtualPrinter.sleep_regex.match(data)
@@ -774,6 +793,7 @@ class VirtualPrinter(object):
prepare_ok_match = VirtualPrinter.prepare_ok_regex.match(data)
send_match = VirtualPrinter.send_regex.match(data)
set_ambient_match = VirtualPrinter.set_ambient_regex.match(data)
start_sd_match = VirtualPrinter.start_sd_regex.match(data)
if sleep_match is not None:
interval = int(sleep_match.group(1))
@@ -802,6 +822,9 @@ class VirtualPrinter(object):
elif set_ambient_match is not None:
self._ambient_temperature = float(set_ambient_match.group(1))
self._send("// set ambient temperature to {}".format(self._ambient_temperature))
elif start_sd_match is not None:
self._selectSdFile(start_sd_match.group(1))
self._startSdPrint()
except:
pass
@@ -953,7 +976,7 @@ class VirtualPrinter(object):
matchE = re.search("E([0-9.]+)", line)
matchF = re.search("F([0-9.]+)", line)
duration = 0
duration = 0.0
if matchF is not None:
try:
self._lastF = float(matchF.group(1))
@@ -1022,6 +1045,7 @@ class VirtualPrinter(object):
pass
if duration:
duration *= 0.1
if duration > self._read_timeout:
slept = 0
while duration - slept > self._read_timeout and not self._killed:
@@ -1119,9 +1143,9 @@ class VirtualPrinter(object):
# set target temps
if 'M104' in line or 'M109' in line:
self._parseHotendCommand(line)
self._parseHotendCommand(line, wait='M109' in line)
elif 'M140' in line or 'M190' in line:
self._parseBedCommand(line)
self._parseBedCommand(line, wait='M190' in line)
elif line.startswith("G0") or line.startswith("G1") or line.startswith("G2") or line.startswith("G3"):
# simulate reprap buffered commands via a Queue with maxsize which internally simulates the moves
self.buffered.put(line)
@@ -1130,6 +1154,9 @@ class VirtualPrinter(object):
if self.outgoing is not None:
raise
self._finishSdPrint()
def _finishSdPrint(self):
if not self._killed:
self._sdPrintingSemaphore.clear()
self._selectedSdFilePos = 0
+2 -1
View File
@@ -1176,7 +1176,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def on_comm_print_job_failed(self):
payload = self._payload_for_print_job_event()
eventManager().fire(Events.PRINT_FAILED, payload)
if payload:
eventManager().fire(Events.PRINT_FAILED, payload)
def on_comm_print_job_cancelling(self, firmware_error=None):
payload = self._payload_for_print_job_event()
+1
View File
@@ -223,6 +223,7 @@ class Server(object):
# monkey patch a bunch of stuff
util.tornado.fix_ioloop_scheduling()
util.tornado.fix_json_encode()
util.flask.enable_additional_translations(additional_folders=[self._settings.getBaseFolder("translations")])
# setup app
+2 -9
View File
@@ -57,15 +57,7 @@ class ThreadSafeSession(sockjs.tornado.session.Session):
class JsonEncodingSessionWrapper(wrapt.ObjectProxy):
def send_message(self, msg, stats=True, binary=False):
"""Send or queue outgoing message
`msg`
Message to send
`stats`
If set to True, will update statistics after operation completes
"""
self.send_jsonified(json.dumps(sockjs.tornado.util.bytes_to_str(msg),
separators=(',', ':'),
default=JsonEncoding.encode),
@@ -74,7 +66,8 @@ class JsonEncodingSessionWrapper(wrapt.ObjectProxy):
class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer.PrinterCallback):
def __init__(self, printer, fileManager, analysisQueue, userManager, eventManager, pluginManager, session):
session = JsonEncodingSessionWrapper(session)
if isinstance(session, sockjs.tornado.session.Session):
session = JsonEncodingSessionWrapper(session)
sockjs.tornado.SockJSConnection.__init__(self, session)
+16
View File
@@ -59,6 +59,22 @@ def fix_ioloop_scheduling():
tornado.ioloop.PeriodicCallback._schedule_next = _schedule_next
def fix_json_encode():
"""
This makes tornado.escape.json_encode use octoprint.util.JsonEncoding.encode as fallback in order to allow
serialization of globally registered types like frozendict and others.
"""
from octoprint.util.json import JsonEncoding
import json
def fixed_json_encode(value):
return json.dumps(value, default=JsonEncoding.encode).replace("</", "<\\/")
import tornado.escape
tornado.escape.json_encode = fixed_json_encode
#~~ More sensible logging
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OctoPrint\n"
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
"POT-Creation-Date: 2018-03-23 15:23+0100\n"
"PO-Revision-Date: 2018-03-23 15:25+0100\n"
"POT-Creation-Date: 2018-04-03 17:40+0200\n"
"PO-Revision-Date: 2018-04-03 17:40+0200\n"
"Last-Translator: Gina Häußge <osd@foosel.net>\n"
"Language: de\n"
"Language-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\n"
@@ -1536,8 +1536,8 @@ msgstr "OctoPrint Release Channel"
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2:5
#, python-format
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> before switching to a release channel other than \"Stable\""
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> before switching to a release channel other than \"Stable\""
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/versionTracking.jinja2:2
msgid "OctoPrint version tracking"
+1 -1
View File
@@ -979,7 +979,7 @@ def thaw_frozendict(obj):
# only true love can thaw a frozen dict
letitgo = dict()
for key, value in obj.items():
if isinstance(value, frozendict.frozendict):
if isinstance(value, (dict, frozendict.frozendict)):
letitgo[key] = thaw_frozendict(value)
else:
letitgo[key] = copy.deepcopy(value)
+11 -11
View File
@@ -850,7 +850,6 @@ class MachineCom(object):
self._monitoring_active = False
self._send_queue_active = False
printing = self.isPrinting() or self.isPaused()
if self._serial is not None:
if not is_error:
self.sendGcodeScript("beforePrinterDisconnected")
@@ -883,6 +882,7 @@ class MachineCom(object):
self._logger.exception("Error while trying to close serial port")
is_error = True
# if we are printing, this will also make sure of firing PRINT_FAILED
if is_error:
self._changeState(self.STATE_CLOSED_WITH_ERROR)
else:
@@ -894,9 +894,6 @@ class MachineCom(object):
if settings().getBoolean(["feature", "sdSupport"]):
self._sdFileList = []
if printing:
self._callback.on_comm_print_job_failed()
def setTemperatureOffset(self, offsets):
self._tempOffsets.update(offsets)
@@ -1003,7 +1000,7 @@ class MachineCom(object):
if self._currentFile is None:
raise ValueError("No file selected for printing")
self._heatupWaitStartTime = None
self._heatupWaitStartTime = None if not self._heating else time.time()
self._heatupWaitTimeLost = 0.0
self._pauseWaitStartTime = 0
self._pauseWaitTimeLost = 0.0
@@ -1543,7 +1540,7 @@ class MachineCom(object):
handled = False
# process oks
if line.startswith("ok") or (self.isPrinting() and supportWait and line == "wait"):
if line.startswith("ok") or (self.isPrinting() and not self.job_on_hold and supportWait and line == "wait"):
# ok only considered handled if it's alone on the line, might be
# a response to an M105 or an M114
self._handle_ok()
@@ -1631,7 +1628,7 @@ class MachineCom(object):
if not disable_external_heatup_detection and not self._temperature_autoreporting \
and not line.strip().startswith("ok") and not self._heating \
and self._firmware_info_received:
self._logger.debug("Externally triggered heatup detected")
self._logger.info("Externally triggered heatup detected")
self._heating = True
self._heatupWaitStartTime = time.time()
@@ -2043,9 +2040,10 @@ class MachineCom(object):
self._clear_to_send.set()
def _finish_heatup(self):
if self._heatupWaitStartTime:
self._heatupWaitTimeLost = self._heatupWaitTimeLost + (time.time() - self._heatupWaitStartTime)
self._heatupWaitStartTime = None
if self._heating:
if self._heatupWaitStartTime:
self._heatupWaitTimeLost = self._heatupWaitTimeLost + (time.time() - self._heatupWaitStartTime)
self._heatupWaitStartTime = None
self._heating = False
def _continue_sending(self):
@@ -2913,7 +2911,9 @@ class MachineCom(object):
modified = True
else:
new_results.append((command, command_type, gcode, subcode, tags))
modified = True
else:
new_results.append((command, command_type, gcode, subcode, tags))
if modified:
if not new_results:
# gcode handler returned None or empty list for all commands, so we'll stop here and return a full out empty result
+1
View File
@@ -52,6 +52,7 @@ class MiscTestCase(unittest.TestCase):
(frozendict(a=1, b=2, c=frozendict(c1=1, c2=2)), dict(a=1, b=2, c=dict(c1=1, c2=2))),
(dict(a=1, b=2, c=3), dict(a=1, b=2, c=3)),
(dict(a=1, b=2, c=frozendict(c1=1, c2=2)), dict(a=1, b=2, c=dict(c1=1, c2=2))),
(dict(a=1, b=2, c=dict(c1=1, c2=2, c3=frozendict(c11=11, c12=12))), dict(a=1, b=2, c=dict(c1=1, c2=2, c3=dict(c11=11, c12=12))))
)
@ddt.unpack
def test_unfreeze_frozendict(self, input, expected):
Binary file not shown.
+4 -4
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OctoPrint\n"
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
"POT-Creation-Date: 2018-03-23 15:23+0100\n"
"PO-Revision-Date: 2018-03-23 15:25+0100\n"
"POT-Creation-Date: 2018-04-03 17:40+0200\n"
"PO-Revision-Date: 2018-04-03 17:40+0200\n"
"Last-Translator: Gina Häußge <osd@foosel.net>\n"
"Language: de\n"
"Language-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\n"
@@ -1536,8 +1536,8 @@ msgstr "OctoPrint Release Channel"
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/releaseChannel.jinja2:5
#, python-format
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> before switching to a release channel other than \"Stable\""
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"Using Release Channels\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
msgid "Make sure you have read <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> before switching to a release channel other than \"Stable\""
msgstr "Stelle sicher, dass du <a href=\"%(url)s\" target=\"_blank\" rel=\"noreferrer noopener\">\"How to use the release channels to help test release candidates\"</a> gelesen hast, bevor du einen anderen Release Channel als \"Stable\" auswählst."
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/versionTracking.jinja2:2
msgid "OctoPrint version tracking"
+5 -4
View File
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OctoPrint 1.3.7rc2.dev16+g47267abcd.dirty\n"
"Project-Id-Version: OctoPrint 1.3.7rc4.dev6+g2c77614b3.dirty\n"
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
"POT-Creation-Date: 2018-03-23 15:23+0100\n"
"POT-Creation-Date: 2018-04-03 17:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1709,8 +1709,9 @@ msgstr ""
#, python-format
msgid ""
"Make sure you have read <a href=\"%(url)s\" target=\"_blank\" "
"rel=\"noreferrer noopener\">\"Using Release Channels\"</a> before "
"switching to a release channel other than \"Stable\""
"rel=\"noreferrer noopener\">\"How to use the release channels to help "
"test release candidates\"</a> before switching to a release channel other"
" than \"Stable\""
msgstr ""
#: src/octoprint/plugins/softwareupdate/templates/snippets/plugins/softwareupdate/versionTracking.jinja2:2