Compare commits
138
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf69c4500d | ||
|
|
c7c6a08748 | ||
|
|
c9c4066331 | ||
|
|
835b973bdc | ||
|
|
bf6a32907c | ||
|
|
2b7885c3f8 | ||
|
|
749af60796 | ||
|
|
87ddcac2fc | ||
|
|
e3383fe4c1 | ||
|
|
292856e1bd | ||
|
|
3dacaaf03a | ||
|
|
6307b765e3 | ||
|
|
eb2561175d | ||
|
|
a30e41f0b4 | ||
|
|
51341f6722 | ||
|
|
fb15751703 | ||
|
|
a0105bcb2f | ||
|
|
103e0796b7 | ||
|
|
363b23d6e3 | ||
|
|
52ad02a08a | ||
|
|
977cf3c383 | ||
|
|
827ea36d72 | ||
|
|
46b0367335 | ||
|
|
596afddfb6 | ||
|
|
68e4fca347 | ||
|
|
256c2dfdbe | ||
|
|
0737ee65bd | ||
|
|
05ac02770b | ||
|
|
25dc81a5d2 | ||
|
|
9e27744a05 | ||
|
|
77df620237 | ||
|
|
8998be66eb | ||
|
|
1180cac147 | ||
|
|
270231a004 | ||
|
|
c2f0f6c7c4 | ||
|
|
c7afae38a8 | ||
|
|
873a825e57 | ||
|
|
dc2318f404 | ||
|
|
699ed1da4d | ||
|
|
d8b95f845c | ||
|
|
014d39c11d | ||
|
|
a544a852f2 | ||
|
|
3311a48e3a | ||
|
|
5ac908afd4 | ||
|
|
12a3e659b1 | ||
|
|
b0780af7fa | ||
|
|
2ec31c7521 | ||
|
|
f2562500a3 | ||
|
|
85a567bdab | ||
|
|
11c415fd17 | ||
|
|
d67ea41032 | ||
|
|
66357ebe7e | ||
|
|
8dbde90a93 | ||
|
|
d2910de121 | ||
|
|
c5be9908c5 | ||
|
|
e844d42275 | ||
|
|
a0a6f958d9 | ||
|
|
16d156b530 | ||
|
|
420226b6c0 | ||
|
|
da8e72b0d6 | ||
|
|
ef13cbecfd | ||
|
|
5910bba30e | ||
|
|
19ba3b1f99 | ||
|
|
23bc6b8df7 | ||
|
|
69bea0f5b0 | ||
|
|
3c53394f4b | ||
|
|
8741053dfc | ||
|
|
8752f70ff3 | ||
|
|
2b66df39b6 | ||
|
|
17bb0e693d | ||
|
|
94e5b5fdaf | ||
|
|
497ec5c6b2 | ||
|
|
eaeae8d5ec | ||
|
|
3a05a2653b | ||
|
|
0ca63017c7 | ||
|
|
ea3416693c | ||
|
|
6dc56af3fa | ||
|
|
af297c2031 | ||
|
|
024cf81238 | ||
|
|
9d5a500b25 | ||
|
|
4bab1975c8 | ||
|
|
eae4153158 | ||
|
|
a92aa96623 | ||
|
|
ccf0ab3b51 | ||
|
|
7259c1c2ef | ||
|
|
d66675c672 | ||
|
|
38483b0c67 | ||
|
|
19de4053fe | ||
|
|
d0ff6d1579 | ||
|
|
105b68c807 | ||
|
|
97a6d8a15e | ||
|
|
26fa3df4aa | ||
|
|
9a336336d7 | ||
|
|
047d7f5046 | ||
|
|
4fc561dab5 | ||
|
|
785ac07de9 | ||
|
|
41c6978880 | ||
|
|
f7ebc4ec11 | ||
|
|
c06e8f47f0 | ||
|
|
dceb5dccd3 | ||
|
|
7a50138ae3 | ||
|
|
43cead8249 | ||
|
|
8492944fb5 | ||
|
|
f7433de2bf | ||
|
|
bbd46fd3a6 | ||
|
|
077486c838 | ||
|
|
baedab5931 | ||
|
|
36c8f25fd1 | ||
|
|
b3050f1058 | ||
|
|
a04a61f61b | ||
|
|
58204248bb | ||
|
|
a47740ae28 | ||
|
|
48d6a27fad | ||
|
|
5ffcd78f27 | ||
|
|
de9dd77b50 | ||
|
|
51c77be7a2 | ||
|
|
f98563cbe9 | ||
|
|
8c8059db30 | ||
|
|
fa586426fa | ||
|
|
60a1bf0d43 | ||
|
|
a48f194350 | ||
|
|
78f0ec94ea | ||
|
|
44f9e756da | ||
|
|
3d992d56cd | ||
|
|
72f7b4627f | ||
|
|
5c1f165079 | ||
|
|
95755ba515 | ||
|
|
791e4e26a9 | ||
|
|
4d61963894 | ||
|
|
5622a9c565 | ||
|
|
2e5069d5a1 | ||
|
|
4cd692e061 | ||
|
|
216a88c00c | ||
|
|
10f1917589 | ||
|
|
26f7d6e517 | ||
|
|
b7b2e99ab1 | ||
|
|
0966b231e8 | ||
|
|
00e1a1962b |
No files matched your search
@@ -19,6 +19,12 @@
|
|||||||
* OctoPrint now has a [plugin system](http://docs.octoprint.org/en/devel/plugins/index.html) which allows extending its
|
* OctoPrint now has a [plugin system](http://docs.octoprint.org/en/devel/plugins/index.html) which allows extending its
|
||||||
core functionality.
|
core functionality.
|
||||||
* New type of API key: [App Session Keys](http://docs.octoprint.org/en/devel/api/apps.html) for trusted applications
|
* New type of API key: [App Session Keys](http://docs.octoprint.org/en/devel/api/apps.html) for trusted applications
|
||||||
|
* Printer Profiles: Printer properties like print volume, extruder offsets etc are now managed via Printer Profiles. A
|
||||||
|
connection to a printer will always have a printer profile associated.
|
||||||
|
* OctoPrint now supports `action:...` commands received via debug messages (`// action:...`) from the printer. Currently supported are
|
||||||
|
- `action:pause`: Pauses the current job in OctoPrint
|
||||||
|
- `action:resume`: Resumes the current job in OctoPrint
|
||||||
|
- `action:disconnect`: Disconnects OctoPrint from the printer
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
@@ -34,12 +40,16 @@
|
|||||||
* Slicing has been greatly improved:
|
* Slicing has been greatly improved:
|
||||||
* It now allows for a definition of slicing profiles to use for slicing plus overrides which can be defined per slicing
|
* It now allows for a definition of slicing profiles to use for slicing plus overrides which can be defined per slicing
|
||||||
job (defining overrides is not yet part of the UI but it's on the roadmap).
|
job (defining overrides is not yet part of the UI but it's on the roadmap).
|
||||||
|
* A new slicing dialog has been added which allows (re-)slicing uploaded STL files (which are now displayed in the file list
|
||||||
|
as well). This dialog also allows specifying which action to take after slicing has been completed (none, selecting the
|
||||||
|
sliced GCODE for printing or starting to print it directly)
|
||||||
* Slicers themselves are integrated into the system via ``SlicingPlugins``.
|
* Slicers themselves are integrated into the system via ``SlicingPlugins``.
|
||||||
* The [Cura integration](https://github.com/daid/Cura) has changed in such a way that OctoPrint now calls the
|
* The [Cura integration](https://github.com/daid/Cura) has changed in such a way that OctoPrint now calls the
|
||||||
[CuraEngine](https://github.com/Ultimaker/CuraEngine) directly instead of depending on the full Cura installation. See
|
[CuraEngine](https://github.com/Ultimaker/CuraEngine) directly instead of depending on the full Cura installation. See
|
||||||
[the wiki](https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura) for instructions on how to change your setup to
|
[the wiki](https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura) for instructions on how to change your setup to
|
||||||
accommodate the new integration.
|
accommodate the new integration.
|
||||||
* The "Slicing done" notification is now colored green ([#558](https://github.com/foosel/OctoPrint/issues/558)).
|
* The "Slicing done" notification is now colored green ([#558](https://github.com/foosel/OctoPrint/issues/558)).
|
||||||
|
* The slicing API allows positioning the model to slice on the print bed (Note: this is not yet available in the UI).
|
||||||
* File management now supports STL files as first class citizens (including UI adjustments to allow management of
|
* File management now supports STL files as first class citizens (including UI adjustments to allow management of
|
||||||
uploaded STL files including removal and reslicing) and also allows folders (not yet supported by UI)
|
uploaded STL files including removal and reslicing) and also allows folders (not yet supported by UI)
|
||||||
* Also interpret lines starting with "!!" as errors
|
* Also interpret lines starting with "!!" as errors
|
||||||
@@ -51,6 +61,17 @@
|
|||||||
long as they are in use
|
long as they are in use
|
||||||
* Settings in UI get refreshed when opening settings dialog
|
* Settings in UI get refreshed when opening settings dialog
|
||||||
* New event "SettingsUpdated"
|
* New event "SettingsUpdated"
|
||||||
|
* "Print time left" is now not displayed until it becomes somewhat stable. Display in web interface now also happens
|
||||||
|
in a fuzzy way instead of the format hh:mm:ss, to not suggest a high accuracy anymore where the can't be one. Additionally
|
||||||
|
OctoPrint will use data from prior prints to enhance the initial print time estimation.
|
||||||
|
* Added handler for uncaught exceptions to make sure those get logged, should make the logs even more useful for analysing
|
||||||
|
bug reports
|
||||||
|
* The server now tracks the modification date of the configuration file and reloads it prior to saving the config if
|
||||||
|
it has been changed during runtime by external editing, hence no config settings added manually while the server
|
||||||
|
was running should be overwritten anymore.
|
||||||
|
* Automatically hard-reload the UI if upon reconnecting to the server a new version is detected.
|
||||||
|
* Better handling of errors on the websocket - no more logging of the full stack trace to the log, only a warning
|
||||||
|
message for now.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
@@ -60,19 +81,44 @@
|
|||||||
setups under Smoothieware
|
setups under Smoothieware
|
||||||
* [#556](https://github.com/foosel/OctoPrint/issues/556) - Allow login of the same user from multiple browsers without
|
* [#556](https://github.com/foosel/OctoPrint/issues/556) - Allow login of the same user from multiple browsers without
|
||||||
side effects
|
side effects
|
||||||
|
* [#680](https://github.com/foosel/OctoPrint/issues/680) - Don't accidentally include a newline from the MIME headers
|
||||||
|
in the parsed multipart data from file uploads
|
||||||
* Various fixes of bugs in newly introduced features and improvements:
|
* Various fixes of bugs in newly introduced features and improvements:
|
||||||
* [#625](https://github.com/foosel/OctoPrint/pull/625) - Newly added GCODE files were not being added to the analysis
|
* [#625](https://github.com/foosel/OctoPrint/pull/625) - Newly added GCODE files were not being added to the analysis
|
||||||
queue
|
queue
|
||||||
|
* [#664](https://github.com/foosel/OctoPrint/issues/664) - Fixed jog controls again
|
||||||
|
* [#677](https://github.com/foosel/OctoPrint/issues/677) - Fixed extruder offsets not being properly editable in
|
||||||
|
printer profiles
|
||||||
|
* [#683](https://github.com/foosel/OctoPrint/issues/683) - Fixed heated bed option not being properly displayed in
|
||||||
|
printer profiles
|
||||||
* Various fixes without tickets:
|
* Various fixes without tickets:
|
||||||
* GCODE viewer now doesn't stumble over completely extrusionless GCODE files
|
* GCODE viewer now doesn't stumble over completely extrusionless GCODE files
|
||||||
* Do not deliver the API key on settings API unless user has admin rights
|
* Do not deliver the API key on settings API unless user has admin rights
|
||||||
|
* Don't hiccup on slic3r filament_diameter comments in GCODE generated for multi extruder setups
|
||||||
|
|
||||||
## 1.1.2 (Unreleased)
|
## 1.1.2 (Unreleased)
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* Added deletion of `*.pyc` files to `python setup.py clean` command, should help tremendously when switching branches (backported
|
||||||
|
from [9e014eb](https://github.com/foosel/OctoPrint/commit/9e014eba1feffde11ed0601d9c911b8cac9f3fb0))
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* [#634](https://github.com/foosel/OctoPrint/pull/634) - Fixed missing `branch` fields in version dicts generated
|
* [#634](https://github.com/foosel/OctoPrint/pull/634) - Fixed missing `branch` fields in version dicts generated
|
||||||
by versioneer
|
by versioneer
|
||||||
|
* [IRC] - Don't hiccup on slic3r filament_diameter comments generated for multi extruder setups
|
||||||
|
* [ML] - Fixed relative URL to sockjs endpoint, wasn't yet using the proper base url
|
||||||
|
* [unreported] & [#698](https://github.com/foosel/OctoPrint/issues/698) - Generated URLs now take X-Forwarded-Host header
|
||||||
|
sent by proxies into account for included host and port, also fixed [#698](https://github.com/foosel/OctoPrint/issues/698)
|
||||||
|
introduced by this
|
||||||
|
* Small fixes for timelapse creation:
|
||||||
|
- [#344](https://github.com/foosel/OctoPrint/issues/344) - Made timelapses capable of coping with missing captures in between by decrementing the image counter again if there
|
||||||
|
was an error fetching the latest image from the snapshot URL (backport of [1a7a468](https://github.com/foosel/OctoPrint/commit/1a7a468eb65fdf2a13b4c7a7723280e822c9c34b)
|
||||||
|
and [bf9d5ef](https://github.com/foosel/OctoPrint/commit/bf9d5efe43a1e57aacd8512125082ddca06b4efc))
|
||||||
|
- [#693](https://github.com/foosel/OctoPrint/issues/693) - Try not to capture an image if image counter is still unset
|
||||||
|
- [unreported] Synchronize image counter decrementing as well as incrementing to prevent rare race conditions when generating the
|
||||||
|
image file names
|
||||||
|
|
||||||
## 1.1.1 (2014-10-27)
|
## 1.1.1 (2014-10-27)
|
||||||
|
|
||||||
@@ -90,6 +136,8 @@
|
|||||||
* [#604](https://github.com/foosel/OctoPrint/issues/604) - Properly initialize settings basedir on server startup
|
* [#604](https://github.com/foosel/OctoPrint/issues/604) - Properly initialize settings basedir on server startup
|
||||||
* [IRC] Also allow downloading .g files via Tornado
|
* [IRC] Also allow downloading .g files via Tornado
|
||||||
|
|
||||||
|
([Commits](https://github.com/foosel/OctoPrint/compare/1.1.0...1.1.1))
|
||||||
|
|
||||||
## 1.1.0 (2014-09-03)
|
## 1.1.0 (2014-09-03)
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
|||||||
@@ -755,6 +755,61 @@ Retrieve the current SD state
|
|||||||
:statuscode 200: No error
|
:statuscode 200: No error
|
||||||
:statuscode 404: If SD support has been disabled in OctoPrint's config.
|
:statuscode 404: If SD support has been disabled in OctoPrint's config.
|
||||||
|
|
||||||
|
.. _sec-api-printer-arbcommand:
|
||||||
|
|
||||||
|
Send an arbitrary command to the printer
|
||||||
|
========================================
|
||||||
|
|
||||||
|
.. http:post:: /api/printer/command
|
||||||
|
|
||||||
|
Sends any command to the printer via the serial interface. Should be used with some care as some commands can interfere with
|
||||||
|
or even stop a running print job.
|
||||||
|
|
||||||
|
Expects a :ref:`Arbitrary Command Request <sec-api-printer-datamodel-arbcommand>` as the request's body.
|
||||||
|
|
||||||
|
If successful returns a :http:statuscode:`204` and an empty body.
|
||||||
|
|
||||||
|
**Example for sending a single command**
|
||||||
|
|
||||||
|
.. sourcecode:: http
|
||||||
|
|
||||||
|
POST /api/printer/command HTTP/1.1
|
||||||
|
Host: example.com
|
||||||
|
Content-Type: application/json
|
||||||
|
X-Api-Key: abcdef...
|
||||||
|
|
||||||
|
{
|
||||||
|
"command": "M106"
|
||||||
|
}
|
||||||
|
|
||||||
|
.. sourcecode:: http
|
||||||
|
|
||||||
|
HTTP/1.1 204 No Content
|
||||||
|
|
||||||
|
**Example for sending multiple commands**
|
||||||
|
|
||||||
|
.. sourcecode:: http
|
||||||
|
|
||||||
|
POST /api/printer/command HTTP/1.1
|
||||||
|
Host: example.com
|
||||||
|
Content-Type: application/json
|
||||||
|
X-Api-Key: abcdef...
|
||||||
|
|
||||||
|
{
|
||||||
|
"commands": [
|
||||||
|
"M18",
|
||||||
|
"M106 S0"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
.. sourcecode:: http
|
||||||
|
|
||||||
|
HTTP/1.1 204 No Content
|
||||||
|
|
||||||
|
:json string command: Single command to send to the printer, mutually exclusive with ``commands``.
|
||||||
|
:json string commands: List of commands to send to the printer, mutually exclusive with ``command``.
|
||||||
|
:statuscode 204: No error
|
||||||
|
|
||||||
.. _sec-api-printer-datamodel:
|
.. _sec-api-printer-datamodel:
|
||||||
|
|
||||||
Datamodel
|
Datamodel
|
||||||
@@ -831,3 +886,24 @@ SD State
|
|||||||
- Boolean
|
- Boolean
|
||||||
- Whether the SD card has been initialized (``true``) or not (``false``).
|
- Whether the SD card has been initialized (``true``) or not (``false``).
|
||||||
|
|
||||||
|
.. _sec-api-printer-datamodel-arbcommand:
|
||||||
|
|
||||||
|
Arbitrary Command Request
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``command``
|
||||||
|
- 0..1
|
||||||
|
- String
|
||||||
|
- Single command to send to the printer, mutually exclusive with ``commands``.
|
||||||
|
* - ``commands``
|
||||||
|
- 0..*
|
||||||
|
- Array of String
|
||||||
|
- Multiple commands to send to the printer (in the given order), mutually exclusive with ``command``.
|
||||||
@@ -96,6 +96,10 @@ ClientOpened
|
|||||||
ClientClosed
|
ClientClosed
|
||||||
A client has disconnected from the webserver
|
A client has disconnected from the webserver
|
||||||
|
|
||||||
|
Payload:
|
||||||
|
|
||||||
|
* ``remoteAddress``: the remote address (IP) of the client that disconnected
|
||||||
|
|
||||||
Printer communication
|
Printer communication
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ nose>=1.3.0
|
|||||||
sphinxcontrib-httpdomain
|
sphinxcontrib-httpdomain
|
||||||
sphinx_rtd_theme
|
sphinx_rtd_theme
|
||||||
po2json
|
po2json
|
||||||
|
ddt
|
||||||
@@ -19,6 +19,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|||||||
DESC="Octoprint Daemon"
|
DESC="Octoprint Daemon"
|
||||||
NAME="Octoprint"
|
NAME="Octoprint"
|
||||||
DAEMON=/usr/local/bin/octoprint
|
DAEMON=/usr/local/bin/octoprint
|
||||||
|
NICE=-10
|
||||||
PIDFILE=/var/run/$NAME.pid
|
PIDFILE=/var/run/$NAME.pid
|
||||||
PKGNAME=octoprint
|
PKGNAME=octoprint
|
||||||
SCRIPTNAME=/etc/init.d/$PKGNAME
|
SCRIPTNAME=/etc/init.d/$PKGNAME
|
||||||
@@ -72,7 +73,7 @@ do_start()
|
|||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
|
|
||||||
if [ $RETVAL != 0 ]; then
|
if [ $RETVAL != 0 ]; then
|
||||||
start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \
|
start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --nicelevel $NICE\
|
||||||
--exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK -- $DAEMON_ARGS
|
--exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK -- $DAEMON_ARGS
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -96,6 +96,26 @@ class CleanCommand(Command):
|
|||||||
file_handler=delete_file
|
file_handler=delete_file
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# pyc files
|
||||||
|
def delete_folder_if_empty(path, applied_handler):
|
||||||
|
if not applied_handler:
|
||||||
|
return
|
||||||
|
if len(os.listdir(path)) == 0:
|
||||||
|
shutil.rmtree(path)
|
||||||
|
print "Deleted %s since it was empty" % path
|
||||||
|
|
||||||
|
def delete_file(path):
|
||||||
|
os.remove(path)
|
||||||
|
print "Deleted %s" % path
|
||||||
|
|
||||||
|
import fnmatch
|
||||||
|
_recursively_handle_files(
|
||||||
|
os.path.abspath("src"),
|
||||||
|
lambda name: fnmatch.fnmatch(name.lower(), "*.pyc"),
|
||||||
|
folder_handler=delete_folder_if_empty,
|
||||||
|
file_handler=delete_file
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class NewTranslation(Command):
|
class NewTranslation(Command):
|
||||||
description = "create a new translation"
|
description = "create a new translation"
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
|
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||||
|
__copyright__ = "Copyright (C) 2014 Gina Häußge - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,589 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
|
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||||
|
__copyright__ = "Copyright (C) 2014 Gina Häußge - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
from octoprint.events import eventManager, Events
|
||||||
|
from octoprint.comm.transport import MessageReceiver, StateReceiver, LogReceiver, State as TransportState
|
||||||
|
from octoprint.filemanager.destinations import FileDestinations
|
||||||
|
from octoprint.settings import settings
|
||||||
|
|
||||||
|
|
||||||
|
class Protocol(MessageReceiver, StateReceiver, LogReceiver):
|
||||||
|
|
||||||
|
def __init__(self, transport_factory, protocol_listener=None):
|
||||||
|
self._logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
self._transport = transport_factory(self, self, self)
|
||||||
|
self._transport_properties = self._transport.get_properties()
|
||||||
|
|
||||||
|
self._protocol_listener = protocol_listener
|
||||||
|
self._state = State.OFFLINE
|
||||||
|
|
||||||
|
self._heatup_start_time = None
|
||||||
|
self._heatup_time_lost = 0.0
|
||||||
|
|
||||||
|
self._pause_start_time = None
|
||||||
|
self._pause_time_lost = 0.0
|
||||||
|
|
||||||
|
self._current_file = None
|
||||||
|
|
||||||
|
self._current_z = 0.0
|
||||||
|
|
||||||
|
self._sd_available = False
|
||||||
|
self._sd_files = []
|
||||||
|
|
||||||
|
self._current_temperature = {}
|
||||||
|
self._temperature_offsets = {}
|
||||||
|
|
||||||
|
self._error = None
|
||||||
|
|
||||||
|
def _reset(self):
|
||||||
|
self._heatup_start_time = None
|
||||||
|
self._heatup_time_lost = 0.0
|
||||||
|
|
||||||
|
self._current_file = None
|
||||||
|
|
||||||
|
self._current_z = 0.0
|
||||||
|
|
||||||
|
self._sd_available = False
|
||||||
|
self._sd_files = []
|
||||||
|
|
||||||
|
self._current_temperature = {}
|
||||||
|
self._temperature_offsets = {}
|
||||||
|
|
||||||
|
self._error = None
|
||||||
|
|
||||||
|
##~~ public
|
||||||
|
|
||||||
|
def connect(self, protocol_options, transport_options):
|
||||||
|
self._transport.connect(transport_options)
|
||||||
|
|
||||||
|
def disconnect(self, on_error=False):
|
||||||
|
if self.is_printing():
|
||||||
|
payload = None
|
||||||
|
if self._current_file is not None:
|
||||||
|
payload = {
|
||||||
|
"file": self._current_file.getFilename(),
|
||||||
|
"filename": os.path.basename(self._current_file.getFilename()),
|
||||||
|
"origin": self._current_file.getFileLocation()
|
||||||
|
}
|
||||||
|
eventManager().fire(Events.PRINT_FAILED, payload)
|
||||||
|
self._transport.disconnect(on_error)
|
||||||
|
|
||||||
|
def send_manually(self, command, high_priority=False):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def select_file(self, filename, origin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def deselect_file(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def start_print(self):
|
||||||
|
if self._current_file is None:
|
||||||
|
raise ValueError("No file selected for printing")
|
||||||
|
|
||||||
|
self._heatup_start_time = None
|
||||||
|
self._heatup_time_lost = 0.0
|
||||||
|
|
||||||
|
self._current_file.start()
|
||||||
|
self._changeState(State.PRINTING)
|
||||||
|
eventManager().fire(Events.PRINT_STARTED, {
|
||||||
|
"file": self._current_file.getFilename(),
|
||||||
|
"filename": os.path.basename(self._current_file.getFilename()),
|
||||||
|
"origin": self._current_file.getFileLocation()
|
||||||
|
})
|
||||||
|
|
||||||
|
def pause_print(self, only_pause=None, only_resume=None):
|
||||||
|
payload = {
|
||||||
|
"file": self._current_file.getFilename(),
|
||||||
|
"filename": os.path.basename(self._current_file.getFilename()),
|
||||||
|
"origin": self._current_file.getFileLocation()
|
||||||
|
}
|
||||||
|
|
||||||
|
if self._state == State.PRINTING and not only_resume:
|
||||||
|
self._pause_start_time = time.time()
|
||||||
|
|
||||||
|
self._changeState(State.PAUSED)
|
||||||
|
eventManager().fire(Events.PRINT_PAUSED, payload)
|
||||||
|
|
||||||
|
elif self._state == State.PAUSED and not only_pause:
|
||||||
|
if self._pause_start_time:
|
||||||
|
self._pause_time_lost += time.time() - self._pause_start_time
|
||||||
|
self._pause_start_time = None
|
||||||
|
|
||||||
|
self._changeState(State.PRINTING)
|
||||||
|
eventManager().fire(Events.PRINT_RESUMED, payload)
|
||||||
|
|
||||||
|
def cancel_print(self):
|
||||||
|
eventManager().fire(Events.PRINT_CANCELLED, {
|
||||||
|
"file": self._current_file.getFilename(),
|
||||||
|
"filename": os.path.basename(self._current_file.getFilename()),
|
||||||
|
"origin": self._current_file.getFileLocation()
|
||||||
|
})
|
||||||
|
self._changeState(State.OPERATIONAL)
|
||||||
|
self._print_cancelled()
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onPrintjobCancelled(self)
|
||||||
|
|
||||||
|
def _print_cancelled(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def init_sd(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def release_sd(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def refresh_sd_files(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def add_sd_file(self, path, local, remote):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def remove_sd_file(self, filename):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_state(self):
|
||||||
|
return self._state
|
||||||
|
|
||||||
|
def get_current_temperatures(self):
|
||||||
|
return self._current_temperature
|
||||||
|
|
||||||
|
def get_temperature_offsets(self):
|
||||||
|
result = {}
|
||||||
|
result.update(self._temperature_offsets)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def set_temperature_offsets(self, new_temperature_offsets):
|
||||||
|
offsets = {}
|
||||||
|
offsets.update(new_temperature_offsets)
|
||||||
|
self._temperature_offsets = offsets
|
||||||
|
|
||||||
|
def get_sd_files(self):
|
||||||
|
return self._sd_files
|
||||||
|
|
||||||
|
def get_print_time(self):
|
||||||
|
if self._current_file is None or self._current_file.getStartTime() is None:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return max(int(time.time() - self._current_file.getStartTime() - self._heatup_time_lost - self._pause_time_lost), 0)
|
||||||
|
|
||||||
|
def get_connection_options(self):
|
||||||
|
return self._transport.get_connection_options()
|
||||||
|
|
||||||
|
def get_current_connection(self):
|
||||||
|
return self._transport.get_current_connection()
|
||||||
|
|
||||||
|
##~~ granular state detection for implementations
|
||||||
|
|
||||||
|
def is_heating_up(self):
|
||||||
|
return self._heatup_start_time is not None
|
||||||
|
|
||||||
|
def is_printing(self):
|
||||||
|
return self._state == State.PRINTING or self._state == State.PAUSED
|
||||||
|
|
||||||
|
def is_sd_printing(self):
|
||||||
|
return isinstance(self._current_file, PrintingSdFileInformation) and self.is_busy()
|
||||||
|
|
||||||
|
def is_streaming(self):
|
||||||
|
return self._state == State.STREAMING
|
||||||
|
|
||||||
|
def is_busy(self):
|
||||||
|
return self.is_printing() or self.is_streaming()
|
||||||
|
|
||||||
|
def is_operational(self):
|
||||||
|
return self._state == State.OPERATIONAL
|
||||||
|
|
||||||
|
def is_sd_ready(self):
|
||||||
|
return self._sd_available
|
||||||
|
|
||||||
|
##~~ state tracking and reporting to protocol listener
|
||||||
|
|
||||||
|
def _changeState(self, newState):
|
||||||
|
oldState = self._state
|
||||||
|
self._state = newState
|
||||||
|
self._stateChanged(newState)
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onStateChange(self, oldState, newState)
|
||||||
|
|
||||||
|
def _stateChanged(self, newState):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _updateTemperature(self, temperatureData):
|
||||||
|
self._current_temperature = temperatureData
|
||||||
|
self._temperatureUpdated(temperatureData)
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onTemperatureUpdate(self, temperatureData)
|
||||||
|
|
||||||
|
def _temperatureUpdated(self, temperatureData):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _reportProgress(self, completion=None, filepos=None):
|
||||||
|
if completion is None:
|
||||||
|
completion = self._getPrintCompletion()
|
||||||
|
if filepos is None:
|
||||||
|
filepos = self._getPrintFilepos()
|
||||||
|
|
||||||
|
progress = {
|
||||||
|
"completion": completion,
|
||||||
|
"filepos": filepos,
|
||||||
|
"printTime": self.get_print_time()
|
||||||
|
}
|
||||||
|
|
||||||
|
self._progressReported(progress)
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onProgress(self, progress)
|
||||||
|
|
||||||
|
def _progressReported(self, progress):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _reportZChange(self, z):
|
||||||
|
old_z = self._current_z
|
||||||
|
self._current_z = z
|
||||||
|
|
||||||
|
self._zChangeReported(z)
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onZChange(self, old_z, z)
|
||||||
|
|
||||||
|
def _zChangeReported(self, newZ):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _changeSdState(self, sdAvailable):
|
||||||
|
self._sd_available = sdAvailable
|
||||||
|
self._sdStateChanged(sdAvailable)
|
||||||
|
if self._sd_available:
|
||||||
|
self.refresh_sd_files()
|
||||||
|
else:
|
||||||
|
self._sd_files = []
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onSdStateChange(self, sdAvailable)
|
||||||
|
|
||||||
|
def _sdStateChanged(self, sdAvailable):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _selectFile(self, currentFile):
|
||||||
|
self._current_file = currentFile
|
||||||
|
self._fileSelected(currentFile)
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onFileSelected(self, currentFile.getFilename(), currentFile.getFilesize(), currentFile.getFileLocation())
|
||||||
|
eventManager().fire(Events.FILE_SELECTED, {
|
||||||
|
"file": self._current_file.getFilename(),
|
||||||
|
"origin": self._current_file.getFileLocation()
|
||||||
|
})
|
||||||
|
|
||||||
|
def _fileSelected(self, currentFile):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _sendSdFiles(self):
|
||||||
|
self._sdFilesSent()
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onSdFiles(self, self._sd_files)
|
||||||
|
|
||||||
|
def _sdFilesSent(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _finishPrintjob(self):
|
||||||
|
self._reportProgress(completion=100, filepos=self._current_file.getFilesize())
|
||||||
|
self._changeState(State.OPERATIONAL)
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onPrintjobDone(self)
|
||||||
|
eventManager().fire(Events.PRINT_DONE, {
|
||||||
|
"file": self._current_file.getFilename(),
|
||||||
|
"filename": os.path.basename(self._current_file.getFilename()),
|
||||||
|
"origin": self._current_file.getFileLocation(),
|
||||||
|
"time": time.time() - self._current_file.getStartTime() if self._current_file.getStartTime() is not None else None
|
||||||
|
})
|
||||||
|
self._printJobFinished()
|
||||||
|
|
||||||
|
def _printJobFinished(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _startFileTransfer(self, filename, filesize):
|
||||||
|
self._fileTransferStarted(filename, filesize)
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onFileTransferStarted(self, filename, filesize)
|
||||||
|
|
||||||
|
def _fileTransferStarted(self, filename, filesize):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _finishFileTransfer(self):
|
||||||
|
self._changeState(State.OPERATIONAL)
|
||||||
|
|
||||||
|
current_file = self._current_file
|
||||||
|
self._current_file = None
|
||||||
|
|
||||||
|
self._fileTransferFinished(current_file)
|
||||||
|
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onFileTransferDone(self)
|
||||||
|
|
||||||
|
def _fileTransferFinished(self, current_file):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _addSdFile(self, filename, filesize):
|
||||||
|
"""
|
||||||
|
Adds a file to the SD file list
|
||||||
|
|
||||||
|
:param filename: the filename to add to the list
|
||||||
|
:param filesize: the filesize to add to the list, may be None
|
||||||
|
"""
|
||||||
|
self._sd_files.append((filename, filesize))
|
||||||
|
self._sdFileAdded(filename, filesize)
|
||||||
|
|
||||||
|
def _sdFileAdded(self, filename, filesize):
|
||||||
|
"""
|
||||||
|
Called when a file has been added to the SD file list, can be used by the underyling protocol implementation
|
||||||
|
to react to that.
|
||||||
|
|
||||||
|
:param filename: the filename to add to the list
|
||||||
|
:param filesize: the filesize to add to the list, may be None
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _addSdFiles(self, files):
|
||||||
|
"""
|
||||||
|
Adds a list of files to the SD file list
|
||||||
|
|
||||||
|
:param files: the list of file tuples (name, size) to add to the list, size may be None
|
||||||
|
"""
|
||||||
|
for f in files:
|
||||||
|
self._sd_files.append(f)
|
||||||
|
self._sdFilesAdded(files)
|
||||||
|
|
||||||
|
def _sdFilesAdded(self, files):
|
||||||
|
"""
|
||||||
|
Called when a list of files has been added to the SD file list, can be used by the underlying protocol
|
||||||
|
implementation to react to that.
|
||||||
|
|
||||||
|
:param files: the file tuples (name, size) added to the list, size may be None
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _resetSdFiles(self):
|
||||||
|
"""
|
||||||
|
Resets the SD file list
|
||||||
|
"""
|
||||||
|
self._sd_files = []
|
||||||
|
self._sdFilesReset()
|
||||||
|
|
||||||
|
def _sdFilesReset(self):
|
||||||
|
"""
|
||||||
|
Called when the list of SD files has been reset, can be used in the underlying protocol implementation to
|
||||||
|
react to that
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _heatupDetected(self):
|
||||||
|
"""
|
||||||
|
Called when the underlying protocol detects the beginning of a heat-up interval.
|
||||||
|
"""
|
||||||
|
self._heatup_start_time = time.time()
|
||||||
|
|
||||||
|
def _heatupDone(self):
|
||||||
|
"""
|
||||||
|
Called when the underlying protocol detects the end of a heat-up interval.
|
||||||
|
"""
|
||||||
|
if self._heatup_start_time is not None:
|
||||||
|
self._heatup_time_lost += time.time() - self._heatup_start_time
|
||||||
|
self._heatup_start_time = None
|
||||||
|
|
||||||
|
def _log_error(self, error):
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onLogError(self, error)
|
||||||
|
|
||||||
|
##~~ StateReceiver
|
||||||
|
|
||||||
|
def onStateChangeReceived(self, source, oldState, newState):
|
||||||
|
if self._transport != source:
|
||||||
|
return
|
||||||
|
|
||||||
|
if newState == TransportState.DETECTING_CONNECTION or newState == TransportState.OPENING_CONNECTION:
|
||||||
|
self._changeState(State.CONNECTING)
|
||||||
|
elif newState == TransportState.CONNECTED:
|
||||||
|
self._changeState(State.CONNECTED)
|
||||||
|
elif newState == TransportState.DISCONNECTED:
|
||||||
|
self._changeState(State.OFFLINE)
|
||||||
|
elif newState == TransportState.DISCONNECTED_WITH_ERROR or newState == TransportState.ERROR:
|
||||||
|
self.onError(self._transport.getError())
|
||||||
|
try:
|
||||||
|
self._transport.disconnect()
|
||||||
|
except:
|
||||||
|
# TODO do we need to handle that?
|
||||||
|
pass
|
||||||
|
|
||||||
|
##~~ MessageReceiver
|
||||||
|
|
||||||
|
def onError(self, error):
|
||||||
|
self._changeState(State.ERROR)
|
||||||
|
self._error = error
|
||||||
|
eventManager().fire(Events.ERROR, {"error": error})
|
||||||
|
|
||||||
|
##~~ LogReceiver
|
||||||
|
|
||||||
|
def onLogRx(self, source, rx):
|
||||||
|
if self._transport != source:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onLogRx(self, rx)
|
||||||
|
|
||||||
|
def onLogTx(self, source, tx):
|
||||||
|
if self._transport != source:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self._protocol_listener is not None:
|
||||||
|
self._protocol_listener.onLogTx(self, tx)
|
||||||
|
|
||||||
|
def onLogError(self, source, error):
|
||||||
|
if self._transport != source:
|
||||||
|
return
|
||||||
|
self._log_error(error)
|
||||||
|
|
||||||
|
##~~ helpers
|
||||||
|
|
||||||
|
def _getPrintCompletion(self):
|
||||||
|
if self._current_file is None:
|
||||||
|
return None
|
||||||
|
return self._current_file.getProgress() * 100
|
||||||
|
|
||||||
|
def _getPrintFilepos(self):
|
||||||
|
if self._current_file is None:
|
||||||
|
return None
|
||||||
|
return self._current_file.getFilepos()
|
||||||
|
|
||||||
|
|
||||||
|
class ProtocolListener(object):
|
||||||
|
def onStateChange(self, source, oldState, newState):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onTemperatureUpdate(self, source, temperatureData):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onProgress(self, source, progress):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onZChange(self, source, oldZ, newZ):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onFileSelected(self, source, filename, filesize, origin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onPrintjobStarted(self, source):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onPrintjobDone(self, source):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onPrintjobCancelled(self, source):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onFileTransferStarted(self, source, filename, filesize):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onFileTransferDone(self, source):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onSdStateChange(self, source, sdAvailable):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onSdFiles(self, source, files):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onLogTx(self, source, tx):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onLogRx(self, source, rx):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onLogError(self, source, error):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class State(object):
|
||||||
|
|
||||||
|
OFFLINE = "Offline"
|
||||||
|
CONNECTING = "Connecting"
|
||||||
|
CONNECTED = "Connected"
|
||||||
|
OPERATIONAL = "Operational"
|
||||||
|
PRINTING = "Printing"
|
||||||
|
STREAMING = "Streaming"
|
||||||
|
PAUSED = "Paused"
|
||||||
|
ERROR = "Error"
|
||||||
|
|
||||||
|
|
||||||
|
### Printing file information classes ##################################################################################
|
||||||
|
|
||||||
|
class PrintingFileInformation(object):
|
||||||
|
"""
|
||||||
|
Encapsulates information regarding the current file being printed: file name, current position, total size and
|
||||||
|
time the print started.
|
||||||
|
Allows to reset the current file position to 0 and to calculate the current progress as a floating point
|
||||||
|
value between 0 and 1.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, filename):
|
||||||
|
self._filename = filename
|
||||||
|
self._filepos = 0
|
||||||
|
self._filesize = None
|
||||||
|
self._startTime = None
|
||||||
|
|
||||||
|
def getStartTime(self):
|
||||||
|
return self._startTime
|
||||||
|
|
||||||
|
def getFilename(self):
|
||||||
|
return self._filename
|
||||||
|
|
||||||
|
def getFilesize(self):
|
||||||
|
return self._filesize
|
||||||
|
|
||||||
|
def getFilepos(self):
|
||||||
|
return self._filepos
|
||||||
|
|
||||||
|
def getFileLocation(self):
|
||||||
|
return FileDestinations.LOCAL
|
||||||
|
|
||||||
|
def getProgress(self):
|
||||||
|
"""
|
||||||
|
The current progress of the file, calculated as relation between file position and absolute size. Returns -1
|
||||||
|
if file size is None or < 1.
|
||||||
|
"""
|
||||||
|
if self._filesize is None or not self._filesize > 0:
|
||||||
|
return -1
|
||||||
|
return float(self._filepos) / float(self._filesize)
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
"""
|
||||||
|
Resets the current file position to 0.
|
||||||
|
"""
|
||||||
|
self._filepos = 0
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
"""
|
||||||
|
Marks the print job as started and remembers the start time.
|
||||||
|
"""
|
||||||
|
self._startTime = time.time()
|
||||||
|
|
||||||
|
|
||||||
|
class PrintingSdFileInformation(PrintingFileInformation):
|
||||||
|
"""
|
||||||
|
Encapsulates information regarding an ongoing print from SD.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, filename, filesize):
|
||||||
|
PrintingFileInformation.__init__(self, filename)
|
||||||
|
self._filesize = filesize
|
||||||
|
|
||||||
|
def setFilepos(self, filepos):
|
||||||
|
"""
|
||||||
|
Sets the current file position.
|
||||||
|
"""
|
||||||
|
self._filepos = filepos
|
||||||
|
|
||||||
|
def getFileLocation(self):
|
||||||
|
return FileDestinations.SDCARD
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
|
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||||
|
__copyright__ = "Copyright (C) 2014 Gina Häußge - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from octoprint.comm.protocol.reprap import RepRapProtocol
|
||||||
|
|
||||||
|
|
||||||
|
class RepetierTextualProtocol(RepRapProtocol):
|
||||||
|
|
||||||
|
__protocolinfo__ = ("repetier", "RepRap (Repetier Flavor)", False)
|
||||||
|
|
||||||
|
MESSAGE_TARGET_TEMPERATURE = staticmethod(lambda line: "TargetExtr" in line or "TargetBed" in line)
|
||||||
|
MESSAGE_TEMPERATURE = staticmethod(lambda line: RepRapProtocol.MESSAGE_TEMPERATURE(line) or RepetierTextualProtocol.MESSAGE_TARGET_TEMPERATURE(line))
|
||||||
|
|
||||||
|
REGEX_POSITIVE_FLOAT = "[+]?[0-9]*\.?[0-9]+"
|
||||||
|
REGEX_TARGET_EXTRUDER_TEMPERATURE = re.compile("TargetExtr([0-9]+):(%s)" % REGEX_POSITIVE_FLOAT)
|
||||||
|
REGEX_TARGET_BED_TEMPERATURE = re.compile("TargetBed:(%s)" % REGEX_POSITIVE_FLOAT)
|
||||||
|
|
||||||
|
def __init__(self, transport_factory, protocol_listener=None):
|
||||||
|
RepRapProtocol.__init__(self, transport_factory, protocol_listener)
|
||||||
|
self._sd_available = True
|
||||||
|
|
||||||
|
def _reset(self, from_start=False):
|
||||||
|
RepRapProtocol._reset(self, from_start=from_start)
|
||||||
|
self._sd_available = True
|
||||||
|
|
||||||
|
def _process_temperatures(self, line):
|
||||||
|
if RepetierTextualProtocol.MESSAGE_TARGET_TEMPERATURE(line):
|
||||||
|
match_extr = RepetierTextualProtocol.REGEX_TARGET_EXTRUDER_TEMPERATURE.match(line)
|
||||||
|
match_bed = RepetierTextualProtocol.REGEX_TARGET_BED_TEMPERATURE.match(line)
|
||||||
|
|
||||||
|
current_temperatures = self.get_current_temperatures()
|
||||||
|
key = None
|
||||||
|
target = None
|
||||||
|
try:
|
||||||
|
if match_extr is not None:
|
||||||
|
tool_num = int(match_extr.group(1))
|
||||||
|
key = "tool%d" % tool_num
|
||||||
|
target = float(match_extr.group(2))
|
||||||
|
elif match_bed is not None:
|
||||||
|
key = "bed"
|
||||||
|
target = float(match_bed.group(1))
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if key is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if key in current_temperatures and current_temperatures[key] is not None and isinstance(current_temperatures[key], tuple):
|
||||||
|
(actual, old_target) = current_temperatures[key]
|
||||||
|
current_temperatures[key] = (actual, target)
|
||||||
|
else:
|
||||||
|
current_temperatures[key] = (None, target)
|
||||||
|
self._updateTemperature(current_temperatures)
|
||||||
|
else:
|
||||||
|
RepRapProtocol._process_temperatures(self, line)
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,377 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
|
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||||
|
__copyright__ = "Copyright (C) 2014 Gina Häußge - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
import Queue
|
||||||
|
import re
|
||||||
|
import heapq
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import itertools
|
||||||
|
|
||||||
|
from octoprint.comm.protocol import PrintingFileInformation
|
||||||
|
|
||||||
|
|
||||||
|
class GcodeCommand(object):
|
||||||
|
|
||||||
|
KNOWN_FLOAT_ATTRIBUTES = ("x", "y", "z", "e", "s", "p", "r")
|
||||||
|
KNOWN_INT_ATTRIBUTES = ("f", "t", "n")
|
||||||
|
KNOWN_ATTRIBUTES = KNOWN_FLOAT_ATTRIBUTES + KNOWN_INT_ATTRIBUTES
|
||||||
|
|
||||||
|
COMMAND_REGEX = re.compile("^([GMT])(\d+)")
|
||||||
|
ARGUMENT_REGEX = re.compile("\s+([%s][-+]?\d*\.?\d+|[%s][-+]?\d+)" % ("".join(map(lambda x: x.upper(), KNOWN_FLOAT_ATTRIBUTES)), "".join(map(lambda x: x.upper(), KNOWN_INT_ATTRIBUTES))))
|
||||||
|
PARAM_REGEX = re.compile("^[GMT]\d+\s+(.*?)$")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_line(line):
|
||||||
|
line = line.strip()
|
||||||
|
command = ""
|
||||||
|
args = {"original": line}
|
||||||
|
match = GcodeCommand.COMMAND_REGEX.match(line)
|
||||||
|
if match is None:
|
||||||
|
args["unknown"] = True
|
||||||
|
else:
|
||||||
|
commandType = match.group(1)
|
||||||
|
commandNumber = int(match.group(2))
|
||||||
|
command = "%s%d" % (commandType, commandNumber)
|
||||||
|
|
||||||
|
|
||||||
|
if commandType == "T":
|
||||||
|
args["tool"] = commandNumber
|
||||||
|
else:
|
||||||
|
matchedArgs = GcodeCommand.ARGUMENT_REGEX.findall(line)
|
||||||
|
if len(matchedArgs) == 0:
|
||||||
|
paramMatch = GcodeCommand.PARAM_REGEX.match(line)
|
||||||
|
if paramMatch is not None:
|
||||||
|
args["param"] = paramMatch.group(1)
|
||||||
|
else:
|
||||||
|
for arg in matchedArgs:
|
||||||
|
key = arg[0].lower()
|
||||||
|
if key in GcodeCommand.KNOWN_INT_ATTRIBUTES:
|
||||||
|
value = int(arg[1:])
|
||||||
|
elif key in GcodeCommand.KNOWN_FLOAT_ATTRIBUTES:
|
||||||
|
value = float(arg[1:])
|
||||||
|
else:
|
||||||
|
value = str(arg[1:])
|
||||||
|
args[key] = value
|
||||||
|
|
||||||
|
return GcodeCommand(command, **args)
|
||||||
|
|
||||||
|
def __init__(self, command, **kwargs):
|
||||||
|
self.command = command
|
||||||
|
self.x = None
|
||||||
|
self.y = None
|
||||||
|
self.z = None
|
||||||
|
self.e = None
|
||||||
|
self.s = None
|
||||||
|
self.p = None
|
||||||
|
self.r = None
|
||||||
|
self.f = None
|
||||||
|
self.t = None
|
||||||
|
self.n = None
|
||||||
|
|
||||||
|
self.tool = None
|
||||||
|
self.original = None
|
||||||
|
self.param = None
|
||||||
|
|
||||||
|
self.progress = None
|
||||||
|
self.callback = None
|
||||||
|
|
||||||
|
self.unknown = False
|
||||||
|
|
||||||
|
for key, value in kwargs.iteritems():
|
||||||
|
if key in GcodeCommand.KNOWN_ATTRIBUTES + ("tool", "original", "param", "progress", "callback", "unknown"):
|
||||||
|
self.__setattr__(key, value)
|
||||||
|
|
||||||
|
def isGetTemperatureCommand(self):
|
||||||
|
return self.command == "M105"
|
||||||
|
|
||||||
|
def isSetTemperatureCommand(self):
|
||||||
|
return self.command in ("M104", "M140", "M109", "M190")
|
||||||
|
|
||||||
|
def isSelectToolCommand(self):
|
||||||
|
return self.command.startswith("T")
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "GcodeCommand(\"{str}\",progress={progress})".format(str=str(self), progress=self.progress)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
if self.original is not None:
|
||||||
|
return self.original
|
||||||
|
else:
|
||||||
|
attr = []
|
||||||
|
for key in GcodeCommand.KNOWN_ATTRIBUTES:
|
||||||
|
value = self.__getattribute__(key)
|
||||||
|
if value is not None:
|
||||||
|
if key in GcodeCommand.KNOWN_INT_ATTRIBUTES:
|
||||||
|
attr.append("%s%d" % (key.upper(), value))
|
||||||
|
elif key in GcodeCommand.KNOWN_FLOAT_ATTRIBUTES:
|
||||||
|
attr.append("%s%f" % (key.upper(), value))
|
||||||
|
else:
|
||||||
|
attr.append("%s%r" % (key.upper(), value))
|
||||||
|
attributeStr = " ".join(attr)
|
||||||
|
return "%s%s%s" % (self.command.upper(), " " + attributeStr if attributeStr else "", " " + self.param if self.param else "")
|
||||||
|
|
||||||
|
|
||||||
|
class CommandQueueEntry(object):
|
||||||
|
PRIORITY_RESEND = 1
|
||||||
|
PRIORITY_HIGH = 2
|
||||||
|
PRIORITY_NORMAL = 3
|
||||||
|
|
||||||
|
def __init__(self, priority, command, line_number=None, command_type=None, prepared=None):
|
||||||
|
self.priority = priority
|
||||||
|
self.command = command
|
||||||
|
self.line_number = line_number
|
||||||
|
self.command_type = command_type
|
||||||
|
self._prepared = prepared
|
||||||
|
self._size = 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def prepared(self):
|
||||||
|
return self._prepared
|
||||||
|
|
||||||
|
@prepared.setter
|
||||||
|
def prepared(self, prepared):
|
||||||
|
self._prepared = prepared
|
||||||
|
self._size = (len(prepared) + 1) if prepared is not None else 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def size(self):
|
||||||
|
return self._size
|
||||||
|
|
||||||
|
def __radd__(self, other):
|
||||||
|
return other + self._size
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "CommandQueueEntry({command},prepared={prepared})".format(command=repr(self.command), prepared=self.prepared)
|
||||||
|
|
||||||
|
|
||||||
|
class SpecialCommandQueueEntry(CommandQueueEntry):
|
||||||
|
TYPE_JOBDONE = "JobDone"
|
||||||
|
TYPE_JOBCANCELLED = "JobCancelled"
|
||||||
|
|
||||||
|
def __init__(self, type):
|
||||||
|
CommandQueueEntry.__init__(self, CommandQueueEntry.PRIORITY_NORMAL, None)
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "SpecialCommandQueueEntry(type={type})".format(type=self.type)
|
||||||
|
|
||||||
|
|
||||||
|
class CommandQueue(Queue.Queue):
|
||||||
|
'''Variant of Queue that retrieves open entries in priority order (lowest first, followed by addition order).
|
||||||
|
|
||||||
|
Entries need to be of the form (priority, command). An optional third argument commandType may be given:
|
||||||
|
(priority, command, commandType), the queue will ensure that only one command of a given commandType will ever
|
||||||
|
be in the queue.
|
||||||
|
'''
|
||||||
|
|
||||||
|
def _init(self, maxsize):
|
||||||
|
self.queue = []
|
||||||
|
self.lookup = {}
|
||||||
|
self.counter = itertools.count()
|
||||||
|
|
||||||
|
import threading
|
||||||
|
self.clearlock = threading.RLock()
|
||||||
|
|
||||||
|
def _qsize(self, len=len):
|
||||||
|
return len(self.queue)
|
||||||
|
|
||||||
|
def _put(self, item, heappush=heapq.heappush):
|
||||||
|
if not isinstance(item, CommandQueueEntry):
|
||||||
|
raise ValueError("queue can only take CommandQueueEntries, can't accept %r" % item)
|
||||||
|
|
||||||
|
command_type = item.command_type
|
||||||
|
if command_type is not None:
|
||||||
|
if command_type not in self.lookup:
|
||||||
|
self.lookup[command_type] = item
|
||||||
|
else:
|
||||||
|
raise TypeAlreadyInQueue()
|
||||||
|
|
||||||
|
heappush(self.queue, (item.priority, next(self.counter), item))
|
||||||
|
|
||||||
|
def _get(self, heappop=heapq.heappop):
|
||||||
|
priority, counter, item = heappop(self.queue)
|
||||||
|
if item.command_type in self.lookup:
|
||||||
|
del self.lookup[item.command_type]
|
||||||
|
return item
|
||||||
|
|
||||||
|
def _entry_at(self, index):
|
||||||
|
try:
|
||||||
|
return self.queue[index]
|
||||||
|
except IndexError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _del(self, entry, heapify=True):
|
||||||
|
item = entry[2]
|
||||||
|
try:
|
||||||
|
self.queue.remove(entry)
|
||||||
|
if heapify:
|
||||||
|
heapq.heapify(self.queue)
|
||||||
|
except ValueError:
|
||||||
|
# that's ok, the entry probably just got removed already e.g. by print cancelling
|
||||||
|
pass
|
||||||
|
|
||||||
|
if item.command_type in self.lookup:
|
||||||
|
del self.lookup[item.command_type]
|
||||||
|
|
||||||
|
def peek(self):
|
||||||
|
"""
|
||||||
|
Returns the left most entry, result is either a tuple (priority, counter, CommandQueueEntry) or None (if queue
|
||||||
|
was empty).
|
||||||
|
"""
|
||||||
|
|
||||||
|
with self.mutex:
|
||||||
|
entry = self._entry_at(0)
|
||||||
|
return entry[2] if entry is not None else None, entry
|
||||||
|
|
||||||
|
def remove(self, entry):
|
||||||
|
with self.mutex:
|
||||||
|
self._del(entry)
|
||||||
|
|
||||||
|
def clear(self, matcher=None):
|
||||||
|
if matcher is None:
|
||||||
|
matcher = lambda x: True
|
||||||
|
|
||||||
|
cleared = []
|
||||||
|
with self.clearlock:
|
||||||
|
for entry in self.queue[:]:
|
||||||
|
priority, counter, item = entry
|
||||||
|
if matcher(item):
|
||||||
|
self._del(entry, heapify=False)
|
||||||
|
cleared.append(entry)
|
||||||
|
heapq.heapify(self.queue)
|
||||||
|
return cleared
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return repr(self.queue)
|
||||||
|
|
||||||
|
class TypeAlreadyInQueue(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class PrintingGcodeFileInformation(PrintingFileInformation):
|
||||||
|
"""
|
||||||
|
Encapsulates information regarding an ongoing direct print. Takes care of the needed file handle and ensures
|
||||||
|
that the file is closed in case of an error.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, filename, offsetCallback):
|
||||||
|
PrintingFileInformation.__init__(self, filename)
|
||||||
|
self._lineCount = None
|
||||||
|
self._firstLine = None
|
||||||
|
self._currentTool = 0
|
||||||
|
|
||||||
|
self._offsetCallback = offsetCallback
|
||||||
|
|
||||||
|
self._fileHandle = None
|
||||||
|
if not os.path.exists(self._filename) or not os.path.isfile(self._filename):
|
||||||
|
raise IOError("File %s does not exist" % self._filename)
|
||||||
|
self._filesize = os.stat(self._filename).st_size
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
"""
|
||||||
|
Opens the file for reading and determines the file size. Start time won't be recorded until 100 lines in
|
||||||
|
"""
|
||||||
|
self._filehandle = open(self._filename, "r")
|
||||||
|
self._lineCount = None
|
||||||
|
self._startTime = None
|
||||||
|
|
||||||
|
def getNext(self):
|
||||||
|
"""
|
||||||
|
Retrieves the next line for printing.
|
||||||
|
"""
|
||||||
|
if self._filehandle is None:
|
||||||
|
raise ValueError("File %s is not open for reading" % self._filename)
|
||||||
|
|
||||||
|
if self._lineCount is None:
|
||||||
|
self._lineCount = 0
|
||||||
|
self._startTime = time.time()
|
||||||
|
return GcodeCommand.from_line("M110 N0")
|
||||||
|
|
||||||
|
try:
|
||||||
|
command = None
|
||||||
|
while command is None:
|
||||||
|
if self._filehandle is None:
|
||||||
|
# file got closed just now
|
||||||
|
return None
|
||||||
|
line = self._filehandle.readline()
|
||||||
|
if not line:
|
||||||
|
self._filehandle.close()
|
||||||
|
self._filehandle = None
|
||||||
|
command = self._process_command(line)
|
||||||
|
self._lineCount += 1
|
||||||
|
self._filepos = self._filehandle.tell()
|
||||||
|
|
||||||
|
return command
|
||||||
|
except Exception as (e):
|
||||||
|
if self._filehandle is not None:
|
||||||
|
self._filehandle.close()
|
||||||
|
self._filehandle = None
|
||||||
|
raise e
|
||||||
|
|
||||||
|
def _process_command(self, line):
|
||||||
|
# remove all comments and trim the line
|
||||||
|
if ";" in line:
|
||||||
|
line = line[0:line.find(";")]
|
||||||
|
line = line.strip()
|
||||||
|
|
||||||
|
if len(line) > 0:
|
||||||
|
# we still got something left => parse the command
|
||||||
|
command = GcodeCommand.from_line(line)
|
||||||
|
if command is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if command.isSelectToolCommand():
|
||||||
|
# track tool changes
|
||||||
|
self._currentTool = command.tool
|
||||||
|
|
||||||
|
elif command.isSetTemperatureCommand() and self._offsetCallback is not None:
|
||||||
|
# if we have a temperature command and an offset callback, retrieve current offsets
|
||||||
|
offsets = self._offsetCallback()
|
||||||
|
|
||||||
|
# extruder temperature, determine which one and retrieve corresponding offset
|
||||||
|
if command.command == "M104" or command.command == "M109":
|
||||||
|
tool_num = self._currentTool
|
||||||
|
if command.t is not None:
|
||||||
|
tool_num = command.t
|
||||||
|
|
||||||
|
key = "tool%d" % tool_num
|
||||||
|
|
||||||
|
# bed temperature
|
||||||
|
elif command.command == "M140" or command.command == "M190":
|
||||||
|
key = "bed"
|
||||||
|
|
||||||
|
# unknown, should never happen
|
||||||
|
else:
|
||||||
|
key = None
|
||||||
|
|
||||||
|
if key is not None and key in offsets:
|
||||||
|
offset = offsets[key]
|
||||||
|
command.s = command.s + offset
|
||||||
|
if command.original is not None:
|
||||||
|
command.original = None
|
||||||
|
|
||||||
|
# finally return the processed command
|
||||||
|
return command
|
||||||
|
else:
|
||||||
|
# no command, return None
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
class StreamingGcodeFileInformation(PrintingGcodeFileInformation):
|
||||||
|
def __init__(self, path, localFilename, remoteFilename):
|
||||||
|
PrintingGcodeFileInformation.__init__(self, path, None)
|
||||||
|
self._localFilename = localFilename
|
||||||
|
self._remoteFilename = remoteFilename
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
PrintingGcodeFileInformation.start(self)
|
||||||
|
self._startTime = time.time()
|
||||||
|
|
||||||
|
def getLocalFilename(self):
|
||||||
|
return self._localFilename
|
||||||
|
|
||||||
|
def getRemoteFilename(self):
|
||||||
|
return self._remoteFilename
|
||||||
|
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
|
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||||
|
__copyright__ = "Copyright (C) 2014 Gina Häußge - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from octoprint.events import eventManager, Events
|
||||||
|
|
||||||
|
class TransportError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class SendTimeout(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Transport(object):
|
||||||
|
|
||||||
|
def __init__(self, messageReceiver=None, stateReceiver=None, logReceiver=None):
|
||||||
|
self._transport_logger = logging.getLogger("TRANSPORT")
|
||||||
|
|
||||||
|
self._messageReceiver = messageReceiver
|
||||||
|
self._stateReceiver = stateReceiver
|
||||||
|
self._logReceiver = logReceiver
|
||||||
|
self._state = State.DISCONNECTED
|
||||||
|
self._error = None
|
||||||
|
self._opt = {}
|
||||||
|
|
||||||
|
def get_properties(self):
|
||||||
|
raise NotImplemented()
|
||||||
|
|
||||||
|
def get_connection_options(self):
|
||||||
|
return []
|
||||||
|
|
||||||
|
def get_current_connection(self):
|
||||||
|
return self._opt
|
||||||
|
|
||||||
|
def connect(self, opt):
|
||||||
|
self._opt = opt
|
||||||
|
|
||||||
|
def disconnect(self, onError=False):
|
||||||
|
if onError:
|
||||||
|
self.changeState(State.DISCONNECTED_WITH_ERROR)
|
||||||
|
else:
|
||||||
|
self.changeState(State.DISCONNECTED)
|
||||||
|
eventManager().fire(Events.DISCONNECTED)
|
||||||
|
def send(self, command):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def receive(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def changeState(self, newState):
|
||||||
|
oldState = self._state
|
||||||
|
self._state = newState
|
||||||
|
if self._stateReceiver is not None:
|
||||||
|
self._stateReceiver.onStateChangeReceived(self, oldState, newState)
|
||||||
|
|
||||||
|
def onError(self, error):
|
||||||
|
self.changeState(State.ERROR)
|
||||||
|
self._error = error
|
||||||
|
|
||||||
|
def onTimeout(self):
|
||||||
|
if self._messageReceiver is not None:
|
||||||
|
self._messageReceiver.onTimeoutReceived(self)
|
||||||
|
|
||||||
|
def getError(self):
|
||||||
|
return self._error
|
||||||
|
|
||||||
|
def logTx(self, tx):
|
||||||
|
if self._logReceiver is not None:
|
||||||
|
self._logReceiver.onLogTx(self, tx)
|
||||||
|
|
||||||
|
def logRx(self, rx):
|
||||||
|
if self._logReceiver is not None:
|
||||||
|
self._logReceiver.onLogRx(self, rx)
|
||||||
|
|
||||||
|
def logError(self, error):
|
||||||
|
if self._logReceiver is not None:
|
||||||
|
self._logReceiver.onLogError(self, error)
|
||||||
|
|
||||||
|
def onMessageReceived(self, message):
|
||||||
|
if self._messageReceiver is not None:
|
||||||
|
self._messageReceiver.onMessageReceived(self, message)
|
||||||
|
|
||||||
|
|
||||||
|
class TransportProperties(object):
|
||||||
|
|
||||||
|
FLOWCONTROL = "flowControl"
|
||||||
|
|
||||||
|
|
||||||
|
class State(object):
|
||||||
|
OPENING_CONNECTION = "Opening connection"
|
||||||
|
DETECTING_CONNECTION = "Detecting connection"
|
||||||
|
CONNECTED = "Connected"
|
||||||
|
DISCONNECTED = "Disconnected"
|
||||||
|
DISCONNECTED_WITH_ERROR = "Disconnected with error"
|
||||||
|
ERROR = "Error"
|
||||||
|
|
||||||
|
|
||||||
|
class MessageReceiver(object):
|
||||||
|
def onMessageReceived(self, source, message):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onTimeoutReceived(self, source):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class StateReceiver(object):
|
||||||
|
def onStateChangeReceived(self, source, oldState, newState):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class LogReceiver(object):
|
||||||
|
def onLogTx(self, source, tx):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onLogRx(self, source, rx):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onLogError(self, source, error):
|
||||||
|
pass
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
|
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||||
|
__copyright__ = "Copyright (C) 2014 Gina Häußge - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
import threading
|
||||||
|
import serial
|
||||||
|
|
||||||
|
try:
|
||||||
|
import _winreg
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
from . import Transport, TransportProperties, State, SendTimeout, TransportError
|
||||||
|
from octoprint.util import getExceptionString
|
||||||
|
from octoprint.util.virtual import VirtualPrinter
|
||||||
|
from octoprint.settings import settings
|
||||||
|
from octoprint.events import eventManager, Events
|
||||||
|
|
||||||
|
class SerialTransport(Transport):
|
||||||
|
|
||||||
|
__transportinfo__ = ("serial", "Serial", False)
|
||||||
|
|
||||||
|
def __init__(self, messageReceiver, stateReceiver, logReceiver):
|
||||||
|
Transport.__init__(self, messageReceiver, stateReceiver, logReceiver)
|
||||||
|
|
||||||
|
self._serial = None
|
||||||
|
self._port = None
|
||||||
|
self._baudrate = None
|
||||||
|
self._connectionTimeout = None
|
||||||
|
self._writeTimeout = None
|
||||||
|
self._readTimeout = None
|
||||||
|
|
||||||
|
self._timeoutCounter = 0
|
||||||
|
self._maxTimeouts = 20
|
||||||
|
|
||||||
|
self._thread = None
|
||||||
|
|
||||||
|
def get_properties(self):
|
||||||
|
return {
|
||||||
|
TransportProperties.FLOWCONTROL: False
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_connection_options(self):
|
||||||
|
return {
|
||||||
|
"port": self.__getSerialList(),
|
||||||
|
"baudrate": self.__getBaudrateList()
|
||||||
|
}
|
||||||
|
|
||||||
|
def connect(self, opt):
|
||||||
|
Transport.connect(self, opt)
|
||||||
|
|
||||||
|
self._port = opt["port"] if "port" in opt else None
|
||||||
|
self._baudrate = opt["baudrate"] if "baudrate" in opt else None
|
||||||
|
|
||||||
|
self._readTimeout = opt["timeout"]["read"] if "timeout" in opt and "read" in opt["timeout"] else 5.0
|
||||||
|
self._writeTimeout = opt["timeout"]["write"] if "timeout" in opt and "write" in opt["timeout"] else 0.5
|
||||||
|
|
||||||
|
if self._connect():
|
||||||
|
self._thread = threading.Thread(target=self._monitor, name="SerialTransportMonitor")
|
||||||
|
self._thread.daemon = True
|
||||||
|
self._thread.start()
|
||||||
|
|
||||||
|
def disconnect(self, onError=False):
|
||||||
|
try:
|
||||||
|
if self._serial is not None:
|
||||||
|
self._serial.close()
|
||||||
|
finally:
|
||||||
|
self._serial = None
|
||||||
|
self._thread = None
|
||||||
|
Transport.disconnect(self, onError)
|
||||||
|
|
||||||
|
def send(self, command):
|
||||||
|
commandToSend = command + "\n"
|
||||||
|
try:
|
||||||
|
self._serial.write(commandToSend)
|
||||||
|
self._transport_logger.info("Send: %s" % command)
|
||||||
|
self.logTx(command)
|
||||||
|
except serial.SerialTimeoutException:
|
||||||
|
self._transport_logger.warn("Timeout while sending: %s" % command)
|
||||||
|
self.logError("Serial timeout while writing to serial port, try again later.")
|
||||||
|
raise SendTimeout()
|
||||||
|
except:
|
||||||
|
exceptionString = getExceptionString()
|
||||||
|
self.logError("Unexpected error while writing serial port: %s" % exceptionString)
|
||||||
|
self.onError(exceptionString)
|
||||||
|
self.disconnect(True)
|
||||||
|
raise TransportError()
|
||||||
|
|
||||||
|
def receive(self):
|
||||||
|
return self._readline()
|
||||||
|
|
||||||
|
def _monitor(self):
|
||||||
|
error = None
|
||||||
|
while True:
|
||||||
|
line = self._readline()
|
||||||
|
if line is None:
|
||||||
|
error = "Serial connection closed unexpectedly"
|
||||||
|
break
|
||||||
|
if line == "":
|
||||||
|
self._timeoutCounter += 1
|
||||||
|
self.onTimeout()
|
||||||
|
if self._maxTimeouts and self._timeoutCounter > self._maxTimeouts:
|
||||||
|
error = "Printer did not respond at all over %d retries, considering it dead" % self._maxTimeouts
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self._timeoutCounter = 0
|
||||||
|
self.onMessageReceived(line.strip())
|
||||||
|
|
||||||
|
if error is not None:
|
||||||
|
self._transport_logger.error(error)
|
||||||
|
self.logError(error)
|
||||||
|
self.onError(error)
|
||||||
|
# TODO further error handling
|
||||||
|
|
||||||
|
def _connect(self):
|
||||||
|
self.changeState(State.OPENING_CONNECTION)
|
||||||
|
if self._port == "VIRTUAL":
|
||||||
|
self._serial = VirtualPrinter(read_timeout=self._readTimeout, write_timeout=self._writeTimeout)
|
||||||
|
self.changeState(State.CONNECTED)
|
||||||
|
self._transport_logger.debug("Connected to %s" % self._serial)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
self._serial = serial.Serial(self._port, self._baudrate, timeout=self._readTimeout, writeTimeout=self._writeTimeout)
|
||||||
|
self.changeState(State.CONNECTED)
|
||||||
|
self._transport_logger.debug("Connected to %s" % self._serial)
|
||||||
|
except:
|
||||||
|
self.logError("Unexpected error while connecting to serial port: %s %s" % (self._port, getExceptionString()))
|
||||||
|
self.onError("Failed to open serial port, permissions correct?")
|
||||||
|
return False
|
||||||
|
eventManager().fire(Events.CONNECTED, {"port": self._port, "baudrate": self._baudrate})
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _readline(self):
|
||||||
|
if self._serial is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
|
line = self._serial.readline()
|
||||||
|
except:
|
||||||
|
exceptionString = getExceptionString()
|
||||||
|
self.logError("Unexpected error while reading serial port: %s" % exceptionString)
|
||||||
|
self.onError(exceptionString)
|
||||||
|
self.disconnect()
|
||||||
|
return None
|
||||||
|
|
||||||
|
if line != "":
|
||||||
|
loggable_line = unicode(line, "ascii", "replace").encode("ascii", "replace").rstrip()
|
||||||
|
self._transport_logger.debug("Recv: %s" % loggable_line)
|
||||||
|
self.logRx(loggable_line)
|
||||||
|
return line
|
||||||
|
|
||||||
|
def __getSerialList(self):
|
||||||
|
baselist=[]
|
||||||
|
if os.name == "nt":
|
||||||
|
try:
|
||||||
|
key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM")
|
||||||
|
i=0
|
||||||
|
while(1):
|
||||||
|
baselist+=[_winreg.EnumValue(key,i)[1]]
|
||||||
|
i+=1
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
baselist = baselist \
|
||||||
|
+ glob.glob("/dev/ttyUSB*") \
|
||||||
|
+ glob.glob("/dev/ttyACM*") \
|
||||||
|
+ glob.glob("/dev/ttyAMA*") \
|
||||||
|
+ glob.glob("/dev/tty.usb*") \
|
||||||
|
+ glob.glob("/dev/cu.*") \
|
||||||
|
+ glob.glob("/dev/rfcomm*")
|
||||||
|
|
||||||
|
additionalPorts = settings().get(["serial", "additionalPorts"])
|
||||||
|
for additional in additionalPorts:
|
||||||
|
baselist += glob.glob(additional)
|
||||||
|
|
||||||
|
prev = settings().get(["serial", "port"])
|
||||||
|
if prev in baselist:
|
||||||
|
baselist.remove(prev)
|
||||||
|
baselist.insert(0, prev)
|
||||||
|
if settings().getBoolean(["devel", "virtualPrinter", "enabled"]):
|
||||||
|
baselist.append("VIRTUAL")
|
||||||
|
return baselist
|
||||||
|
|
||||||
|
def __getBaudrateList(self):
|
||||||
|
ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600]
|
||||||
|
prev = settings().getInt(["serial", "baudrate"])
|
||||||
|
if prev in ret:
|
||||||
|
ret.remove(prev)
|
||||||
|
ret.insert(0, prev)
|
||||||
|
return ret
|
||||||
@@ -42,6 +42,7 @@ class Events(object):
|
|||||||
UPDATED_FILES = "UpdatedFiles"
|
UPDATED_FILES = "UpdatedFiles"
|
||||||
METADATA_ANALYSIS_STARTED = "MetadataAnalysisStarted"
|
METADATA_ANALYSIS_STARTED = "MetadataAnalysisStarted"
|
||||||
METADATA_ANALYSIS_FINISHED = "MetadataAnalysisFinished"
|
METADATA_ANALYSIS_FINISHED = "MetadataAnalysisFinished"
|
||||||
|
METADATA_STATISTICS_UPDATED = "MetadataStatisticsUpdated"
|
||||||
|
|
||||||
# SD Upload
|
# SD Upload
|
||||||
TRANSFER_STARTED = "TransferStarted"
|
TRANSFER_STARTED = "TransferStarted"
|
||||||
@@ -62,6 +63,7 @@ class Events(object):
|
|||||||
HOME = "Home"
|
HOME = "Home"
|
||||||
Z_CHANGE = "ZChange"
|
Z_CHANGE = "ZChange"
|
||||||
WAITING = "Waiting"
|
WAITING = "Waiting"
|
||||||
|
DWELL = "Dwelling"
|
||||||
COOLING = "Cooling"
|
COOLING = "Cooling"
|
||||||
ALERT = "Alert"
|
ALERT = "Alert"
|
||||||
CONVEYOR = "Conveyor"
|
CONVEYOR = "Conveyor"
|
||||||
@@ -306,7 +308,7 @@ class CommandTrigger(GenericEventListener):
|
|||||||
def _executeGcodeCommand(self, command):
|
def _executeGcodeCommand(self, command):
|
||||||
commands = [command]
|
commands = [command]
|
||||||
if isinstance(command, (list, tuple, set)):
|
if isinstance(command, (list, tuple, set)):
|
||||||
self.logger.debug("Executing GCode commands: %r" % command)
|
self._logger.debug("Executing GCode commands: %r" % command)
|
||||||
commands = list(command)
|
commands = list(command)
|
||||||
else:
|
else:
|
||||||
self._logger.debug("Executing GCode command: %s" % command)
|
self._logger.debug("Executing GCode command: %s" % command)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from octoprint.events import eventManager, Events
|
from octoprint.events import eventManager, Events
|
||||||
|
from octoprint.plugin import plugin_manager, ProgressPlugin
|
||||||
|
|
||||||
from .destinations import FileDestinations
|
from .destinations import FileDestinations
|
||||||
from .analysis import QueueEntry, AnalysisQueue
|
from .analysis import QueueEntry, AnalysisQueue
|
||||||
@@ -113,6 +114,8 @@ class FileManager(object):
|
|||||||
self._slicing_progress_callbacks = []
|
self._slicing_progress_callbacks = []
|
||||||
self._last_slicing_progress = None
|
self._last_slicing_progress = None
|
||||||
|
|
||||||
|
self._progress_plugins = plugin_manager().get_implementations(ProgressPlugin)
|
||||||
|
|
||||||
for storage_type, storage_manager in self._storage_managers.items():
|
for storage_type, storage_manager in self._storage_managers.items():
|
||||||
self._determine_analysis_backlog(storage_type, storage_manager)
|
self._determine_analysis_backlog(storage_type, storage_manager)
|
||||||
|
|
||||||
@@ -156,7 +159,7 @@ class FileManager(object):
|
|||||||
position=None, profile=None, printer_profile_id=None, overrides=None, callback=None, callback_args=None):
|
position=None, profile=None, printer_profile_id=None, overrides=None, callback=None, callback_args=None):
|
||||||
absolute_source_path = self.get_absolute_path(source_location, source_path)
|
absolute_source_path = self.get_absolute_path(source_location, source_path)
|
||||||
|
|
||||||
def stlProcessed(source_location, source_path, tmp_path, dest_location, dest_path, start_time, printer_profile_id, callback, callback_args, _error=None, _cancelled=False):
|
def stlProcessed(source_location, source_path, tmp_path, dest_location, dest_path, start_time, printer_profile_id, callback, callback_args, _error=None, _cancelled=False, _analysis=None):
|
||||||
try:
|
try:
|
||||||
if _error:
|
if _error:
|
||||||
eventManager().fire(Events.SLICING_FAILED, {"stl": source_path, "gcode": dest_path, "reason": _error})
|
eventManager().fire(Events.SLICING_FAILED, {"stl": source_path, "gcode": dest_path, "reason": _error})
|
||||||
@@ -184,7 +187,7 @@ class FileManager(object):
|
|||||||
file_obj = Wrapper(stl_name, temp_path, hash)
|
file_obj = Wrapper(stl_name, temp_path, hash)
|
||||||
|
|
||||||
printer_profile = self._printer_profile_manager.get(printer_profile_id)
|
printer_profile = self._printer_profile_manager.get(printer_profile_id)
|
||||||
self.add_file(dest_location, dest_path, file_obj, links=links, allow_overwrite=True, printer_profile=printer_profile)
|
self.add_file(dest_location, dest_path, file_obj, links=links, allow_overwrite=True, printer_profile=printer_profile, analysis=_analysis)
|
||||||
|
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
eventManager().fire(Events.SLICING_DONE, {"stl": source_path, "gcode": dest_path, "time": end_time - start_time})
|
eventManager().fire(Events.SLICING_DONE, {"stl": source_path, "gcode": dest_path, "time": end_time - start_time})
|
||||||
@@ -246,14 +249,25 @@ class FileManager(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
progress_int = int(_progress * 100)
|
progress_int = int(_progress * 100)
|
||||||
if self._last_slicing_progress == progress_int:
|
if self._last_slicing_progress != progress_int:
|
||||||
return
|
|
||||||
else:
|
|
||||||
self._last_slicing_progress = progress_int
|
self._last_slicing_progress = progress_int
|
||||||
|
for callback in self._slicing_progress_callbacks:
|
||||||
|
try: callback.sendSlicingProgress(slicer, source_location, source_path, dest_location, dest_path, progress_int)
|
||||||
|
except: self._logger.exception("Exception while pushing slicing progress")
|
||||||
|
|
||||||
|
if progress_int:
|
||||||
|
def call_plugins(slicer, source_location, source_path, dest_location, dest_path, progress):
|
||||||
|
for name, plugin in self._progress_plugins.items():
|
||||||
|
try:
|
||||||
|
plugin.on_slicing_progress(slicer, source_location, source_path, dest_location, dest_path, progress)
|
||||||
|
except:
|
||||||
|
self._logger.exception("Exception while sending slicing progress to plugin %s" % name)
|
||||||
|
|
||||||
|
import threading
|
||||||
|
thread = threading.Thread(target=call_plugins, args=(slicer, source_location, source_path, dest_location, dest_path, progress_int))
|
||||||
|
thread.daemon = False
|
||||||
|
thread.start()
|
||||||
|
|
||||||
for callback in self._slicing_progress_callbacks:
|
|
||||||
try: callback.sendSlicingProgress(slicer, source_location, source_path, dest_location, dest_path, progress_int)
|
|
||||||
except: self._logger.exception("Exception while pushing slicing progress")
|
|
||||||
|
|
||||||
def get_busy_files(self):
|
def get_busy_files(self):
|
||||||
return self._slicing_jobs.keys()
|
return self._slicing_jobs.keys()
|
||||||
@@ -272,17 +286,20 @@ class FileManager(object):
|
|||||||
result[dst] = self._storage_managers[dst].list_files(path=path, filter=filter, recursive=recursive)
|
result[dst] = self._storage_managers[dst].list_files(path=path, filter=filter, recursive=recursive)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def add_file(self, destination, path, file_object, links=None, allow_overwrite=False, printer_profile=None):
|
def add_file(self, destination, path, file_object, links=None, allow_overwrite=False, printer_profile=None, analysis=None):
|
||||||
if printer_profile is None:
|
if printer_profile is None:
|
||||||
printer_profile = self._printer_profile_manager.get_current_or_default()
|
printer_profile = self._printer_profile_manager.get_current_or_default()
|
||||||
|
|
||||||
file_path = self._storage(destination).add_file(path, file_object, links=links, printer_profile=printer_profile, allow_overwrite=allow_overwrite)
|
file_path = self._storage(destination).add_file(path, file_object, links=links, printer_profile=printer_profile, allow_overwrite=allow_overwrite)
|
||||||
absolute_path = self._storage(destination).get_absolute_path(file_path)
|
absolute_path = self._storage(destination).get_absolute_path(file_path)
|
||||||
|
|
||||||
file_type = get_file_type(absolute_path)
|
if analysis is None:
|
||||||
if file_type:
|
file_type = get_file_type(absolute_path)
|
||||||
queue_entry = QueueEntry(file_path, file_type[-1], destination, absolute_path, printer_profile)
|
if file_type:
|
||||||
self._analysis_queue.enqueue(queue_entry, high_priority=True)
|
queue_entry = QueueEntry(file_path, file_type[-1], destination, absolute_path, printer_profile)
|
||||||
|
self._analysis_queue.enqueue(queue_entry, high_priority=True)
|
||||||
|
else:
|
||||||
|
self._add_analysis_result(destination, path, analysis)
|
||||||
|
|
||||||
eventManager().fire(Events.UPDATED_FILES, dict(type="printables"))
|
eventManager().fire(Events.UPDATED_FILES, dict(type="printables"))
|
||||||
return file_path
|
return file_path
|
||||||
@@ -309,9 +326,13 @@ class FileManager(object):
|
|||||||
def remove_link(self, destination, path, rel, data):
|
def remove_link(self, destination, path, rel, data):
|
||||||
self._storage(destination).remove_link(path, rel, data)
|
self._storage(destination).remove_link(path, rel, data)
|
||||||
|
|
||||||
def log_print(self, destination, path, timestamp, print_time, success):
|
def log_print(self, destination, path, timestamp, print_time, success, printer_profile):
|
||||||
try:
|
try:
|
||||||
self._storage(destination).add_history(path, dict(timestamp=timestamp, printTime=print_time, success=success))
|
if success:
|
||||||
|
self._storage(destination).add_history(path, dict(timestamp=timestamp, printTime=print_time, success=success, printerProfile=printer_profile))
|
||||||
|
else:
|
||||||
|
self._storage(destination).add_history(path, dict(timestamp=timestamp, success=success, printerProfile=printer_profile))
|
||||||
|
eventManager().fire(Events.METADATA_STATISTICS_UPDATED, dict(storage=destination, path=path))
|
||||||
except NoSuchStorage:
|
except NoSuchStorage:
|
||||||
# if there's no storage configured where to log the print, we'll just not log it
|
# if there's no storage configured where to log the print, we'll just not log it
|
||||||
pass
|
pass
|
||||||
@@ -348,10 +369,13 @@ class FileManager(object):
|
|||||||
raise NoSuchStorage("No storage configured for destination {destination}".format(**locals()))
|
raise NoSuchStorage("No storage configured for destination {destination}".format(**locals()))
|
||||||
return self._storage_managers[destination]
|
return self._storage_managers[destination]
|
||||||
|
|
||||||
def _on_analysis_finished(self, entry, result):
|
def _add_analysis_result(self, destination, path, result):
|
||||||
if not entry.location in self._storage_managers:
|
if not destination in self._storage_managers:
|
||||||
return
|
return
|
||||||
|
|
||||||
storage_manager = self._storage_managers[entry.location]
|
storage_manager = self._storage_managers[destination]
|
||||||
storage_manager.set_additional_metadata(entry.path, "analysis", result)
|
storage_manager.set_additional_metadata(path, "analysis", result)
|
||||||
|
|
||||||
|
def _on_analysis_finished(self, entry, result):
|
||||||
|
self._add_analysis_result(entry.location, entry.path, result)
|
||||||
|
|
||||||
@@ -9,9 +9,12 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pylru
|
import pylru
|
||||||
|
import tempfile
|
||||||
|
|
||||||
import octoprint.filemanager
|
import octoprint.filemanager
|
||||||
|
|
||||||
|
from octoprint.util import safeRename
|
||||||
|
|
||||||
|
|
||||||
class StorageInterface(object):
|
class StorageInterface(object):
|
||||||
|
|
||||||
@@ -501,6 +504,7 @@ class LocalFileStorage(StorageInterface):
|
|||||||
metadata[name]["history"] = []
|
metadata[name]["history"] = []
|
||||||
|
|
||||||
metadata[name]["history"].append(data)
|
metadata[name]["history"].append(data)
|
||||||
|
self._calculate_stats_from_history(name, path, metadata=metadata, save=False)
|
||||||
self._save_metadata(path, metadata)
|
self._save_metadata(path, metadata)
|
||||||
|
|
||||||
def _update_history(self, name, path, index, data):
|
def _update_history(self, name, path, index, data):
|
||||||
@@ -510,7 +514,8 @@ class LocalFileStorage(StorageInterface):
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
metadata[name]["history"][index] = data
|
metadata[name]["history"][index].update(data)
|
||||||
|
self._calculate_stats_from_history(name, path, metadata=metadata, save=False)
|
||||||
self._save_metadata(path, metadata)
|
self._save_metadata(path, metadata)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
@@ -523,10 +528,55 @@ class LocalFileStorage(StorageInterface):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
del metadata[name]["history"][index]
|
del metadata[name]["history"][index]
|
||||||
|
self._calculate_stats_from_history(name, path, metadata=metadata, save=False)
|
||||||
self._save_metadata(path, metadata)
|
self._save_metadata(path, metadata)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _calculate_stats_from_history(self, name, path, metadata=None, save=True):
|
||||||
|
if metadata is None:
|
||||||
|
metadata = self._get_metadata(path)
|
||||||
|
|
||||||
|
if not name in metadata or not "history" in metadata[name]:
|
||||||
|
return
|
||||||
|
|
||||||
|
# collect data from history
|
||||||
|
former_print_times = dict()
|
||||||
|
last_print = dict()
|
||||||
|
|
||||||
|
|
||||||
|
for history_entry in metadata[name]["history"]:
|
||||||
|
if not "printTime" in history_entry or not "success" in history_entry or not history_entry["success"] or not "printerProfile" in history_entry:
|
||||||
|
continue
|
||||||
|
|
||||||
|
printer_profile = history_entry["printerProfile"]
|
||||||
|
print_time = history_entry["printTime"]
|
||||||
|
|
||||||
|
if not printer_profile in former_print_times:
|
||||||
|
former_print_times[printer_profile] = []
|
||||||
|
former_print_times[printer_profile].append(print_time)
|
||||||
|
|
||||||
|
if not printer_profile in last_print or last_print[printer_profile] is None or ("timestamp" in history_entry and history_entry["timestamp"] > last_print[printer_profile]["timestamp"]):
|
||||||
|
last_print[printer_profile] = history_entry
|
||||||
|
|
||||||
|
# calculate stats
|
||||||
|
statistics = dict(averagePrintTime=dict(), lastPrintTime=dict())
|
||||||
|
|
||||||
|
for printer_profile in former_print_times:
|
||||||
|
if not former_print_times[printer_profile]:
|
||||||
|
continue
|
||||||
|
statistics["averagePrintTime"][printer_profile] = sum(former_print_times[printer_profile]) / float(len(former_print_times[printer_profile]))
|
||||||
|
|
||||||
|
for printer_profile in last_print:
|
||||||
|
if not last_print[printer_profile]:
|
||||||
|
continue
|
||||||
|
statistics["lastPrintTime"][printer_profile] = last_print[printer_profile]["printTime"]
|
||||||
|
|
||||||
|
metadata[name]["statistics"] = statistics
|
||||||
|
|
||||||
|
if save:
|
||||||
|
self._save_metadata(path, metadata)
|
||||||
|
|
||||||
def _get_links(self, name, path, searched_rel):
|
def _get_links(self, name, path, searched_rel):
|
||||||
metadata = self._get_metadata(path)
|
metadata = self._get_metadata(path)
|
||||||
result = []
|
result = []
|
||||||
@@ -809,20 +859,27 @@ class LocalFileStorage(StorageInterface):
|
|||||||
with open(metadata_path) as f:
|
with open(metadata_path) as f:
|
||||||
try:
|
try:
|
||||||
import yaml
|
import yaml
|
||||||
return yaml.safe_load(f)
|
metadata = yaml.safe_load(f)
|
||||||
except:
|
except:
|
||||||
self._logger.exception("Error while reading .metadata.yaml from {path}".format(**locals()))
|
self._logger.exception("Error while reading .metadata.yaml from {path}".format(**locals()))
|
||||||
|
else:
|
||||||
|
self._metadata_cache[path] = metadata
|
||||||
|
return metadata
|
||||||
return dict()
|
return dict()
|
||||||
|
|
||||||
def _save_metadata(self, path, metadata):
|
def _save_metadata(self, path, metadata):
|
||||||
metadata_path = os.path.join(path, ".metadata.yaml")
|
metadata_path = os.path.join(path, ".metadata.yaml")
|
||||||
|
|
||||||
|
fh, metadata_temporary_path = tempfile.mkstemp()
|
||||||
|
os.close(fh)
|
||||||
|
|
||||||
with self._metadata_lock:
|
with self._metadata_lock:
|
||||||
with open(metadata_path, "w") as f:
|
try:
|
||||||
try:
|
with open(metadata_temporary_path, "w") as f:
|
||||||
import yaml
|
import yaml
|
||||||
yaml.safe_dump(metadata, stream=f, default_flow_style=False, indent=" ", allow_unicode=True)
|
yaml.safe_dump(metadata, stream=f, default_flow_style=False, indent=" ", allow_unicode=True)
|
||||||
except:
|
safeRename(metadata_temporary_path, metadata_path, throw_error=True)
|
||||||
self._logger.exception("Error while writing .metadata.yaml to {path}".format(**locals()))
|
except:
|
||||||
else:
|
self._logger.exception("Error while writing .metadata.yaml to {path}".format(**locals()))
|
||||||
self._metadata_cache[path] = metadata
|
else:
|
||||||
|
self._metadata_cache[path] = metadata
|
||||||
@@ -30,7 +30,8 @@ def plugin_manager(init=False, plugin_folders=None, plugin_types=None, plugin_en
|
|||||||
BlueprintPlugin,
|
BlueprintPlugin,
|
||||||
EventHandlerPlugin,
|
EventHandlerPlugin,
|
||||||
SlicerPlugin,
|
SlicerPlugin,
|
||||||
AppPlugin]
|
AppPlugin,
|
||||||
|
ProgressPlugin]
|
||||||
if plugin_entry_points is None:
|
if plugin_entry_points is None:
|
||||||
plugin_entry_points = "octoprint.plugin"
|
plugin_entry_points = "octoprint.plugin"
|
||||||
if plugin_disabled_list is None:
|
if plugin_disabled_list is None:
|
||||||
|
|||||||
@@ -228,6 +228,36 @@ class SlicerPlugin(Plugin):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ProgressPlugin(Plugin):
|
||||||
|
"""
|
||||||
|
Via the ``ProgressPlugin`` mixing plugins can let themselves be called upon progress in print jobs or slicing jobs,
|
||||||
|
limited to minimally 1% steps.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def on_print_progress(self, storage, path, progress):
|
||||||
|
"""
|
||||||
|
Called by OctoPrint on minimally 1% increments during a running print job.
|
||||||
|
|
||||||
|
:param location string: Location of the file
|
||||||
|
:param path string: Path of the file
|
||||||
|
:param progress int: Current progress as a value between 0 and 100
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def on_slicing_progress(self, slicer, source_location, source_path, destination_location, destination_path, progress):
|
||||||
|
"""
|
||||||
|
Called by OctoPrint on minimally 1% increments during a running slicing job.
|
||||||
|
|
||||||
|
:param slicer string: Key of the slicer reporting the progress
|
||||||
|
:param source_location string: Location of the source file
|
||||||
|
:param source_path string: Path of the source file
|
||||||
|
:param destination_location string: Location the destination file
|
||||||
|
:param destination_path string: Path of the destination file
|
||||||
|
:param progress int: Current progress as a value between 0 and 100
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AppPlugin(Plugin):
|
class AppPlugin(Plugin):
|
||||||
def get_additional_apps(self):
|
def get_additional_apps(self):
|
||||||
return []
|
return []
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import logging
|
|||||||
import logging.handlers
|
import logging.handlers
|
||||||
import os
|
import os
|
||||||
import flask
|
import flask
|
||||||
|
import math
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
import octoprint.util
|
import octoprint.util
|
||||||
@@ -114,9 +115,8 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||||||
# setup job tracking across threads
|
# setup job tracking across threads
|
||||||
import threading
|
import threading
|
||||||
self._slicing_commands = dict()
|
self._slicing_commands = dict()
|
||||||
self._slicing_commands_mutex = threading.Lock()
|
|
||||||
self._cancelled_jobs = []
|
self._cancelled_jobs = []
|
||||||
self._cancelled_jobs_mutex = threading.Lock()
|
self._job_mutex = threading.Lock()
|
||||||
|
|
||||||
##~~ StartupPlugin API
|
##~~ StartupPlugin API
|
||||||
|
|
||||||
@@ -188,7 +188,10 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||||||
|
|
||||||
def is_slicer_configured(self):
|
def is_slicer_configured(self):
|
||||||
cura_engine = s.get(["cura_engine"])
|
cura_engine = s.get(["cura_engine"])
|
||||||
return cura_engine is not None and os.path.exists(cura_engine)
|
if cura_engine is not None and os.path.exists(cura_engine):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self._logger.info("Path to CuraEngine has not been configured yet or does not exist (currently set to %r), Cura will not be selectable for slicing" % cura_engine)
|
||||||
|
|
||||||
def get_slicer_properties(self):
|
def get_slicer_properties(self):
|
||||||
return dict(
|
return dict(
|
||||||
@@ -230,54 +233,56 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||||||
self._save_profile(path, new_profile, allow_overwrite=allow_overwrite)
|
self._save_profile(path, new_profile, allow_overwrite=allow_overwrite)
|
||||||
|
|
||||||
def do_slice(self, model_path, printer_profile, machinecode_path=None, profile_path=None, position=None, on_progress=None, on_progress_args=None, on_progress_kwargs=None):
|
def do_slice(self, model_path, printer_profile, machinecode_path=None, profile_path=None, position=None, on_progress=None, on_progress_args=None, on_progress_kwargs=None):
|
||||||
if not profile_path:
|
|
||||||
profile_path = s.get(["default_profile"])
|
|
||||||
if not machinecode_path:
|
|
||||||
path, _ = os.path.splitext(model_path)
|
|
||||||
machinecode_path = path + ".gco"
|
|
||||||
|
|
||||||
if position and isinstance(position, dict) and "x" in position and "y" in position:
|
|
||||||
posX = position["x"]
|
|
||||||
posY = position["y"]
|
|
||||||
else:
|
|
||||||
posX = None
|
|
||||||
posY = None
|
|
||||||
|
|
||||||
if on_progress:
|
|
||||||
if not on_progress_args:
|
|
||||||
on_progress_args = ()
|
|
||||||
if not on_progress_kwargs:
|
|
||||||
on_progress_kwargs = dict()
|
|
||||||
|
|
||||||
self._cura_logger.info("### Slicing %s to %s using profile stored at %s" % (model_path, machinecode_path, profile_path))
|
|
||||||
|
|
||||||
engine_settings = self._convert_to_engine(profile_path, printer_profile, posX, posY)
|
|
||||||
|
|
||||||
executable = s.get(["cura_engine"])
|
|
||||||
if not executable:
|
|
||||||
return False, "Path to CuraEngine is not configured "
|
|
||||||
|
|
||||||
working_dir, _ = os.path.split(executable)
|
|
||||||
args = ['"%s"' % executable, '-v', '-p']
|
|
||||||
for k, v in engine_settings.items():
|
|
||||||
args += ["-s", '"%s=%s"' % (k, str(v))]
|
|
||||||
args += ['-o', '"%s"' % machinecode_path, '"%s"' % model_path]
|
|
||||||
|
|
||||||
import sarge
|
|
||||||
command = " ".join(args)
|
|
||||||
self._logger.info("Running %r in %s" % (command, working_dir))
|
|
||||||
try:
|
try:
|
||||||
p = sarge.run(command, cwd=working_dir, async=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
with self._job_mutex:
|
||||||
try:
|
if not profile_path:
|
||||||
with self._slicing_commands_mutex:
|
profile_path = s.get(["default_profile"])
|
||||||
self._slicing_commands[machinecode_path] = p.commands[0]
|
if not machinecode_path:
|
||||||
|
path, _ = os.path.splitext(model_path)
|
||||||
|
machinecode_path = path + ".gco"
|
||||||
|
|
||||||
|
if position and isinstance(position, dict) and "x" in position and "y" in position:
|
||||||
|
posX = position["x"]
|
||||||
|
posY = position["y"]
|
||||||
|
else:
|
||||||
|
posX = None
|
||||||
|
posY = None
|
||||||
|
|
||||||
|
if on_progress:
|
||||||
|
if not on_progress_args:
|
||||||
|
on_progress_args = ()
|
||||||
|
if not on_progress_kwargs:
|
||||||
|
on_progress_kwargs = dict()
|
||||||
|
|
||||||
|
self._cura_logger.info("### Slicing %s to %s using profile stored at %s" % (model_path, machinecode_path, profile_path))
|
||||||
|
|
||||||
|
engine_settings = self._convert_to_engine(profile_path, printer_profile, posX, posY)
|
||||||
|
|
||||||
|
executable = s.get(["cura_engine"])
|
||||||
|
if not executable:
|
||||||
|
return False, "Path to CuraEngine is not configured "
|
||||||
|
|
||||||
|
working_dir, _ = os.path.split(executable)
|
||||||
|
args = ['"%s"' % executable, '-v', '-p']
|
||||||
|
for k, v in engine_settings.items():
|
||||||
|
args += ["-s", '"%s=%s"' % (k, str(v))]
|
||||||
|
args += ['-o', '"%s"' % machinecode_path, '"%s"' % model_path]
|
||||||
|
|
||||||
|
import sarge
|
||||||
|
command = " ".join(args)
|
||||||
|
self._logger.info("Running %r in %s" % (command, working_dir))
|
||||||
|
|
||||||
|
p = sarge.run(command, cwd=working_dir, async=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
||||||
|
self._slicing_commands[machinecode_path] = p.commands[0]
|
||||||
|
|
||||||
|
try:
|
||||||
layer_count = None
|
layer_count = None
|
||||||
step_factor = dict(
|
step_factor = dict(
|
||||||
inset=0,
|
inset=0,
|
||||||
skin=1,
|
skin=1,
|
||||||
export=2
|
export=2
|
||||||
)
|
)
|
||||||
|
analysis = None
|
||||||
while p.returncode is None:
|
while p.returncode is None:
|
||||||
line = p.stderr.readline(timeout=0.5)
|
line = p.stderr.readline(timeout=0.5)
|
||||||
if not line:
|
if not line:
|
||||||
@@ -331,17 +336,50 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||||||
continue
|
continue
|
||||||
on_progress_kwargs["_progress"] = (step_factor[step] * layer_count + current_layer) / (layer_count * 3)
|
on_progress_kwargs["_progress"] = (step_factor[step] * layer_count + current_layer) / (layer_count * 3)
|
||||||
on_progress(*on_progress_args, **on_progress_kwargs)
|
on_progress(*on_progress_args, **on_progress_kwargs)
|
||||||
|
|
||||||
|
elif line.startswith("Print time:"):
|
||||||
|
try:
|
||||||
|
print_time = int(line[len("Print time:"):].strip())
|
||||||
|
if analysis is None:
|
||||||
|
analysis = dict()
|
||||||
|
analysis["estimatedPrintTime"] = print_time
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
elif line.startswith("Filament:") or line.startswith("Filament2:"):
|
||||||
|
if line.startswith("Filament:"):
|
||||||
|
filament_str = line[len("Filament:"):].strip()
|
||||||
|
tool_key = "tool0"
|
||||||
|
else:
|
||||||
|
filament_str = line[len("Filament2:"):].strip()
|
||||||
|
tool_key = "tool1"
|
||||||
|
|
||||||
|
try:
|
||||||
|
filament = int(filament_str)
|
||||||
|
if analysis is None:
|
||||||
|
analysis = dict()
|
||||||
|
if not "filament" in analysis:
|
||||||
|
analysis["filament"] = dict()
|
||||||
|
if not tool_key in analysis["filament"]:
|
||||||
|
analysis["filament"][tool_key] = dict()
|
||||||
|
analysis["filament"][tool_key]["length"] = filament
|
||||||
|
if "filamentDiameter" in engine_settings:
|
||||||
|
radius_in_cm = float(int(engine_settings["filamentDiameter"]) / 10000.0) / 2.0
|
||||||
|
filament_in_cm = filament / 10.0
|
||||||
|
analysis["filament"][tool_key]["volume"] = filament_in_cm * math.pi * radius_in_cm * radius_in_cm
|
||||||
|
except:
|
||||||
|
pass
|
||||||
finally:
|
finally:
|
||||||
p.close()
|
p.close()
|
||||||
|
|
||||||
with self._cancelled_jobs_mutex:
|
with self._job_mutex:
|
||||||
if machinecode_path in self._cancelled_jobs:
|
if machinecode_path in self._cancelled_jobs:
|
||||||
self._cura_logger.info("### Cancelled")
|
self._cura_logger.info("### Cancelled")
|
||||||
raise octoprint.slicing.SlicingCancelled()
|
raise octoprint.slicing.SlicingCancelled()
|
||||||
|
|
||||||
self._cura_logger.info("### Finished, returncode %d" % p.returncode)
|
self._cura_logger.info("### Finished, returncode %d" % p.returncode)
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
return True, None
|
return True, dict(analysis=analysis)
|
||||||
else:
|
else:
|
||||||
self._logger.warn("Could not slice via Cura, got return code %r" % p.returncode)
|
self._logger.warn("Could not slice via Cura, got return code %r" % p.returncode)
|
||||||
return False, "Got returncode %r" % p.returncode
|
return False, "Got returncode %r" % p.returncode
|
||||||
@@ -353,21 +391,21 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||||||
return False, "Unknown error, please consult the log file"
|
return False, "Unknown error, please consult the log file"
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
with self._cancelled_jobs_mutex:
|
with self._job_mutex:
|
||||||
if machinecode_path in self._cancelled_jobs:
|
if machinecode_path in self._cancelled_jobs:
|
||||||
self._cancelled_jobs.remove(machinecode_path)
|
self._cancelled_jobs.remove(machinecode_path)
|
||||||
with self._slicing_commands_mutex:
|
|
||||||
if machinecode_path in self._slicing_commands:
|
if machinecode_path in self._slicing_commands:
|
||||||
del self._slicing_commands[machinecode_path]
|
del self._slicing_commands[machinecode_path]
|
||||||
|
|
||||||
self._cura_logger.info("-" * 40)
|
self._cura_logger.info("-" * 40)
|
||||||
|
|
||||||
def cancel_slicing(self, machinecode_path):
|
def cancel_slicing(self, machinecode_path):
|
||||||
with self._slicing_commands_mutex:
|
with self._job_mutex:
|
||||||
if machinecode_path in self._slicing_commands:
|
if machinecode_path in self._slicing_commands:
|
||||||
with self._cancelled_jobs_mutex:
|
self._cancelled_jobs.append(machinecode_path)
|
||||||
self._cancelled_jobs.append(machinecode_path)
|
command = self._slicing_commands[machinecode_path]
|
||||||
self._slicing_commands[machinecode_path].terminate()
|
if command is not None:
|
||||||
|
command.terminate()
|
||||||
self._logger.info("Cancelled slicing of %s" % machinecode_path)
|
self._logger.info("Cancelled slicing of %s" % machinecode_path)
|
||||||
|
|
||||||
def _load_profile(self, path):
|
def _load_profile(self, path):
|
||||||
|
|||||||
+444
-261
@@ -1,12 +1,15 @@
|
|||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
from octoprint.comm.protocol.repetier import RepetierTextualProtocol
|
||||||
|
from octoprint.comm.transport import Transport
|
||||||
|
|
||||||
__author__ = "Gina Häußge <osd@foosel.net>"
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import datetime
|
|
||||||
import threading
|
import threading
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import octoprint.util.comm as comm
|
import octoprint.util.comm as comm
|
||||||
@@ -17,6 +20,12 @@ from octoprint.events import eventManager, Events
|
|||||||
|
|
||||||
from octoprint.filemanager.destinations import FileDestinations
|
from octoprint.filemanager.destinations import FileDestinations
|
||||||
|
|
||||||
|
from octoprint.comm.protocol import State as ProtocolState, Protocol
|
||||||
|
from octoprint.comm.protocol.reprap import RepRapProtocol
|
||||||
|
from octoprint.comm.transport.serialTransport import SerialTransport
|
||||||
|
|
||||||
|
from octoprint.plugin import plugin_manager, ProgressPlugin
|
||||||
|
|
||||||
def getConnectionOptions():
|
def getConnectionOptions():
|
||||||
"""
|
"""
|
||||||
Retrieves the available ports, baudrates, prefered port and baudrate for connecting to the printer.
|
Retrieves the available ports, baudrates, prefered port and baudrate for connecting to the printer.
|
||||||
@@ -34,17 +43,14 @@ class Printer():
|
|||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
self._logger = logging.getLogger(__name__)
|
self._logger = logging.getLogger(__name__)
|
||||||
|
#self._estimationLogger = logging.getLogger("ESTIMATIONS")
|
||||||
|
#self._printTimeLogger = logging.getLogger("PRINT_TIME")
|
||||||
|
|
||||||
self._analysisQueue = analysisQueue
|
self._analysisQueue = analysisQueue
|
||||||
self._fileManager = fileManager
|
self._fileManager = fileManager
|
||||||
self._printerProfileManager = printerProfileManager
|
self._printerProfileManager = printerProfileManager
|
||||||
|
|
||||||
# state
|
# state
|
||||||
# TODO do we really need to hold the temperature here?
|
|
||||||
self._temp = None
|
|
||||||
self._bedTemp = None
|
|
||||||
self._targetTemp = None
|
|
||||||
self._targetBedTemp = None
|
|
||||||
self._temps = deque([], 300)
|
self._temps = deque([], 300)
|
||||||
self._tempBacklog = []
|
self._tempBacklog = []
|
||||||
|
|
||||||
@@ -73,13 +79,19 @@ class Printer():
|
|||||||
self._streamingFinishedCallback = None
|
self._streamingFinishedCallback = None
|
||||||
|
|
||||||
self._selectedFile = None
|
self._selectedFile = None
|
||||||
|
self._timeEstimationData = None
|
||||||
|
|
||||||
# comm
|
# comm
|
||||||
self._comm = None
|
self._comm = None
|
||||||
|
|
||||||
|
self._protocol = self._createProtocol()
|
||||||
|
|
||||||
# callbacks
|
# callbacks
|
||||||
self._callbacks = []
|
self._callbacks = []
|
||||||
|
|
||||||
|
# progress plugins
|
||||||
self._lastProgressReport = None
|
self._lastProgressReport = None
|
||||||
|
self._progressPlugins = plugin_manager().get_implementations(ProgressPlugin)
|
||||||
|
|
||||||
self._stateMonitor = StateMonitor(
|
self._stateMonitor = StateMonitor(
|
||||||
ratelimit=0.5,
|
ratelimit=0.5,
|
||||||
@@ -108,7 +120,51 @@ class Printer():
|
|||||||
currentZ=None
|
currentZ=None
|
||||||
)
|
)
|
||||||
|
|
||||||
eventManager().subscribe(Events.METADATA_ANALYSIS_FINISHED, self.onMetadataAnalysisFinished);
|
eventManager().subscribe(Events.METADATA_ANALYSIS_FINISHED, self.onMetadataAnalysisFinished)
|
||||||
|
eventManager().subscribe(Events.METADATA_STATISTICS_UPDATED, self.onMetadataStatisticsUpdated)
|
||||||
|
|
||||||
|
def _getTransportFactory(self):
|
||||||
|
transports = self._getSubclassAttributes(Transport, "__transportinfo__", validator=lambda x: not x[2])
|
||||||
|
|
||||||
|
transportType = settings().get(["communication", "transport"])
|
||||||
|
for t in transports:
|
||||||
|
id, name, abstract, factory = t
|
||||||
|
if transportType == id:
|
||||||
|
return factory
|
||||||
|
|
||||||
|
return SerialTransport
|
||||||
|
|
||||||
|
def _createProtocol(self):
|
||||||
|
transport = self._getTransportFactory()
|
||||||
|
protocol_type = settings().get(["communication", "protocol"])
|
||||||
|
|
||||||
|
protocols = self._getSubclassAttributes(Protocol, "__protocolinfo__", validator=lambda x: not x[2])
|
||||||
|
|
||||||
|
protocol_factory = RepRapProtocol
|
||||||
|
for p in protocols:
|
||||||
|
id, name, abstract, factory = p
|
||||||
|
if protocol_type == id:
|
||||||
|
protocol_factory = factory
|
||||||
|
break
|
||||||
|
|
||||||
|
return protocol_factory(transport, protocol_listener=self)
|
||||||
|
|
||||||
|
def _getSubclassAttributes(self, origin, attribute, converter=lambda o, v: v, validator=lambda x: True):
|
||||||
|
result = []
|
||||||
|
|
||||||
|
if hasattr(origin, attribute):
|
||||||
|
value = getattr(origin, attribute)
|
||||||
|
if validator(value):
|
||||||
|
converted = list(converter(origin, value))
|
||||||
|
converted.append(origin)
|
||||||
|
result.append(converted)
|
||||||
|
|
||||||
|
subclasses = origin.__subclasses__()
|
||||||
|
if subclasses:
|
||||||
|
for s in subclasses:
|
||||||
|
result.extend(self._getSubclassAttributes(s, attribute, converter, validator))
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
#~~ callback handling
|
#~~ callback handling
|
||||||
|
|
||||||
@@ -150,6 +206,129 @@ class Printer():
|
|||||||
try: callback.sendFeedbackCommandOutput(name, output)
|
try: callback.sendFeedbackCommandOutput(name, output)
|
||||||
except: self._logger.exception("Exception while pushing feedback command output")
|
except: self._logger.exception("Exception while pushing feedback command output")
|
||||||
|
|
||||||
|
#~~ callbacks from protocol
|
||||||
|
|
||||||
|
def onStateChange(self, source, oldState, newState):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
# forward relevant state changes to gcode manager
|
||||||
|
if oldState == ProtocolState.PRINTING:
|
||||||
|
self._analysisQueue.resume() # printing done, put those cpu cycles to good use
|
||||||
|
if self._selectedFile is not None and newState == ProtocolState.OFFLINE or newState == ProtocolState.ERROR:
|
||||||
|
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._protocol.get_print_time(), False)
|
||||||
|
elif newState == ProtocolState.PRINTING:
|
||||||
|
self._analysisQueue.pause() # do not analyse files while printing
|
||||||
|
|
||||||
|
self._setState(newState)
|
||||||
|
|
||||||
|
def onTemperatureUpdate(self, source, temperatureData):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._addTemperatureData(temperatureData)
|
||||||
|
|
||||||
|
def onProgress(self, source, progress):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._setProgressData(progress["completion"], progress["filepos"], progress["printTime"])
|
||||||
|
|
||||||
|
def onZChange(self, source, oldZ, newZ):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
if newZ != oldZ:
|
||||||
|
# we have to react to all z-changes, even those that might "go backward" due to a slicer's retraction or
|
||||||
|
# anti-backlash-routines. Event subscribes should individually take care to filter out "wrong" z-changes
|
||||||
|
eventManager().fire(Events.Z_CHANGE, {"new": newZ, "old": oldZ})
|
||||||
|
|
||||||
|
self._setCurrentZ(newZ)
|
||||||
|
|
||||||
|
def onFileSelected(self, source, filename, filesize, origin):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._setJobData(filename, filesize, origin)
|
||||||
|
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
||||||
|
|
||||||
|
if self._printAfterSelect:
|
||||||
|
self.startPrint()
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onPrintjobDone(self, source):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._setProgressData(100.0, self._selectedFile["filesize"], self._protocol.get_print_time())
|
||||||
|
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
||||||
|
|
||||||
|
if self._selectedFile is not None:
|
||||||
|
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._protocol.get_print_time(), True, self._printerProfileManager.get_current_or_default()["id"])
|
||||||
|
|
||||||
|
def onPrintjobCancelled(self, source):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self._selectedFile is not None:
|
||||||
|
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._protocol.get_print_time(), False, self._printerProfileManager.get_current_or_default()["id"])
|
||||||
|
|
||||||
|
def onFileTransferStarted(self, source, filename, filesize):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._sdStreaming = True
|
||||||
|
|
||||||
|
self._setJobData(filename, filesize, FileDestinations.SDCARD)
|
||||||
|
self._setProgressData(0.0, 0, 0)
|
||||||
|
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
||||||
|
|
||||||
|
def onFileTransferDone(self, source):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._sdStreaming = False
|
||||||
|
|
||||||
|
if self._streamingFinishedCallback is not None:
|
||||||
|
self._streamingFinishedCallback(self._sdRemoteName, FileDestinations.SDCARD)
|
||||||
|
|
||||||
|
self._sdRemoteName = None
|
||||||
|
self._setCurrentZ(None)
|
||||||
|
self._setJobData(None, None, None)
|
||||||
|
self._setProgressData(None, None, None)
|
||||||
|
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
||||||
|
|
||||||
|
def onSdStateChange(self, source, sdAvailable):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
||||||
|
|
||||||
|
def onSdFiles(self, source, files):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
eventManager().fire(Events.UPDATED_FILES, {"type": "gcode"})
|
||||||
|
self._sdFilelistAvailable.set()
|
||||||
|
|
||||||
|
def onLogTx(self, source, tx):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._addLog("Send: %s" % tx)
|
||||||
|
|
||||||
|
def onLogRx(self, source, rx):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._addLog("Recv: %s" % rx)
|
||||||
|
|
||||||
|
def onLogError(self, source, error):
|
||||||
|
if not source == self._protocol:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._addLog("ERROR: %s" % error)
|
||||||
|
|
||||||
#~~ callback from metadata analysis event
|
#~~ callback from metadata analysis event
|
||||||
|
|
||||||
def onMetadataAnalysisFinished(self, event, data):
|
def onMetadataAnalysisFinished(self, event, data):
|
||||||
@@ -158,119 +337,126 @@ class Printer():
|
|||||||
self._selectedFile["filesize"],
|
self._selectedFile["filesize"],
|
||||||
self._selectedFile["sd"])
|
self._selectedFile["sd"])
|
||||||
|
|
||||||
|
def onMetadataStatisticsUpdated(self, event, data):
|
||||||
|
self._setJobData(self._selectedFile["filename"],
|
||||||
|
self._selectedFile["filesize"],
|
||||||
|
self._selectedFile["sd"])
|
||||||
|
|
||||||
|
#~~ progress plugin reporting
|
||||||
|
|
||||||
|
def _reportPrintProgressToPlugins(self, progress):
|
||||||
|
if not progress or not self._selectedFile or not "sd" in self._selectedFile or not "filename" in self._selectedFile:
|
||||||
|
return
|
||||||
|
|
||||||
|
storage = "sdcard" if self._selectedFile["sd"] else "local"
|
||||||
|
filename = self._selectedFile["filename"]
|
||||||
|
|
||||||
|
def call_plugins(storage, filename, progress):
|
||||||
|
for name, plugin in self._progressPlugins.items():
|
||||||
|
try:
|
||||||
|
plugin.on_print_progress(storage, filename, progress)
|
||||||
|
except:
|
||||||
|
self._logger.exception("Exception while sending print progress to plugin %s" % name)
|
||||||
|
|
||||||
|
thread = threading.Thread(target=call_plugins, args=(storage, filename, progress))
|
||||||
|
thread.daemon = False
|
||||||
|
thread.start()
|
||||||
|
|
||||||
#~~ printer commands
|
#~~ printer commands
|
||||||
|
|
||||||
def connect(self, port=None, baudrate=None, profile=None):
|
def connect(self, protocol_option_overrides=None, transport_option_overrides=None, profile=None):
|
||||||
"""
|
"""
|
||||||
Connects to the printer. If port and/or baudrate is provided, uses these settings, otherwise autodetection
|
Connects to the printer. If port and/or baudrate is provided, uses these settings, otherwise autodetection
|
||||||
will be attempted.
|
will be attempted.
|
||||||
"""
|
"""
|
||||||
if self._comm is not None:
|
self._protocol.disconnect()
|
||||||
self._comm.close()
|
|
||||||
self._comm = comm.MachineCom(port, baudrate, callbackObject=self)
|
protocol_options = settings().get(["communication", "protocolOptions"], merged=True)
|
||||||
|
if protocol_option_overrides is not None and isinstance(protocol_option_overrides, dict):
|
||||||
|
protocol_options = util.dict_merge(protocol_options, protocol_option_overrides)
|
||||||
|
|
||||||
|
transport_options = settings().get(["communication", "transportOptions"], merged=True)
|
||||||
|
if transport_option_overrides is not None and isinstance(transport_option_overrides, dict):
|
||||||
|
transport_options = util.dict_merge(transport_options, transport_option_overrides)
|
||||||
|
|
||||||
|
self._protocol.connect(protocol_options, transport_options)
|
||||||
self._printerProfileManager.select(profile)
|
self._printerProfileManager.select(profile)
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
"""
|
"""
|
||||||
Closes the connection to the printer.
|
Closes the connection to the printer.
|
||||||
"""
|
"""
|
||||||
if self._comm is not None:
|
self._protocol.disconnect()
|
||||||
self._comm.close()
|
|
||||||
self._comm = None
|
|
||||||
self._printerProfileManager.deselect()
|
self._printerProfileManager.deselect()
|
||||||
eventManager().fire(Events.DISCONNECTED)
|
eventManager().fire(Events.DISCONNECTED)
|
||||||
|
|
||||||
|
def getConnectionOptions(self):
|
||||||
|
connection_options = self._protocol.get_connection_options()
|
||||||
|
|
||||||
|
return {
|
||||||
|
"ports": connection_options["port"],
|
||||||
|
"baudrates": connection_options["baudrate"],
|
||||||
|
"portPreference": settings().get(["serial", "port"]),
|
||||||
|
"baudratePreference": settings().getInt(["serial", "baudrate"]),
|
||||||
|
"autoconnect": settings().getBoolean(["serial", "autoconnect"])
|
||||||
|
}
|
||||||
|
|
||||||
def command(self, command):
|
def command(self, command):
|
||||||
"""
|
self._protocol.send_manually(command)
|
||||||
Sends a single gcode command to the printer.
|
|
||||||
"""
|
|
||||||
self.commands([command])
|
|
||||||
|
|
||||||
def commands(self, commands):
|
def commands(self, commands):
|
||||||
"""
|
self.command(commands)
|
||||||
Sends multiple gcode commands (provided as a list) to the printer.
|
|
||||||
"""
|
|
||||||
if self._comm is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
for command in commands:
|
|
||||||
self._comm.sendCommand(command)
|
|
||||||
|
|
||||||
def jog(self, axis, amount):
|
def jog(self, axis, amount):
|
||||||
|
if not axis or not amount:
|
||||||
|
return
|
||||||
|
|
||||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
printer_profile = self._printerProfileManager.get_current_or_default()
|
||||||
movement_speed = printer_profile["axes"][axis]["speed"]
|
axis = axis.lower()
|
||||||
self.commands(["G91", "G1 %s%.4f F%d" % (axis.upper(), amount, movement_speed), "G90"])
|
if axis in printer_profile["axes"]:
|
||||||
|
speed = printer_profile["axes"][axis]["speed"]
|
||||||
|
self._protocol.jog(axis, amount, speed)
|
||||||
|
|
||||||
def home(self, axes):
|
def home(self, axes):
|
||||||
self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), axes)), "G90"])
|
self._protocol.home(axes)
|
||||||
|
|
||||||
def extrude(self, amount):
|
def extrude(self, amount):
|
||||||
|
if not amount:
|
||||||
|
return
|
||||||
|
|
||||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
printer_profile = self._printerProfileManager.get_current_or_default()
|
||||||
extrusion_speed = printer_profile["axes"]["e"]["speed"]
|
if "e" in printer_profile["axes"]:
|
||||||
self.commands(["G91", "G1 E%s F%d" % (amount, extrusion_speed), "G90"])
|
speed = printer_profile["axes"]["e"]["speed"]
|
||||||
|
self._protocol.extrude(amount, speed)
|
||||||
|
|
||||||
def changeTool(self, tool):
|
def changeTool(self, tool):
|
||||||
try:
|
self._protocol.change_tool(tool)
|
||||||
toolNum = int(tool[len("tool"):])
|
|
||||||
self.command("T%d" % toolNum)
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def setTemperature(self, type, value):
|
def setTemperature(self, type, value):
|
||||||
if type.startswith("tool"):
|
self._protocol.set_temperature(type, value)
|
||||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
|
||||||
extruder_count = printer_profile["extruder"]["count"]
|
|
||||||
if extruder_count > 1:
|
|
||||||
try:
|
|
||||||
toolNum = int(type[len("tool"):])
|
|
||||||
self.command("M104 T%d S%f" % (toolNum, value))
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.command("M104 S%f" % value)
|
|
||||||
elif type == "bed":
|
|
||||||
self.command("M140 S%f" % value)
|
|
||||||
|
|
||||||
def setTemperatureOffset(self, offsets={}):
|
def setTemperatureOffset(self, offsets):
|
||||||
if self._comm is None:
|
current_offsets = self._protocol.get_temperature_offsets()
|
||||||
return
|
|
||||||
|
|
||||||
tool, bed = self._comm.getOffsets()
|
new_offsets = {}
|
||||||
|
new_offsets.update(current_offsets)
|
||||||
validatedOffsets = {}
|
|
||||||
|
|
||||||
for key in offsets:
|
for key in offsets:
|
||||||
value = offsets[key]
|
if key == "bed" or re.match("tool\d+", key):
|
||||||
if key == "bed":
|
new_offsets[key] = offsets[key]
|
||||||
bed = value
|
|
||||||
validatedOffsets[key] = value
|
|
||||||
elif key.startswith("tool"):
|
|
||||||
try:
|
|
||||||
toolNum = int(key[len("tool"):])
|
|
||||||
tool[toolNum] = value
|
|
||||||
validatedOffsets[key] = value
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
self._comm.setTemperatureOffset(tool, bed)
|
self._protocol.set_temperature_offsets(new_offsets)
|
||||||
self._stateMonitor.setTempOffsets(validatedOffsets)
|
self._stateMonitor.setTempOffsets(new_offsets)
|
||||||
|
|
||||||
def selectFile(self, filename, sd, printAfterSelect=False):
|
|
||||||
if self._comm is None or (self._comm.isBusy() or self._comm.isStreaming()):
|
|
||||||
self._logger.info("Cannot load file: printer not connected or currently busy")
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def selectFile(self, filename, origin, printAfterSelect=False):
|
||||||
self._printAfterSelect = printAfterSelect
|
self._printAfterSelect = printAfterSelect
|
||||||
self._comm.selectFile(filename, sd)
|
self._protocol.select_file(filename, origin)
|
||||||
self._setProgressData(0, None, None, None)
|
self._setProgressData(0, None, None)
|
||||||
self._setCurrentZ(None)
|
self._setCurrentZ(None)
|
||||||
|
|
||||||
def unselectFile(self):
|
def unselectFile(self):
|
||||||
if self._comm is not None and (self._comm.isBusy() or self._comm.isStreaming()):
|
self._protocol.deselect_file()
|
||||||
return
|
self._setProgressData(0, None, None)
|
||||||
|
|
||||||
self._comm.unselectFile()
|
|
||||||
self._setProgressData(0, None, None, None)
|
|
||||||
self._setCurrentZ(None)
|
self._setCurrentZ(None)
|
||||||
|
|
||||||
def startPrint(self):
|
def startPrint(self):
|
||||||
@@ -278,31 +464,27 @@ class Printer():
|
|||||||
Starts the currently loaded print job.
|
Starts the currently loaded print job.
|
||||||
Only starts if the printer is connected and operational, not currently printing and a printjob is loaded
|
Only starts if the printer is connected and operational, not currently printing and a printjob is loaded
|
||||||
"""
|
"""
|
||||||
if self._comm is None or not self._comm.isOperational() or self._comm.isPrinting():
|
if not self._protocol.is_operational() or self._protocol.is_busy():
|
||||||
return
|
return
|
||||||
if self._selectedFile is None:
|
if self._selectedFile is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self._timeEstimationData = TimeEstimationHelper()
|
||||||
|
self._lastProgressReport = None
|
||||||
self._setCurrentZ(None)
|
self._setCurrentZ(None)
|
||||||
self._comm.startPrint()
|
self._protocol.start_print()
|
||||||
|
|
||||||
def togglePausePrint(self):
|
def togglePausePrint(self):
|
||||||
"""
|
"""
|
||||||
Pause the current printjob.
|
Pause the current printjob.
|
||||||
"""
|
"""
|
||||||
if self._comm is None:
|
self._protocol.pause_print()
|
||||||
return
|
|
||||||
|
|
||||||
self._comm.setPause(not self._comm.isPaused())
|
|
||||||
|
|
||||||
def cancelPrint(self, disableMotorsAndHeater=True):
|
def cancelPrint(self, disableMotorsAndHeater=True):
|
||||||
"""
|
"""
|
||||||
Cancel the current printjob.
|
Cancel the current printjob.
|
||||||
"""
|
"""
|
||||||
if self._comm is None:
|
self._protocol.cancel_print()
|
||||||
return
|
|
||||||
|
|
||||||
self._comm.cancelPrint()
|
|
||||||
|
|
||||||
if disableMotorsAndHeater:
|
if disableMotorsAndHeater:
|
||||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
printer_profile = self._printerProfileManager.get_current_or_default()
|
||||||
@@ -316,11 +498,11 @@ class Printer():
|
|||||||
|
|
||||||
# reset progress, height, print time
|
# reset progress, height, print time
|
||||||
self._setCurrentZ(None)
|
self._setCurrentZ(None)
|
||||||
self._setProgressData(None, None, None, None)
|
self._setProgressData(None, None, None)
|
||||||
|
|
||||||
# mark print as failure
|
# mark print as failure
|
||||||
if self._selectedFile is not None:
|
if self._selectedFile is not None:
|
||||||
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), False)
|
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._protocol.get_print_time(), False, self._printerProfileManager.get_current_or_default()["id"])
|
||||||
payload = {
|
payload = {
|
||||||
"file": self._selectedFile["filename"],
|
"file": self._selectedFile["filename"],
|
||||||
"origin": FileDestinations.LOCAL
|
"origin": FileDestinations.LOCAL
|
||||||
@@ -347,48 +529,88 @@ class Printer():
|
|||||||
self._messages.append(message)
|
self._messages.append(message)
|
||||||
self._stateMonitor.addMessage(message)
|
self._stateMonitor.addMessage(message)
|
||||||
|
|
||||||
def _setProgressData(self, progress, filepos, printTime, printTimeLeft):
|
def _estimateTotalPrintTime(self, progress, printTime):
|
||||||
|
if not progress or not printTime:
|
||||||
|
#self._estimationLogger.info("{progress};{printTime};;;;".format(**locals()))
|
||||||
|
return None
|
||||||
|
|
||||||
|
else:
|
||||||
|
newEstimate = printTime * 100 / progress
|
||||||
|
self._timeEstimationData.update(newEstimate)
|
||||||
|
|
||||||
|
result = None
|
||||||
|
if self._timeEstimationData.is_stable():
|
||||||
|
result = self._timeEstimationData.average_total_rolling
|
||||||
|
|
||||||
|
#averageTotal = self._timeEstimationData.average_total
|
||||||
|
#averageTotalRolling = self._timeEstimationData.average_total_rolling
|
||||||
|
#averageDistance = self._timeEstimationData.average_distance
|
||||||
|
|
||||||
|
#self._estimationLogger.info("{progress};{printTime};{newEstimate};{averageTotal};{averageTotalRolling};{averageDistance}".format(**locals()))
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def _setProgressData(self, progress, filepos, printTime):
|
||||||
|
estimatedTotalPrintTime = self._estimateTotalPrintTime(progress, printTime)
|
||||||
|
statisticalTotalPrintTime = None
|
||||||
|
totalPrintTime = estimatedTotalPrintTime
|
||||||
|
|
||||||
|
if self._selectedFile and "estimatedPrintTime" in self._selectedFile and self._selectedFile["estimatedPrintTime"]:
|
||||||
|
statisticalTotalPrintTime = self._selectedFile["estimatedPrintTime"]
|
||||||
|
if progress and printTime:
|
||||||
|
if estimatedTotalPrintTime is None:
|
||||||
|
totalPrintTime = statisticalTotalPrintTime
|
||||||
|
else:
|
||||||
|
if progress < 50:
|
||||||
|
sub_progress = progress * 2 / 100
|
||||||
|
else:
|
||||||
|
sub_progress = 1.0
|
||||||
|
totalPrintTime = (1 - sub_progress) * statisticalTotalPrintTime + sub_progress * estimatedTotalPrintTime
|
||||||
|
|
||||||
|
#self._printTimeLogger.info("{progress};{printTime};{estimatedTotalPrintTime};{statisticalTotalPrintTime};{totalPrintTime}".format(**locals()))
|
||||||
|
|
||||||
self._progress = progress
|
self._progress = progress
|
||||||
self._printTime = printTime
|
self._printTime = printTime
|
||||||
self._printTimeLeft = printTimeLeft
|
self._printTimeLeft = totalPrintTime - printTime if (totalPrintTime is not None and printTime is not None) else None
|
||||||
|
|
||||||
self._stateMonitor.setProgress({
|
self._stateMonitor.setProgress({
|
||||||
"completion": self._progress * 100 if self._progress is not None else None,
|
"completion": self._progress,
|
||||||
"filepos": filepos,
|
"filepos": filepos,
|
||||||
"printTime": int(self._printTime) if self._printTime is not None else None,
|
"printTime": int(self._printTime) if self._printTime is not None else None,
|
||||||
"printTimeLeft": int(self._printTimeLeft * 60) if self._printTimeLeft is not None else None
|
"printTimeLeft": int(self._printTimeLeft) if self._printTimeLeft is not None else None
|
||||||
})
|
})
|
||||||
|
|
||||||
def _addTemperatureData(self, temp, bedTemp):
|
if progress:
|
||||||
|
progress_int = int(progress)
|
||||||
|
if self._lastProgressReport != progress_int:
|
||||||
|
self._lastProgressReport = progress_int
|
||||||
|
self._reportPrintProgressToPlugins(progress_int)
|
||||||
|
|
||||||
|
|
||||||
|
def _addTemperatureData(self, temperatureData):
|
||||||
currentTimeUtc = int(time.time())
|
currentTimeUtc = int(time.time())
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"time": currentTimeUtc
|
"time": currentTimeUtc
|
||||||
}
|
}
|
||||||
for tool in temp.keys():
|
for tool in temperatureData.keys():
|
||||||
data["tool%d" % tool] = {
|
data[tool] = {
|
||||||
"actual": temp[tool][0],
|
"actual": temperatureData[tool][0],
|
||||||
"target": temp[tool][1]
|
"target": temperatureData[tool][1]
|
||||||
}
|
|
||||||
if bedTemp is not None and isinstance(bedTemp, tuple):
|
|
||||||
data["bed"] = {
|
|
||||||
"actual": bedTemp[0],
|
|
||||||
"target": bedTemp[1]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self._temps.append(data)
|
self._temps.append(data)
|
||||||
|
|
||||||
self._temp = temp
|
|
||||||
self._bedTemp = bedTemp
|
|
||||||
|
|
||||||
self._stateMonitor.addTemperature(data)
|
self._stateMonitor.addTemperature(data)
|
||||||
|
|
||||||
def _setJobData(self, filename, filesize, sd):
|
def _setJobData(self, filename, filesize, origin):
|
||||||
|
sd = origin == FileDestinations.SDCARD
|
||||||
if filename is not None:
|
if filename is not None:
|
||||||
self._selectedFile = {
|
self._selectedFile = {
|
||||||
"filename": filename,
|
"filename": filename,
|
||||||
"filesize": filesize,
|
"filesize": filesize,
|
||||||
"sd": sd
|
"sd": sd,
|
||||||
|
"estimatedPrintTime": None
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
self._selectedFile = None
|
self._selectedFile = None
|
||||||
@@ -400,12 +622,15 @@ class Printer():
|
|||||||
"date": None
|
"date": None
|
||||||
},
|
},
|
||||||
"estimatedPrintTime": None,
|
"estimatedPrintTime": None,
|
||||||
|
"averagePrintTime": None,
|
||||||
|
"lastPrintTime": None,
|
||||||
"filament": None,
|
"filament": None,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|
||||||
estimatedPrintTime = None
|
estimatedPrintTime = None
|
||||||
lastPrintTime = None
|
lastPrintTime = None
|
||||||
|
averagePrintTime = None
|
||||||
date = None
|
date = None
|
||||||
filament = None
|
filament = None
|
||||||
if filename:
|
if filename:
|
||||||
@@ -424,17 +649,28 @@ class Printer():
|
|||||||
estimatedPrintTime = fileData["analysis"]["estimatedPrintTime"]
|
estimatedPrintTime = fileData["analysis"]["estimatedPrintTime"]
|
||||||
if "filament" in fileData["analysis"].keys():
|
if "filament" in fileData["analysis"].keys():
|
||||||
filament = fileData["analysis"]["filament"]
|
filament = fileData["analysis"]["filament"]
|
||||||
if "prints" in fileData and fileData["prints"] and "last" in fileData["prints"] and fileData["prints"]["last"] and "lastPrintTime" in fileData["prints"]["last"]:
|
if "statistics" in fileData:
|
||||||
lastPrintTime = fileData["prints"]["last"]["lastPrintTime"]
|
printer_profile = self._printerProfileManager.get_current_or_default()["id"]
|
||||||
|
if "averagePrintTime" in fileData["statistics"] and printer_profile in fileData["statistics"]["averagePrintTime"]:
|
||||||
|
averagePrintTime = fileData["statistics"]["averagePrintTime"][printer_profile]
|
||||||
|
if "lastPrintTime" in fileData["statistics"] and printer_profile in fileData["statistics"]["lastPrintTime"]:
|
||||||
|
lastPrintTime = fileData["statistics"]["lastPrintTime"][printer_profile]
|
||||||
|
|
||||||
|
if averagePrintTime is not None:
|
||||||
|
self._selectedFile["estimatedPrintTime"] = averagePrintTime
|
||||||
|
elif estimatedPrintTime is not None:
|
||||||
|
# TODO apply factor which first needs to be tracked!
|
||||||
|
self._selectedFile["estimatedPrintTime"] = estimatedPrintTime
|
||||||
|
|
||||||
self._stateMonitor.setJobData({
|
self._stateMonitor.setJobData({
|
||||||
"file": {
|
"file": {
|
||||||
"name": os.path.basename(filename) if filename is not None else None,
|
"name": os.path.basename(filename) if filename is not None else None,
|
||||||
"origin": FileDestinations.SDCARD if sd else FileDestinations.LOCAL,
|
"origin": origin,
|
||||||
"size": filesize,
|
"size": filesize,
|
||||||
"date": date
|
"date": date
|
||||||
},
|
},
|
||||||
"estimatedPrintTime": estimatedPrintTime,
|
"estimatedPrintTime": estimatedPrintTime,
|
||||||
|
"averagePrintTime": averagePrintTime,
|
||||||
"lastPrintTime": lastPrintTime,
|
"lastPrintTime": lastPrintTime,
|
||||||
"filament": filament,
|
"filament": filament,
|
||||||
})
|
})
|
||||||
@@ -466,149 +702,57 @@ class Printer():
|
|||||||
|
|
||||||
#~~ callbacks triggered from self._comm
|
#~~ callbacks triggered from self._comm
|
||||||
|
|
||||||
def mcLog(self, message):
|
|
||||||
"""
|
|
||||||
Callback method for the comm object, called upon log output.
|
|
||||||
"""
|
|
||||||
self._addLog(message)
|
|
||||||
|
|
||||||
def mcTempUpdate(self, temp, bedTemp):
|
|
||||||
self._addTemperatureData(temp, bedTemp)
|
|
||||||
|
|
||||||
def mcStateChange(self, state):
|
|
||||||
"""
|
|
||||||
Callback method for the comm object, called if the connection state changes.
|
|
||||||
"""
|
|
||||||
oldState = self._state
|
|
||||||
|
|
||||||
# forward relevant state changes to gcode manager
|
|
||||||
if self._comm is not None and oldState == self._comm.STATE_PRINTING:
|
|
||||||
if self._selectedFile is not None:
|
|
||||||
if state == self._comm.STATE_OPERATIONAL:
|
|
||||||
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), True)
|
|
||||||
elif state == self._comm.STATE_CLOSED or state == self._comm.STATE_ERROR or state == self._comm.STATE_CLOSED_WITH_ERROR:
|
|
||||||
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), False)
|
|
||||||
self._analysisQueue.resume() # printing done, put those cpu cycles to good use
|
|
||||||
elif self._comm is not None and state == self._comm.STATE_PRINTING:
|
|
||||||
self._analysisQueue.pause() # do not analyse files while printing
|
|
||||||
|
|
||||||
self._setState(state)
|
|
||||||
|
|
||||||
def mcMessage(self, message):
|
|
||||||
"""
|
|
||||||
Callback method for the comm object, called upon message exchanges via serial.
|
|
||||||
Stores the message in the message buffer, truncates buffer to the last 300 lines.
|
|
||||||
"""
|
|
||||||
self._addMessage(message)
|
|
||||||
|
|
||||||
def mcProgress(self):
|
|
||||||
"""
|
|
||||||
Callback method for the comm object, called upon any change in progress of the printjob.
|
|
||||||
Triggers storage of new values for printTime, printTimeLeft and the current progress.
|
|
||||||
"""
|
|
||||||
|
|
||||||
self._setProgressData(self._comm.getPrintProgress(), self._comm.getPrintFilepos(), self._comm.getPrintTime(), self._comm.getPrintTimeRemainingEstimate())
|
|
||||||
|
|
||||||
def mcZChange(self, newZ):
|
|
||||||
"""
|
|
||||||
Callback method for the comm object, called upon change of the z-layer.
|
|
||||||
"""
|
|
||||||
oldZ = self._currentZ
|
|
||||||
if newZ != oldZ:
|
|
||||||
# we have to react to all z-changes, even those that might "go backward" due to a slicer's retraction or
|
|
||||||
# anti-backlash-routines. Event subscribes should individually take care to filter out "wrong" z-changes
|
|
||||||
eventManager().fire(Events.Z_CHANGE, {"new": newZ, "old": oldZ})
|
|
||||||
|
|
||||||
self._setCurrentZ(newZ)
|
|
||||||
|
|
||||||
def mcSdStateChange(self, sdReady):
|
|
||||||
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
|
||||||
|
|
||||||
def mcSdFiles(self, files):
|
|
||||||
eventManager().fire(Events.UPDATED_FILES, {"type": "gcode"})
|
|
||||||
self._sdFilelistAvailable.set()
|
|
||||||
|
|
||||||
def mcFileSelected(self, filename, filesize, sd):
|
|
||||||
self._setJobData(filename, filesize, sd)
|
|
||||||
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
|
||||||
|
|
||||||
if self._printAfterSelect:
|
|
||||||
self.startPrint()
|
|
||||||
|
|
||||||
def mcPrintjobDone(self):
|
|
||||||
self._setProgressData(1.0, self._selectedFile["filesize"], self._comm.getPrintTime(), 0)
|
|
||||||
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
|
||||||
|
|
||||||
def mcFileTransferStarted(self, filename, filesize):
|
|
||||||
self._sdStreaming = True
|
|
||||||
|
|
||||||
self._setJobData(filename, filesize, True)
|
|
||||||
self._setProgressData(0.0, 0, 0, None)
|
|
||||||
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
|
||||||
|
|
||||||
def mcFileTransferDone(self, filename):
|
|
||||||
self._sdStreaming = False
|
|
||||||
|
|
||||||
if self._streamingFinishedCallback is not None:
|
|
||||||
# in case of SD files, both filename and absolutePath are the same, so we set the (remote) filename for
|
|
||||||
# both parameters
|
|
||||||
self._streamingFinishedCallback(filename, filename, FileDestinations.SDCARD)
|
|
||||||
|
|
||||||
self._setCurrentZ(None)
|
|
||||||
self._setJobData(None, None, None)
|
|
||||||
self._setProgressData(None, None, None, None)
|
|
||||||
self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
|
|
||||||
|
|
||||||
def mcReceivedRegisteredMessage(self, command, output):
|
def mcReceivedRegisteredMessage(self, command, output):
|
||||||
self._sendFeedbackCommandOutput(command, output)
|
self._sendFeedbackCommandOutput(command, output)
|
||||||
|
|
||||||
|
def mcForceDisconnect(self):
|
||||||
|
self.disconnect()
|
||||||
|
|
||||||
#~~ sd file handling
|
#~~ sd file handling
|
||||||
|
|
||||||
def getSdFiles(self):
|
def getSdFiles(self):
|
||||||
if self._comm is None or not self._comm.isSdReady():
|
if not self._protocol.is_sd_ready():
|
||||||
return []
|
return []
|
||||||
return self._comm.getSdFiles()
|
return self._protocol.get_sd_files()
|
||||||
|
|
||||||
def addSdFile(self, filename, absolutePath, streamingFinishedCallback):
|
def addSdFile(self, filename, absolutePath, streamingFinishedCallback):
|
||||||
if not self._comm or self._comm.isBusy() or not self._comm.isSdReady():
|
if self._protocol.is_busy() or not self._protocol.is_sd_ready():
|
||||||
self._logger.error("No connection to printer or printer is busy")
|
logging.error("No connection to printer or printer is busy")
|
||||||
return
|
return
|
||||||
|
|
||||||
self._streamingFinishedCallback = streamingFinishedCallback
|
self._streamingFinishedCallback = streamingFinishedCallback
|
||||||
|
|
||||||
self.refreshSdFiles(blocking=True)
|
self.refreshSdFiles(blocking=True)
|
||||||
existingSdFiles = map(lambda x: x[0], self._comm.getSdFiles())
|
existingSdFiles = map(lambda x: x[0], self._protocol.get_sd_files())
|
||||||
|
|
||||||
remoteName = util.getDosFilename(filename, existingSdFiles)
|
self._sdRemoteName = util.getDosFilename(filename, existingSdFiles)
|
||||||
self._comm.startFileTransfer(absolutePath, filename, remoteName)
|
self._protocol.add_sd_file(absolutePath, filename, self._sdRemoteName)
|
||||||
|
|
||||||
return remoteName
|
return self._sdRemoteName
|
||||||
|
|
||||||
def deleteSdFile(self, filename):
|
def deleteSdFile(self, filename):
|
||||||
if not self._comm or not self._comm.isSdReady():
|
if not self._protocol.is_sd_ready():
|
||||||
return
|
return
|
||||||
self._comm.deleteSdFile(filename)
|
self._protocol.remove_sd_file(filename)
|
||||||
|
|
||||||
def initSdCard(self):
|
def initSdCard(self):
|
||||||
if not self._comm or self._comm.isSdReady():
|
self._protocol.init_sd()
|
||||||
return
|
|
||||||
self._comm.initSdCard()
|
|
||||||
|
|
||||||
def releaseSdCard(self):
|
def releaseSdCard(self):
|
||||||
if not self._comm or not self._comm.isSdReady():
|
if not self._protocol.is_sd_ready() or self._protocol.is_busy():
|
||||||
return
|
return
|
||||||
self._comm.releaseSdCard()
|
self._protocol.release_sd()
|
||||||
|
|
||||||
def refreshSdFiles(self, blocking=False):
|
def refreshSdFiles(self, blocking=False):
|
||||||
"""
|
"""
|
||||||
Refreshs the list of file stored on the SD card attached to printer (if available and printer communication
|
Refreshs the list of file stored on the SD card attached to printer (if available and printer communication
|
||||||
available). Optional blocking parameter allows making the method block (max 10s) until the file list has been
|
available). Optional blocking parameter allows making the method block (max 10s) until the file list has been
|
||||||
received (and can be accessed via self._comm.getSdFiles()). Defaults to a asynchronous operation.
|
received (and can be accessed via self._protocol.get_sd_files()). Defaults to a asynchronous operation.
|
||||||
"""
|
"""
|
||||||
if not self._comm or not self._comm.isSdReady():
|
if not self._protocol.is_sd_ready():
|
||||||
return
|
return
|
||||||
self._sdFilelistAvailable.clear()
|
self._sdFilelistAvailable.clear()
|
||||||
self._comm.refreshSdFiles()
|
self._protocol.refresh_sd_files()
|
||||||
if blocking:
|
if blocking:
|
||||||
self._sdFilelistAvailable.wait(10000)
|
self._sdFilelistAvailable.wait(10000)
|
||||||
|
|
||||||
@@ -618,10 +762,7 @@ class Printer():
|
|||||||
"""
|
"""
|
||||||
Returns a human readable string corresponding to the current communication state.
|
Returns a human readable string corresponding to the current communication state.
|
||||||
"""
|
"""
|
||||||
if self._comm is None:
|
return self._state
|
||||||
return "Offline"
|
|
||||||
else:
|
|
||||||
return self._comm.getStateString()
|
|
||||||
|
|
||||||
def getCurrentData(self):
|
def getCurrentData(self):
|
||||||
return self._stateMonitor.getCurrentData()
|
return self._stateMonitor.getCurrentData()
|
||||||
@@ -631,26 +772,13 @@ class Printer():
|
|||||||
return currentData["job"]
|
return currentData["job"]
|
||||||
|
|
||||||
def getCurrentTemperatures(self):
|
def getCurrentTemperatures(self):
|
||||||
if self._comm is not None:
|
temperatures = self._protocol.get_current_temperatures()
|
||||||
tempOffset, bedTempOffset = self._comm.getOffsets()
|
offsets = self._protocol.get_temperature_offsets()
|
||||||
else:
|
|
||||||
tempOffset = {}
|
|
||||||
bedTempOffset = None
|
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
if self._temp is not None:
|
result.update(temperatures)
|
||||||
for tool in self._temp.keys():
|
for key, tool in result:
|
||||||
result["tool%d" % tool] = {
|
tool["offset"] = offsets[key] if key in offsets and offsets[key] is not None else 0
|
||||||
"actual": self._temp[tool][0],
|
|
||||||
"target": self._temp[tool][1],
|
|
||||||
"offset": tempOffset[tool] if tool in tempOffset.keys() and tempOffset[tool] is not None else 0
|
|
||||||
}
|
|
||||||
if self._bedTemp is not None:
|
|
||||||
result["bed"] = {
|
|
||||||
"actual": self._bedTemp[0],
|
|
||||||
"target": self._bedTemp[1],
|
|
||||||
"offset": bedTempOffset
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -658,36 +786,34 @@ class Printer():
|
|||||||
return self._temps
|
return self._temps
|
||||||
|
|
||||||
def getCurrentConnection(self):
|
def getCurrentConnection(self):
|
||||||
if self._comm is None:
|
opt = self._protocol.get_current_connection()
|
||||||
return "Closed", None, None, None
|
if "port" in opt.keys() and "baudrate" in opt.keys():
|
||||||
|
return self._protocol.get_state(), opt["port"], opt["baudrate"], self._printerProfileManager.get_current_or_default()
|
||||||
port, baudrate = self._comm.getConnection()
|
return self._protocol.get_state(), None, None, None
|
||||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
|
||||||
return self._comm.getStateString(), port, baudrate, printer_profile
|
|
||||||
|
|
||||||
def isClosedOrError(self):
|
def isClosedOrError(self):
|
||||||
return self._comm is None or self._comm.isClosedOrError()
|
return self._protocol.get_state() == ProtocolState.OFFLINE or self._protocol == ProtocolState.ERROR
|
||||||
|
|
||||||
def isOperational(self):
|
def isOperational(self):
|
||||||
return self._comm is not None and self._comm.isOperational()
|
return not self.isClosedOrError()
|
||||||
|
|
||||||
def isPrinting(self):
|
def isPrinting(self):
|
||||||
return self._comm is not None and self._comm.isPrinting()
|
return self._protocol.get_state() == ProtocolState.PRINTING
|
||||||
|
|
||||||
def isPaused(self):
|
def isPaused(self):
|
||||||
return self._comm is not None and self._comm.isPaused()
|
return self._protocol.get_state() == ProtocolState.PAUSED
|
||||||
|
|
||||||
def isError(self):
|
def isError(self):
|
||||||
return self._comm is not None and self._comm.isError()
|
return self._protocol.get_state() == ProtocolState.ERROR
|
||||||
|
|
||||||
def isReady(self):
|
def isReady(self):
|
||||||
return self.isOperational() and not self._comm.isStreaming()
|
return self.isOperational() and not self._protocol.is_streaming()
|
||||||
|
|
||||||
def isSdReady(self):
|
def isSdReady(self):
|
||||||
if not settings().getBoolean(["feature", "sdSupport"]) or self._comm is None:
|
if not settings().getBoolean(["feature", "sdSupport"]):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return self._comm.isSdReady()
|
return self._protocol.is_sd_ready()
|
||||||
|
|
||||||
class StateMonitor(object):
|
class StateMonitor(object):
|
||||||
def __init__(self, ratelimit, updateCallback, addTemperatureCallback, addLogCallback, addMessageCallback):
|
def __init__(self, ratelimit, updateCallback, addTemperatureCallback, addLogCallback, addMessageCallback):
|
||||||
@@ -778,3 +904,60 @@ class StateMonitor(object):
|
|||||||
"offsets": self._offsets
|
"offsets": self._offsets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TimeEstimationHelper(object):
|
||||||
|
|
||||||
|
STABLE_THRESHOLD = 0.1
|
||||||
|
STABLE_COUNTDOWN = 250
|
||||||
|
STABLE_ROLLING_WINDOW = 250
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
import collections
|
||||||
|
self._distances = collections.deque([], self.__class__.STABLE_ROLLING_WINDOW)
|
||||||
|
self._totals = collections.deque([], self.__class__.STABLE_ROLLING_WINDOW)
|
||||||
|
self._sum_total = 0
|
||||||
|
self._count = 0
|
||||||
|
self._stable_counter = None
|
||||||
|
|
||||||
|
def is_stable(self):
|
||||||
|
return self._stable_counter is not None and self._stable_counter >= self.__class__.STABLE_COUNTDOWN
|
||||||
|
|
||||||
|
def update(self, newEstimate):
|
||||||
|
old_average_total = self.average_total
|
||||||
|
|
||||||
|
self._sum_total += newEstimate
|
||||||
|
self._totals.append(newEstimate)
|
||||||
|
self._count += 1
|
||||||
|
|
||||||
|
if old_average_total:
|
||||||
|
self._distances.append(abs(self.average_total - old_average_total))
|
||||||
|
|
||||||
|
if -1.0 * self.__class__.STABLE_THRESHOLD < self.average_distance < self.__class__.STABLE_THRESHOLD:
|
||||||
|
if self._stable_counter is None:
|
||||||
|
self._stable_counter = 0
|
||||||
|
else:
|
||||||
|
self._stable_counter += 1
|
||||||
|
else:
|
||||||
|
self._stable_counter = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def average_total(self):
|
||||||
|
if not self._count:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return self._sum_total / self._count
|
||||||
|
|
||||||
|
@property
|
||||||
|
def average_total_rolling(self):
|
||||||
|
if not self._count or self._count < self.__class__.STABLE_ROLLING_WINDOW:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return sum(self._totals) / len(self._totals)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def average_distance(self):
|
||||||
|
if not self._count or self._count < self.__class__.STABLE_ROLLING_WINDOW + 1:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return sum(self._distances) / len(self._distances)
|
||||||
|
|
||||||
@@ -216,6 +216,8 @@ class Server():
|
|||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
from tornado.web import Application
|
from tornado.web import Application
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
debug = self._debug
|
debug = self._debug
|
||||||
|
|
||||||
# first initialize the settings singleton and make sure it uses given configfile and basedir if available
|
# first initialize the settings singleton and make sure it uses given configfile and basedir if available
|
||||||
@@ -224,6 +226,9 @@ class Server():
|
|||||||
# then initialize logging
|
# then initialize logging
|
||||||
self._initLogging(self._debug, self._logConf)
|
self._initLogging(self._debug, self._logConf)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
def exception_logger(exc_type, exc_value, exc_tb):
|
||||||
|
logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_tb))
|
||||||
|
sys.excepthook = exception_logger
|
||||||
logger.info("Starting OctoPrint %s" % DISPLAY_VERSION)
|
logger.info("Starting OctoPrint %s" % DISPLAY_VERSION)
|
||||||
|
|
||||||
# then initialize the plugin manager
|
# then initialize the plugin manager
|
||||||
@@ -275,8 +280,10 @@ class Server():
|
|||||||
app.wsgi_app,
|
app.wsgi_app,
|
||||||
settings().get(["server", "reverseProxy", "prefixHeader"]),
|
settings().get(["server", "reverseProxy", "prefixHeader"]),
|
||||||
settings().get(["server", "reverseProxy", "schemeHeader"]),
|
settings().get(["server", "reverseProxy", "schemeHeader"]),
|
||||||
|
settings().get(["server", "reverseProxy", "hostHeader"]),
|
||||||
settings().get(["server", "reverseProxy", "prefixFallback"]),
|
settings().get(["server", "reverseProxy", "prefixFallback"]),
|
||||||
settings().get(["server", "reverseProxy", "prefixScheme"])
|
settings().get(["server", "reverseProxy", "schemeFallback"]),
|
||||||
|
settings().get(["server", "reverseProxy", "hostFallback"])
|
||||||
)
|
)
|
||||||
|
|
||||||
secret_key = settings().get(["server", "secretKey"])
|
secret_key = settings().get(["server", "secretKey"])
|
||||||
@@ -348,7 +355,7 @@ class Server():
|
|||||||
printer_profile = printerProfileManager.get_default()
|
printer_profile = printerProfileManager.get_default()
|
||||||
connectionOptions = getConnectionOptions()
|
connectionOptions = getConnectionOptions()
|
||||||
if port in connectionOptions["ports"]:
|
if port in connectionOptions["ports"]:
|
||||||
printer.connect(port=port, baudrate=baudrate, profile=printer_profile["id"] if "id" in printer_profile else "_default")
|
printer.connect(transport_option_overrides=dict(port=port, baudrate=baudrate), profile=printer_profile["id"] if "id" in printer_profile else "_default")
|
||||||
|
|
||||||
# start up watchdogs
|
# start up watchdogs
|
||||||
observer = Observer()
|
observer = Observer()
|
||||||
@@ -438,7 +445,7 @@ class Server():
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loggers": {
|
"loggers": {
|
||||||
"SERIAL": {
|
"TRANSPORT": {
|
||||||
"level": "CRITICAL",
|
"level": "CRITICAL",
|
||||||
"handlers": ["serialFile"],
|
"handlers": ["serialFile"],
|
||||||
"propagate": False
|
"propagate": False
|
||||||
@@ -470,8 +477,8 @@ class Server():
|
|||||||
|
|
||||||
if settings().getBoolean(["serial", "log"]):
|
if settings().getBoolean(["serial", "log"]):
|
||||||
# enable debug logging to serial.log
|
# enable debug logging to serial.log
|
||||||
logging.getLogger("SERIAL").setLevel(logging.DEBUG)
|
logging.getLogger("TRANSPORT").setLevel(logging.DEBUG)
|
||||||
logging.getLogger("SERIAL").debug("Enabling serial logging")
|
logging.getLogger("TRANSPORT").debug("Enabling transport logging")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
server = Server()
|
server = Server()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ def connectionState():
|
|||||||
@restricted_access
|
@restricted_access
|
||||||
def connectionCommand():
|
def connectionCommand():
|
||||||
valid_commands = {
|
valid_commands = {
|
||||||
"connect": ["autoconnect"],
|
"connect": [],
|
||||||
"disconnect": []
|
"disconnect": []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ def connectionCommand():
|
|||||||
if "autoconnect" in data.keys():
|
if "autoconnect" in data.keys():
|
||||||
settings().setBoolean(["serial", "autoconnect"], data["autoconnect"])
|
settings().setBoolean(["serial", "autoconnect"], data["autoconnect"])
|
||||||
settings().save()
|
settings().save()
|
||||||
printer.connect(port=port, baudrate=baudrate, profile=printerProfile)
|
printer.connect(transport_option_overrides=dict(port=port, baudrate=baudrate), profile=printerProfile)
|
||||||
elif command == "disconnect":
|
elif command == "disconnect":
|
||||||
printer.disconnect()
|
printer.disconnect()
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ def _getFileList(origin, filter=None):
|
|||||||
failure = 0
|
failure = 0
|
||||||
last = None
|
last = None
|
||||||
for entry in history:
|
for entry in history:
|
||||||
success += 1 if entry["success"] else 0
|
success += 1 if "success" in entry and entry["success"] else 0
|
||||||
failure += 1 if not entry["success"] else 0
|
failure += 1 if "success" in entry and not entry["success"] else 0
|
||||||
if not last or entry["timestamp"] > last["timestamp"]:
|
if not last or ("timestamp" in entry and "timestamp" in last and entry["timestamp"] > last["timestamp"]):
|
||||||
last = entry
|
last = entry
|
||||||
if last:
|
if last:
|
||||||
prints = dict(
|
prints = dict(
|
||||||
@@ -99,10 +99,11 @@ def _getFileList(origin, filter=None):
|
|||||||
failure=failure,
|
failure=failure,
|
||||||
last=dict(
|
last=dict(
|
||||||
success=last["success"],
|
success=last["success"],
|
||||||
date=last["timestamp"],
|
date=last["timestamp"]
|
||||||
printTime=last["printTime"]
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if "printTime" in last:
|
||||||
|
prints["last"]["printTime"] = last["printTime"]
|
||||||
file["prints"] = prints
|
file["prints"] = prints
|
||||||
|
|
||||||
file.update({
|
file.update({
|
||||||
@@ -287,13 +288,11 @@ def gcodeFileCommand(filename, target):
|
|||||||
return make_response("Printer is not operational, cannot directly start printing", 409)
|
return make_response("Printer is not operational, cannot directly start printing", 409)
|
||||||
printAfterLoading = True
|
printAfterLoading = True
|
||||||
|
|
||||||
sd = False
|
|
||||||
if target == FileDestinations.SDCARD:
|
if target == FileDestinations.SDCARD:
|
||||||
filenameToSelect = filename
|
filenameToSelect = filename
|
||||||
sd = True
|
|
||||||
else:
|
else:
|
||||||
filenameToSelect = fileManager.get_absolute_path(target, filename)
|
filenameToSelect = fileManager.get_absolute_path(target, filename)
|
||||||
printer.selectFile(filenameToSelect, sd, printAfterLoading)
|
printer.selectFile(filenameToSelect, target, printAfterLoading)
|
||||||
|
|
||||||
elif command == "slice":
|
elif command == "slice":
|
||||||
if "slicer" in data.keys():
|
if "slicer" in data.keys():
|
||||||
|
|||||||
@@ -300,7 +300,6 @@ def printerSdState():
|
|||||||
@api.route("/printer/command", methods=["POST"])
|
@api.route("/printer/command", methods=["POST"])
|
||||||
@restricted_access
|
@restricted_access
|
||||||
def printerCommand():
|
def printerCommand():
|
||||||
# TODO: document me
|
|
||||||
if not printer.isOperational():
|
if not printer.isOperational():
|
||||||
return make_response("Printer is not operational", 409)
|
return make_response("Printer is not operational", 409)
|
||||||
|
|
||||||
@@ -309,15 +308,17 @@ def printerCommand():
|
|||||||
|
|
||||||
data = request.json
|
data = request.json
|
||||||
|
|
||||||
parameters = {}
|
parameters = dict()
|
||||||
if "parameters" in data.keys():
|
if "parameters" in data.keys(): parameters = data["parameters"]
|
||||||
parameters = data["parameters"]
|
|
||||||
|
|
||||||
commands = []
|
if "command" in data and "commands" in data:
|
||||||
if "command" in data.keys():
|
return make_response("'command' and 'commands' are mutually exclusive", 400)
|
||||||
|
elif "command" in data:
|
||||||
commands = [data["command"]]
|
commands = [data["command"]]
|
||||||
elif "commands" in data.keys():
|
elif "commands" in data and isinstance(data["commands"], (list, tuple)):
|
||||||
commands = data["commands"]
|
commands = data["commands"]
|
||||||
|
else:
|
||||||
|
return make_response("Need either single 'command' or list of 'commands'", 400)
|
||||||
|
|
||||||
commandsToSend = []
|
commandsToSend = []
|
||||||
for command in commands:
|
for command in commands:
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ def _validate_profile(profile):
|
|||||||
converted_offsets = []
|
converted_offsets = []
|
||||||
for offset in profile["extruder"]["offsets"]:
|
for offset in profile["extruder"]["offsets"]:
|
||||||
try:
|
try:
|
||||||
converted_offsets.append((float(offset[0]), float(offset[0])))
|
converted_offsets.append((float(offset[0]), float(offset[1])))
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
profile["extruder"]["offsets"] = converted_offsets
|
profile["extruder"]["offsets"] = converted_offsets
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ def getSettings():
|
|||||||
"key": s.get(["api", "key"]) if admin_permission.can() else "n/a",
|
"key": s.get(["api", "key"]) if admin_permission.can() else "n/a",
|
||||||
"allowCrossOrigin": s.get(["api", "allowCrossOrigin"])
|
"allowCrossOrigin": s.get(["api", "allowCrossOrigin"])
|
||||||
},
|
},
|
||||||
|
"appearance": {
|
||||||
|
"name": s.get(["appearance", "name"]),
|
||||||
|
"color": s.get(["appearance", "color"])
|
||||||
|
},
|
||||||
"printer": {
|
"printer": {
|
||||||
"defaultExtrusionLength": s.getInt(["printerParameters", "defaultExtrusionLength"])
|
"defaultExtrusionLength": s.getInt(["printerParameters", "defaultExtrusionLength"])
|
||||||
},
|
},
|
||||||
@@ -120,6 +124,10 @@ def setSettings():
|
|||||||
if "key" in data["api"].keys(): s.set(["api", "key"], data["api"]["key"], True)
|
if "key" in data["api"].keys(): s.set(["api", "key"], data["api"]["key"], True)
|
||||||
if "allowCrossOrigin" in data["api"].keys(): s.setBoolean(["api", "allowCrossOrigin"], data["api"]["allowCrossOrigin"])
|
if "allowCrossOrigin" in data["api"].keys(): s.setBoolean(["api", "allowCrossOrigin"], data["api"]["allowCrossOrigin"])
|
||||||
|
|
||||||
|
if "appearance" in data.keys():
|
||||||
|
if "name" in data["appearance"].keys(): s.set(["appearance", "name"], data["appearance"]["name"])
|
||||||
|
if "color" in data["appearance"].keys(): s.set(["appearance", "color"], data["appearance"]["color"])
|
||||||
|
|
||||||
if "printer" in data.keys():
|
if "printer" in data.keys():
|
||||||
if "defaultExtrusionLength" in data["printer"]: s.setInt(["printerParameters", "defaultExtrusionLength"], data["printer"]["defaultExtrusionLength"])
|
if "defaultExtrusionLength" in data["printer"]: s.setInt(["printerParameters", "defaultExtrusionLength"], data["printer"]["defaultExtrusionLength"])
|
||||||
|
|
||||||
@@ -156,12 +164,12 @@ def setSettings():
|
|||||||
if "log" in data["serial"].keys(): s.setBoolean(["serial", "log"], data["serial"]["log"])
|
if "log" in data["serial"].keys(): s.setBoolean(["serial", "log"], data["serial"]["log"])
|
||||||
if oldLog and not s.getBoolean(["serial", "log"]):
|
if oldLog and not s.getBoolean(["serial", "log"]):
|
||||||
# disable debug logging to serial.log
|
# disable debug logging to serial.log
|
||||||
logging.getLogger("SERIAL").debug("Disabling serial logging")
|
logging.getLogger("TRANSPORT").debug("Disabling transport logging")
|
||||||
logging.getLogger("SERIAL").setLevel(logging.CRITICAL)
|
logging.getLogger("TRANSPORT").setLevel(logging.CRITICAL)
|
||||||
elif not oldLog and s.getBoolean(["serial", "log"]):
|
elif not oldLog and s.getBoolean(["serial", "log"]):
|
||||||
# enable debug logging to serial.log
|
# enable debug logging to serial.log
|
||||||
logging.getLogger("SERIAL").setLevel(logging.DEBUG)
|
logging.getLogger("TRANSPORT").setLevel(logging.DEBUG)
|
||||||
logging.getLogger("SERIAL").debug("Enabling serial logging")
|
logging.getLogger("TRANSPORT").debug("Enabling transport logging")
|
||||||
|
|
||||||
if "folder" in data.keys():
|
if "folder" in data.keys():
|
||||||
if "uploads" in data["folder"].keys(): s.setBaseFolder("uploads", data["folder"]["uploads"])
|
if "uploads" in data["folder"].keys(): s.setBaseFolder("uploads", data["folder"]["uploads"])
|
||||||
|
|||||||
@@ -147,20 +147,25 @@ class ReverseProxied(object):
|
|||||||
:param app: the WSGI application
|
:param app: the WSGI application
|
||||||
:param header_script_name: the HTTP header in the wsgi environment from which to determine the prefix
|
:param header_script_name: the HTTP header in the wsgi environment from which to determine the prefix
|
||||||
:param header_scheme: the HTTP header in the wsgi environment from which to determine the scheme
|
:param header_scheme: the HTTP header in the wsgi environment from which to determine the scheme
|
||||||
|
:param header_host: the HTTP header in the wsgi environment from which to determine the host for which to generate external URLs
|
||||||
:param base_url: the prefix to use as fallback if headers are not set
|
:param base_url: the prefix to use as fallback if headers are not set
|
||||||
|
:param scheme: the scheme to use as fallback if headers are not set
|
||||||
|
:param host: the host to use as fallback if headers are not set
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, app, header_prefix="x-script-name", header_scheme="x-scheme", base_url="", scheme=""):
|
def __init__(self, app, header_prefix="x-script-name", header_scheme="x-scheme", header_host="x-forwarded-host", base_url="", scheme="", host=""):
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
# headers for prefix & scheme, converted to conform to WSGI format
|
# headers for prefix & scheme & host, converted to conform to WSGI format
|
||||||
to_wsgi_format = lambda header: "HTTP_" + header.upper().replace("-", "_")
|
to_wsgi_format = lambda header: "HTTP_" + header.upper().replace("-", "_")
|
||||||
self._header_prefix = to_wsgi_format(header_prefix)
|
self._header_prefix = to_wsgi_format(header_prefix)
|
||||||
self._header_scheme = to_wsgi_format(header_scheme)
|
self._header_scheme = to_wsgi_format(header_scheme)
|
||||||
|
self._header_host = to_wsgi_format(header_host)
|
||||||
|
|
||||||
# fallback prefix & scheme from config
|
# fallback prefix & scheme & host from config
|
||||||
self._fallback_prefix = base_url
|
self._fallback_prefix = base_url
|
||||||
self._fallback_scheme = scheme
|
self._fallback_scheme = scheme
|
||||||
|
self._fallback_host = host
|
||||||
|
|
||||||
def __call__(self, environ, start_response):
|
def __call__(self, environ, start_response):
|
||||||
# determine prefix
|
# determine prefix
|
||||||
@@ -184,6 +189,15 @@ class ReverseProxied(object):
|
|||||||
if scheme:
|
if scheme:
|
||||||
environ["wsgi.url_scheme"] = scheme
|
environ["wsgi.url_scheme"] = scheme
|
||||||
|
|
||||||
|
# determine host
|
||||||
|
host = environ.get(self._header_host, "")
|
||||||
|
if not host:
|
||||||
|
host = self._fallback_host
|
||||||
|
|
||||||
|
# rewrite host header based on host
|
||||||
|
if host:
|
||||||
|
environ["HTTP_HOST"] = host
|
||||||
|
|
||||||
# call wrapped app with rewritten environment
|
# call wrapped app with rewritten environment
|
||||||
return self.app(environ, start_response)
|
return self.app(environ, start_response)
|
||||||
|
|
||||||
@@ -34,6 +34,8 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection):
|
|||||||
self._eventManager = eventManager
|
self._eventManager = eventManager
|
||||||
self._pluginManager = pluginManager
|
self._pluginManager = pluginManager
|
||||||
|
|
||||||
|
self._remoteAddress = None
|
||||||
|
|
||||||
def _getRemoteAddress(self, info):
|
def _getRemoteAddress(self, info):
|
||||||
forwardedFor = info.headers.get("X-Forwarded-For")
|
forwardedFor = info.headers.get("X-Forwarded-For")
|
||||||
if forwardedFor is not None:
|
if forwardedFor is not None:
|
||||||
@@ -41,8 +43,8 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection):
|
|||||||
return info.ip
|
return info.ip
|
||||||
|
|
||||||
def on_open(self, info):
|
def on_open(self, info):
|
||||||
remoteAddress = self._getRemoteAddress(info)
|
self._remoteAddress = self._getRemoteAddress(info)
|
||||||
self._logger.info("New connection from client: %s" % remoteAddress)
|
self._logger.info("New connection from client: %s" % self._remoteAddress)
|
||||||
|
|
||||||
# connected => update the API key, might be necessary if the client was left open while the server restarted
|
# connected => update the API key, might be necessary if the client was left open while the server restarted
|
||||||
self._emit("connected", {"apikey": octoprint.server.UI_API_KEY, "version": octoprint.server.VERSION, "display_version": octoprint.server.DISPLAY_VERSION})
|
self._emit("connected", {"apikey": octoprint.server.UI_API_KEY, "version": octoprint.server.VERSION, "display_version": octoprint.server.DISPLAY_VERSION})
|
||||||
@@ -52,20 +54,20 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection):
|
|||||||
octoprint.timelapse.registerCallback(self)
|
octoprint.timelapse.registerCallback(self)
|
||||||
self._pluginManager.register_client(self)
|
self._pluginManager.register_client(self)
|
||||||
|
|
||||||
self._eventManager.fire(Events.CLIENT_OPENED, {"remoteAddress": remoteAddress})
|
self._eventManager.fire(Events.CLIENT_OPENED, {"remoteAddress": self._remoteAddress})
|
||||||
for event in octoprint.events.all_events():
|
for event in octoprint.events.all_events():
|
||||||
self._eventManager.subscribe(event, self._onEvent)
|
self._eventManager.subscribe(event, self._onEvent)
|
||||||
|
|
||||||
octoprint.timelapse.notifyCallbacks(octoprint.timelapse.current)
|
octoprint.timelapse.notifyCallbacks(octoprint.timelapse.current)
|
||||||
|
|
||||||
def on_close(self):
|
def on_close(self):
|
||||||
self._logger.info("Client connection closed")
|
self._logger.info("Client connection closed: %s" % self._remoteAddress)
|
||||||
self._printer.unregisterCallback(self)
|
self._printer.unregisterCallback(self)
|
||||||
self._fileManager.unregister_slicingprogress_callback(self)
|
self._fileManager.unregister_slicingprogress_callback(self)
|
||||||
octoprint.timelapse.unregisterCallback(self)
|
octoprint.timelapse.unregisterCallback(self)
|
||||||
self._pluginManager.unregister_client(self)
|
self._pluginManager.unregister_client(self)
|
||||||
|
|
||||||
self._eventManager.fire(Events.CLIENT_CLOSED)
|
self._eventManager.fire(Events.CLIENT_CLOSED, {"remoteAddress": self._remoteAddress})
|
||||||
for event in octoprint.events.all_events():
|
for event in octoprint.events.all_events():
|
||||||
self._eventManager.unsubscribe(event, self._onEvent)
|
self._eventManager.unsubscribe(event, self._onEvent)
|
||||||
|
|
||||||
@@ -137,4 +139,7 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection):
|
|||||||
self.sendEvent(event, payload)
|
self.sendEvent(event, payload)
|
||||||
|
|
||||||
def _emit(self, type, payload):
|
def _emit(self, type, payload):
|
||||||
self.send({type: payload})
|
try:
|
||||||
|
self.send({type: payload})
|
||||||
|
except Exception as e:
|
||||||
|
self._logger.warn("Could not send message to client %s: %s" % (self._remoteAddress, e.message))
|
||||||
@@ -194,7 +194,8 @@ class UploadStorageFallbackHandler(tornado.web.RequestHandler):
|
|||||||
end_of_header = None
|
end_of_header = None
|
||||||
if delimiter_loc != -1:
|
if delimiter_loc != -1:
|
||||||
# found the delimiter in the currently available data
|
# found the delimiter in the currently available data
|
||||||
data, self._buffer = data[0:delimiter_loc], data[delimiter_loc:]
|
delimiter_data_end = 0 if delimiter_loc == 0 else delimiter_loc - 2
|
||||||
|
data, self._buffer = data[0:delimiter_data_end], data[delimiter_loc:]
|
||||||
end_of_header = self._buffer.find("\r\n\r\n")
|
end_of_header = self._buffer.find("\r\n\r\n")
|
||||||
else:
|
else:
|
||||||
# make sure any boundary (with single or double ==) contained at the end of chunk does not get
|
# make sure any boundary (with single or double ==) contained at the end of chunk does not get
|
||||||
@@ -339,7 +340,7 @@ class UploadStorageFallbackHandler(tornado.web.RequestHandler):
|
|||||||
if "content_type" in part and part["content_type"] is not None:
|
if "content_type" in part and part["content_type"] is not None:
|
||||||
self._new_body += b"Content-Type: %s\r\n" % part["content_type"]
|
self._new_body += b"Content-Type: %s\r\n" % part["content_type"]
|
||||||
self._new_body += b"\r\n"
|
self._new_body += b"\r\n"
|
||||||
self._new_body += value
|
self._new_body += value + b"\r\n"
|
||||||
self._new_body += b"--%s--\r\n" % self._multipart_boundary
|
self._new_body += b"--%s--\r\n" % self._multipart_boundary
|
||||||
|
|
||||||
def _handle_method(self, *args, **kwargs):
|
def _handle_method(self, *args, **kwargs):
|
||||||
|
|||||||
+49
-17
@@ -23,6 +23,30 @@ def settings(init=False, configfile=None, basedir=None):
|
|||||||
return instance
|
return instance
|
||||||
|
|
||||||
default_settings = {
|
default_settings = {
|
||||||
|
"communication": {
|
||||||
|
"protocol": "reprap",
|
||||||
|
"protocolOptions": {
|
||||||
|
"buffer": 63,
|
||||||
|
"temperature": 5,
|
||||||
|
"sdStatus": 1,
|
||||||
|
"waitForStart": False,
|
||||||
|
"forceChecksum": True,
|
||||||
|
"sdAlwaysAvailable": False
|
||||||
|
},
|
||||||
|
"transport": "serial",
|
||||||
|
"transportOptions": {
|
||||||
|
"port": None,
|
||||||
|
"baudrate": None,
|
||||||
|
"timeout": {
|
||||||
|
"read": 5,
|
||||||
|
"write": 0.5
|
||||||
|
},
|
||||||
|
"additionalPorts": []
|
||||||
|
},
|
||||||
|
"autoconnect": False,
|
||||||
|
"log": False
|
||||||
|
},
|
||||||
|
# TODO Remove, not used by the new communication layer but apparently still by the layers above it!
|
||||||
"serial": {
|
"serial": {
|
||||||
"port": None,
|
"port": None,
|
||||||
"baudrate": None,
|
"baudrate": None,
|
||||||
@@ -45,8 +69,10 @@ default_settings = {
|
|||||||
"reverseProxy": {
|
"reverseProxy": {
|
||||||
"prefixHeader": "X-Script-Name",
|
"prefixHeader": "X-Script-Name",
|
||||||
"schemeHeader": "X-Scheme",
|
"schemeHeader": "X-Scheme",
|
||||||
|
"hostHeader": "X-Forwarded-Host",
|
||||||
"prefixFallback": "",
|
"prefixFallback": "",
|
||||||
"schemeFallback": ""
|
"schemeFallback": "",
|
||||||
|
"hostFallback": ""
|
||||||
},
|
},
|
||||||
"uploads": {
|
"uploads": {
|
||||||
"maxSize": 1 * 1024 * 1024 * 1024, # 1GB
|
"maxSize": 1 * 1024 * 1024 * 1024, # 1GB
|
||||||
@@ -79,12 +105,12 @@ default_settings = {
|
|||||||
},
|
},
|
||||||
"feature": {
|
"feature": {
|
||||||
"temperatureGraph": True,
|
"temperatureGraph": True,
|
||||||
"waitForStartOnConnect": False,
|
"waitForStartOnConnect": False, # TODO move to protocol options or reprap protocol
|
||||||
"alwaysSendChecksum": False,
|
"alwaysSendChecksum": True, # TODO move to protocol options
|
||||||
"sdSupport": True,
|
"sdSupport": True, # TODO remove (can be always on)
|
||||||
"sdAlwaysAvailable": False,
|
"sdAlwaysAvailable": False, # TODO move to protocol options
|
||||||
"swallowOkAfterResend": True,
|
"swallowOkAfterResend": True, # TODO remove (must always be done!)
|
||||||
"repetierTargetTemp": False
|
"repetierTargetTemp": False # TODO remove (built into repetier protocol implementation)
|
||||||
},
|
},
|
||||||
"folder": {
|
"folder": {
|
||||||
"uploads": None,
|
"uploads": None,
|
||||||
@@ -111,6 +137,10 @@ default_settings = {
|
|||||||
"pauseTriggers": [],
|
"pauseTriggers": [],
|
||||||
"defaultExtrusionLength": 5
|
"defaultExtrusionLength": 5
|
||||||
},
|
},
|
||||||
|
"appearance": {
|
||||||
|
"name": "",
|
||||||
|
"color": "default"
|
||||||
|
},
|
||||||
"controls": [],
|
"controls": [],
|
||||||
"system": {
|
"system": {
|
||||||
"actions": []
|
"actions": []
|
||||||
@@ -158,10 +188,21 @@ default_settings = {
|
|||||||
"okWithLinenumber": False,
|
"okWithLinenumber": False,
|
||||||
"numExtruders": 1,
|
"numExtruders": 1,
|
||||||
"includeCurrentToolInTemps": True,
|
"includeCurrentToolInTemps": True,
|
||||||
|
"movementSpeed": {
|
||||||
|
"x": 6000,
|
||||||
|
"y": 6000,
|
||||||
|
"z": 200,
|
||||||
|
"e": 300
|
||||||
|
},
|
||||||
"hasBed": True,
|
"hasBed": True,
|
||||||
"repetierStyleTargetTemperature": False,
|
"repetierStyleTargetTemperature": False,
|
||||||
"smoothieTemperatureReporting": False,
|
"smoothieTemperatureReporting": False,
|
||||||
"extendedSdFileList": False
|
"extendedSdFileList": False,
|
||||||
|
"throttle": 0.01,
|
||||||
|
"waitOnLongMoves": False,
|
||||||
|
"rxBuffer": 64,
|
||||||
|
"txBuffer": 40,
|
||||||
|
"commandBuffer": 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,15 +322,6 @@ class Settings(object):
|
|||||||
|
|
||||||
dirty = True
|
dirty = True
|
||||||
|
|
||||||
if "appearance" in self._config:
|
|
||||||
if "name" in self._config["appearance"]:
|
|
||||||
default_profile["name"] = self._config["appearance"]["name"]
|
|
||||||
if "color" in self._config["appearance"]:
|
|
||||||
default_profile["color"] = self._config["appearance"]["color"]
|
|
||||||
|
|
||||||
del self._config["appearance"]
|
|
||||||
dirty = True
|
|
||||||
|
|
||||||
if dirty:
|
if dirty:
|
||||||
if not "printerProfiles" in self._config:
|
if not "printerProfiles" in self._config:
|
||||||
self._config["printerProfiles"] = dict()
|
self._config["printerProfiles"] = dict()
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ class SlicingManager(object):
|
|||||||
|
|
||||||
if not ok:
|
if not ok:
|
||||||
callback_kwargs.update(dict(_error=result))
|
callback_kwargs.update(dict(_error=result))
|
||||||
|
elif result is not None and isinstance(result, dict) and "analysis" in result:
|
||||||
|
callback_kwargs.update(dict(_analysis=result["analysis"]))
|
||||||
except SlicingCancelled:
|
except SlicingCancelled:
|
||||||
callback_kwargs.update(dict(_cancelled=True))
|
callback_kwargs.update(dict(_cancelled=True))
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover,.btn:focus{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class^=icon-],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^=icon-],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^=icon-],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,.75)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.activeLine truncated
|
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,0.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover,.btn:focus{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0044cc',GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)}.btn-warning:hover,.btn-warning:focus,.btn-warning:aLine truncated
|
||||||
@@ -342,6 +342,21 @@ function formatDuration(seconds) {
|
|||||||
return _.sprintf(gettext(/* L10N: duration format */ "%(hour)02d:%(minute)02d:%(second)02d"), {hour: h, minute: m, second: s});
|
return _.sprintf(gettext(/* L10N: duration format */ "%(hour)02d:%(minute)02d:%(second)02d"), {hour: h, minute: m, second: s});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatFuzzyEstimation(seconds, base) {
|
||||||
|
if (!seconds) return "-";
|
||||||
|
if (seconds < 0) return "-";
|
||||||
|
|
||||||
|
var m;
|
||||||
|
if (base != undefined) {
|
||||||
|
m = moment(base);
|
||||||
|
} else {
|
||||||
|
m = moment();
|
||||||
|
}
|
||||||
|
|
||||||
|
m.add(seconds, "s");
|
||||||
|
return m.fromNow(true);
|
||||||
|
}
|
||||||
|
|
||||||
function formatDate(unixTimestamp) {
|
function formatDate(unixTimestamp) {
|
||||||
if (!unixTimestamp) return "-";
|
if (!unixTimestamp) return "-";
|
||||||
return moment.unix(unixTimestamp).format(gettext(/* L10N: Date format */ "YYYY-MM-DD HH:mm"));
|
return moment.unix(unixTimestamp).format(gettext(/* L10N: Date format */ "YYYY-MM-DD HH:mm"));
|
||||||
|
|||||||
@@ -1,33 +1,20 @@
|
|||||||
function AppearanceViewModel(settingsViewModel, printerStateViewModel) {
|
function AppearanceViewModel(settingsViewModel, printerStateViewModel) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.settings = settingsViewModel;
|
self.name = settingsViewModel.appearance_name;
|
||||||
self.printerState = printerStateViewModel;
|
self.color = settingsViewModel.appearance_color;
|
||||||
|
|
||||||
self.connected = ko.observable(false);
|
|
||||||
|
|
||||||
self.printerState.isErrorOrClosed.subscribe(function() {
|
|
||||||
self.connected(!self.printerState.isErrorOrClosed());
|
|
||||||
});
|
|
||||||
|
|
||||||
self.brand = ko.computed(function() {
|
self.brand = ko.computed(function() {
|
||||||
if (self.settings.printerProfiles.currentProfileData().name() && self.connected())
|
if (self.name())
|
||||||
return gettext("OctoPrint") + ": " + self.settings.printerProfiles.currentProfileData().name();
|
return gettext("OctoPrint") + ": " + self.name();
|
||||||
else
|
else
|
||||||
return gettext("OctoPrint");
|
return gettext("OctoPrint");
|
||||||
});
|
});
|
||||||
|
|
||||||
self.title = ko.computed(function() {
|
self.title = ko.computed(function() {
|
||||||
if (self.settings.printerProfiles.currentProfileData().name() && self.connected())
|
if (self.name())
|
||||||
return self.settings.printerProfiles.currentProfileData().name() + " [" + gettext("OctoPrint") + "]";
|
return self.name() + " [" + gettext("OctoPrint") + "]";
|
||||||
else
|
else
|
||||||
return gettext("OctoPrint");
|
return gettext("OctoPrint");
|
||||||
});
|
});
|
||||||
|
|
||||||
self.color = ko.computed(function() {
|
|
||||||
if (self.settings.printerProfiles.currentProfileData().color() && self.connected())
|
|
||||||
return self.settings.printerProfiles.currentProfileData().color();
|
|
||||||
else
|
|
||||||
return "default";
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
@@ -62,6 +62,7 @@ function ConnectionViewModel(loginStateViewModel, settingsViewModel, printerProf
|
|||||||
var portPreference = response.options.portPreference;
|
var portPreference = response.options.portPreference;
|
||||||
var baudratePreference = response.options.baudratePreference;
|
var baudratePreference = response.options.baudratePreference;
|
||||||
var printerPreference = response.options.printerProfilePreference;
|
var printerPreference = response.options.printerProfilePreference;
|
||||||
|
var printerProfiles = response.options.printerProfiles;
|
||||||
|
|
||||||
self.portOptions(ports);
|
self.portOptions(ports);
|
||||||
self.baudrateOptions(baudrates);
|
self.baudrateOptions(baudrates);
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ function ControlViewModel(loginStateViewModel, settingsViewModel) {
|
|||||||
self.sendJogCommand = function(axis, multiplier, distance) {
|
self.sendJogCommand = function(axis, multiplier, distance) {
|
||||||
if (typeof distance === "undefined")
|
if (typeof distance === "undefined")
|
||||||
distance = $('#jog_distance button.active').data('distance');
|
distance = $('#jog_distance button.active').data('distance');
|
||||||
if (self.settings.getPrinterInvertAxis(axis)) {
|
if (self.settings.printerProfiles.currentProfileData() && self.settings.printerProfiles.currentProfileData()["axes"] && self.settings.printerProfiles.currentProfileData()["axes"][axis] && self.settings.printerProfiles.currentProfileData()["axes"][axis]["inverted"]()) {
|
||||||
multiplier *= -1;
|
multiplier *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ function PrinterProfilesViewModel() {
|
|||||||
self.editorVolumeHeight(data.volume.height);
|
self.editorVolumeHeight(data.volume.height);
|
||||||
self.editorVolumeFormFactor(data.volume.formFactor);
|
self.editorVolumeFormFactor(data.volume.formFactor);
|
||||||
|
|
||||||
self.editorHeatedBed(data.volume.heatedBed);
|
self.editorHeatedBed(data.heatedBed);
|
||||||
|
|
||||||
self.editorNozzleDiameter(data.extruder.nozzleDiameter);
|
self.editorNozzleDiameter(data.extruder.nozzleDiameter);
|
||||||
self.editorExtruders(data.extruder.count);
|
self.editorExtruders(data.extruder.count);
|
||||||
@@ -301,7 +301,7 @@ function PrinterProfilesViewModel() {
|
|||||||
for (var i = 1; i < self.editorExtruders(); i++) {
|
for (var i = 1; i < self.editorExtruders(); i++) {
|
||||||
var offset = [0.0, 0.0];
|
var offset = [0.0, 0.0];
|
||||||
if (i < self.editorExtruderOffsets().length) {
|
if (i < self.editorExtruderOffsets().length) {
|
||||||
offset = self.editorExtruderOffsets()[i];
|
offset = [parseFloat(self.editorExtruderOffsets()[i]["x"]()), parseFloat(self.editorExtruderOffsets()[i]["y"]())];
|
||||||
}
|
}
|
||||||
profile.extruder.offsets.push(offset);
|
profile.extruder.offsets.push(offset);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,15 @@ function PrinterStateViewModel(loginStateViewModel) {
|
|||||||
return formatDuration(self.printTime());
|
return formatDuration(self.printTime());
|
||||||
});
|
});
|
||||||
self.printTimeLeftString = ko.computed(function() {
|
self.printTimeLeftString = ko.computed(function() {
|
||||||
if (!self.printTimeLeft())
|
if (self.printTimeLeft() == undefined) {
|
||||||
return "-";
|
if (!self.printTime() || !(self.isPrinting() || self.isPaused())) {
|
||||||
return formatDuration(self.printTimeLeft());
|
return "-";
|
||||||
|
} else {
|
||||||
|
return gettext("Calculating...");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return formatFuzzyEstimation(self.printTimeLeft());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
self.progressString = ko.computed(function() {
|
self.progressString = ko.computed(function() {
|
||||||
if (!self.progress())
|
if (!self.progress())
|
||||||
|
|||||||
@@ -9,6 +9,43 @@ function SettingsViewModel(loginStateViewModel, usersViewModel, printerProfilesV
|
|||||||
self.api_key = ko.observable(undefined);
|
self.api_key = ko.observable(undefined);
|
||||||
self.api_allowCrossOrigin = ko.observable(undefined);
|
self.api_allowCrossOrigin = ko.observable(undefined);
|
||||||
|
|
||||||
|
self.appearance_name = ko.observable(undefined);
|
||||||
|
self.appearance_color = ko.observable(undefined);
|
||||||
|
|
||||||
|
self.appearance_available_colors = ko.observable([
|
||||||
|
{key: "default", name: gettext("default")},
|
||||||
|
{key: "red", name: gettext("red")},
|
||||||
|
{key: "orange", name: gettext("orange")},
|
||||||
|
{key: "yellow", name: gettext("yellow")},
|
||||||
|
{key: "green", name: gettext("green")},
|
||||||
|
{key: "blue", name: gettext("blue")},
|
||||||
|
{key: "violet", name: gettext("violet")},
|
||||||
|
{key: "black", name: gettext("black")}
|
||||||
|
]);
|
||||||
|
|
||||||
|
self.appearance_colorName = function(color) {
|
||||||
|
switch (color) {
|
||||||
|
case "red":
|
||||||
|
return gettext("red");
|
||||||
|
case "orange":
|
||||||
|
return gettext("orange");
|
||||||
|
case "yellow":
|
||||||
|
return gettext("yellow");
|
||||||
|
case "green":
|
||||||
|
return gettext("green");
|
||||||
|
case "blue":
|
||||||
|
return gettext("blue");
|
||||||
|
case "violet":
|
||||||
|
return gettext("violet");
|
||||||
|
case "black":
|
||||||
|
return gettext("black");
|
||||||
|
case "default":
|
||||||
|
return gettext("default");
|
||||||
|
default:
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
self.printer_defaultExtrusionLength = ko.observable(undefined);
|
self.printer_defaultExtrusionLength = ko.observable(undefined);
|
||||||
|
|
||||||
self.webcam_streamUrl = ko.observable(undefined);
|
self.webcam_streamUrl = ko.observable(undefined);
|
||||||
@@ -23,6 +60,7 @@ function SettingsViewModel(loginStateViewModel, usersViewModel, printerProfilesV
|
|||||||
self.feature_temperatureGraph = ko.observable(undefined);
|
self.feature_temperatureGraph = ko.observable(undefined);
|
||||||
self.feature_waitForStart = ko.observable(undefined);
|
self.feature_waitForStart = ko.observable(undefined);
|
||||||
self.feature_alwaysSendChecksum = ko.observable(undefined);
|
self.feature_alwaysSendChecksum = ko.observable(undefined);
|
||||||
|
self.feature_pingPong = ko.observable(undefined);
|
||||||
self.feature_sdSupport = ko.observable(undefined);
|
self.feature_sdSupport = ko.observable(undefined);
|
||||||
self.feature_sdAlwaysAvailable = ko.observable(undefined);
|
self.feature_sdAlwaysAvailable = ko.observable(undefined);
|
||||||
self.feature_swallowOkAfterResend = ko.observable(undefined);
|
self.feature_swallowOkAfterResend = ko.observable(undefined);
|
||||||
@@ -101,6 +139,9 @@ function SettingsViewModel(loginStateViewModel, usersViewModel, printerProfilesV
|
|||||||
self.api_key(response.api.key);
|
self.api_key(response.api.key);
|
||||||
self.api_allowCrossOrigin(response.api.allowCrossOrigin);
|
self.api_allowCrossOrigin(response.api.allowCrossOrigin);
|
||||||
|
|
||||||
|
self.appearance_name(response.appearance.name);
|
||||||
|
self.appearance_color(response.appearance.color);
|
||||||
|
|
||||||
self.printer_defaultExtrusionLength(response.printer.defaultExtrusionLength);
|
self.printer_defaultExtrusionLength(response.printer.defaultExtrusionLength);
|
||||||
|
|
||||||
self.webcam_streamUrl(response.webcam.streamUrl);
|
self.webcam_streamUrl(response.webcam.streamUrl);
|
||||||
@@ -158,6 +199,10 @@ function SettingsViewModel(loginStateViewModel, usersViewModel, printerProfilesV
|
|||||||
"key": self.api_key(),
|
"key": self.api_key(),
|
||||||
"allowCrossOrigin": self.api_allowCrossOrigin()
|
"allowCrossOrigin": self.api_allowCrossOrigin()
|
||||||
},
|
},
|
||||||
|
"appearance" : {
|
||||||
|
"name": self.appearance_name(),
|
||||||
|
"color": self.appearance_color()
|
||||||
|
},
|
||||||
"printer": {
|
"printer": {
|
||||||
"defaultExtrusionLength": self.printer_defaultExtrusionLength()
|
"defaultExtrusionLength": self.printer_defaultExtrusionLength()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ function SlicingViewModel(loginStateViewModel, printerProfilesViewModel) {
|
|||||||
self.afterSlicing = ko.observable("none");
|
self.afterSlicing = ko.observable("none");
|
||||||
|
|
||||||
self.show = function(target, file) {
|
self.show = function(target, file) {
|
||||||
|
self.requestData();
|
||||||
self.target = target;
|
self.target = target;
|
||||||
self.file = file;
|
self.file = file;
|
||||||
self.title(_.sprintf(gettext("Slicing %(filename)s"), {filename: self.file}));
|
self.title(_.sprintf(gettext("Slicing %(filename)s"), {filename: self.file}));
|
||||||
@@ -48,13 +49,18 @@ function SlicingViewModel(loginStateViewModel, printerProfilesViewModel) {
|
|||||||
&& self.profile() != undefined;
|
&& self.profile() != undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
self.requestData = function() {
|
self.requestData = function(callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "slicing",
|
url: API_BASEURL + "slicing",
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: self.fromResponse
|
success: function(data) {
|
||||||
})
|
self.fromResponse(data);
|
||||||
|
if (callback !== undefined) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.fromResponse = function(data) {
|
self.fromResponse = function(data) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
window.BABEL_TO_LOAD_de = {"locale": "de", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-10-20 09:44+0200\nPO-Revision-Date: 2014-10-20 09:48+0100\nLast-Translator: Gina H\u00e4u\u00dfge <osd@foosel.net>\nLanguage-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Verbleibende Druckdauer", "Proceed": "Fortfahren", "Timelapse Temp Folder": "Tempor\u00e4res Zeitrafferverzeichnis", "Title": "Titel", "Only show files stored locally": "Nur lokal abgelegte Dateien anzeigen", "yellow": "Gelb", "Action": "Aktion", "Passwords do not match": "Passw\u00f6rter nicht identisch", "Sort by name": "Nach Name sortieren", "Save connection settings": "Verbindungseinstellungen speichern", "Rendering timelapse": "Zeitraffer wird gerendert", "Temperature": "Temperatur", "Files": "Dateien", "Bed Size": "Bettdimensionen", "Resume": "Weiter", "Always assume SD card is present": "Immer davon ausgehen, dass eine SD-Karte vorhanden ist", "Load and Print": "Laden und Drucken", "Sending file to SD": "Sende Datei zu SD", "Number of Extruders": "Anzahl Extruder", "black": "Schwarz", "Last Printed": "Zuletzt gedruckt", "Sourcecode": "Quellcode", "Estimated layer height": "Gesch\u00e4tzte Schichth\u00f6he", "You are now logged out": "Du bist jetzt ausgeloggt", "Uploaded": "Hochgeladen", "Opening serial port": "\u00d6ffnet Serialport", "New timelapse %(movie_basename)s is done rendering.": "Neue Zeitrafferaufnahme %(movie_basename)s wurde fertig gerendert", "Invert control": "Invertieren", "Webcam": "Webcam", "Remember me": "Login merken", "Enable GCode Visualizer": "GCode Viewer aktivieren", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Der Server scheint offline zu sein, zumindest kann ich mich nicht mit ihm verbinden. Ich werde <strong>\u00fcber die n\u00e4chsten Minuten</strong> versuchen, zu reconnecten, aber Du kannst mittels des folgenden Buttons auch jederzeit einen manuellen Reconnect ansto\u00dfen.", "Rendering failed": "Rendering fehlgeschlagen", "Upload Folder": "Uploadverzeichnis", "descending": "absteigend", "Only show files stored on SD": "Nur auf SD abgelegte Dateien anzeigen", "X": "X", "Add user": "Nutzer hinzuf\u00fcgen", "GCODE commands in layer": "GCODE Kommandos in Schicht", "Estimated print time": "Gesch\u00e4tzte Druckdauer", "Serial Connection": "Serielle Verbindung", "Control": "Kontrolle", "Password": "Passwort", "Also show next layer": "Auch n\u00e4chste Schicht anzeigen", "Print Time": "Druckdauer", "Slicer": "Slicer", "Sort by file size": "Nach Gr\u00f6\u00dfe sortieren", "Machine State": "Druckerstatus", "Slicing Profile": "Slicingprofil", "Pauses the print job": "Pausiert den Druckjob", "API": "API", "Printing from SD": "Drucke von SD", "Stream URL": "Stream-URL", "Terminal filters": "Terminalfilter", "Change password for user \"%(user)s\"": "Passwort\u00e4nderung f\u00fcr Nutzer \"%(user)s\"", "mm": "mm", "Enable Temperature Graph": "Temperaturgraph aktivieren", "Delete user": "Nutzer l\u00f6schen", "Confirm Password": "Passwort best\u00e4tigen", "Disconnect": "Trennen", "Slicing done": "Slicing abgeschlossen", "Initialize SD card": "SD-Karte initialisieren", "System": "System", "Send": "Senden", "State": "Status", "Version": "Version", "YYYY-MM-DD HH:mm": "DD.MM.YYYY HH:mm", "Attempt to reconnect": "Erneut verbinden", "Streaming done": "Streaming abgeschlossen", "violet": "Violett", "Print": "Drucken", "Layer count": "Schichtanzahl", "OctoPrint Settings": "OctoPrint Einstellungen", "Are you sure?": "Bist Du sicher?", "blue": "Blau", "Printer": "Drucker", "Tool": "Werkzeug", "Settings": "Einstellungen", "Path to FFMPEG": "Pfad zu FFMPEG", "Upload to SD": "Upload (SD)", "The command \"%(command)s\" could not be executed.": "Das Kommando \"%(command)s\" konnte nicht ausgef\u00fchrt werden.", "Printed": "Gedruckt", "Wait for <code>start</code> on connect": "Bei der Verbindung auf <code>start</code> warten", "Layer number": "Schichtnummer", "Sync with job progress": "Job mit Fortschritt synchronisieren", "Circular": "Rund", "Total filament used": "Gesamtmenge genutzten Filaments", "red": "Rot", "Save as default": "Als Standard speichern", "Slicing ...": "Slice ...", "Last Print Time": "Letzte Druckdauer", "Target": "Soll", "Streaming ...": "Streame ...", "Default extrusion length": "Standard Extrusionsl\u00e4nge", "Logout successful": "Logout erfolgreich", "Now rendering timelapse %(movie_basename)s": "Rendere Zeitrafferaufnahme %(movie_basename)s", "Documentation": "Dokumentation", "%(hLine truncated
|
window.BABEL_TO_LOAD_de = {"locale": "de", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-12-18 14:45+0100\nPO-Revision-Date: 2014-12-18 14:11+0000\nLast-Translator: Gina H\u00e4u\u00dfge <gina@foosel.net>\nLanguage-Team: German (http://www.transifex.com/projects/p/octoprint/language/de/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Verbleibende Druckdauer", "sec": "Sek", "Proceed": "Fortfahren", "Timelapse Temp Folder": "Tempor\u00e4res Zeitrafferverzeichnis", "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> target temperature format": "<code>TargetExtr%%n</code>/<code>TargetBed</code> Zieltemperaturformat unterst\u00fctzen", "Upload Folder": "Uploadverzeichnis", "Only show files stored locally": "Nur lokal abgelegte Dateien anzeigen", "Add Printer Profile": "Druckerprofil hinzuf\u00fcgen", "yellow": "Gelb", "Save": "Speichern", "Action": "Aktion", "Passwords do not match": "Passw\u00f6rter nicht identisch", "Sort by name": "Nach Name sortieren", "Save connection settings": "Verbindungseinstellungen speichern", "Rendering timelapse": "Zeitraffer wird gerendert", "Color": "Farbe", "Temperature": "Temperatur", "Files": "Dateien", "Resume": "Weiter", "Always assume SD card is present": "Immer davon ausgehen, dass eine SD-Karte vorhanden ist", "Load and Print": "Laden und Drucken", "Sending file to SD": "Sende Datei zu SD", "Number of Extruders": "Anzahl Extruder", "black": "Schwarz", "Last Printed": "Zuletzt gedruckt", "Sourcecode": "Quellcode", "Estimated layer height": "Gesch\u00e4tzte Schichth\u00f6he", "You are now logged out": "Du bist jetzt ausgeloggt", "Uploaded": "Hochgeladen", "Form Factor": "Formfaktor", "Opening serial port": "\u00d6ffnet Serialport", "New timelapse %(movie_basename)s is done rendering.": "Neue Zeitrafferaufnahme %(movie_basename)s wurde fertig gerendert", "Invert control": "Invertieren", "Webcam": "Webcam", "Select for printing": "Zum Drucken ausw\u00e4hlen", "Allow <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>": "<a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a> erlauben", "Remember me": "Login merken", "Enable GCode Visualizer": "GCode Viewer aktivieren", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Der Server scheint offline zu sein, zumindest kann ich mich nicht mit ihm verbinden. Ich werde <strong>\u00fcber die n\u00e4chsten Minuten</strong> versuchen, mich erneut zu verbinden, aber Du kannst mittels des folgenden Buttons auch jederzeit einen manuellen Reconnect ansto\u00dfen.", "Rendering failed": "Rendering fehlgeschlagen", "Motors off": "Motoren aus", "descending": "absteigend", "Only show files stored on SD": "Nur auf SD abgelegte Dateien anzeigen", "X": "X", "Add user": "Nutzer hinzuf\u00fcgen", "GCODE commands in layer": "GCODE Kommandos in Schicht", "Estimated print time": "Gesch\u00e4tzte Druckdauer", "Serial Connection": "Serielle Verbindung", "Control": "Kontrolle", "Password": "Passwort", "Also show next layer": "Auch n\u00e4chste Schicht anzeigen", "Print Time": "Druckdauer", "Slicer": "Slicer", "Nozzle Diameter": "D\u00fcsendurchmesser", "Sort by file size": "Nach Gr\u00f6\u00dfe sortieren", "Machine State": "Druckerstatus", "Slicing Profile": "Slicingprofil", "mm": "mm", "API": "API", "Printing from SD": "Drucke von SD", "Stream URL": "Stream-URL", "Terminal filters": "Terminalfilter", "Change password for user \"%(user)s\"": "Passwort\u00e4nderung f\u00fcr Nutzer \"%(user)s\"", "Enable Temperature Graph": "Temperaturgraph aktivieren", "Delete user": "Nutzer l\u00f6schen", "Timelapse bitrate": "Zeitrafferbitrate", "Confirm Password": "Passwort best\u00e4tigen", "Disconnect": "Trennen", "Slicing done": "Slicing abgeschlossen", "Initialize SD card": "SD-Karte initialisieren", "System": "System", "Send": "Senden", "State": "Status", "Version": "Version", "YYYY-MM-DD HH:mm": "DD.MM.YYYY HH:mm", "Attempt to reconnect": "Erneut verbinden", "Streaming done": "Streaming abgeschlossen", "violet": "Violett", "Print": "Drucken", "Layer count": "Schichtanzahl", "OctoPrint Settings": "OctoPrint Einstellungen", "Are you sure?": "Bist Du sicher?", "blue": "Blau", "Printer": "Drucker", "Delete Profile": "Profil entfernen", "Tool": "Werkzeug", "Settings": "Einstellungen", "Circular": "Rund", "Path to FFMPEG": "Pfad zu FFMPEG", "Upload to SD": "Upload (SD)", "The command \"%(command)s\" could not be executed.": "Das Kommando \"%(command)s\" konnte nicht ausgef\u00fchrt werden.", "Select a slicing profile...": "W\u00e4hle ein Slicingprofile...", "Wait for <code>start</code> on connect":Line truncated
|
||||||
@@ -1 +1 @@
|
|||||||
window.BABEL_TO_LOAD_fr = {"locale": "fr", "domain": "messages", "plural_expr": "(n > 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-08-28 15:52+0200\nPO-Revision-Date: 2014-08-28 13:54+0000\nLast-Translator: Gina H\u00e4u\u00dfge <gina@foosel.net>\nLanguage-Team: French (http://www.transifex.com/projects/p/octoprint/language/fr/)\nPlural-Forms: nplurals=2; plural=(n > 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Temps d'impression restant", "Proceed": "Continuer", "Timelapse Temp Folder": "R\u00e9pertoire temporaire des timelapses", "Title": "Titre", "Only show files stored locally": "Ne montre que les fichiers enregistr\u00e9s localement", "yellow": "jaune", "Path to Cura": "Chemin vers Cura", "Action": "Action", "Passwords do not match": "Les mots de passes ne sont pas semblables", "Sort by name": "Trier par nom", "Save connection settings": "Sauvegarder les param\u00e8tres de connection", "Rendering timelapse": "Rendu du timelapse en cours", "Cura": "Cura", "Files": "Fichiers", "Bed Size": "Taille du lit", "Always assume SD card is present": "Toujours supposer que la carte SD est pr\u00e9sente", "Load and Print": "Charger et imprimer", "Sending file to SD": "Envoi du fichier vers la carte SD en cours", "Number of Extruders": "Nombre d'extrudeurs", "black": "noir", "Last Printed": "Impression pr\u00e9c\u00e9dente", "Sourcecode": "Code source", "Estimated layer height": "Hauteur de couche estim\u00e9e", "You are now logged out": "Vous \u00eates maintenant d\u00e9connect\u00e9", "Uploaded": "Charg\u00e9", "Opening serial port": "Ouverture du port s\u00e9rie en cours", "New timelapse %(movie_basename)s is done rendering.": "Le rendu du nouveau timelapse %(movie_basename)s est termin\u00e9.", "Invert control": "Inverser le contr\u00f4le", "Webcam": "Webcam", "Remember me": "Se souvenir de moi", "Enable GCode Visualizer": "Activer le visualisateur de GCode", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Le serveur semble \u00eatre hors ligne, du moins je ne re\u00e7ois aucunes r\u00e9ponses de celui-ci. Je vais tenter de me reconnecter automatiquement <strong>dans les minutes qui suivent</strong>. Quoiqu'il en soit vous pouvez tenter de vous reconnecter manuellement en utilisant le bouton ci-dessous.", "Rendering failed": "Echec du rendu", "Upload Folder": "R\u00e9pertoire des chargements", "descending": "descendant", "X": "X", "Add user": "Ajouter utilisateur", "GCODE commands in layer": "Commandes GCODE dans la couche", "Estimated print time": "Temps d'impression estim\u00e9", "Serial Connection": "Connection s\u00e9rie", "Control": "Contr\u00f4le", "Password": "Mot de passe", "Also show next layer": "Montrer \u00e9galement la couche suivante", "Print Time": "Temps d'impression", "Sort by file size": "Trier par taille des fichiers", "Machine State": "Etat de la machine", "default": "Par d\u00e9faut", "API": "API", "Printing from SD": "Impression depuis la carte SD en cours", "Terminal filters": "Filtres du terminal", "Change password for user \"%(user)s\"": "Changer le mot de passe pour l'utilisateur \"%(user)s\"", "Enable Temperature Graph": "Activer le graphique de temp\u00e9rature", "Delete user": "Supprimer utilisateur", "Confirm Password": "Confirmer le mot de passe", "Disconnect": "D\u00e9connecter", "Slicing done": "Tranchage termin\u00e9", "Initialize SD card": "Initialiser la carte SD", "System": "Syst\u00eame", "Send": "Envoyer", "State": "Etat", "Version": "Version", "YYYY-MM-DD HH:mm": "DD-MM-YYYY HH:mm", "Attempt to reconnect": "Tentative de reconnection", "Streaming done": "Diffusion en direct termin\u00e9", "violet": "violet", "Print": "Imprimer", "Layer count": "Nombre de couches", "OctoPrint Settings": "Param\u00e8tres d'OctoPrint", "Are you sure?": "Etes-vous s\u00fbre?", "blue": "bleu", "Printer": "Imprimante", "Tool": "Outil", "Settings": "Param\u00e8tres", "Path to FFMPEG": "Chemin vers FFMPEG", "Upload to SD": "Chargement vers la carte SD", "The command \"%(command)s\" could not be executed.": "La commande \"%(command)s\" n'a pas pu \u00eatre ex\u00e9cut\u00e9e", "Printed": "Imprim\u00e9", "Layer number": "Couche num\u00e9ro", "Sync with job progress": "Synchroniser avec le progr\u00e8s du job", "Circular": "Circulaire", "Total filament used": "Quantit\u00e9 de filament utilis\u00e9", "red": "rouge", "Save as default": "Sauver en tant que d\u00e9faut", "Slicing ...": "Tranchage en cours...", "Last Print Time": "Temps d'impression pr\u00e9c\u00e9dent", "Target": "Cible", "Streaming ...": "Diffusion en direct en cours...", "Logout successful": "Fermeture de session r\u00e9ussie", "Now rendering timelapse %(movieLine truncated
|
window.BABEL_TO_LOAD_fr = {"locale": "fr", "domain": "messages", "plural_expr": "(n > 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-12-18 14:45+0100\nPO-Revision-Date: 2014-12-18 14:04+0000\nLast-Translator: Gina H\u00e4u\u00dfge <gina@foosel.net>\nLanguage-Team: French (http://www.transifex.com/projects/p/octoprint/language/fr/)\nPlural-Forms: nplurals=2; plural=(n > 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Temps d'impression restant", "sec": "sec", "Proceed": "Continuer", "Timelapse Temp Folder": "R\u00e9pertoire temporaire des timelapses", "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> target temperature format": "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> format de temp\u00e9rature de la cible", "Upload Folder": "R\u00e9pertoire des chargements", "Only show files stored locally": "Ne montre que les fichiers enregistr\u00e9s localement", "Add Printer Profile": "", "yellow": "jaune", "Save": "Sauver", "Action": "Action", "Passwords do not match": "Les mots de passes ne sont pas semblables", "Sort by name": "Trier par nom", "Save connection settings": "Sauvegarder les param\u00e8tres de connection", "Rendering timelapse": "Rendu du timelapse en cours", "Color": "Couleur", "Temperature": "Temp\u00e9rature", "Files": "Fichiers", "Resume": "", "Always assume SD card is present": "Toujours supposer que la carte SD est pr\u00e9sente", "Load and Print": "Charger et imprimer", "Sending file to SD": "Envoi du fichier vers la carte SD en cours", "Number of Extruders": "Nombre d'extrudeurs", "black": "noir", "Last Printed": "Impression pr\u00e9c\u00e9dente", "Sourcecode": "Code source", "Estimated layer height": "Hauteur de couche estim\u00e9e", "You are now logged out": "Vous \u00eates maintenant d\u00e9connect\u00e9", "Uploaded": "Charg\u00e9", "Form Factor": "", "Opening serial port": "Ouverture du port s\u00e9rie en cours", "New timelapse %(movie_basename)s is done rendering.": "Le rendu du nouveau timelapse %(movie_basename)s est termin\u00e9.", "Invert control": "Inverser le contr\u00f4le", "Webcam": "Webcam", "Select for printing": "", "Allow <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>": "Permettre <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>", "Remember me": "Se souvenir de moi", "Enable GCode Visualizer": "Activer le visualisateur de GCode", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Le serveur semble \u00eatre hors ligne, du moins je ne re\u00e7ois aucunes r\u00e9ponses de celui-ci. Je vais tenter de me reconnecter automatiquement <strong>dans les minutes qui suivent</strong>. Quoiqu'il en soit vous pouvez tenter de vous reconnecter manuellement en utilisant le bouton ci-dessous.", "Rendering failed": "Echec du rendu", "Motors off": "Eteindre les moteurs", "descending": "descendant", "Only show files stored on SD": "Ne montrer que les fichier enregistr\u00e9s sur la carte SD", "X": "X", "Add user": "Ajouter utilisateur", "GCODE commands in layer": "Commandes GCODE dans la couche", "Estimated print time": "Temps d'impression estim\u00e9", "Serial Connection": "Connection s\u00e9rie", "Control": "Contr\u00f4le", "Password": "Mot de passe", "Also show next layer": "Montrer \u00e9galement la couche suivante", "Print Time": "Temps d'impression", "Slicer": "", "Nozzle Diameter": "", "Sort by file size": "Trier par taille des fichiers", "Machine State": "Etat de la machine", "Slicing Profile": "", "mm": "mm", "API": "API", "Printing from SD": "Impression depuis la carte SD en cours", "Stream URL": "URL de diffusion en direct", "Terminal filters": "Filtres du terminal", "Change password for user \"%(user)s\"": "Changer le mot de passe pour l'utilisateur \"%(user)s\"", "Enable Temperature Graph": "Activer le graphique de temp\u00e9rature", "Delete user": "Supprimer utilisateur", "Timelapse bitrate": "Bitrate du timelapse", "Confirm Password": "Confirmer le mot de passe", "Disconnect": "D\u00e9connecter", "Slicing done": "Tranchage termin\u00e9", "Initialize SD card": "Initialiser la carte SD", "System": "Syst\u00eame", "Send": "Envoyer", "State": "Etat", "Version": "Version", "YYYY-MM-DD HH:mm": "DD-MM-YYYY HH:mm", "Attempt to reconnect": "Tentative de reconnection", "Streaming done": "Diffusion en direct termin\u00e9", "violet": "violet", "Print": "Imprimer", "Layer count": "Nombre de couches", "OctoPrint Settings": "Param\u00e8tres d'OctoPrint", "Are you sure?": "Etes-vous s\u00fbre?", "blue": "bleu", "Printer": "Imprimante", "Delete Profile": "", "Tool": "Outil", "Settings": "Param\u00e8tres", "Circular": "Circulaire", "Path to FFMPEG": "Chemin vers FFMPEG", "Upload to
Line truncated
|
||||||
@@ -1 +1 @@
|
|||||||
window.BABEL_TO_LOAD_he = {"locale": "he", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint 1.2.0-dev-131-g854387b\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-08-31 12:52+0300\nPO-Revision-Date: 2014-08-31 18:44+0200\nLast-Translator: Guy Sheffer <guysoft@gmail.com>\nLanguage-Team: he <guysoft@gmail.com>\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "\u05d6\u05de\u05df \u05d4\u05d3\u05e4\u05e1\u05d4 \u05e0\u05d5\u05ea\u05e8", "Proceed": "\u05d4\u05de\u05e9\u05da", "Timelapse Temp Folder": "\u05ea\u05e7\u05d9\u05d9\u05d4 \u05d6\u05de\u05e0\u05d9\u05ea \u05dc-timelapse", "Title": "\u05db\u05d5\u05ea\u05e8\u05ea", "Only show files stored locally": "\u05d4\u05e6\u05d2 \u05e8\u05e7 \u05e7\u05d1\u05e6\u05d9\u05dd \u05d4\u05e9\u05de\u05d5\u05e8\u05d9\u05dd \u05de\u05e7\u05d5\u05de\u05d9\u05ea", "yellow": "\u05e6\u05d4\u05d5\u05d1", "Path to Cura": "\u05e0\u05ea\u05d9\u05d1 \u05dc-Cura", "Action": "\u05e4\u05e2\u05d5\u05dc\u05d4", "Passwords do not match": "\u05e1\u05d9\u05e1\u05de\u05d0\u05d5\u05ea \u05dc\u05d0 \u05ea\u05d5\u05d0\u05de\u05d5\u05ea", "Sort by name": "\u05de\u05d9\u05d9\u05df \u05dc\u05e4\u05d9 \u05e9\u05dd", "Save connection settings": "\u05e9\u05de\u05d5\u05e8 \u05d4\u05d2\u05d3\u05e8\u05d5\u05ea \u05d7\u05d9\u05d1\u05d5\u05e8", "Rendering timelapse": "\u05de\u05e8\u05e0\u05d3\u05e8 timelapse", "Cura": "Cura", "Files": "\u05e7\u05d1\u05e6\u05d9\u05dd", "Bed Size": "\u05d2\u05d5\u05d3\u05dc \u05de\u05d9\u05d8\u05d4", "Always assume SD card is present": "\u05ea\u05de\u05d9\u05d3 \u05ea\u05e0\u05d9\u05d7 \u05e9\u05db\u05e8\u05d8\u05d9\u05e1 SD \u05e0\u05de\u05e6\u05d0", "Load and Print": "\u05d8\u05e2\u05df \u05d5\u05d4\u05d3\u05e4\u05e1", "Sending file to SD": "\u05e9\u05d5\u05dc\u05d7 \u05e7\u05d5\u05d1\u05e5 \u05d0\u05dc SD", "Number of Extruders": "\u05de\u05e1\u05e4\u05e8 \u05d0\u05e7\u05e1\u05d8\u05e8\u05d5\u05d3\u05e8\u05d9\u05dd", "black": "\u05e9\u05d7\u05d5\u05e8", "Last Printed": "\u05d4\u05d5\u05d3\u05e4\u05e1 \u05dc\u05d0\u05d7\u05e8\u05d5\u05e0\u05d4", "Sourcecode": "\u05e7\u05d5\u05d3 \u05de\u05e7\u05d5\u05e8", "Estimated layer height": "\u05d2\u05d5\u05d1\u05d4 \u05e9\u05db\u05d1\u05d5\u05ea \u05de\u05e9\u05d5\u05e2\u05e8", "You are now logged out": "\u05d4\u05ea\u05e0\u05ea\u05e7\u05ea \u05de\u05d4\u05de\u05e2\u05e8\u05db\u05ea", "Uploaded": "\u05d4\u05d5\u05e2\u05dc\u05d4", "Opening serial port": "\u05e4\u05d5\u05ea\u05d7 \u05d9\u05e6\u05d9\u05e8\u05d4 \u05d8\u05d5\u05e8\u05d9\u05ea", "New timelapse %(movie_basename)s is done rendering.": "\u05e1\u05d9\u05d9\u05dd \u05dc\u05e8\u05e0\u05d3\u05e8 \u05d0\u05ea \u05d4-timelapse %(movie_basename)s", "Invert control": "\u05d4\u05e4\u05d5\u05da \u05e9\u05dc\u05d9\u05d8\u05d4", "Webcam": "\u05de\u05e6\u05dc\u05de\u05ea \u05e8\u05e9\u05ea", "Remember me": "\u05d6\u05db\u05d5\u05e8 \u05d0\u05d5\u05ea\u05d9", "Enable GCode Visualizer": "\u05d4\u05e4\u05e2\u05dc \u05d5\u05d9\u05d6\u05d5\u05d0\u05dc\u05d9\u05d6\u05e6\u05d9\u05d4 \u05e9\u05dc GCode", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "\u05e0\u05e8\u05d0\u05d4 \u05e9\u05d4\u05e9\u05e8\u05ea \u05dc\u05d0 \u05de\u05d7\u05d5\u05d1\u05e8, \u05d0\u05d5 \u05dc\u05e4\u05d7\u05d5\u05ea \u05d0\u05e0\u05d9 \u05dc\u05d0 \u05de\u05e6\u05dc\u05d9\u05d7 \u05dc\u05e7\u05d1\u05dc \u05db\u05dc \u05ea\u05d2\u05d5\u05d1\u05d4 \u05de\u05de\u05e0\u05d5. \u05d0\u05e0\u05e1\u05d4 \u05dc\u05d4\u05ea\u05d7\u05d1\u05e8 \u05de\u05d7\u05d3\u05e9 \u05d0\u05d5\u05d8\u05d5\u05de\u05d8\u05d9\u05ea <strong>\u05d1\u05e2\u05d5\u05d3 \u05de\u05e1\u05e4\u05e8 \u05d3\u05e7\u05d5\u05ea</strong>, \u05d0\u05d1\u05dc \u05e0\u05d9\u05ea\u05df \u05d2\u05dd \u05dc\u05e0\u05e1\u05d5\u05ea \u05dc\u05d4\u05ea\u05d7\u05d1\u05e8 \u05de\u05d7\u05d3\u05e9 \u05e2\u05dd \u05d4\u05db\u05e4\u05ea\u05d5\u05e8 \u05dc\u05d4\u05dc\u05df.", "Rendering failed": "\u05e8\u05d9\u05e0\u05d3\u05d5\u05e8 \u05e0\u05db\u05e9\u05dc", "Upload Folder": "\u05ea\u05e7\u05d9\u05d9\u05ea \u05d4\u05e2\u05dc\u05d0\u05d4", "descending": "\u05e1\u05d3\u05e8 \u05d9\u05d5\u05e8\u05d3", "X": "X", "Add user": "\u05d4\u05d5\u05e1\u05e3 \u05de\u05e9\u05ea\u05de\u05e9", "GCODE commands in layer": "\u05e4\u05e7\u05d5\u05d3\u05d5\u05ea GCODE \u05d1\u05e9\u05db\u05d1\u05d4", "Estimated print time": "\u05d6\u05de\u05df \u05d4\u05d3\u05e4\u05e1\u05d4 \u05de\u05e9\u05d5\u05e2\u05e8", "Serial Connection": "\u05d7\u05d9\u05d1\u05d5\u05e8 \u05d8\u05d5\u05e8\u05d9", "Control": "\u05e9\u05dc\u05d9\u05d8\u05d4", "Password": "\u05e1\u05d9\u05e1\u05de\u05d4", "Also show next layer": "\u05d0\u05e4\u05e9\u05e8 \u05d4\u05e6\u05d2\u05d4 \u05e9\u05dc \u05e9\u05db\u05d1\u05d4 \u05d4Line truncated
|
window.BABEL_TO_LOAD_he = {"locale": "he", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-12-18 14:45+0100\nPO-Revision-Date: 2014-12-18 14:04+0000\nLast-Translator: Gina H\u00e4u\u00dfge <gina@foosel.net>\nLanguage-Team: Hebrew (http://www.transifex.com/projects/p/octoprint/language/he/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "\u05d6\u05de\u05df \u05d4\u05d3\u05e4\u05e1\u05d4 \u05e0\u05d5\u05ea\u05e8", "sec": "\u05e9\u05e0'", "Proceed": "\u05d4\u05de\u05e9\u05da", "Timelapse Temp Folder": "\u05ea\u05e7\u05d9\u05d9\u05d4 \u05d6\u05de\u05e0\u05d9\u05ea \u05dc-timelapse", "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> target temperature format": "\u05ea\u05de\u05d5\u05da \u05e2\u05d1\u05d5\u05e8 <code>TargetExtr%%n</code>/<code>TargetBed</code> \u05e4\u05d5\u05e8\u05de\u05d8 \u05d8\u05de\u05e4\u05e8\u05d8\u05d5\u05e8\u05ea \u05d9\u05d9\u05e2\u05d3", "Upload Folder": "\u05ea\u05e7\u05d9\u05d9\u05ea \u05d4\u05e2\u05dc\u05d0\u05d4", "Only show files stored locally": "\u05d4\u05e6\u05d2 \u05e8\u05e7 \u05e7\u05d1\u05e6\u05d9\u05dd \u05d4\u05e9\u05de\u05d5\u05e8\u05d9\u05dd \u05de\u05e7\u05d5\u05de\u05d9\u05ea", "Add Printer Profile": "", "yellow": "\u05e6\u05d4\u05d5\u05d1", "Save": "\u05e9\u05de\u05d5\u05e8", "Action": "\u05e4\u05e2\u05d5\u05dc\u05d4", "Passwords do not match": "\u05e1\u05d9\u05e1\u05de\u05d0\u05d5\u05ea \u05dc\u05d0 \u05ea\u05d5\u05d0\u05de\u05d5\u05ea", "Sort by name": "\u05de\u05d9\u05d9\u05df \u05dc\u05e4\u05d9 \u05e9\u05dd", "Save connection settings": "\u05e9\u05de\u05d5\u05e8 \u05d4\u05d2\u05d3\u05e8\u05d5\u05ea \u05d7\u05d9\u05d1\u05d5\u05e8", "Rendering timelapse": "\u05de\u05e8\u05e0\u05d3\u05e8 timelapse", "Color": "\u05e6\u05d1\u05e2", "Temperature": "\u05d8\u05de\u05e4\u05e8\u05d8\u05d5\u05e8\u05d4", "Files": "\u05e7\u05d1\u05e6\u05d9\u05dd", "Resume": "", "Always assume SD card is present": "\u05ea\u05de\u05d9\u05d3 \u05ea\u05e0\u05d9\u05d7 \u05e9\u05db\u05e8\u05d8\u05d9\u05e1 SD \u05e0\u05de\u05e6\u05d0", "Load and Print": "\u05d8\u05e2\u05df \u05d5\u05d4\u05d3\u05e4\u05e1", "Sending file to SD": "\u05e9\u05d5\u05dc\u05d7 \u05e7\u05d5\u05d1\u05e5 \u05d0\u05dc SD", "Number of Extruders": "\u05de\u05e1\u05e4\u05e8 \u05d0\u05e7\u05e1\u05d8\u05e8\u05d5\u05d3\u05e8\u05d9\u05dd", "black": "\u05e9\u05d7\u05d5\u05e8", "Last Printed": "\u05d4\u05d5\u05d3\u05e4\u05e1 \u05dc\u05d0\u05d7\u05e8\u05d5\u05e0\u05d4", "Sourcecode": "\u05e7\u05d5\u05d3 \u05de\u05e7\u05d5\u05e8", "Estimated layer height": "\u05d2\u05d5\u05d1\u05d4 \u05e9\u05db\u05d1\u05d5\u05ea \u05de\u05e9\u05d5\u05e2\u05e8", "You are now logged out": "\u05d4\u05ea\u05e0\u05ea\u05e7\u05ea \u05de\u05d4\u05de\u05e2\u05e8\u05db\u05ea", "Uploaded": "\u05d4\u05d5\u05e2\u05dc\u05d4", "Form Factor": "", "Opening serial port": "\u05e4\u05d5\u05ea\u05d7 \u05d9\u05e6\u05d9\u05e8\u05d4 \u05d8\u05d5\u05e8\u05d9\u05ea", "New timelapse %(movie_basename)s is done rendering.": "\u05e1\u05d9\u05d9\u05dd \u05dc\u05e8\u05e0\u05d3\u05e8 \u05d0\u05ea \u05d4-timelapse %(movie_basename)s", "Invert control": "\u05d4\u05e4\u05d5\u05da \u05e9\u05dc\u05d9\u05d8\u05d4", "Webcam": "\u05de\u05e6\u05dc\u05de\u05ea \u05e8\u05e9\u05ea", "Select for printing": "", "Allow <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>": "\u05d0\u05e4\u05e9\u05e8 <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>", "Remember me": "\u05d6\u05db\u05d5\u05e8 \u05d0\u05d5\u05ea\u05d9", "Enable GCode Visualizer": "\u05d4\u05e4\u05e2\u05dc \u05d5\u05d9\u05d6\u05d5\u05d0\u05dc\u05d9\u05d6\u05e6\u05d9\u05d4 \u05e9\u05dc GCode", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "\u05e0\u05e8\u05d0\u05d4 \u05e9\u05d4\u05e9\u05e8\u05ea \u05dc\u05d0 \u05de\u05d7\u05d5\u05d1\u05e8, \u05d0\u05d5 \u05dc\u05e4\u05d7\u05d5\u05ea \u05d0\u05e0\u05d9 \u05dc\u05d0 \u05de\u05e6\u05dc\u05d9\u05d7 \u05dc\u05e7\u05d1\u05dc \u05db\u05dc \u05ea\u05d2\u05d5\u05d1\u05d4 \u05de\u05de\u05e0\u05d5. \u05d0\u05e0\u05e1\u05d4 \u05dc\u05d4\u05ea\u05d7\u05d1\u05e8 \u05de\u05d7\u05d3\u05e9 \u05d0\u05d5\u05d8\u05d5\u05de\u05d8\u05d9\u05ea <strong>\u05d1\u05e2\u05d5\u05d3 \u05de\u05e1\u05e4\u05e8 \u05d3\u05e7\u05d5\u05ea</strong>, \u05d0\u05d1\u05dc \u05e0\u05d9\u05ea\u05df \u05d2\u05dd \u05dc\u05e0\u05e1\u05d5\u05ea \u05dc\u05d4\u05ea\u05d7\u05d1\u05e8 \u05de\u05d7\u05d3\u05e9 \u05e2\u05dd \u05d4\u05db\u05e4\u05ea\u05d5\u05e8 \u05dc\u05d4\u05dc\u05df.", "Rendering failed": "\u05e8\u05d9\u05e0\u05d3\u05d5\u05e8 \u05e0\u05db\u05e9\u05dc", "Motors off": "\u05db\u05d1\u05d4 \u05de\u05e0\u05d5\u05e2\u05d9\u05dd", "descending": "\u05eLine truncated
|
||||||
@@ -1 +1 @@
|
|||||||
window.BABEL_TO_LOAD_nl = {"locale": "nl", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-08-28 15:52+0200\nPO-Revision-Date: 2014-09-01 20:11+0000\nLast-Translator: leon.bek <leon.bek@gmail.com>\nLanguage-Team: Dutch (http://www.transifex.com/projects/p/octoprint/language/nl/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Resterende print tijd", "Proceed": "Verder", "Timelapse Temp Folder": "Tijdelijke timelapse map", "Title": "Titel", "Only show files stored locally": "Laat alleen lokale bestanden zien", "yellow": "geel", "Path to Cura": "Lokatie van Cura", "Action": "Actie", "Passwords do not match": "Wachtwoorden komen niet overeen", "Sort by name": "Sorteer op naam", "Save connection settings": "Verbindings instellingen opslaan", "Rendering timelapse": "Renderen van timelapse", "Cura": "Cura", "Files": "Bestanden", "Bed Size": "Platform grootte", "Always assume SD card is present": "Neem aan dat SD kaart altijd aanwezig is", "Load and Print": "Laad en print", "Sending file to SD": "Verstuur bestand naar SD", "Number of Extruders": "Aantal Extruders", "black": "zwart", "Last Printed": "Laats geprint", "Sourcecode": "Broncode", "Estimated layer height": "Geschatte laag hooge", "You are now logged out": "Je bent nu uitgelogd", "Uploaded": "Geupload", "Opening serial port": "Openen van seri\u00eble poort", "New timelapse %(movie_basename)s is done rendering.": "Nieuwe timelapse %(movie_basename)s is gereed", "Invert control": "Bedieining spiegelen", "Webcam": "Webcam", "Remember me": "Onthoud me", "Enable GCode Visualizer": "Schakel GCode Visualizer in", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "De server lijkt offline te zijn, dat wil zeggen dat ik er geen reactie van krijg. Ik zal proberen om <strong>gedurende een paar minuten</strong> opnieuw te verbinden. Maar je bent op elk moment vrij om handmatig proberen te verbinden met onderstaande knop.", "Rendering failed": "Renderen mislukt", "Upload Folder": "Lokatie voor Uploads", "descending": "Aflopend", "X": "X", "Add user": "Gebruiker toevoegen", "GCODE commands in layer": "GCODE commando's in laag", "Estimated print time": "Geschatte print tijd", "Serial Connection": "Seri\u00eble verbinding", "Control": "Controle", "Password": "Wachtwoord", "Also show next layer": "Laat ook volgende laag zien", "Print Time": "Print tijd", "Sort by file size": "Sorteer op bestands grootte", "Machine State": "Machine status", "default": "Standaard", "API": "API", "Printing from SD": "Printen vanaf SD", "Terminal filters": "Terminal filters", "Change password for user \"%(user)s\"": "Verander wachtwoord voor gebruiker \"%(user)s\"", "Enable Temperature Graph": "Schakel temperatuur grafiek in", "Delete user": "Gebruiker verwijderen", "Confirm Password": "Bevestig wachtwoord", "Disconnect": "Verbreken", "Slicing done": "Slicing klaar", "Initialize SD card": "Formateer SD kaart", "System": "Systeem", "Send": "Verstuur", "State": "Status", "Version": "Versie", "YYYY-MM-DD HH:mm": "DD-MM-YYYY HH:mm", "Attempt to reconnect": "Probeer opnieuw te verbinden", "Streaming done": "Streaming klaar", "violet": "violet", "Print": "Print", "Layer count": "Aantal lagen", "OctoPrint Settings": "OctoPrint instellingen", "Are you sure?": "Weet je het zeker?", "blue": "blauw", "Printer": "Printer", "Tool": "Gereedschap", "Settings": "Instellingen", "Path to FFMPEG": "Lokatie van FFMPEG", "Upload to SD": "Uploaden naar SD", "The command \"%(command)s\" could not be executed.": "Het commando \"%(command)s\" kon niet uitgevoerd worden.", "Printed": "Geprint", "Layer number": "Laag nummer", "Sync with job progress": "Synchroniseer met taak voortgang", "Circular": "Cirkelvormig", "Total filament used": "Totaal gebruikte filament", "red": "rood", "Save as default": "Stel in als standaard", "Slicing ...": "Slicing ...", "Last Print Time": "Laatste print tijd", "Target": "Doel", "Streaming ...": "Streaming ...", "Logout successful": "Uitloggen succesvol", "Now rendering timelapse %(movie_basename)s": "Aan het renderen van timelapse %(movie_basename)s", "Documentation": "Documentatie", "%(hour)02d:%(minute)02d:%(second)02d": "%(hour)02d:%(minute)02d:%(second)02d", "Upload": "Upload", "ascending": "Oplopend", "Model size": "Model grootte", "Temperatures": "Temperaturen", "visited": "bezocht", "Timed": "Getimed", "Edit user \"%(user)s\"": "Bewerk gebruiker \"%(user)s\"", "Snapshot URL": "Snapshot URL", "Release SD card": "Geef SD kaart vrij", "Server is offline": "Server is offline", "Log communication to serial.log (might negatively impact
Line truncated
|
window.BABEL_TO_LOAD_nl = {"locale": "nl", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-12-18 14:45+0100\nPO-Revision-Date: 2014-12-18 14:04+0000\nLast-Translator: Gina H\u00e4u\u00dfge <gina@foosel.net>\nLanguage-Team: Dutch (http://www.transifex.com/projects/p/octoprint/language/nl/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Resterende print tijd", "sec": "sec", "Proceed": "Doorgaan", "Timelapse Temp Folder": "Tijdelijke timelapse map", "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> target temperature format": "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> target temperature format", "Upload Folder": "Lokatie voor Uploads", "Only show files stored locally": "Laat alleen lokale bestanden zien", "Add Printer Profile": "", "yellow": "geel", "Save": "Opslaan", "Action": "Actie", "Passwords do not match": "De wachtwoorden komen niet overeen", "Sort by name": "Sorteer op naam", "Save connection settings": "Verbindings instellingen opslaan", "Rendering timelapse": "Renderen van timelapse", "Color": "Kleur", "Temperature": "Temperatuur", "Files": "Bestanden", "Resume": "Ga verder", "Always assume SD card is present": "Neem aan dat SD kaart altijd aanwezig is", "Load and Print": "Laad en print", "Sending file to SD": "Verstuur bestand naar SD kaartje", "Number of Extruders": "Aantal Extruders", "black": "zwart", "Last Printed": "Vorige print-job", "Sourcecode": "Broncode", "Estimated layer height": "Geschatte laag hooge", "You are now logged out": "Je bent nu uitgelogd", "Uploaded": "Geupload", "Form Factor": "", "Opening serial port": "Openen van seri\u00eble poort", "New timelapse %(movie_basename)s is done rendering.": "Nieuwe timelapse %(movie_basename)s is gerenderd", "Invert control": "Bedieining spiegelen", "Webcam": "Webcam", "Select for printing": "", "Allow <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>": "Sta <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a> toe", "Remember me": "Onthoud me", "Enable GCode Visualizer": "Schakel GCode Visualizer in", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "De server lijkt offline te zijn, althans er komt geen enkele reactie. Ik zal over <strong>een paar minuten</strong> opnieuw pogen te verbinden. Je kunt op elk moment met onderstaande knop 'handmatig' proberen te verbinden", "Rendering failed": "Renderen mislukt", "Motors off": "Motoren uit", "descending": "Aflopend", "Only show files stored on SD": "Laat alleen bestanden op SD-kaart zien", "X": "X", "Add user": "Gebruiker toevoegen", "GCODE commands in layer": "GCODE commando's in laag", "Estimated print time": "Geschatte print tijd", "Serial Connection": "Seri\u00eble verbinding", "Control": "Controle", "Password": "Wachtwoord", "Also show next layer": "Laat ook volgende laag zien", "Print Time": "Print tijd", "Slicer": "'Slicer' of fileersoftware", "Nozzle Diameter": "", "Sort by file size": "Sorteer op bestands grootte", "Machine State": "Machine status", "Slicing Profile": "Fileer profiel", "mm": "mm", "API": "API", "Printing from SD": "Printen vanaf SD kaartje", "Stream URL": "Stream URL", "Terminal filters": "Terminal filters", "Change password for user \"%(user)s\"": "Verander wachtwoord voor gebruiker \"%(user)s\"", "Enable Temperature Graph": "Schakel temperatuur grafiek in", "Delete user": "Gebruiker verwijderen", "Timelapse bitrate": "Timelapse bitrate", "Confirm Password": "Bevestig wachtwoord", "Disconnect": "Verbreken", "Slicing done": "Fileren is klaar", "Initialize SD card": "Formateer SD kaart", "System": "Systeem", "Send": "Verstuur", "State": "Status", "Version": "Versie", "YYYY-MM-DD HH:mm": "DD-MM-YYYY HH:mm", "Attempt to reconnect": "Probeer opnieuw te verbinden", "Streaming done": "Het Streamen is klaar", "violet": "violet", "Print": "Print", "Layer count": "Aantal lagen", "OctoPrint Settings": "OctoPrint instellingen", "Are you sure?": "Weet je het zeker?", "blue": "blauw", "Printer": "Printer", "Delete Profile": "", "Tool": "Gereedschap", "Settings": "Instellingen", "Circular": "Cirkelvormig", "Path to FFMPEG": "Lokatie van FFMPEG", "Upload to SD": "opslaan op SD-kaart ", "The command \"%(command)s\" could not be executed.": "Het commando \"%(command)s\" kon niet uitgevoerd worden.", "Select a slicing profile...": "", "Wait for <code>start</code> on connect": "Wacht voor <code>start</code> bij het verbinden", "Sync with job progress": "Synchroniseer met taak voortgang", "Calculating...": "", "Total filament used": "Totaal gebruikte filament", "red": "rood", "Save as default":
Line truncated
|
||||||
@@ -1 +1 @@
|
|||||||
window.BABEL_TO_LOAD_no = {"locale": "nb_NO", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-08-28 15:52+0200\nPO-Revision-Date: 2014-09-03 16:07+0000\nLast-Translator: lobster2b <ch.eikefjord@gmail.com>\nLanguage-Team: Norwegian (http://www.transifex.com/projects/p/octoprint/language/no/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Gjenst\u00e5ende utskriftstid", "Proceed": "Fortsett", "Timelapse Temp Folder": "Timelapse midlertidig mappe", "Title": "Tittel", "Only show files stored locally": "Bare vis filer lagret lokalt", "yellow": "gul", "Path to Cura": "Sti til Cura", "Action": "Handling", "Passwords do not match": "Passordet er ikke likt", "Sort by name": "Sorter ved navn", "Save connection settings": "Lagre tilkoblingsinnstillinger", "Rendering timelapse": "Sammensetter timelapse", "Cura": "Cura", "Files": "Filer", "Bed Size": "Plattformst\u00f8rrelse", "Always assume SD card is present": "Alltid anta at minnekort er p\u00e5 plass", "Load and Print": "Last og skriv ut", "Sending file to SD": "Sender fil til minnekort", "Number of Extruders": "Antall dyser", "black": "svart", "Last Printed": "Sist utskrevet", "Sourcecode": "Kildekode", "Estimated layer height": "Estimert lagh\u00f8yde", "You are now logged out": "Du er n\u00e5 logget ut", "Uploaded": "Opplastet", "Opening serial port": "\u00c5pner serialport", "New timelapse %(movie_basename)s is done rendering.": "Ny timelapse for %(movie_basename)s er ferdig sammensatt", "Invert control": "Inverter kontroller", "Webcam": "Nettkamera", "Remember me": "Husk meg", "Enable GCode Visualizer": "Aktiver GCode framviser", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Serveren er tilsynelatende frakoblet, i det minste f\u00e5r jeg ikke noen respons fra den. Jeg pr\u00f8ver \u00e5 koble til automatisk <strong>over de neste minuttene</strong>, du kan pr\u00f8ve en manuell oppkobling n\u00e5r du \u00f8nsker det ved \u00e5 bruke knappen nedenfor.", "Rendering failed": "Sammensetting feilet", "Upload Folder": "Opplastningsmappe", "descending": "synkende", "X": "X", "Add user": "Legg til bruker", "GCODE commands in layer": "GCODE kommandoer i lag", "Estimated print time": "Beregnet printtid", "Serial Connection": "Seriell kontakt", "Control": "Kontroll", "Password": "Passord", "Also show next layer": "Ogs\u00e5 vis neste lag", "Print Time": "Utskriftstid", "Sort by file size": "Sorter filer etter st\u00f8rrelse", "Machine State": "Maskintilstand", "default": "standard", "API": "API", "Printing from SD": "Utskrift fra minnekort", "Terminal filters": "Terminal filtre", "Change password for user \"%(user)s\"": "Endre passord for bruker \"%(user)s\"", "Enable Temperature Graph": "Aktiver temperaturgraf", "Delete user": "Slett bruker", "Confirm Password": "Bekreft passord", "Disconnect": "Koble fra", "Slicing done": "Slicing ferdig", "Initialize SD card": "Start minnekortet", "System": "System", "Send": "Send", "State": "Tilstand", "Version": "Versjon", "YYYY-MM-DD HH:mm": "YYYY-MM-DD HH:mm", "Attempt to reconnect": "Fors\u00f8k \u00e5 koble til p\u00e5 nytt", "Streaming done": "Streaming ferdig", "violet": "fiolett", "Print": "Utskriv", "Layer count": "Antall lag", "OctoPrint Settings": "OctoPrint innstillinger", "Are you sure?": "Er du sikker?", "blue": "bl\u00e5", "Printer": "Printer", "Tool": "Verkt\u00f8y", "Settings": "Innstillinger", "Path to FFMPEG": "Sti til FFMPEG", "Upload to SD": "Last opp til minnekort", "The command \"%(command)s\" could not be executed.": "Kommando \"%(command)s\" mislykkes", "Printed": "Utskrevet", "Layer number": "Lag nummer", "Sync with job progress": "Synkroniser med jobbprogresjon", "Circular": "Sirkul\u00e6r", "Total filament used": "Totalt tr\u00e5dforbruk", "red": "r\u00f8d", "Save as default": "Lagre som standard", "Slicing ...": "Slicing ...", "Last Print Time": "Siste utskriftstid", "Target": "M\u00e5l", "Streaming ...": "Streaming ...", "Logout successful": "Logg ut vellykket", "Now rendering timelapse %(movie_basename)s": "Sammensetter timelapse %(movie_basename)s", "Documentation": "Dokumentasjon", "%(hour)02d:%(minute)02d:%(second)02d": "%(hour)02d:%(minute)02d:%(second)02d", "Upload": "Last opp", "ascending": "stigende", "Model size": "Modellst\u00f8rrelse", "Temperatures": "Temperaturer", "visited": "bes\u00f8kt", "Timed": "Tidtakes", "Edit user \"%(user)s\"": "Endre bruker \"%(user)s\"", "Snapshot URL": "Hurtigbilde URL", "Release SD card": "L\u00f8s ut minnekort", "Server is offline": "Server er frakoblet", "Log communication to serial.log (might negatively imLine truncated
|
window.BABEL_TO_LOAD_no = {"locale": "nb_NO", "domain": "messages", "plural_expr": "(n != 1)", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-12-18 14:45+0100\nPO-Revision-Date: 2014-12-18 14:04+0000\nLast-Translator: Gina H\u00e4u\u00dfge <gina@foosel.net>\nLanguage-Team: Norwegian (http://www.transifex.com/projects/p/octoprint/language/no/)\nPlural-Forms: nplurals=2; plural=(n != 1)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Gjenst\u00e5ende utskriftstid", "sec": "sek", "Proceed": "Fortsett", "Timelapse Temp Folder": "Timelapse midlertidig mappe", "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> target temperature format": "St\u00f8tte <code>TargetExtr%%n</code>/<code>TargetBed</code> m\u00e5l temperatur format", "Upload Folder": "Opplastningsmappe", "Only show files stored locally": "Bare vis filer lagret lokalt", "Add Printer Profile": "", "yellow": "gul", "Save": "Lagre", "Action": "Handling", "Passwords do not match": "Passordet er ikke likt", "Sort by name": "Sorter ved navn", "Save connection settings": "Lagre tilkoblingsinnstillinger", "Rendering timelapse": "Sammensetter timelapse", "Color": "Farge", "Temperature": "Temperatur", "Files": "Filer", "Resume": "Fortsett", "Always assume SD card is present": "Alltid anta at minnekort er p\u00e5 plass", "Load and Print": "Last og skriv ut", "Sending file to SD": "Sender fil til minnekort", "Number of Extruders": "Antall dyser", "black": "svart", "Last Printed": "Sist utskrevet", "Sourcecode": "Kildekode", "Estimated layer height": "Estimert lagh\u00f8yde", "You are now logged out": "Du er n\u00e5 logget ut", "Uploaded": "Opplastet", "Form Factor": "", "Opening serial port": "\u00c5pner serialport", "New timelapse %(movie_basename)s is done rendering.": "Ny timelapse for %(movie_basename)s er ferdig sammensatt", "Invert control": "Inverter kontroller", "Webcam": "Nettkamera", "Select for printing": "", "Allow <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>": "Tillat <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>", "Remember me": "Husk meg", "Enable GCode Visualizer": "Aktiver GCode framviser", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Serveren er tilsynelatende frakoblet, i det minste f\u00e5r jeg ikke noen respons fra den. Jeg pr\u00f8ver \u00e5 koble til automatisk <strong>over de neste minuttene</strong>, du kan pr\u00f8ve en manuell oppkobling n\u00e5r du \u00f8nsker det ved \u00e5 bruke knappen nedenfor.", "Rendering failed": "Sammensetting feilet", "Motors off": "Motorer av", "descending": "synkende", "Only show files stored on SD": "Bare vis filer lagret p\u00e5 minnekortet", "X": "X", "Add user": "Legg til bruker", "GCODE commands in layer": "GCODE kommandoer i lag", "Estimated print time": "Beregnet printtid", "Serial Connection": "Seriell kontakt", "Control": "Kontroll", "Password": "Passord", "Also show next layer": "Ogs\u00e5 vis neste lag", "Print Time": "Utskriftstid", "Slicer": "Slicer", "Nozzle Diameter": "", "Sort by file size": "Sorter filer etter st\u00f8rrelse", "Machine State": "Maskintilstand", "Slicing Profile": "Slicer profil", "mm": "mm", "API": "API", "Printing from SD": "Utskrift fra minnekort", "Stream URL": "Str\u00f8m URL", "Terminal filters": "Terminal filtre", "Change password for user \"%(user)s\"": "Endre passord for bruker \"%(user)s\"", "Enable Temperature Graph": "Aktiver temperaturgraf", "Delete user": "Slett bruker", "Timelapse bitrate": "Timelapse bitrate", "Confirm Password": "Bekreft passord", "Disconnect": "Koble fra", "Slicing done": "Slicing ferdig", "Initialize SD card": "Start minnekortet", "System": "System", "Send": "Send", "State": "Tilstand", "Version": "Versjon", "YYYY-MM-DD HH:mm": "YYYY-MM-DD HH:mm", "Attempt to reconnect": "Fors\u00f8k \u00e5 koble til p\u00e5 nytt", "Streaming done": "Str\u00f8mming ferdig", "violet": "fiolett", "Print": "Utskriv", "Layer count": "Antall lag", "OctoPrint Settings": "OctoPrint innstillinger", "Are you sure?": "Er du sikker?", "blue": "bl\u00e5", "Printer": "Printer", "Delete Profile": "", "Tool": "Verkt\u00f8y", "Settings": "Innstillinger", "Circular": "Sirkul\u00e6r", "Path to FFMPEG": "Sti til FFMPEG", "Upload to SD": "Last opp til minnekort", "The command \"%(command)s\" could not be executed.": "Kommando \"%(command)s\" mislykkes", "Select a slicing profile...": "", "Wait for <code>start</code> on connect": "Vent for <code>start</code> p\u00e5 tilkobling", "Sync with job progress": "Synkroniser med jobbprogresjon", "Calculating...": "", "Total filament used": "Totalt tr\u00e5dforbruk", "red": "r\u00f8d", "Save as default": "Lagre som standard", "SlicingLine truncated
|
||||||
@@ -1 +1 @@
|
|||||||
window.BABEL_TO_LOAD_ro = {"locale": "ro", "domain": "messages", "plural_expr": "(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1))", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-08-28 15:52+0200\nPO-Revision-Date: 2014-08-31 16:21+0000\nLast-Translator: 3Dmaker4U <3dmaker4u@gmail.com>\nLanguage-Team: Romanian (http://www.transifex.com/projects/p/octoprint/language/ro/)\nPlural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1))\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Timp de imprimare r\u0103mas", "Proceed": "Continuare", "Timelapse Temp Folder": "Director temporar pentru \u00eenregistrarea rapid\u0103", "Title": "Titlu", "Only show files stored locally": "Arat\u0103 doar fi\u0219ierele stocate local", "yellow": "galben", "Path to Cura": "Cale c\u0103tre Cura", "Action": "Ac\u021biune", "Passwords do not match": "Parolele nu se potrivesc", "Sort by name": "Sortare dup\u0103 nume", "Save connection settings": "Salvare configura\u021bie conexiune", "Rendering timelapse": "Redare \u00eenregistrare rapid\u0103", "Cura": "Cura", "Files": "Fi\u0219iere", "Bed Size": "M\u0103rime mas\u0103", "Always assume SD card is present": "Consider\u0103 \u00eentotdeauna cardul SD prezent", "Load and Print": "\u00cenc\u0103rcare \u0219i imprimare", "Sending file to SD": "Se transmite fi\u0219ierul c\u0103tre SD", "Number of Extruders": "Num\u0103r de extrudere", "black": "negru", "Last Printed": "Ultima dat\u0103 imprimat", "Sourcecode": "Cod surs\u0103", "Estimated layer height": "\u00cen\u0103l\u021bimea stratului estimat\u0103", "You are now logged out": "Acum e\u0219ti deconectat", "Uploaded": "\u00cenc\u0103rcat", "Opening serial port": "Se deschide portul serial", "New timelapse %(movie_basename)s is done rendering.": "Redarea noii \u00eenregistr\u0103ri rapide %(movie_basename)s s-a terminat.", "Invert control": "Inversare comand\u0103", "Webcam": "Webcam", "Remember me": "\u021aine-m\u0103 minte", "Enable GCode Visualizer": "Activeaz\u0103 vizualizarea GCode", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Se pare c\u0103 serverul nu este connectat sau, cel pu\u021bin, mie nu-mi r\u0103spunde. Voi \u00eencerca s\u0103 m\u0103 reconectez automat <strong>\u00een urm\u0103toarele dou\u0103 minute</strong>, dar po\u021bi \u00eencerca oric\u00e2nd s\u0103 te reconectezi manual utiliz\u00e2nd butonul de mai jos.", "Rendering failed": "Redarea a e\u0219uat", "Upload Folder": "\u00cencarc\u0103 director", "descending": "descresc\u0103tor", "X": "X", "Add user": "Ad\u0103ugare utilizator", "GCODE commands in layer": "comenzi GCODE \u00een strat", "Estimated print time": "Timp de imprimare estimat", "Serial Connection": "Conexiune serial\u0103", "Control": "Control", "Password": "Parol\u0103", "Also show next layer": "Vizualizare strat urm\u0103tor", "Print Time": "Timp de imprimare", "Sort by file size": "Sortare dup\u0103 m\u0103rimea fi\u0219ierului", "Machine State": "Starea ma\u0219inii", "default": "implicit", "API": "API", "Printing from SD": "Se imprim\u0103 de pe SD", "Terminal filters": "Filtre pentru terminal", "Change password for user \"%(user)s\"": "Modificare parol\u0103 pentru utilizatorul \"%(user)s\"", "Enable Temperature Graph": "Activeaz\u0103 graficul temperaturii", "Delete user": "\u0218tergere utilizator", "Confirm Password": "Confirmare parol\u0103", "Disconnect": "Deconectare", "Slicing done": "Feliere terminat\u0103", "Initialize SD card": "Ini\u021bializare card SD", "System": "Sistem", "Send": "Trimitere", "State": "Stare", "Version": "Versiune", "YYYY-MM-DD HH:mm": "DD.MM.YYYY HH.mm", "Attempt to reconnect": "\u00cencercare de reconectare", "Streaming done": "Transmiterea s-a terminat", "violet": "violet", "Print": "Imprimare", "Layer count": "Num\u0103r de straturi", "OctoPrint Settings": "Configurare OctoPrint", "Are you sure?": "E\u0219ti sigur?", "blue": "albastru", "Printer": "Imprimant\u0103", "Tool": "Unealt\u0103", "Settings": "Configura\u021bii", "Path to FFMPEG": "Cale c\u0103tre FFMPEG", "Upload to SD": "\u00cenc\u0103rcare pe SD", "The command \"%(command)s\" could not be executed.": "Comanda \"%(command)s\" nu a putut fi executat\u0103.", "Printed": "Imprimat", "Layer number": "Num\u0103rul stratului", "Sync with job progress": "Sincronizare cu stadiul lucr\u0103rii", "Circular": "Circular", "Total filament used": "Filament utilizat \u00een total", "red": "ro\u0219u", "Save as default": "Salvare ca valori implicite", "Slicing ...": "Se feliaz\u0103...", "Last Print Time": "Ultima imprimare a durat", "Target": "\u021aint\u0103", "Streaming ...": "Se transmite...", "Logout successful": "DecoLine truncated
|
window.BABEL_TO_LOAD_ro = {"locale": "ro", "domain": "messages", "plural_expr": "(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1))", "messages": {"": "Project-Id-Version: OctoPrint\nReport-Msgid-Bugs-To: i18n@octoprint.org\nPOT-Creation-Date: 2014-12-18 14:45+0100\nPO-Revision-Date: 2014-12-18 14:04+0000\nLast-Translator: Gina H\u00e4u\u00dfge <gina@foosel.net>\nLanguage-Team: Romanian (http://www.transifex.com/projects/p/octoprint/language/ro/)\nPlural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1))\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\nGenerated-By: Babel 1.3\n", "Print Time Left": "Timp de imprimare r\u0103mas", "sec": "sec", "Proceed": "Continuare", "Timelapse Temp Folder": "Director temporar pentru \u00eenregistrarea rapid\u0103", "Support <code>TargetExtr%%n</code>/<code>TargetBed</code> target temperature format": "Sus\u021bine formatul <code>TargetExtr%%n</code>/<code>TargetBed</code> pentru temperatura \u021bint\u0103", "Upload Folder": "\u00cencarc\u0103 director", "Only show files stored locally": "Arat\u0103 doar fi\u0219ierele stocate local", "Add Printer Profile": "", "yellow": "galben", "Save": "Salvare", "Action": "Ac\u021biune", "Passwords do not match": "Parolele nu se potrivesc", "Sort by name": "Sortare dup\u0103 nume", "Save connection settings": "Salvare configura\u021bie conexiune", "Rendering timelapse": "Redare \u00eenregistrare rapid\u0103", "Color": "Culoare", "Temperature": "Temperatur\u0103", "Files": "Fi\u0219iere", "Resume": "", "Always assume SD card is present": "Consider\u0103 \u00eentotdeauna cardul SD prezent", "Load and Print": "\u00cenc\u0103rcare \u0219i imprimare", "Sending file to SD": "Se transmite fi\u0219ierul c\u0103tre SD", "Number of Extruders": "Num\u0103r de extrudere", "black": "negru", "Last Printed": "Ultima dat\u0103 imprimat", "Sourcecode": "Cod surs\u0103", "Estimated layer height": "\u00cen\u0103l\u021bimea stratului estimat\u0103", "You are now logged out": "Acum e\u0219ti deconectat", "Uploaded": "\u00cenc\u0103rcat", "Form Factor": "", "Opening serial port": "Se deschide portul serial", "New timelapse %(movie_basename)s is done rendering.": "Redarea noii \u00eenregistr\u0103ri rapide %(movie_basename)s s-a terminat.", "Invert control": "Inversare comand\u0103", "Webcam": "Webcam", "Select for printing": "", "Allow <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>": "Permite <a href=\"%(url)s\">Cross Origin Resource Sharing (CORS)</a>", "Remember me": "\u021aine-m\u0103 minte", "Enable GCode Visualizer": "Activeaz\u0103 vizualizarea GCode", "The server appears to be offline, at least I'm not getting any response from it. I'll try to reconnect automatically <strong>over the next couple of minutes</strong>, however you are welcome to try a manual reconnect anytime using the button below.": "Se pare c\u0103 serverul nu este connectat sau, cel pu\u021bin, mie nu-mi r\u0103spunde. Voi \u00eencerca s\u0103 m\u0103 reconectez automat <strong>\u00een urm\u0103toarele dou\u0103 minute</strong>, dar po\u021bi \u00eencerca oric\u00e2nd s\u0103 te reconectezi manual utiliz\u00e2nd butonul de mai jos.", "Rendering failed": "Redarea a e\u0219uat", "Motors off": "Oprire motoare", "descending": "descresc\u0103tor", "Only show files stored on SD": "Arat\u0103 doar fi\u0219ierele stocate pe SD", "X": "X", "Add user": "Ad\u0103ugare utilizator", "GCODE commands in layer": "comenzi GCODE \u00een strat", "Estimated print time": "Timp de imprimare estimat", "Serial Connection": "Conexiune serial\u0103", "Control": "Control", "Password": "Parol\u0103", "Also show next layer": "Vizualizare strat urm\u0103tor", "Print Time": "Timp de imprimare", "Slicer": "", "Nozzle Diameter": "", "Sort by file size": "Sortare dup\u0103 m\u0103rimea fi\u0219ierului", "Machine State": "Starea ma\u0219inii", "Slicing Profile": "", "mm": "mm", "API": "API", "Printing from SD": "Se imprim\u0103 de pe SD", "Stream URL": "URL flux video", "Terminal filters": "Filtre pentru terminal", "Change password for user \"%(user)s\"": "Modificare parol\u0103 pentru utilizatorul \"%(user)s\"", "Enable Temperature Graph": "Activeaz\u0103 graficul temperaturii", "Delete user": "\u0218tergere utilizator", "Timelapse bitrate": "Vitez\u0103 \u00eenregistrare rapid\u0103", "Confirm Password": "Confirmare parol\u0103", "Disconnect": "Deconectare", "Slicing done": "Feliere terminat\u0103", "Initialize SD card": "Ini\u021bializare card SD", "System": "Sistem", "Send": "Trimitere", "State": "Stare", "Version": "Versiune", "YYYY-MM-DD HH:mm": "DD.MM.YYYY HH.mm", "Attempt to reconnect": "\u00cencercare de reconectare", "Streaming done": "Transmiterea s-a terminat", "violet": "violet", "Print": "Imprimare", "Layer count": "Num\u0103r de straturi", "OctoPrint Settings": "Configurare OctoPrint", "Are you sure?": "E\u0219ti sigur?", "blue": "albastru", "Printer": "Imprimant\u0103", "Delete Profile": "", "Tool": "Unealt\u0103",
Line truncated
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
var CONFIG_GCODE_SIZE_THRESHOLD = {{ gcodeThreshold }};
|
var CONFIG_GCODE_SIZE_THRESHOLD = {{ gcodeThreshold }};
|
||||||
var CONFIG_GCODE_MOBILE_SIZE_THRESHOLD = {{ gcodeMobileThreshold }};
|
var CONFIG_GCODE_MOBILE_SIZE_THRESHOLD = {{ gcodeMobileThreshold }};
|
||||||
|
|
||||||
var SOCKJS_URI = window.location.protocol.slice(0, -1) + "://" + (window.document ? window.document.domain : window.location.hostname) + ":" + window.location.port + BASEURL + "sockjs";
|
var SOCKJS_URI = "{{ url_for('index') }}" + "sockjs";
|
||||||
var SOCKJS_DEBUG = {% if debug -%} true; {% else %} false; {%- endif %}
|
var SOCKJS_DEBUG = {% if debug -%} true; {% else %} false; {%- endif %}
|
||||||
|
|
||||||
var UI_API_KEY = "{{ uiApiKey }}";
|
var UI_API_KEY = "{{ uiApiKey }}";
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
<div class="accordion span4">
|
<div class="accordion span4">
|
||||||
<div class="accordion-group" data-bind="visible: loginState.isUser" id="connection_accordion">
|
<div class="accordion-group" data-bind="visible: loginState.isUser" id="connection_accordion">
|
||||||
<div class="accordion-heading">
|
<div class="accordion-heading">
|
||||||
<a class="accordion-toggle" data-toggle="collapse" href="#connection"><i class="icon-signal"></i> {{ _('Connection') }}</a>
|
<a class="accordion-toggle" data-toggle="collapse" data-target="#connection"><i class="icon-signal"></i> {{ _('Connection') }}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="accordion-body collapse in" id="connection">
|
<div class="accordion-body collapse in" id="connection">
|
||||||
<div class="accordion-inner">
|
<div class="accordion-inner">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<li><a href="#settings_api" data-toggle="tab">{{ _('API') }}</a></li>
|
<li><a href="#settings_api" data-toggle="tab">{{ _('API') }}</a></li>
|
||||||
<li class="nav-header">OctoPrint</li>
|
<li class="nav-header">OctoPrint</li>
|
||||||
<li><a href="#settings_folder" data-toggle="tab">{{ _('Folders') }}</a></li>
|
<li><a href="#settings_folder" data-toggle="tab">{{ _('Folders') }}</a></li>
|
||||||
|
<li><a href="#settings_appearance" data-toggle="tab">{{ _('Appearance') }}</a></li>
|
||||||
<li><a href="#settings_logs" data-toggle="tab">{{ _('Logs') }}</a></li>
|
<li><a href="#settings_logs" data-toggle="tab">{{ _('Logs') }}</a></li>
|
||||||
{% if settingsPlugins %}
|
{% if settingsPlugins %}
|
||||||
<li class="nav-header">Plugins</li>
|
<li class="nav-header">Plugins</li>
|
||||||
@@ -366,7 +367,7 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" data-bind="checked: feature_alwaysSendChecksum" id="settings-featureAlwaysSendChecksum"> {{ _('Send a checksum with <strong>every</strong> command') }} <span class="label">{{ _('Repetier') }}</span>
|
<input type="checkbox" data-bind="checked: feature_alwaysSendChecksum" id="settings-featureAlwaysSendChecksum"> {{ _('Send a checksum with <strong>every</strong> command (reconnect after changing)') }} <span class="label">{{ _('Repetier') }}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -477,6 +478,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane" id="settings_appearance">
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="settings-appearanceName">{{ _('Title') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="input-block-level" data-bind="value: appearance_name" id="settings-appearanceName">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="settings-appearanceColor">{{ _('Color') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<select id="settings-appearanceColor" data-bind="value: appearance_color, options: appearance_available_colors, optionsText: 'name', optionsValue: 'key'">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
<div class="tab-pane" id="settings_api">
|
<div class="tab-pane" id="settings_api">
|
||||||
<form class="form-horizontal" onsubmit="return false;">
|
<form class="form-horizontal" onsubmit="return false;">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|||||||
@@ -227,8 +227,12 @@ class Timelapse(object):
|
|||||||
self._logger.warn("Cannot capture image, capture directory is unset")
|
self._logger.warn("Cannot capture image, capture directory is unset")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if self._imageNumber is None:
|
||||||
|
self._logger.warn("Cannot capture image, image number is unset")
|
||||||
|
return
|
||||||
|
|
||||||
with self._captureMutex:
|
with self._captureMutex:
|
||||||
filename = os.path.join(self._captureDir, "tmp_%05d.jpg" % (self._imageNumber))
|
filename = os.path.join(self._captureDir, "tmp_%05d.jpg" % self._imageNumber)
|
||||||
self._imageNumber += 1
|
self._imageNumber += 1
|
||||||
self._logger.debug("Capturing image to %s" % filename)
|
self._logger.debug("Capturing image to %s" % filename)
|
||||||
captureThread = threading.Thread(target=self._captureWorker, kwargs={"filename": filename})
|
captureThread = threading.Thread(target=self._captureWorker, kwargs={"filename": filename})
|
||||||
@@ -243,8 +247,9 @@ class Timelapse(object):
|
|||||||
self._logger.debug("Image %s captured from %s" % (filename, self._snapshotUrl))
|
self._logger.debug("Image %s captured from %s" % (filename, self._snapshotUrl))
|
||||||
except:
|
except:
|
||||||
self._logger.exception("Could not capture image %s from %s, decreasing image counter again" % (filename, self._snapshotUrl))
|
self._logger.exception("Could not capture image %s from %s, decreasing image counter again" % (filename, self._snapshotUrl))
|
||||||
if self._imageNumber is not None and self._imageNumber > 0:
|
with self._captureMutex:
|
||||||
self._imageNumber -= 1
|
if self._imageNumber is not None and self._imageNumber > 0:
|
||||||
|
self._imageNumber -= 1
|
||||||
eventManager().fire(Events.CAPTURE_DONE, {"file": filename})
|
eventManager().fire(Events.CAPTURE_DONE, {"file": filename})
|
||||||
|
|
||||||
def _createMovie(self, success=True):
|
def _createMovie(self, success=True):
|
||||||
@@ -299,7 +304,7 @@ class Timelapse(object):
|
|||||||
|
|
||||||
# finalize command with output file
|
# finalize command with output file
|
||||||
self._logger.debug("Rendering movie to %s" % output)
|
self._logger.debug("Rendering movie to %s" % output)
|
||||||
command.append(output)
|
command.append("\"" + output + "\"")
|
||||||
eventManager().fire(Events.MOVIE_RENDERING, {"gcode": self._gcodeFile, "movie": output, "movie_basename": os.path.basename(output)})
|
eventManager().fire(Events.MOVIE_RENDERING, {"gcode": self._gcodeFile, "movie": output, "movie_basename": os.path.basename(output)})
|
||||||
|
|
||||||
command_str = " ".join(command)
|
command_str = " ".join(command)
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -8,6 +8,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import threading
|
||||||
import logging
|
import logging
|
||||||
from flask import make_response
|
from flask import make_response
|
||||||
|
|
||||||
@@ -147,7 +148,7 @@ def findCollisionfreeName(input, extension, existingFilenames):
|
|||||||
raise ValueError("Can't create a collision free filename")
|
raise ValueError("Can't create a collision free filename")
|
||||||
|
|
||||||
|
|
||||||
def safeRename(old, new):
|
def safeRename(old, new, throw_error=False):
|
||||||
"""
|
"""
|
||||||
Safely renames a file.
|
Safely renames a file.
|
||||||
|
|
||||||
@@ -172,12 +173,14 @@ def safeRename(old, new):
|
|||||||
os.rename(new, backup)
|
os.rename(new, backup)
|
||||||
os.rename(old, new)
|
os.rename(old, new)
|
||||||
os.remove(backup)
|
os.remove(backup)
|
||||||
except OSError:
|
except OSError as e:
|
||||||
# if anything went wrong, try to rename the backup file to its original name
|
# if anything went wrong, try to rename the backup file to its original name
|
||||||
logger.error("Could not perform safe rename, trying to revert")
|
logger.error("Could not perform safe rename, trying to revert")
|
||||||
if os.path.exists(backup):
|
if os.path.exists(backup):
|
||||||
os.remove(new)
|
silentRemove(new)
|
||||||
os.rename(backup, new)
|
os.rename(backup, new)
|
||||||
|
if throw_error:
|
||||||
|
raise e
|
||||||
else:
|
else:
|
||||||
# on anything else than windows it's ooooh so much easier...
|
# on anything else than windows it's ooooh so much easier...
|
||||||
os.rename(old, new)
|
os.rename(old, new)
|
||||||
@@ -298,3 +301,42 @@ def address_for_client(host, port):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class CountedEvent(object):
|
||||||
|
|
||||||
|
def __init__(self, value=0, max=None):
|
||||||
|
self._counter = 0
|
||||||
|
self._max = max
|
||||||
|
self._mutex = threading.Lock()
|
||||||
|
self._event = threading.Event()
|
||||||
|
|
||||||
|
self._internal_set(value)
|
||||||
|
|
||||||
|
def set(self):
|
||||||
|
with self._mutex:
|
||||||
|
self._internal_set(self._counter + 1)
|
||||||
|
|
||||||
|
def clear(self, completely=False):
|
||||||
|
with self._mutex:
|
||||||
|
if completely:
|
||||||
|
self._internal_set(0)
|
||||||
|
else:
|
||||||
|
self._internal_set(self._counter - 1)
|
||||||
|
|
||||||
|
def wait(self, timeout=None):
|
||||||
|
self._event.wait(timeout)
|
||||||
|
|
||||||
|
def blocked(self):
|
||||||
|
with self._mutex:
|
||||||
|
return self._counter == 0
|
||||||
|
|
||||||
|
def _internal_set(self, value):
|
||||||
|
self._counter = value
|
||||||
|
if self._counter <= 0:
|
||||||
|
self._counter = 0
|
||||||
|
self._event.clear()
|
||||||
|
else:
|
||||||
|
if self._max is not None and self._counter > self._max:
|
||||||
|
self._counter = self._max
|
||||||
|
self._event.set()
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
import os, struct, sys, time
|
|
||||||
|
|
||||||
from serial import Serial
|
|
||||||
|
|
||||||
import chipDB
|
import chipDB
|
||||||
|
|
||||||
class IspBase():
|
class IspBase():
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import os, struct, sys, time
|
import os, struct, sys, time
|
||||||
|
|
||||||
from serial import Serial
|
from serial import Serial
|
||||||
from serial import SerialException
|
from serial import SerialException, SerialTimeoutException
|
||||||
|
|
||||||
import ispBase, intelHex
|
import ispBase, intelHex
|
||||||
|
|
||||||
|
|||||||
+76
-44
@@ -77,6 +77,8 @@ gcodeToEvent = {
|
|||||||
"M226": Events.WAITING,
|
"M226": Events.WAITING,
|
||||||
"M0": Events.WAITING,
|
"M0": Events.WAITING,
|
||||||
"M1": Events.WAITING,
|
"M1": Events.WAITING,
|
||||||
|
# dwell command
|
||||||
|
"G4": Events.DWELL,
|
||||||
|
|
||||||
# part cooler
|
# part cooler
|
||||||
"M245": Events.COOLING,
|
"M245": Events.COOLING,
|
||||||
@@ -143,10 +145,14 @@ class MachineCom(object):
|
|||||||
self._bedTempOffset = 0
|
self._bedTempOffset = 0
|
||||||
self._commandQueue = queue.Queue()
|
self._commandQueue = queue.Queue()
|
||||||
self._currentZ = None
|
self._currentZ = None
|
||||||
self._heatupWaitStartTime = 0
|
self._heatupWaitStartTime = None
|
||||||
self._heatupWaitTimeLost = 0.0
|
self._heatupWaitTimeLost = 0.0
|
||||||
|
self._pauseWaitStartTime = None
|
||||||
|
self._pauseWaitTimeLost = 0.0
|
||||||
self._currentExtruder = 0
|
self._currentExtruder = 0
|
||||||
|
|
||||||
|
self._timeout = None
|
||||||
|
|
||||||
self._alwaysSendChecksum = settings().getBoolean(["feature", "alwaysSendChecksum"])
|
self._alwaysSendChecksum = settings().getBoolean(["feature", "alwaysSendChecksum"])
|
||||||
self._currentLine = 1
|
self._currentLine = 1
|
||||||
self._resendDelta = None
|
self._resendDelta = None
|
||||||
@@ -155,6 +161,7 @@ class MachineCom(object):
|
|||||||
# hooks
|
# hooks
|
||||||
self._pluginManager = octoprint.plugin.plugin_manager()
|
self._pluginManager = octoprint.plugin.plugin_manager()
|
||||||
self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.gcode")
|
self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.gcode")
|
||||||
|
self._printer_action_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.action")
|
||||||
|
|
||||||
# SD status data
|
# SD status data
|
||||||
self._sdAvailable = False
|
self._sdAvailable = False
|
||||||
@@ -314,20 +321,17 @@ class MachineCom(object):
|
|||||||
if self._currentFile is None or self._currentFile.getStartTime() is None:
|
if self._currentFile is None or self._currentFile.getStartTime() is None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return time.time() - self._currentFile.getStartTime()
|
return time.time() - self._currentFile.getStartTime() - self._pauseWaitTimeLost
|
||||||
|
|
||||||
def getPrintTimeRemainingEstimate(self):
|
def getCleanedPrintTime(self):
|
||||||
printTime = self.getPrintTime()
|
printTime = self.getPrintTime()
|
||||||
if printTime is None:
|
if printTime is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
printTime /= 60
|
cleanedPrintTime = printTime - self._heatupWaitTimeLost
|
||||||
progress = self._currentFile.getProgress()
|
if cleanedPrintTime < 0:
|
||||||
if progress:
|
cleanedPrintTime = 0.0
|
||||||
printTimeTotal = printTime / progress
|
return cleanedPrintTime
|
||||||
return printTimeTotal - printTime
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def getTemp(self):
|
def getTemp(self):
|
||||||
return self._temp
|
return self._temp
|
||||||
@@ -388,6 +392,11 @@ class MachineCom(object):
|
|||||||
if self._currentFile is None:
|
if self._currentFile is None:
|
||||||
raise ValueError("No file selected for printing")
|
raise ValueError("No file selected for printing")
|
||||||
|
|
||||||
|
self._heatupWaitStartTime = 0
|
||||||
|
self._heatupWaitTimeLost = 0.0
|
||||||
|
self._pauseWaitStartTime = 0
|
||||||
|
self._pauseWaitTimeLost = 0.0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._currentFile.start()
|
self._currentFile.start()
|
||||||
|
|
||||||
@@ -470,6 +479,10 @@ class MachineCom(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if not pause and self.isPaused():
|
if not pause and self.isPaused():
|
||||||
|
if self._pauseWaitStartTime:
|
||||||
|
self._pauseWaitTimeLost = self._pauseWaitTimeLost + (time.time() - self._pauseWaitStartTime)
|
||||||
|
self._pauseWaitStartTime = None
|
||||||
|
|
||||||
self._changeState(self.STATE_PRINTING)
|
self._changeState(self.STATE_PRINTING)
|
||||||
if self.isSdFileSelected():
|
if self.isSdFileSelected():
|
||||||
self.sendCommand("M24")
|
self.sendCommand("M24")
|
||||||
@@ -482,6 +495,9 @@ class MachineCom(object):
|
|||||||
"origin": self._currentFile.getFileLocation()
|
"origin": self._currentFile.getFileLocation()
|
||||||
})
|
})
|
||||||
elif pause and self.isPrinting():
|
elif pause and self.isPrinting():
|
||||||
|
if not self._pauseWaitStartTime:
|
||||||
|
self._pauseWaitStartTime = time.time()
|
||||||
|
|
||||||
self._changeState(self.STATE_PAUSED)
|
self._changeState(self.STATE_PAUSED)
|
||||||
if self.isSdFileSelected():
|
if self.isSdFileSelected():
|
||||||
self.sendCommand("M25") # pause print
|
self.sendCommand("M25") # pause print
|
||||||
@@ -495,21 +511,6 @@ class MachineCom(object):
|
|||||||
def getSdFiles(self):
|
def getSdFiles(self):
|
||||||
return self._sdFiles
|
return self._sdFiles
|
||||||
|
|
||||||
def startSdFileTransfer(self, filename):
|
|
||||||
if not self.isOperational() or self.isBusy():
|
|
||||||
return
|
|
||||||
|
|
||||||
self._changeState(self.STATE_TRANSFERING_FILE)
|
|
||||||
self.sendCommand("M28 %s" % filename.lower())
|
|
||||||
|
|
||||||
def endSdFileTransfer(self, filename):
|
|
||||||
if not self.isOperational() or self.isBusy():
|
|
||||||
return
|
|
||||||
|
|
||||||
self.sendCommand("M29 %s" % filename.lower())
|
|
||||||
self._changeState(self.STATE_OPERATIONAL)
|
|
||||||
self.refreshSdFiles()
|
|
||||||
|
|
||||||
def deleteSdFile(self, filename):
|
def deleteSdFile(self, filename):
|
||||||
if not self.isOperational() or (self.isBusy() and
|
if not self.isOperational() or (self.isBusy() and
|
||||||
isinstance(self._currentFile, PrintingSdFileInformation) and
|
isinstance(self._currentFile, PrintingSdFileInformation) and
|
||||||
@@ -637,9 +638,11 @@ class MachineCom(object):
|
|||||||
self._changeState(self.STATE_CONNECTING)
|
self._changeState(self.STATE_CONNECTING)
|
||||||
|
|
||||||
#Start monitoring the serial port.
|
#Start monitoring the serial port.
|
||||||
timeout = getNewTimeout("communication")
|
self._timeout = getNewTimeout("communication")
|
||||||
|
|
||||||
tempRequestTimeout = getNewTimeout("temperature")
|
tempRequestTimeout = getNewTimeout("temperature")
|
||||||
sdStatusRequestTimeout = getNewTimeout("sdStatus")
|
sdStatusRequestTimeout = getNewTimeout("sdStatus")
|
||||||
|
|
||||||
startSeen = not settings().getBoolean(["feature", "waitForStartOnConnect"])
|
startSeen = not settings().getBoolean(["feature", "waitForStartOnConnect"])
|
||||||
heatingUp = False
|
heatingUp = False
|
||||||
swallowOk = False
|
swallowOk = False
|
||||||
@@ -651,7 +654,28 @@ class MachineCom(object):
|
|||||||
if line is None:
|
if line is None:
|
||||||
break
|
break
|
||||||
if line.strip() is not "":
|
if line.strip() is not "":
|
||||||
timeout = getNewTimeout("communication")
|
self._timeout = getNewTimeout("communication")
|
||||||
|
|
||||||
|
##~~ debugging output handling
|
||||||
|
if line.startswith("//"):
|
||||||
|
debugging_output = line[2:].strip()
|
||||||
|
if debugging_output.startswith("action:"):
|
||||||
|
action_command = debugging_output[len("action:"):].strip()
|
||||||
|
|
||||||
|
if action_command == "pause":
|
||||||
|
self._log("Pausing on request of the printer...")
|
||||||
|
self.setPause(True)
|
||||||
|
elif action_command == "resume":
|
||||||
|
self._log("Resuming on request of the printer...")
|
||||||
|
self.setPause(False)
|
||||||
|
elif action_command == "disconnect":
|
||||||
|
self._log("Disconnecting on request of the printer...")
|
||||||
|
self._callback.mcForceDisconnect()
|
||||||
|
else:
|
||||||
|
for hook in self._printer_action_hooks:
|
||||||
|
self._printer_action_hooks[hook](self, line, action_command)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
##~~ Error handling
|
##~~ Error handling
|
||||||
line = self._handleErrors(line)
|
line = self._handleErrors(line)
|
||||||
@@ -688,12 +712,9 @@ class MachineCom(object):
|
|||||||
self._callback.mcTempUpdate(self._temp, self._bedTemp)
|
self._callback.mcTempUpdate(self._temp, self._bedTemp)
|
||||||
|
|
||||||
#If we are waiting for an M109 or M190 then measure the time we lost during heatup, so we can remove that time from our printing time estimate.
|
#If we are waiting for an M109 or M190 then measure the time we lost during heatup, so we can remove that time from our printing time estimate.
|
||||||
if not 'ok' in line:
|
if 'ok' in line and self._heatupWaitStartTime:
|
||||||
heatingUp = True
|
self._heatupWaitTimeLost = self._heatupWaitTimeLost + (time.time() - self._heatupWaitStartTime)
|
||||||
if self._heatupWaitStartTime != 0:
|
self._heatupWaitStartTime = None
|
||||||
t = time.time()
|
|
||||||
self._heatupWaitTimeLost = t - self._heatupWaitStartTime
|
|
||||||
self._heatupWaitStartTime = t
|
|
||||||
elif supportRepetierTargetTemp and ('TargetExtr' in line or 'TargetBed' in line):
|
elif supportRepetierTargetTemp and ('TargetExtr' in line or 'TargetBed' in line):
|
||||||
matchExtr = self._regex_repetierTempExtr.match(line)
|
matchExtr = self._regex_repetierTempExtr.match(line)
|
||||||
matchBed = self._regex_repetierTempBed.match(line)
|
matchBed = self._regex_repetierTempBed.match(line)
|
||||||
@@ -823,7 +844,7 @@ class MachineCom(object):
|
|||||||
|
|
||||||
### Baudrate detection
|
### Baudrate detection
|
||||||
if self._state == self.STATE_DETECT_BAUDRATE:
|
if self._state == self.STATE_DETECT_BAUDRATE:
|
||||||
if line == '' or time.time() > timeout:
|
if line == '' or time.time() > self._timeout:
|
||||||
if len(self._baudrateDetectList) < 1:
|
if len(self._baudrateDetectList) < 1:
|
||||||
self.close()
|
self.close()
|
||||||
self._errorValue = "No more baudrates to test, and no suitable baudrate found."
|
self._errorValue = "No more baudrates to test, and no suitable baudrate found."
|
||||||
@@ -843,7 +864,7 @@ class MachineCom(object):
|
|||||||
self._log("Trying baudrate: %d" % (baudrate))
|
self._log("Trying baudrate: %d" % (baudrate))
|
||||||
self._baudrateDetectRetry = 5
|
self._baudrateDetectRetry = 5
|
||||||
self._baudrateDetectTestOk = 0
|
self._baudrateDetectTestOk = 0
|
||||||
timeout = getNewTimeout("communication")
|
self._timeout = getNewTimeout("communication")
|
||||||
self._serial.write('\n')
|
self._serial.write('\n')
|
||||||
self._sendCommand("M105")
|
self._sendCommand("M105")
|
||||||
self._testingBaudrate = True
|
self._testingBaudrate = True
|
||||||
@@ -879,7 +900,7 @@ class MachineCom(object):
|
|||||||
else:
|
else:
|
||||||
self.initSdCard()
|
self.initSdCard()
|
||||||
eventManager().fire(Events.CONNECTED, {"port": self._port, "baudrate": self._baudrate})
|
eventManager().fire(Events.CONNECTED, {"port": self._port, "baudrate": self._baudrate})
|
||||||
elif time.time() > timeout:
|
elif time.time() > self._timeout:
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
### Operational
|
### Operational
|
||||||
@@ -901,7 +922,7 @@ class MachineCom(object):
|
|||||||
|
|
||||||
### Printing
|
### Printing
|
||||||
elif self._state == self.STATE_PRINTING:
|
elif self._state == self.STATE_PRINTING:
|
||||||
if line == "" and time.time() > timeout:
|
if line == "" and time.time() > self._timeout:
|
||||||
self._log("Communication timeout during printing, forcing a line")
|
self._log("Communication timeout during printing, forcing a line")
|
||||||
line = 'ok'
|
line = 'ok'
|
||||||
|
|
||||||
@@ -1238,14 +1259,25 @@ class MachineCom(object):
|
|||||||
self._resendDelta = None
|
self._resendDelta = None
|
||||||
|
|
||||||
return None
|
return None
|
||||||
def _gcode_M112(self, cmd): # It's an emergency what todo? Canceling the print should be the minimum
|
|
||||||
self.cancelPrint()
|
|
||||||
return cmd
|
|
||||||
|
|
||||||
def _gcode_M112(self, cmd): # It's an emergency what todo? Canceling the print should be the minimum
|
def _gcode_M112(self, cmd): # It's an emergency what todo? Canceling the print should be the minimum
|
||||||
self.cancelPrint()
|
self.cancelPrint()
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
def _gcode_G4(self, cmd):
|
||||||
|
# we are intending to dwell for a period of time, increase the timeout to match
|
||||||
|
cmd = cmd.upper()
|
||||||
|
p_idx = cmd.find('P')
|
||||||
|
s_idx = cmd.find('S')
|
||||||
|
_timeout = 0
|
||||||
|
if p_idx != -1:
|
||||||
|
# dwell time is specified in milliseconds
|
||||||
|
_timeout = int(cmd[p_idx+1:]) / 1000.0
|
||||||
|
elif s_idx != -1:
|
||||||
|
# dwell time is specified in seconds
|
||||||
|
_timeout = int(cmd[s_idx+1:])
|
||||||
|
self._timeout = getNewTimeout("communication") + _timeout
|
||||||
|
return cmd
|
||||||
|
|
||||||
### MachineCom callback ################################################################################################
|
### MachineCom callback ################################################################################################
|
||||||
|
|
||||||
@@ -1286,6 +1318,9 @@ class MachineComPrintCallback(object):
|
|||||||
def mcReceivedRegisteredMessage(self, command, message):
|
def mcReceivedRegisteredMessage(self, command, message):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def mcForceDisconnect(self):
|
||||||
|
pass
|
||||||
|
|
||||||
### Printing file information classes ##################################################################################
|
### Printing file information classes ##################################################################################
|
||||||
|
|
||||||
class PrintingFileInformation(object):
|
class PrintingFileInformation(object):
|
||||||
@@ -1386,9 +1421,9 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
|||||||
"""
|
"""
|
||||||
Opens the file for reading and determines the file size. Start time won't be recorded until 100 lines in
|
Opens the file for reading and determines the file size. Start time won't be recorded until 100 lines in
|
||||||
"""
|
"""
|
||||||
|
PrintingFileInformation.start(self)
|
||||||
self._filehandle = open(self._filename, "r")
|
self._filehandle = open(self._filename, "r")
|
||||||
self._lineCount = None
|
self._lineCount = None
|
||||||
self._startTime = None
|
|
||||||
|
|
||||||
def getNext(self):
|
def getNext(self):
|
||||||
"""
|
"""
|
||||||
@@ -1415,9 +1450,6 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
|||||||
self._lineCount += 1
|
self._lineCount += 1
|
||||||
self._filepos = self._filehandle.tell()
|
self._filepos = self._filehandle.tell()
|
||||||
|
|
||||||
if self._lineCount >= 100 and self._startTime is None:
|
|
||||||
self._startTime = time.time()
|
|
||||||
|
|
||||||
return processedLine
|
return processedLine
|
||||||
except Exception as (e):
|
except Exception as (e):
|
||||||
if self._filehandle is not None:
|
if self._filehandle is not None:
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class gcode(object):
|
|||||||
|
|
||||||
def _load(self, gcodeFile, printer_profile):
|
def _load(self, gcodeFile, printer_profile):
|
||||||
filePos = 0
|
filePos = 0
|
||||||
|
readBytes = 0
|
||||||
pos = [0.0, 0.0, 0.0]
|
pos = [0.0, 0.0, 0.0]
|
||||||
posOffset = [0.0, 0.0, 0.0]
|
posOffset = [0.0, 0.0, 0.0]
|
||||||
currentE = [0.0]
|
currentE = [0.0]
|
||||||
@@ -53,29 +54,46 @@ class gcode(object):
|
|||||||
absoluteE = True
|
absoluteE = True
|
||||||
scale = 1.0
|
scale = 1.0
|
||||||
posAbs = True
|
posAbs = True
|
||||||
feedRateXY = min(printer_profile["axes"]["x"], printer_profile["axes"]["y"])
|
feedRateXY = min(printer_profile["axes"]["x"]["speed"], printer_profile["axes"]["y"]["speed"])
|
||||||
offsets = printer_profile["extruder"]["offsets"]
|
offsets = printer_profile["extruder"]["offsets"]
|
||||||
|
|
||||||
for line in gcodeFile:
|
for line in gcodeFile:
|
||||||
if self._abort:
|
if self._abort:
|
||||||
raise AnalysisAborted()
|
raise AnalysisAborted()
|
||||||
filePos += 1
|
filePos += 1
|
||||||
|
readBytes += len(line)
|
||||||
|
|
||||||
|
if isinstance(gcodeFile, (file)):
|
||||||
|
percentage = float(readBytes) / float(self._fileSize)
|
||||||
|
elif isinstance(gcodeFile, (list)):
|
||||||
|
percentage = float(filePos) / float(len(gcodeFile))
|
||||||
|
else:
|
||||||
|
percentage = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.progressCallback is not None and (filePos % 1000 == 0):
|
if self.progressCallback is not None and (filePos % 1000 == 0) and percentage is not None:
|
||||||
if isinstance(gcodeFile, (file)):
|
self.progressCallback(percentage)
|
||||||
self.progressCallback(float(gcodeFile.tell()) / float(self._fileSize))
|
|
||||||
elif isinstance(gcodeFile, (list)):
|
|
||||||
self.progressCallback(float(filePos) / float(len(gcodeFile)))
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if ';' in line:
|
if ';' in line:
|
||||||
comment = line[line.find(';')+1:].strip()
|
comment = line[line.find(';')+1:].strip()
|
||||||
if comment.startswith("filament_diameter"):
|
if comment.startswith("filament_diameter"):
|
||||||
self._filamentDiameter = float(comment.split("=", 1)[1].strip())
|
filamentValue = comment.split("=", 1)[1].strip()
|
||||||
elif comment.startswith("CURA_PROFILE_STRING"):
|
try:
|
||||||
curaOptions = self._parseCuraProfileString(comment)
|
self._filamentDiameter = float(filamentValue)
|
||||||
|
except ValueError:
|
||||||
|
try:
|
||||||
|
self._filamentDiameter = float(filamentValue.split(",")[0].strip())
|
||||||
|
except ValueError:
|
||||||
|
self._filamentDiameter = 0.0
|
||||||
|
elif comment.startswith("CURA_PROFILE_STRING") or comment.startswith("CURA_OCTO_PROFILE_STRING"):
|
||||||
|
if comment.startswith("CURA_PROFILE_STRING"):
|
||||||
|
prefix = "CURA_PROFILE_STRING:"
|
||||||
|
else:
|
||||||
|
prefix = "CURA_OCTO_PROFILE_STRING:"
|
||||||
|
|
||||||
|
curaOptions = self._parseCuraProfileString(comment, prefix)
|
||||||
if "filament_diameter" in curaOptions:
|
if "filament_diameter" in curaOptions:
|
||||||
try:
|
try:
|
||||||
self._filamentDiameter = float(curaOptions["filament_diameter"])
|
self._filamentDiameter = float(curaOptions["filament_diameter"])
|
||||||
@@ -226,8 +244,8 @@ class gcode(object):
|
|||||||
self.extrusionVolume[i] = (self.extrusionAmount[i] * (math.pi * radius * radius)) / 1000
|
self.extrusionVolume[i] = (self.extrusionAmount[i] * (math.pi * radius * radius)) / 1000
|
||||||
self.totalMoveTimeMinute = totalMoveTimeMinute
|
self.totalMoveTimeMinute = totalMoveTimeMinute
|
||||||
|
|
||||||
def _parseCuraProfileString(self, comment):
|
def _parseCuraProfileString(self, comment, prefix):
|
||||||
return {key: value for (key, value) in map(lambda x: x.split("=", 1), zlib.decompress(base64.b64decode(comment[len("CURA_PROFILE_STRING:"):])).split("\b"))}
|
return {key: value for (key, value) in map(lambda x: x.split("=", 1), zlib.decompress(base64.b64decode(comment[len(prefix):])).split("\b"))}
|
||||||
|
|
||||||
|
|
||||||
def getCodeInt(line, code):
|
def getCodeInt(line, code):
|
||||||
|
|||||||
+410
-181
@@ -9,21 +9,42 @@ import os
|
|||||||
import re
|
import re
|
||||||
import threading
|
import threading
|
||||||
import math
|
import math
|
||||||
|
import Queue
|
||||||
|
|
||||||
|
from serial import SerialTimeoutException
|
||||||
|
|
||||||
from octoprint.settings import settings
|
from octoprint.settings import settings
|
||||||
|
|
||||||
class VirtualPrinter():
|
class VirtualPrinter():
|
||||||
def __init__(self):
|
def __init__(self, read_timeout=5.0, write_timeout=10.0):
|
||||||
self.readList = ['start\n', 'Marlin: Virtual Marlin!\n', '\x80\n', 'SD init fail\n'] # no sd card as default startup scenario
|
self._read_timeout = read_timeout
|
||||||
|
self._write_timeout = write_timeout
|
||||||
|
|
||||||
|
self.incoming = CharCountingQueue(settings().getInt(["devel", "virtualPrinter", "rxBuffer"]), name="RxBuffer")
|
||||||
|
self.outgoing = Queue.Queue()
|
||||||
|
self.buffered = Queue.Queue(maxsize=settings().getInt(["devel", "virtualPrinter", "commandBuffer"]))
|
||||||
|
|
||||||
|
for item in ['start\n', 'Marlin: Virtual Marlin!\n', '\x80\n', 'SD card ok\n']: # no sd card as default startup scenario
|
||||||
|
self.outgoing.put(item)
|
||||||
|
|
||||||
self.currentExtruder = 0
|
self.currentExtruder = 0
|
||||||
self.temp = [0.0] * settings().getInt(["devel", "virtualPrinter", "numExtruders"])
|
self.temp = [0.0] * settings().getInt(["devel", "virtualPrinter", "numExtruders"])
|
||||||
self.targetTemp = [0.0] * settings().getInt(["devel", "virtualPrinter", "numExtruders"])
|
self.targetTemp = [0.0] * settings().getInt(["devel", "virtualPrinter", "numExtruders"])
|
||||||
self.lastTempAt = time.time()
|
self.lastTempAt = time.time()
|
||||||
self.bedTemp = 1.0
|
self.bedTemp = 1.0
|
||||||
self.bedTargetTemp = 1.0
|
self.bedTargetTemp = 1.0
|
||||||
|
self.speeds = settings().get(["devel", "virtualPrinter", "movementSpeed"])
|
||||||
|
|
||||||
|
self._relative = True
|
||||||
|
self._lastX = None
|
||||||
|
self._lastY = None
|
||||||
|
self._lastZ = None
|
||||||
|
self._lastE = None
|
||||||
|
|
||||||
|
self._unitModifier = 1
|
||||||
|
|
||||||
self._virtualSd = settings().getBaseFolder("virtualSd")
|
self._virtualSd = settings().getBaseFolder("virtualSd")
|
||||||
self._sdCardReady = False
|
self._sdCardReady = True
|
||||||
self._sdPrinter = None
|
self._sdPrinter = None
|
||||||
self._sdPrintingSemaphore = threading.Event()
|
self._sdPrintingSemaphore = threading.Event()
|
||||||
self._selectedSdFile = None
|
self._selectedSdFile = None
|
||||||
@@ -36,151 +57,221 @@ class VirtualPrinter():
|
|||||||
self.currentLine = 0
|
self.currentLine = 0
|
||||||
self.lastN = 0
|
self.lastN = 0
|
||||||
|
|
||||||
|
self._incoming_lock = threading.RLock()
|
||||||
|
|
||||||
waitThread = threading.Thread(target=self._sendWaitAfterTimeout)
|
waitThread = threading.Thread(target=self._sendWaitAfterTimeout)
|
||||||
waitThread.start()
|
waitThread.start()
|
||||||
|
|
||||||
def write(self, data):
|
readThread = threading.Thread(target=self._processIncoming)
|
||||||
if self.readList is None:
|
readThread.start()
|
||||||
return
|
|
||||||
|
|
||||||
data = data.strip()
|
bufferThread = threading.Thread(target=self._processBuffer)
|
||||||
|
bufferThread.start()
|
||||||
|
|
||||||
# strip checksum
|
def __str__(self):
|
||||||
if "*" in data:
|
return "VIRTUAL(read_timeout={read_timeout},write_timeout={write_timeout},options={options})"\
|
||||||
data = data[:data.rfind("*")]
|
.format(read_timeout=self._read_timeout, write_timeout=self._write_timeout, options=settings().get(["devel", "virtualPrinter"]))
|
||||||
self.currentLine += 1
|
|
||||||
elif settings().getBoolean(["devel", "virtualPrinter", "forceChecksum"]):
|
|
||||||
self.readList.append("Error: Missing checksum")
|
|
||||||
return
|
|
||||||
|
|
||||||
# track N = N + 1
|
def _clearQueue(self, queue):
|
||||||
if data.startswith("N") and "M110" in data:
|
try:
|
||||||
linenumber = int(re.search("N([0-9]+)", data).group(1))
|
while queue.get(block=False):
|
||||||
self.lastN = linenumber
|
continue
|
||||||
self.currentLine = linenumber
|
except Queue.Empty:
|
||||||
self._sendOk()
|
pass
|
||||||
return
|
|
||||||
elif data.startswith("N"):
|
def _processIncoming(self):
|
||||||
linenumber = int(re.search("N([0-9]+)", data).group(1))
|
while self.incoming is not None:
|
||||||
expected = self.lastN + 1
|
self._simulateTemps()
|
||||||
if linenumber != expected:
|
|
||||||
self.readList.append("Error: expected line %d got %d" % (expected, linenumber))
|
try:
|
||||||
self.readList.append("Resend:%d" % expected)
|
data = self.incoming.get(timeout=0.01)
|
||||||
if settings().getBoolean(["devel", "virtualPrinter", "okAfterResend"]):
|
except Queue.Empty:
|
||||||
self.readList.append("ok")
|
continue
|
||||||
return
|
|
||||||
elif self.currentLine == 100:
|
if data is None:
|
||||||
# simulate a resend at line 100 of the last 5 lines
|
continue
|
||||||
self.lastN = 94
|
|
||||||
self.readList.append("Error: Line Number is not Last Line Number\n")
|
data = data.strip()
|
||||||
self.readList.append("rs %d\n" % (self.currentLine - 5))
|
|
||||||
if settings().getBoolean(["devel", "virtualPrinter", "okAfterResend"]):
|
# strip checksum
|
||||||
self.readList.append("ok")
|
if "*" in data:
|
||||||
return
|
data = data[:data.rfind("*")]
|
||||||
else:
|
self.currentLine += 1
|
||||||
|
elif settings().getBoolean(["devel", "virtualPrinter", "forceChecksum"]):
|
||||||
|
self.outgoing.put("Error: Missing checksum")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# track N = N + 1
|
||||||
|
if data.startswith("N") and "M110" in data:
|
||||||
|
linenumber = int(re.search("N([0-9]+)", data).group(1))
|
||||||
self.lastN = linenumber
|
self.lastN = linenumber
|
||||||
data = data.split(None, 1)[1].strip()
|
self.currentLine = linenumber
|
||||||
|
self._sendOk()
|
||||||
|
continue
|
||||||
|
elif data.startswith("N"):
|
||||||
|
linenumber = int(re.search("N([0-9]+)", data).group(1))
|
||||||
|
expected = self.lastN + 1
|
||||||
|
if linenumber != expected:
|
||||||
|
with self._incoming_lock:
|
||||||
|
self._clearQueue(self.incoming)
|
||||||
|
self.outgoing.put("Error: expected line %d got %d" % (expected, linenumber))
|
||||||
|
self.outgoing.put("Resend:%d" % expected)
|
||||||
|
self.outgoing.put("ok")
|
||||||
|
continue
|
||||||
|
elif self.currentLine == 100:
|
||||||
|
# simulate a resend at line 100
|
||||||
|
with self._incoming_lock:
|
||||||
|
self.lastN = 99
|
||||||
|
self._clearQueue(self.incoming)
|
||||||
|
self.outgoing.put("Error: Line Number is not Last Line Number\n")
|
||||||
|
self.outgoing.put("rs 100\n")
|
||||||
|
self.outgoing.put("ok")
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
self.lastN = linenumber
|
||||||
|
data = data.split(None, 1)[1].strip()
|
||||||
|
|
||||||
data += "\n"
|
data += "\n"
|
||||||
|
|
||||||
# shortcut for writing to SD
|
# shortcut for writing to SD
|
||||||
if self._writingToSd and not self._selectedSdFile is None and not "M29" in data:
|
if self._writingToSd and not self._selectedSdFile is None and not "M29" in data:
|
||||||
with open(self._selectedSdFile, "a") as f:
|
with open(self._selectedSdFile, "a") as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
self._sendOk()
|
self._sendOk()
|
||||||
return
|
continue
|
||||||
|
|
||||||
#print "Send: %s" % (data.rstrip())
|
#print "Send: %s" % (data.rstrip())
|
||||||
if 'M104' in data or 'M109' in data:
|
if 'M104' in data or 'M109' in data:
|
||||||
self._parseHotendCommand(data)
|
self._parseHotendCommand(data)
|
||||||
return
|
continue
|
||||||
|
|
||||||
if 'M140' in data or 'M190' in data:
|
if 'M140' in data or 'M190' in data:
|
||||||
self._parseBedCommand(data)
|
self._parseBedCommand(data)
|
||||||
return
|
continue
|
||||||
|
|
||||||
if 'M105' in data:
|
if 'M105' in data:
|
||||||
self._processTemperatureQuery()
|
self._processTemperatureQuery()
|
||||||
elif 'M20' in data:
|
continue
|
||||||
if self._sdCardReady:
|
elif 'M20' in data:
|
||||||
self._listSd()
|
if self._sdCardReady:
|
||||||
elif 'M21' in data:
|
self._listSd()
|
||||||
self._sdCardReady = True
|
elif 'M21' in data:
|
||||||
self.readList.append("SD card ok")
|
self._sdCardReady = True
|
||||||
elif 'M22' in data:
|
self.outgoing.put("SD card ok")
|
||||||
self._sdCardReady = False
|
elif 'M22' in data:
|
||||||
elif 'M23' in data:
|
self._sdCardReady = False
|
||||||
if self._sdCardReady:
|
elif 'M23' in data:
|
||||||
filename = data.split(None, 1)[1].strip()
|
if self._sdCardReady:
|
||||||
self._selectSdFile(filename)
|
filename = data.split(None, 1)[1].strip()
|
||||||
elif 'M24' in data:
|
self._selectSdFile(filename)
|
||||||
if self._sdCardReady:
|
elif 'M24' in data:
|
||||||
self._startSdPrint()
|
if self._sdCardReady:
|
||||||
elif 'M25' in data:
|
self._startSdPrint()
|
||||||
if self._sdCardReady:
|
elif 'M25' in data:
|
||||||
self._pauseSdPrint()
|
if self._sdCardReady:
|
||||||
elif 'M26' in data:
|
self._pauseSdPrint()
|
||||||
if self._sdCardReady:
|
elif 'M26' in data:
|
||||||
pos = int(re.search("S([0-9]+)", data).group(1))
|
if self._sdCardReady:
|
||||||
self._setSdPos(pos)
|
pos = int(re.search("S([0-9]+)", data).group(1))
|
||||||
elif 'M27' in data:
|
self._setSdPos(pos)
|
||||||
if self._sdCardReady:
|
elif 'M27' in data:
|
||||||
self._reportSdStatus()
|
if self._sdCardReady:
|
||||||
elif 'M28' in data:
|
self._reportSdStatus()
|
||||||
if self._sdCardReady:
|
elif 'M28' in data:
|
||||||
filename = data.split(None, 1)[1].strip()
|
if self._sdCardReady:
|
||||||
self._writeSdFile(filename)
|
filename = data.split(None, 1)[1].strip()
|
||||||
elif 'M29' in data:
|
self._writeSdFile(filename)
|
||||||
if self._sdCardReady:
|
elif 'M29' in data:
|
||||||
self._finishSdFile()
|
if self._sdCardReady:
|
||||||
elif 'M30' in data:
|
self._finishSdFile()
|
||||||
if self._sdCardReady:
|
elif 'M30' in data:
|
||||||
filename = data.split(None, 1)[1].strip()
|
if self._sdCardReady:
|
||||||
self._deleteSdFile(filename)
|
filename = data.split(None, 1)[1].strip()
|
||||||
elif "M114" in data:
|
self._deleteSdFile(filename)
|
||||||
# send dummy position report
|
elif "M114" in data:
|
||||||
self.readList.append("ok C: X:10.00 Y:3.20 Z:5.20 E:1.24")
|
# send dummy position report
|
||||||
elif "M117" in data:
|
self.outgoing.put("ok C: X:10.00 Y:3.20 Z:5.20 E:1.24")
|
||||||
# we'll just use this to echo a message, to allow playing around with pause triggers
|
continue
|
||||||
self.readList.append("ok %s" % re.search("M117\s+(.*)", data).group(1))
|
elif "M117" in data:
|
||||||
elif "M999" in data:
|
# we'll just use this to echo a message, to allow playing around with pause triggers
|
||||||
# mirror Marlin behaviour
|
self.outgoing.put("echo:%s" % re.search("M117\s+(.*)", data).group(1))
|
||||||
self.readList.append("Resend: 1")
|
elif "M999" in data:
|
||||||
elif data.startswith("T"):
|
# mirror Marlin behaviour
|
||||||
self.currentExtruder = int(re.search("T(\d+)", data).group(1))
|
self.outgoing.put("Resend: 1")
|
||||||
self._sendOk()
|
elif data.startswith("T"):
|
||||||
self.readList.append("Active Extruder: %d" % self.currentExtruder)
|
self.currentExtruder = int(re.search("T(\d+)", data).group(1))
|
||||||
elif len(data.strip()) > 0:
|
self.outgoing.put("Active Extruder: %d" % self.currentExtruder)
|
||||||
self._sendOk()
|
elif "G20" in data:
|
||||||
|
self._unitModifier = 1.0 / 2.54
|
||||||
|
if self._lastX is not None:
|
||||||
|
self._lastX *= 2.54
|
||||||
|
if self._lastY is not None:
|
||||||
|
self._lastY *= 2.54
|
||||||
|
if self._lastZ is not None:
|
||||||
|
self._lastZ *= 2.54
|
||||||
|
if self._lastE is not None:
|
||||||
|
self._lastE *= 2.54
|
||||||
|
elif "G21" in data:
|
||||||
|
self._unitModifier = 1.0
|
||||||
|
if self._lastX is not None:
|
||||||
|
self._lastX /= 2.54
|
||||||
|
if self._lastY is not None:
|
||||||
|
self._lastY /= 2.54
|
||||||
|
if self._lastZ is not None:
|
||||||
|
self._lastZ /= 2.54
|
||||||
|
if self._lastE is not None:
|
||||||
|
self._lastE /= 2.54
|
||||||
|
elif "G90" in data:
|
||||||
|
self._relative = False
|
||||||
|
elif "G91" in data:
|
||||||
|
self._relative = True
|
||||||
|
elif "G92" in data:
|
||||||
|
self._setPosition(data)
|
||||||
|
elif data.startswith("!!DEBUG:"):
|
||||||
|
self._debugTrigger(data[len("!!DEBUG:"):].strip())
|
||||||
|
|
||||||
|
elif data.startswith("G0") or data.startswith("G1") or data.startswith("G2") or data.startswith("G3") \
|
||||||
|
or data.startswith("G28") or data.startswith("G29") or data.startswith("G30") \
|
||||||
|
or data.startswith("G31") or data.startswith("G32"):
|
||||||
|
# simulate reprap buffered commands via a Queue with maxsize which internally simulates the moves
|
||||||
|
self.buffered.put(data)
|
||||||
|
|
||||||
|
if len(data.strip()) > 0:
|
||||||
|
self._sendOk()
|
||||||
|
|
||||||
|
def _debugTrigger(self, data):
|
||||||
|
if data == "action_pause":
|
||||||
|
self.outgoing.put("// action:pause")
|
||||||
|
elif data == "action_resume":
|
||||||
|
self.outgoing.put("// action:resume")
|
||||||
|
elif data == "action_disconnect":
|
||||||
|
self.outgoing.put("// action:disconnect")
|
||||||
|
|
||||||
def _listSd(self):
|
def _listSd(self):
|
||||||
self.readList.append("Begin file list")
|
self.outgoing.put("Begin file list")
|
||||||
if settings().getBoolean(["devel", "virtualPrinter", "extendedSdFileList"]):
|
if settings().getBoolean(["devel", "virtualPrinter", "extendedSdFileList"]):
|
||||||
self.readList.extend(
|
items = map(
|
||||||
map(
|
lambda x: "%s %d" % (x.upper(), os.stat(os.path.join(self._virtualSd, x)).st_size),
|
||||||
lambda x: "%s %d" % (x.upper(), os.stat(os.path.join(self._virtualSd, x)).st_size),
|
os.listdir(self._virtualSd)
|
||||||
os.listdir(self._virtualSd)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.readList.extend(
|
items = map(
|
||||||
map(
|
lambda x: x.upper(),
|
||||||
lambda x: x.upper(),
|
os.listdir(self._virtualSd)
|
||||||
os.listdir(self._virtualSd)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
self.readList.append("End file list")
|
for item in items:
|
||||||
self._sendOk()
|
self.outgoing.put(item)
|
||||||
|
self.outgoing.put("End file list")
|
||||||
|
|
||||||
def _selectSdFile(self, filename):
|
def _selectSdFile(self, filename):
|
||||||
file = os.path.join(self._virtualSd, filename).lower()
|
file = os.path.join(self._virtualSd, filename).lower()
|
||||||
if not os.path.exists(file) or not os.path.isfile(file):
|
if not os.path.exists(file) or not os.path.isfile(file):
|
||||||
self.readList.append("open failed, File: %s." % filename)
|
self.outgoing.put("open failed, File: %s." % filename)
|
||||||
else:
|
else:
|
||||||
self._selectedSdFile = file
|
self._selectedSdFile = file
|
||||||
self._selectedSdFileSize = os.stat(file).st_size
|
self._selectedSdFileSize = os.stat(file).st_size
|
||||||
self.readList.append("File opened: %s Size: %d" % (filename, self._selectedSdFileSize))
|
self.outgoing.put("File opened: %s Size: %d" % (filename, self._selectedSdFileSize))
|
||||||
self.readList.append("File selected")
|
self.outgoing.put("File selected")
|
||||||
|
|
||||||
def _startSdPrint(self):
|
def _startSdPrint(self):
|
||||||
if self._selectedSdFile is not None:
|
if self._selectedSdFile is not None:
|
||||||
@@ -188,20 +279,18 @@ class VirtualPrinter():
|
|||||||
self._sdPrinter = threading.Thread(target=self._sdPrintingWorker)
|
self._sdPrinter = threading.Thread(target=self._sdPrintingWorker)
|
||||||
self._sdPrinter.start()
|
self._sdPrinter.start()
|
||||||
self._sdPrintingSemaphore.set()
|
self._sdPrintingSemaphore.set()
|
||||||
self._sendOk()
|
|
||||||
|
|
||||||
def _pauseSdPrint(self):
|
def _pauseSdPrint(self):
|
||||||
self._sdPrintingSemaphore.clear()
|
self._sdPrintingSemaphore.clear()
|
||||||
self._sendOk()
|
|
||||||
|
|
||||||
def _setSdPos(self, pos):
|
def _setSdPos(self, pos):
|
||||||
self._newSdFilePos = pos
|
self._newSdFilePos = pos
|
||||||
|
|
||||||
def _reportSdStatus(self):
|
def _reportSdStatus(self):
|
||||||
if self._sdPrinter is not None and self._sdPrintingSemaphore.is_set:
|
if self._sdPrinter is not None and self._sdPrintingSemaphore.is_set:
|
||||||
self.readList.append("SD printing byte %d/%d" % (self._selectedSdFilePos, self._selectedSdFileSize))
|
self.outgoing.put("SD printing byte %d/%d" % (self._selectedSdFilePos, self._selectedSdFileSize))
|
||||||
else:
|
else:
|
||||||
self.readList.append("Not SD printing")
|
self.outgoing.put("Not SD printing")
|
||||||
|
|
||||||
def _processTemperatureQuery(self):
|
def _processTemperatureQuery(self):
|
||||||
includeTarget = not settings().getBoolean(["devel", "virtualPrinter", "repetierStyleTargetTemperature"])
|
includeTarget = not settings().getBoolean(["devel", "virtualPrinter", "repetierStyleTargetTemperature"])
|
||||||
@@ -224,16 +313,16 @@ class VirtualPrinter():
|
|||||||
|
|
||||||
if settings().getBoolean(["devel", "virtualPrinter", "includeCurrentToolInTemps"]):
|
if settings().getBoolean(["devel", "virtualPrinter", "includeCurrentToolInTemps"]):
|
||||||
if includeTarget:
|
if includeTarget:
|
||||||
self.readList.append("ok T:%.2f /%.2f %s @:64\n" % (self.temp[self.currentExtruder], self.targetTemp[self.currentExtruder] + 1, allTempsString))
|
self.outgoing.put("ok T:%.2f /%.2f %s @:64\n" % (self.temp[self.currentExtruder], self.targetTemp[self.currentExtruder] + 1, allTempsString))
|
||||||
else:
|
else:
|
||||||
self.readList.append("ok T:%.2f %s @:64\n" % (self.temp[self.currentExtruder], allTempsString))
|
self.outgoing.put("ok T:%.2f %s @:64\n" % (self.temp[self.currentExtruder], allTempsString))
|
||||||
else:
|
else:
|
||||||
self.readList.append("ok %s @:64\n" % allTempsString)
|
self.outgoing.put("ok %s @:64\n" % allTempsString)
|
||||||
else:
|
else:
|
||||||
if includeTarget:
|
if includeTarget:
|
||||||
self.readList.append("ok T:%.2f /%.2f B:%.2f /%.2f @:64\n" % (self.temp[0], self.targetTemp[0], self.bedTemp, self.bedTargetTemp))
|
self.outgoing.put("ok T:%.2f /%.2f B:%.2f /%.2f @:64\n" % (self.temp[0], self.targetTemp[0], self.bedTemp, self.bedTargetTemp))
|
||||||
else:
|
else:
|
||||||
self.readList.append("ok T:%.2f B:%.2f @:64\n" % (self.temp[0], self.bedTemp))
|
self.outgoing.put("ok T:%.2f B:%.2f @:64\n" % (self.temp[0], self.bedTemp))
|
||||||
|
|
||||||
def _parseHotendCommand(self, line):
|
def _parseHotendCommand(self, line):
|
||||||
tool = 0
|
tool = 0
|
||||||
@@ -254,14 +343,10 @@ class VirtualPrinter():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if "M109" in line:
|
if "M109" in line:
|
||||||
self._heatupThread = threading.Thread(target=self._waitForHeatup, args=["tool%d" % tool])
|
self._waitForHeatup("tool%d" % tool)
|
||||||
self._heatupThread.start()
|
|
||||||
return
|
|
||||||
|
|
||||||
self._sendOk()
|
|
||||||
|
|
||||||
if settings().getBoolean(["devel", "virtualPrinter", "repetierStyleTargetTemperature"]):
|
if settings().getBoolean(["devel", "virtualPrinter", "repetierStyleTargetTemperature"]):
|
||||||
self.readList.append("TargetExtr%d:%d" % (tool, self.targetTemp[tool]))
|
self.outgoing.put("TargetExtr%d:%d" % (tool, self.targetTemp[tool]))
|
||||||
|
self._sendOk()
|
||||||
|
|
||||||
def _parseBedCommand(self, line):
|
def _parseBedCommand(self, line):
|
||||||
try:
|
try:
|
||||||
@@ -270,14 +355,98 @@ class VirtualPrinter():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if "M190" in line:
|
if "M190" in line:
|
||||||
self._heatupThread = threading.Thread(target=self._waitForHeatup, args=["bed"])
|
self._waitForHeatup("bed")
|
||||||
self._heatupThread.start()
|
if settings().getBoolean(["devel", "virtualPrinter", "repetierStyleTargetTemperature"]):
|
||||||
return
|
self.outgoing.put("TargetBed:%d" % self.bedTargetTemp)
|
||||||
|
|
||||||
self._sendOk()
|
self._sendOk()
|
||||||
|
|
||||||
if settings().getBoolean(["devel", "virtualPrinter", "repetierStyleTargetTemperature"]):
|
def _performMove(self, line):
|
||||||
self.readList.append("TargetBed:%d" % self.bedTargetTemp)
|
matchX = re.search("X([0-9.]+)", line)
|
||||||
|
matchY = re.search("Y([0-9.]+)", line)
|
||||||
|
matchZ = re.search("Z([0-9.]+)", line)
|
||||||
|
matchE = re.search("E([0-9.]+)", line)
|
||||||
|
|
||||||
|
duration = 0
|
||||||
|
if matchX is not None:
|
||||||
|
try:
|
||||||
|
x = float(matchX.group(1))
|
||||||
|
if self._relative or self._lastX is None:
|
||||||
|
duration = max(duration, x * self._unitModifier / float(self.speeds["x"]) * 60.0)
|
||||||
|
else:
|
||||||
|
duration = max(duration, (x - self._lastX) * self._unitModifier / float(self.speeds["x"]) * 60.0)
|
||||||
|
self._lastX = x
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if matchY is not None:
|
||||||
|
try:
|
||||||
|
y = float(matchY.group(1))
|
||||||
|
if self._relative or self._lastY is None:
|
||||||
|
duration = max(duration, y * self._unitModifier / float(self.speeds["y"]) * 60.0)
|
||||||
|
else:
|
||||||
|
duration = max(duration, (y - self._lastY) * self._unitModifier / float(self.speeds["y"]) * 60.0)
|
||||||
|
self._lastY = y
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if matchZ is not None:
|
||||||
|
try:
|
||||||
|
z = float(matchZ.group(1))
|
||||||
|
if self._relative or self._lastZ is None:
|
||||||
|
duration = max(duration, z * self._unitModifier / float(self.speeds["z"]) * 60.0)
|
||||||
|
else:
|
||||||
|
duration = max(duration, (z - self._lastZ) * self._unitModifier / float(self.speeds["z"]) * 60.0)
|
||||||
|
self._lastZ = z
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if matchE is not None:
|
||||||
|
try:
|
||||||
|
e = float(matchE.group(1))
|
||||||
|
if self._relative or self._lastE is None:
|
||||||
|
duration = max(duration, e * self._unitModifier / float(self.speeds["e"]) * 60.0)
|
||||||
|
else:
|
||||||
|
duration = max(duration, (e - self._lastE) * self._unitModifier / float(self.speeds["e"]) * 60.0)
|
||||||
|
self._lastE = e
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if duration:
|
||||||
|
if settings().getBoolean(["devel", "virtualPrinter", "waitOnLongMoves"]):
|
||||||
|
slept = 0
|
||||||
|
while duration - slept > self._read_timeout:
|
||||||
|
time.sleep(self._read_timeout)
|
||||||
|
self.outgoing.put("wait")
|
||||||
|
slept += self._read_timeout
|
||||||
|
else:
|
||||||
|
time.sleep(duration)
|
||||||
|
|
||||||
|
def _setPosition(self, line):
|
||||||
|
matchX = re.search("X([0-9.]+)", line)
|
||||||
|
matchY = re.search("Y([0-9.]+)", line)
|
||||||
|
matchZ = re.search("Z([0-9.]+)", line)
|
||||||
|
matchE = re.search("E([0-9.]+)", line)
|
||||||
|
|
||||||
|
if matchX is None and matchY is None and matchZ is None and matchE is None:
|
||||||
|
self._lastX = self._lastY = self._lastZ = self._lastE = 0
|
||||||
|
else:
|
||||||
|
if matchX is not None:
|
||||||
|
try:
|
||||||
|
self._lastX = float(matchX.group(1))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if matchY is not None:
|
||||||
|
try:
|
||||||
|
self._lastY = float(matchY.group(1))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if matchZ is not None:
|
||||||
|
try:
|
||||||
|
self._lastZ = float(matchZ.group(1))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if matchE is not None:
|
||||||
|
try:
|
||||||
|
self._lastE = float(matchE.group(1))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def _writeSdFile(self, filename):
|
def _writeSdFile(self, filename):
|
||||||
file = os.path.join(self._virtualSd, filename).lower()
|
file = os.path.join(self._virtualSd, filename).lower()
|
||||||
@@ -285,17 +454,15 @@ class VirtualPrinter():
|
|||||||
if os.path.isfile(file):
|
if os.path.isfile(file):
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
else:
|
else:
|
||||||
self.readList.append("error writing to file")
|
self.outgoing.put("error writing to file")
|
||||||
|
|
||||||
self._writingToSd = True
|
self._writingToSd = True
|
||||||
self._selectedSdFile = file
|
self._selectedSdFile = file
|
||||||
self.readList.append("Writing to file: %s" % filename)
|
self.outgoing.put("Writing to file: %s" % filename)
|
||||||
self._sendOk()
|
|
||||||
|
|
||||||
def _finishSdFile(self):
|
def _finishSdFile(self):
|
||||||
self._writingToSd = False
|
self._writingToSd = False
|
||||||
self._selectedSdFile = None
|
self._selectedSdFile = None
|
||||||
self._sendOk()
|
|
||||||
|
|
||||||
def _sdPrintingWorker(self):
|
def _sdPrintingWorker(self):
|
||||||
self._selectedSdFilePos = 0
|
self._selectedSdFilePos = 0
|
||||||
@@ -318,47 +485,45 @@ class VirtualPrinter():
|
|||||||
if 'M140' in line or 'M190' in line:
|
if 'M140' in line or 'M190' in line:
|
||||||
self._parseBedCommand(line)
|
self._parseBedCommand(line)
|
||||||
|
|
||||||
time.sleep(0.01)
|
time.sleep(settings().getFloat(["devel", "virtualPrinter", "throttle"]))
|
||||||
|
|
||||||
self._sdPrintingSemaphore.clear()
|
self._sdPrintingSemaphore.clear()
|
||||||
self._selectedSdFilePos = 0
|
self._selectedSdFilePos = 0
|
||||||
self._sdPrinter = None
|
self._sdPrinter = None
|
||||||
self.readList.append("Done printing file")
|
self.outgoing.put("Done printing file")
|
||||||
|
|
||||||
def _waitForHeatup(self, heater):
|
def _waitForHeatup(self, heater):
|
||||||
delta = 0.5
|
delta = 1
|
||||||
delay = 1
|
delay = 1
|
||||||
if heater.startswith("tool"):
|
if heater.startswith("tool"):
|
||||||
toolNum = int(heater[len("tool"):])
|
toolNum = int(heater[len("tool"):])
|
||||||
while self.temp[toolNum] < self.targetTemp[toolNum] - delta or self.temp[toolNum] > self.targetTemp[toolNum] + delta:
|
while self.temp[toolNum] < self.targetTemp[toolNum] - delta or self.temp[toolNum] > self.targetTemp[toolNum] + delta:
|
||||||
self._simulateTemps()
|
self._simulateTemps(delta=delta)
|
||||||
self.readList.append("T:%0.2f /%0.2f" % (self.temp[toolNum], self.targetTemp[toolNum]))
|
self.outgoing.put("T:%0.2f" % self.temp[toolNum])
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
elif heater == "bed":
|
elif heater == "bed":
|
||||||
while self.bedTemp < self.bedTargetTemp - delta or self.bedTemp > self.bedTargetTemp + delta:
|
while self.bedTemp < self.bedTargetTemp - delta or self.bedTemp > self.bedTargetTemp + delta:
|
||||||
self._simulateTemps()
|
self._simulateTemps(delta=delta)
|
||||||
self.readList.append("B:%0.2f /%0.2f" % (self.bedTemp, self.bedTargetTemp))
|
self.outgoing.put("B:%0.2f" % self.bedTemp)
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
self.readList.append("ok")
|
|
||||||
|
|
||||||
def _deleteSdFile(self, filename):
|
def _deleteSdFile(self, filename):
|
||||||
f = os.path.join(self._virtualSd, filename)
|
f = os.path.join(self._virtualSd, filename)
|
||||||
if os.path.exists(f) and os.path.isfile(f):
|
if os.path.exists(f) and os.path.isfile(f):
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
self._sendOk()
|
|
||||||
|
|
||||||
def _simulateTemps(self):
|
def _simulateTemps(self, delta=1):
|
||||||
timeDiff = self.lastTempAt - time.time()
|
timeDiff = self.lastTempAt - time.time()
|
||||||
self.lastTempAt = time.time()
|
self.lastTempAt = time.time()
|
||||||
for i in range(len(self.temp)):
|
for i in range(len(self.temp)):
|
||||||
if abs(self.temp[i] - self.targetTemp[i]) > 1:
|
if abs(self.temp[i] - self.targetTemp[i]) > delta:
|
||||||
oldVal = self.temp[i]
|
oldVal = self.temp[i]
|
||||||
self.temp[i] += math.copysign(timeDiff * 10, self.targetTemp[i] - self.temp[i])
|
self.temp[i] += math.copysign(timeDiff * 10, self.targetTemp[i] - self.temp[i])
|
||||||
if math.copysign(1, self.targetTemp[i] - oldVal) != math.copysign(1, self.targetTemp[i] - self.temp[i]):
|
if math.copysign(1, self.targetTemp[i] - oldVal) != math.copysign(1, self.targetTemp[i] - self.temp[i]):
|
||||||
self.temp[i] = self.targetTemp[i]
|
self.temp[i] = self.targetTemp[i]
|
||||||
if self.temp[i] < 0:
|
if self.temp[i] < 0:
|
||||||
self.temp[i] = 0
|
self.temp[i] = 0
|
||||||
if abs(self.bedTemp - self.bedTargetTemp) > 1:
|
if abs(self.bedTemp - self.bedTargetTemp) > delta:
|
||||||
oldVal = self.bedTemp
|
oldVal = self.bedTemp
|
||||||
self.bedTemp += math.copysign(timeDiff * 10, self.bedTargetTemp - self.bedTemp)
|
self.bedTemp += math.copysign(timeDiff * 10, self.bedTargetTemp - self.bedTemp)
|
||||||
if math.copysign(1, self.bedTargetTemp - oldVal) != math.copysign(1, self.bedTargetTemp - self.bedTemp):
|
if math.copysign(1, self.bedTargetTemp - oldVal) != math.copysign(1, self.bedTargetTemp - self.bedTemp):
|
||||||
@@ -366,34 +531,98 @@ class VirtualPrinter():
|
|||||||
if self.bedTemp < 0:
|
if self.bedTemp < 0:
|
||||||
self.bedTemp = 0
|
self.bedTemp = 0
|
||||||
|
|
||||||
|
def _processBuffer(self):
|
||||||
|
while self.buffered is not None:
|
||||||
|
try:
|
||||||
|
line = self.buffered.get(timeout=0.5)
|
||||||
|
except Queue.Empty:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if line is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
self._performMove(line)
|
||||||
|
|
||||||
|
def write(self, data):
|
||||||
|
with self._incoming_lock:
|
||||||
|
if self.incoming is None or self.outgoing is None:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
self.incoming.put(data, timeout=self._write_timeout)
|
||||||
|
except Queue.Full:
|
||||||
|
raise SerialTimeoutException()
|
||||||
|
|
||||||
def readline(self):
|
def readline(self):
|
||||||
if self.readList is None:
|
try:
|
||||||
return ''
|
line = self.outgoing.get(timeout=self._read_timeout)
|
||||||
n = 0
|
time.sleep(settings().getFloat(["devel", "virtualPrinter", "throttle"]))
|
||||||
|
return line
|
||||||
self._simulateTemps()
|
except Queue.Empty:
|
||||||
|
return ""
|
||||||
while len(self.readList) < 1:
|
|
||||||
time.sleep(0.1)
|
|
||||||
n += 1
|
|
||||||
if n == 20:
|
|
||||||
return ''
|
|
||||||
if self.readList is None:
|
|
||||||
return ''
|
|
||||||
time.sleep(0.001)
|
|
||||||
return self.readList.pop(0)
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.readList = None
|
self.incoming = None
|
||||||
|
self.outgoing = None
|
||||||
|
self.buffered = None
|
||||||
|
|
||||||
def _sendOk(self):
|
def _sendOk(self):
|
||||||
if settings().getBoolean(["devel", "virtualPrinter", "okWithLinenumber"]):
|
if settings().getBoolean(["devel", "virtualPrinter", "okWithLinenumber"]):
|
||||||
self.readList.append("ok %d" % self.lastN)
|
self.outgoing.put("ok %d" % self.lastN)
|
||||||
else:
|
else:
|
||||||
self.readList.append("ok")
|
self.outgoing.put("ok")
|
||||||
|
|
||||||
def _sendWaitAfterTimeout(self, timeout=5):
|
def _sendWaitAfterTimeout(self, timeout=5):
|
||||||
time.sleep(timeout)
|
time.sleep(timeout)
|
||||||
if self.readList is not None:
|
if self.outgoing is not None:
|
||||||
self.readList.append("wait")
|
self.outgoing.put("wait")
|
||||||
|
|
||||||
|
class CharCountingQueue(Queue.Queue):
|
||||||
|
|
||||||
|
def __init__(self, maxsize, name=None):
|
||||||
|
Queue.Queue.__init__(self, maxsize=maxsize)
|
||||||
|
self._size = 0
|
||||||
|
self._name = name
|
||||||
|
|
||||||
|
def put(self, item, block=True, timeout=None):
|
||||||
|
self.not_full.acquire()
|
||||||
|
try:
|
||||||
|
item_size = self._len(item)
|
||||||
|
|
||||||
|
if not block:
|
||||||
|
if self._qsize() + item_size >= self.maxsize:
|
||||||
|
raise Queue.Full
|
||||||
|
elif timeout is None:
|
||||||
|
while self._qsize() + item_size >= self.maxsize:
|
||||||
|
self.not_full.wait()
|
||||||
|
elif timeout < 0:
|
||||||
|
raise ValueError("'timeout' must be a positive number")
|
||||||
|
else:
|
||||||
|
endtime = time.time() + timeout
|
||||||
|
while self._qsize() + item_size >= self.maxsize:
|
||||||
|
remaining = endtime - time.time()
|
||||||
|
if remaining <= 0.0:
|
||||||
|
raise Queue.Full
|
||||||
|
self.not_full.wait(remaining)
|
||||||
|
|
||||||
|
self._put(item)
|
||||||
|
self.unfinished_tasks += 1
|
||||||
|
self.not_empty.notify()
|
||||||
|
finally:
|
||||||
|
self.not_full.release()
|
||||||
|
|
||||||
|
def _len(self, item):
|
||||||
|
return len(item)
|
||||||
|
|
||||||
|
def _qsize(self, len=len):
|
||||||
|
return self._size
|
||||||
|
|
||||||
|
# Put a new item in the queue
|
||||||
|
def _put(self, item):
|
||||||
|
self.queue.append(item)
|
||||||
|
self._size += self._len(item)
|
||||||
|
|
||||||
|
# Get an item from the queue
|
||||||
|
def _get(self):
|
||||||
|
item = self.queue.popleft()
|
||||||
|
self._size -= self._len(item)
|
||||||
|
return item
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
|
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||||
|
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
from ddt import ddt, data, unpack
|
||||||
|
|
||||||
|
import octoprint.printer
|
||||||
|
|
||||||
|
@ddt
|
||||||
|
class EstimationTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.estimation_helper = type(octoprint.printer.TimeEstimationHelper)(octoprint.printer.TimeEstimationHelper.__name__, (octoprint.printer.TimeEstimationHelper,), {
|
||||||
|
'STABLE_THRESHOLD': 0.1,
|
||||||
|
'STABLE_ROLLING_WINDOW': 3,
|
||||||
|
'STABLE_COUNTDOWN': 1
|
||||||
|
})()
|
||||||
|
|
||||||
|
@data(
|
||||||
|
((1.0, 2.0, 3.0, 4.0, 5.0), 3.0),
|
||||||
|
((1.0, 2.0, 0.0, 1.0, 2.0), 1.2),
|
||||||
|
((1.0, -2.0, -1.0, -2.0, 3.0), -0.2)
|
||||||
|
)
|
||||||
|
@unpack
|
||||||
|
def test_average_total(self, estimates, expected):
|
||||||
|
for estimate in estimates:
|
||||||
|
self.estimation_helper.update(estimate)
|
||||||
|
|
||||||
|
self.assertEquals(self.estimation_helper.average_total, expected)
|
||||||
|
|
||||||
|
@data(
|
||||||
|
((1.0, 2.0), None), # not enough values, have 1, need 3
|
||||||
|
((1.0, 2.0, 3.0), None), # not enough values, have 2, need 3
|
||||||
|
((1.0, 2.0, 3.0, 4.0), 0.5), # average totals: 1.0, 1.5, 2.0, 2.5 => (3 * 0.5 / 3 = 0.5
|
||||||
|
((1.0, 2.0, 3.0, 4.0, 5.0), 0.5), # average totals: 1.0, 1.5, 2.0, 2.5, 3.0 => (0.5 + 0.5 + 0.5) / 3 = 0.5
|
||||||
|
((1.0, 2.0, 0.0, 1.0, 2.0), 0.7 / 3) # average totals: 1.0, 1.5, 1.0, 1.0, 1.2 => (0.5 + 0.0 + 0.2) / 3 = 0.7 / 3
|
||||||
|
)
|
||||||
|
@unpack
|
||||||
|
def test_average_distance(self, estimates, expected):
|
||||||
|
for estimate in estimates:
|
||||||
|
self.estimation_helper.update(estimate)
|
||||||
|
|
||||||
|
self.assertEquals(self.estimation_helper.average_distance, expected)
|
||||||
|
|
||||||
|
@data(
|
||||||
|
((1.0, 1.0), None),
|
||||||
|
((1.0, 1.0, 1.0), 1.0),
|
||||||
|
((1.0, 2.0, 3.0, 4.0, 5.0), 4.0),
|
||||||
|
)
|
||||||
|
@unpack
|
||||||
|
def test_average_total_rolling(self, estimates, expected):
|
||||||
|
for estimate in estimates:
|
||||||
|
self.estimation_helper.update(estimate)
|
||||||
|
|
||||||
|
self.assertEquals(self.estimation_helper.average_total_rolling, expected)
|
||||||
|
|
||||||
|
@data(
|
||||||
|
((1.0, 1.0, 1.0, 1.0), False), # average totals: 1.0, 1.0, 1.0, 1.0 => 3.0 / 3 = 1.0
|
||||||
|
((1.0, 1.0, 1.0, 1.0, 1.0), True), # average totals: 1.0, 1.0, 1.0, 1.0, 1.0 => 0.0 / 3 = 0.0
|
||||||
|
((1.0, 2.0, 3.0, 4.0, 5.0), False), # average totals: 1.0, 1.5, 2.0, 2.5, 3.0 => 1.5 / 3 = 0.5
|
||||||
|
((0.0, 0.09, 0.18, 0.27, 0.36), True) # average totals: 0.0, 0.045, 0.09, 0.135, 0.18 => (0.045 + 0.045 + 0.045) / 3 = 0.045
|
||||||
|
)
|
||||||
|
@unpack
|
||||||
|
def test_is_stable(self, estimates, expected):
|
||||||
|
for estimate in estimates:
|
||||||
|
self.estimation_helper.update(estimate)
|
||||||
|
|
||||||
|
self.assertEquals(self.estimation_helper.is_stable(), expected)
|
||||||
|
|
||||||
Reference in new issue
Block a user