Compare commits

...
Author SHA1 Message Date
Gina Häußge 7affce2f64 Forgot to fix the Commit link 2015-03-23 10:49:35 +01:00
Gina Häußge 809c452285 Preparing release of 1.1.2 2015-03-23 10:43:42 +01:00
Gina Häußge 157408b53a Back ported some documentation from devel 2015-03-23 10:08:16 +01:00
Gina Häußge d8694107b7 Made metadata reading in client a bit more resilient against errors 2015-03-23 10:08:01 +01:00
Gina Häußge 30e43f9c41 Fixed a bug causing gcodeInterpreter to hiccup on GCODES containing invalid coordinates such as Xnan or Yinf, causing in turn the file API to fail until the offending file was deleted and its metadata removed
(cherry picked from commit ce363ce)
2015-03-23 09:51:54 +01:00
Gina Häußge 3899626870 If a tool did not extrude anything, skip it in the filament usage summary
Also targets #539
(cherry picked from commit dffa00d)
2015-03-23 09:18:52 +01:00
Gina Häußge d504157c6f Added sanity check for extruder selection in gcode files
Any T command targeting a number higher than the value specified in the settings for gcodeAnalysis.maxExtruders (defaults to 10) will be ignored and trigger a warning in the log file.

Fix for #539
(cherry picked from commit 7d5c55f)
2015-03-23 09:15:27 +01:00
Gina Häußge ad68b05f7d Fix: docs for printer resource now match implementation 2015-03-09 09:29:17 +01:00
Gina Häußge 7eb7acf3af Fixed bed temperature offsets
See #801 and guysoft/OctoPi#76
2015-03-09 09:08:07 +01:00
Gina Häußge d974ab0979 Forgot a changelog entry (again)
(cherry picked from commit 2111a06)
2015-02-22 15:38:44 +01:00
Gina Häußge 89d972ff40 Always make sure to (re)set file position to the beginning when starting SD card prints
Closes #780
(cherry picked from commit 5c35a28)
2015-02-22 15:24:48 +01:00
Gina Häußge 4fede5a9c6 Merge remote-tracking branch 'origin/master' 2015-02-10 18:41:24 +01:00
Gina Häußge 7971bc91b2 Always send commands with checksum when printing
(cherry picked from commit 3ee745d)
2015-02-10 18:40:41 +01:00
Gina Häußge 2523cf81ba Merge pull request #752 from Diaoul/patch-1
Fix logger call for gcode multi commands events
2015-02-01 12:59:56 +01:00
Antoine Bertin 8a61e4517f Fix logger call for gcode multi commands events 2015-02-01 11:05:37 +01:00
Gina Häußge f32c977381 Update CONTRIBUTING.md 2015-01-27 09:53:09 +01:00
Gina Häußge 2de863c5db Update CONTRIBUTING.md 2015-01-23 12:50:34 +01:00
Gina Häußge 09e5676009 Update CONTRIBUTING.md 2015-01-23 12:30:02 +01:00
Gina Häußge 5f835edf2e Changelog entries for #706 and #719 2015-01-19 16:48:03 +01:00
Gina Häußge 83790fcd64 Do not truncate error reported from printer in UI
Closes #706
2015-01-19 16:42:09 +01:00
Gina Häußge 6dd2dcee16 GCODE viewer: Even better version of initial bed centering, backported from c858c8f75b
See #719
2015-01-19 16:34:40 +01:00
Gina Häußge a91a354fa9 Fixed a bug causing the GCODE viewer to be zoomed in outside of the print bed due to missing initial move
Possible fix for #719
2015-01-19 16:26:52 +01:00
Gina Häußge 4bf3d698e3 Fixed some changelog entries and added commit history to unreleased 1.1.2 2015-01-19 15:52:20 +01:00
Gina Häußge 868dc6d7a9 Increased default communication and connection timeouts 2015-01-12 17:34:08 +01:00
Gina Häußge 1ddb187518 Fixed changelog entry for last commit, was added to wrong section 2015-01-12 17:25:02 +01:00
Gina Häußge b7badcbf02 Fix error where API state is requested and printer is offline
(cherry picked from commit 619fe9a)
2015-01-12 16:55:38 +01:00
C-o-r-E 684d12e60e Fix error where API state is requested and printer is offline
(cherry picked from commit 619fe9a)
2015-01-12 16:53:17 +01:00
Gina Häußge 87ddcac2fc Don't user server.host but server.forwardedHost as fallback for generated external URLs
Closes #698
2014-12-30 10:20:50 +01:00
Gina Häußge e3383fe4c1 Generated URLs now take X-Forwarded-Host header sent by proxies into account for included host and port 2014-12-29 20:48:33 +01:00
Gina Häußge 292856e1bd Fixed relative URL to sockjs endpoint, wasn't yet using the proper base url 2014-12-29 20:45:54 +01:00
Gina Häußge 6307b765e3 Only decrement the image counter if it is set and larger than 0
Backported from devel
2014-12-28 00:19:55 +01:00
Gina Häußge a30e41f0b4 Timelapses: Do not try to use image counter if still set to None and synchronize decrementing of image counter via mutex as well
Possible fixes for #693, the latter maybe also for #690
2014-12-28 00:12:19 +01:00
Gina Häußge 51341f6722 Added removal of pyc files (and their parent folders if they are empty after that) to the python setup.py clean command
(cherry picked from commit 9e014eb)
2014-12-28 00:00:57 +01:00
Gina Häußge fb15751703 Decrease image counter if an image could not be captured from webcam
Should keep rendering of timelapse from breaking if only a couple of images couldn't be captured due to whatever reason. Suggested by @midopple in #344
(cherry picked from commit bf9d5ef)
2014-12-27 23:55:23 +01:00
Gina Häußge a0105bcb2f Better error handling for capture issues during timelapsing
Should help debugging issue #425 and any future problems in that area.
(cherry picked from commit 1a7a468)
2014-12-27 23:52:38 +01:00
Gina Häußge d2910de121 Added entry to change log 2014-12-09 22:24:53 +01:00
Gina Häußge c5be9908c5 Don't hiccup on slic3r filament_diameter comments generated for multi extruder setups 2014-12-09 22:20:55 +01:00
19 changed files with 1215 additions and 150 deletions

No files matched your search

+34 -1
View File
@@ -1,11 +1,42 @@
# OctoPrint Changelog
## 1.1.2 (Unreleased)
## 1.1.2 (2015-03-23)
### 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))
* Increased default communication and connection timeouts
* [#706](https://github.com/foosel/OctoPrint/issues/706) - Do not truncate error reported from printer
### Bug Fixes
* [#539](https://github.com/foosel/OctoPrint/issues/539) - Limit maximum number of tools, sanity check tool numbers in
GCODE files against upper limit and refuse to create 10000 tools due to weird slicers. (backported from `devel`)
* [#634](https://github.com/foosel/OctoPrint/pull/634) - Fixed missing `branch` fields in version dicts generated
by versioneer
* [#679](https://github.com/foosel/OctoPrint/issues/679) - Fix error where API state is requested and printer is offline
(backport of [619fe9a](https://github.com/foosel/OctoPrint/commit/619fe9a0e78826bd1524b235a910156439bcb6d7)).
* [#719](https://github.com/foosel/OctoPrint/issues/719) - Properly center print bed in GCODE viewer
* [#780](https://github.com/foosel/OctoPrint/issues/780) - Always (re)set file position in SD files to 0 so that reprints
work correctly (backported from ``devel``)
* [#801](https://github.com/foosel/OctoPrint/issues/801) - Fixed setting of bed temperature offset
* [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
* [unreported] Fixed a bug causing gcodeInterpreter to hiccup on GCODES containing invalid coordinates such as Xnan or
Yinf (backported from `devel`)
* 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
([Commits](https://github.com/foosel/OctoPrint/compare/1.1.1...1.1.2))
## 1.1.1 (2014-10-27)
@@ -23,6 +54,8 @@
* [#604](https://github.com/foosel/OctoPrint/issues/604) - Properly initialize settings basedir on server startup
* [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)
### New Features
+37 -10
View File
@@ -1,22 +1,49 @@
Issues, Tickets, however you may call them
------------------------------------------
Read the following short instructions **fully** and **follow them** if you want your ticket to be taken care of and not closed again directly!
Read the following short instructions **fully** and **follow them** if you want your ticket to be taken care of and not closed again directly! They are linked on top of every new issue form, so don't say nobody warned you afterwards.
- Always create **one ticket for one purpose**. So don't mix two or more feature requests, support requests, bugs etc into one ticket. If you do, your ticket will be treated as if only describing the first purpose, the others will be ignored!
- If you want to report a bug, **READ AND FOLLOW [How to file a bug report](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)!** Tickets will be automatically checked if they comply with the requirements outlined in that wiki node! Other then what's written in there (**and really EVERYTHING that is written in there!**) you don't have to do anything special with your ticket.
- **Read the [FAQ](https://github.com/foosel/OctoPrint/wiki/FAQ)**
- Always create **one ticket for one purpose**. So don't mix two or more feature requests, support requests, bugs etc into one ticket. If you do, your ticket will be closed!
- If you want to report a bug, **READ AND FOLLOW [How to file a bug report](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)!** Tickets will be automatically checked if they comply with the requirements outlined in that wiki node! Other then what's written in there (**and really EVERYTHING that is written in there!**) you don't have to do anything special with your ticket. Listen to what GitIssueBot might have to say to you!
- If you want to post a **request** of any kind (feature request, documentation request, ...), **add [Request] to your issue's title!**
- If you need **support** with a problem of your installation (e.g. if you have problems getting the webcam to work), **add [Support] to your issue's title!**. Note that for problems like these, the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741) will probably get you help faster!
- If you have a general **question**, **add [Question] to your issue's title!**. Note that for problems like these, the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741) will probably get you help faster!
- If you have another reason for creating a ticket that doesn't fit any of the above categories, think hard if it might not be something better suited for the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741). If you are sure it needs to be reported here, **add [Misc] to your issue's title!**
- If you need **support** with a problem of your installation (e.g. if you have problems getting the webcam to work) or have a general **question**, the issue tracker is not the right place. Consult the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741) instead!
- If you are a developer that wants to brainstorm a pull request or possible changes to the plugin system, **add [Brainstorming] to your issue's title!** (see below).
- If you have another reason for creating a ticket that doesn't fit any of the above categories, it's something better suited for the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741).
Following these guidelines (**especially EVERYTHING mentioned in ["How to file a bug report"](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)**) is necessary so the tickets stay manageable - you are not the only one with an open issue, so please respect that you have to **play by the rules** so that your problem can be taken care of. Tickets not playing by the rules **will be closed without further investigation!**.
Pull Requests
-------------
1. Please create all pull requests against the `devel` branch.
2. Create **one pull request per feature/bug fix**.
3. Create a custom branch for your feature/bug fix and use that as base for your pull request. Pull requests directly against your version of `devel` will be closed.
4. In your pull request's description, state what your pull request is doing, as in, what feature does it implement, what bug does it fix.
1. If you want to add a new feature to OctoPrint, **please always first consider if it wouldn't be better suited for a
plugin.** As a general rule of thumb, any feature that is only of interest to a small sub group should be moved into a
plugin. If the current plugin system doesn't allow you to implement your feature as a plugin, create a "Brainstorming"
ticket to get the discussion going how best to solve *this* in OctoPrint's plugin system - maybe that's the actual PR
you have been waiting for to contribute :)
2. If you plan to make **any large changes to the code or appearance, please open a "Brainstorming" ticket first** so that
we can determine if it's a good time for your specific pull request. It might be that I'm currently in the process of
making heavy changes to the code locations you'd target as well, or your approach doesn't fit the general "project
vision", and that would just cause unnecessary work and frustration for everyone or possibly get the PR rejected.
3. When adding code to OctoPrint, make sure you **follow the current coding style**. That means tabs instead of spaces in the
python files (yes, I know that this goes against PEP-8, I don't care) and space instead of tabs in the Javascript sources,
english language (that means code, variables, comments!), comments where necessary (tell why the code does something like
it does it, structure your code), following the general architecture. If your PR needs to make changes to the Stylesheets,
change the ``.less`` files from which the CSS is compiled. PRs that contain direct changes to the compiled
CSS will be closed.
4. **Test your changes thoroughly**. That also means testing with usage scenarios you don't normally use, e.g. if you only
use access control, test without and vice versa. If you only test with your printer, test with the virtual printer and
vice versa. State in your pull request how your tested your changes.
5. Please create all pull requests **against the `devel` branch**.
6. Create **one pull request per feature/bug fix**.
7. Create a **custom branch** for your feature/bug fix and use that as base for your pull request. Pull requests directly
against your version of `devel` will be closed.
7. In your pull request's description, **state what your pull request is doing**, as in, what feature does it implement, what
bug does it fix. The more thoroughly you explain your intent behind the PR here, the higher the chances it will get merged
fast.
History
-------
* 2015-01-23: More guidelines for creating pull requests, support/questions redirected to Mailinglist/G+ community
* 2015-01-27: Added another explicit link to the FAQ
+351
View File
@@ -0,0 +1,351 @@
.. _sec-api-datamodel:
*****************
Common data model
*****************
.. contents::
.. _sec-api-datamodel-printer:
Printer related
===============
.. _sec-api-datamodel-printer-state:
Printer State
-------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``text``
- 1
- String
- A textual representation of the current state of the printer, e.g. "Operational" or "Printing"
* - ``flags``
- 1
- Printer state flags
- A couple of boolean printer state flags
* - ``flags.operational``
- 1
- Boolean
- ``true`` if the printer is operational, ``false`` otherwise
* - ``flags.paused``
- 1
- Boolean
- ``true`` if the printer is currently paused, ``false`` otherwise
* - ``flags.printing``
- 1
- Boolean
- ``true`` if the printer is currently printing, ``false`` otherwise
* - ``flags.sdReady``
- 1
- Boolean
- ``true`` if the printer's SD card is available and initialized, ``false`` otherwise. This is redundant information
to :ref:`the SD State <sec-api-printer-datamodel-sdstate>`.
* - ``flags.error``
- 1
- Boolean
- ``true`` if an unrecoverable error occurred, ``false`` otherwise
* - ``flags.ready``
- 1
- Boolean
- ``true`` if the printer is operational and no data is currently being streamed to SD, so ready to receive instructions
* - ``flags.closedOrError``
- 1
- Boolean
- ``true`` if the printer is disconnected (possibly due to an error), ``false`` otherwise
.. _sec-api-datamodel-printer-tempdata:
Temperature Data
----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``actual``
- 1
- Number
- Current temperature
* - ``target``
- 1
- Number
- Target temperature, may be ``null`` if no target temperature is set.
* - ``offset``
- 0..1
- Number
- Currently configured temperature offset to apply, will be left out for historic temperature information.
.. _sec-api-datamodel-printer-temphistory:
Historic Temperature Data Point
-------------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``time``
- 1
- Unix Timestamp
- Timestamp of this data point
* - ``tool{n}``
- 0..*
- :ref:`Temperature Data <sec-api-datamodel-printer-tempdata>`
- Temperature stats for tool *n*. Enumeration starts at 0 for the first tool. Not included if querying only
bed state.
* - ``bed``
- 0..*
- :ref:`Temperature Data <sec-api-datamodel-printer-tempdata>`
- Temperature stats for the printer's heated bed. Not included if querying only tool state.
.. _sec-api-datamodel-printer-tempoffset:
Temperature offset
------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``tool{n}``
- 0..1
- Number
- Temperature offset for tool *n*. Enumeration starts at 0 for the first tool.
* - ``bed``
- 0..1
- Number
- Temperature offset for the printer's heated bed.
.. _sec-api-datamodel-jobs:
Job related
===========
.. _sec-api-datamodel-jobs-job:
Job information
---------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``file``
- 1
- :ref:`File information (abridged) <sec-api-datamodel-files-file>`
- The file that is the target of the current print job
* - ``estimatedPrintTime``
- 0..1
- Integer
- The estimated print time for the file, in seconds.
* - ``lastPrintTime``
- 0..1
- Integer
- The print time of the last print of the file, in seconds.
* - ``filament``
- 0..1
- Object
- Information regarding the estimated filament usage of the print job
* - ``filament.length``
- 0..1
- Integer
- Length of filament used, in mm
* - ``filament.volume``
- 0..1
- Float
- Volume of filament used, in cm³
.. _sec-api-datamodel-jobs-progress:
Progress information
--------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``completion``
- 1
- Float
- Percentage of completion of the current print job
* - ``filepos``
- 1
- Integer
- Current position in the file being printed, in bytes from the beginning
* - ``printTime``
- 1
- Integer
- Time already spent printing, in seconds
* - ``printTimeLeft``
- 1
- Integer
- Estimate of time left to print, in seconds
.. _sec-api-datamodel-files:
File related
============
.. _sec-api-datamodel-files-file:
File information
----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- String
- The name of the file
* - ``size``
- 0..1
- Number
- The size of the file in bytes. Only available for ``local`` files.
* - ``date``
- 0..1
- Unix timestamp
- The timestamp when this file was uploaded. Only available for ``local`` files.
* - ``origin``
- 1
- String, either ``local`` or ``sdcard``
- The origin of the file, ``local`` when stored in OctoPrint's ``uploads`` folder, ``sdcard`` when stored on the
printer's SD card (if available)
* - ``refs``
- 0..1
- :ref:`sec-api-datamodel-files-ref`
- References relevant to this file, left out in abridged version
* - ``gcodeAnalysis``
- 0..1
- :ref:`GCODE analysis information <sec-api-datamodel-files-gcodeanalysis>`
- Information from the analysis of the GCODE file, if available. Left out in abridged version.
* - ``prints``
- 0..1
- :ref:`Print history <sec-api-datamodel-files-prints>`
- Information regarding prints of this file, if available. Left out in abridged version.
.. _sec-api-datamodel-files-gcodeanalysis:
GCODE analysis information
--------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``estimatedPrintTime``
- 0..1
- Integer
- The estimated print time of the file, in seconds
* - ``filament``
- 0..1
- Object
- The estimated usage of filament
* - ``filament.length``
- 0..1
- Integer
- The length of filament used, in mm
* - ``filament.volume``
- 0..1
- Float
- The volume of filament used, in cm³
.. _sec-api-datamodel-files-prints:
Print history
-------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``failure``
- 1
- Number
- The number of failed prints on record for the file
* - ``success``
- 1
- Number
- The number of successful prints on record for the file
* - ``last``
- 0..1
- Object
- Information regarding the last print on record for the file
* - ``last.date``
- 1
- Unix timestamp
- Timestamp when this file was printed last
* - ``last.success``
- 1
- Boolean
- Whether the last print on record was a success (``true``) or not (``false``)
.. _sec-api-datamodel-files-ref:
References
----------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``resource``
- 1
- URL
- The resource that represents the file (e.g. for issuing commands to or for deleting)
* - ``download``
- 0..1
- URL
- The download URL for the file
* - ``model``
- 0..1
- URL
- The model from which this file was generated (e.g. an STL, currently not used)
+1
View File
@@ -14,3 +14,4 @@ API Documentation
printer.rst
job.rst
logs.rst
datamodel.rst
+626 -85
View File
@@ -16,15 +16,167 @@ Printer control is mostly achieved through the use of commands, issued to resour
printer. OctoPrint currently knows the following components:
Print head
Print head commands allow jogging and homing the print head in all three axes. See :ref:`sec-api-printer-printheadcommand`.
Heater
Heater commands allow setting the temperature and temperature offsets for the printer's hotend and bed. Currently
OctoPrint only supports one hotend heater (this will change in the future). See :ref:`sec-api-printer-heatercommand`.
Feeder
Feeder commands allow extrusion/extraction of filament. Currently OctoPrint only supports one feeder (this will
change in a future version). See :ref:`sec-api-printer-feedercommand`.
Print head commands allow jogging and homing the print head in all three axes. Querying the resource is currently
not supported.
See :ref:`sec-api-printer-printheadcommand`.
Tool
Tool commands allow setting the temperature and temperature offsets for the printer's hotends/tools. Querying the
corresponding resource returns temperature information including an optional history.
See :ref:`sec-api-printer-toolcommand`.
Bed
Bed commands allow setting the temperature and temperature offset for the printer's heated bed. Querying the
corresponding resource returns temperature information including an optional history.
See :ref:`sec-api-printer-bedcommand`.
SD card
SD commands allow initialization, refresh and release of the printer's SD card (if available). See :ref:`sec-api-printer-sdcommand`.
SD commands allow initialization, refresh and release of the printer's SD card (if available). Querying the
corresponding resource returns the current SD card state.
See :ref:`sec-api-printer-sdcommand`.
Besides that, OctoPrint also provides a :ref:`full state report of the printer <sec-api-printer-state>`.
.. _sec-api-printer-state:
Retrieve the current printer state
==================================
.. http:get:: /api/printer
Retrieves the current state of the printer. Returned information includes:
* temperature information (see also :ref:`Retrieve the current tool state <sec-api-printer-toolstate>` and
:ref:`Retrieve the current bed state <sec-api-printer-bedstate>`)
* sd state (if available, see also :ref:`Retrieve the current SD state <sec-api-printer-sdstate>`)
* general printer state
Temperature information can also be made to include the printer's temperature history by supplying the ``history``
query parameter. The amount of data points to return here can be limited using the ``limit`` query parameter.
Clients can specific a list of attributes to not return in the response (e.g. if they don't need it) via the
``exclude`` query parameter.
Returns a :http:statuscode:`200` with a :ref:`Full State Response <sec-api-printer-datamodel-fullstate>` in the
body upon success.
**Example 1**
Include temperature history data, but limit it to two entries.
.. sourcecode:: http
GET /api/printer?history=true&limit=2 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"temperature": {
"tool0": {
"actual": 214.8821,
"target": 220.0,
"offset": 0
},
"tool1": {
"actual": 25.3,
"target": null,
"offset": 0
},
"bed": {
"actual": 50.221,
"target": 70.0,
"offset": 5
},
"history": [
{
"time": 1395651928,
"tool0": {
"actual": 214.8821,
"target": 220.0
},
"tool1": {
"actual": 25.3,
"target": null
},
"bed": {
"actual": 50.221,
"target": 70.0
}
},
{
"time": 1395651926,
"tool0": {
"actual": 212.32,
"target": 220.0
},
"tool1": {
"actual": 25.1,
"target": null
},
"bed": {
"actual": 49.1123,
"target": 70.0
}
}
]
},
"sd": {
"ready": true
},
"state": {
"text": "Operational",
"flags": {
"operational": true,
"paused": false,
"printing": false,
"sdReady": true,
"error": false,
"ready": true,
"closedOrError": false
}
}
}
**Example 2**
Exclude temperature and sd data.
.. sourcecode:: http
GET /api/printer?exclude=temperature,sd HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"state": {
"text": "Operational",
"flags": {
"operational": true,
"paused": false,
"printing": false,
"sdReady": true,
"error": false,
"ready": true,
"closedOrError": false
}
}
}
:query exclude: An optional comma-separated list of fields to exclude from the response (e.g. if not needed by
the client). Valid values to supply here are ``temperature``, ``sd`` and ``state``.
:query history: If set to ``true`` (or: ``yes``, ``y``, ``1``), history information will be included in the response
too. If no ``limit`` parameter is given, all available temperature history data will be returned.
:query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
will be returned. Will be ignored if ``history`` is not enabled.
:statuscode 200: No error
:statuscode 409: If the printer is not operational.
.. _sec-api-printer-printheadcommand:
@@ -70,6 +222,10 @@ Issue a print head command
"z": 0.02
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Home Request**
Home the X and Y axes.
@@ -86,6 +242,10 @@ Issue a print head command
"axes": ["x", "y"]
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``jog`` or ``home``.
:json number x: ``jog`` command: The amount to travel on the X axis in mm.
:json number y: ``jog`` command: The amount to travel on the Y axis in mm.
@@ -96,67 +256,70 @@ Issue a print head command
request.
:statuscode 409: If the printer is not operational or currently printing.
.. _sec-api-printer-heatercommand:
.. _sec-api-printer-toolcommand:
Issue a heater command
======================
Issue a tool command
====================
.. todo::
.. http:post:: /api/printer/tool
Update to current implementation!
Tool commands allow setting the temperature and temperature offsets for the printer's tools (hotends), selecting
the current tool and extruding/retracting from the currently selected tool. Available commands are:
.. http:post:: /api/printer/heater
target
Sets the given target temperature on the printer's tools. Additional parameters:
Heater commands allow setting the temperature and temperature offsets for the printer's hotend and bed. Available
commands are:
temp
Sets the given target temperature on the printer's hotend and/or bed. Additional parameters:
* ``targets``: Target temperature(s) to set, allowed properties are:
* ``hotend``: New target temperature of the printer's hotend in centigrade.
* ``bed``: New target temperature of the printer's bed in centigrade.
* ``targets``: Target temperature(s) to set, properties must match the format ``tool{n}`` with ``n`` being the
tool's index starting with 0.
offset
Sets the given temperature offset on the printer's hotend and/or bed. Additional parameters:
Sets the given temperature offset on the printer's tools. Additional parameters:
* ``offsets``: Offset(s) to set, allowed properties are:
* ``offsets``: Offset(s) to set, properties must match the format ``tool{n}`` with ``n`` being the tool's index
starting with 0.
* ``hotend``: New offset of the printer's hotend temperature in centigrade, max/min of +/-50°C.
* ``bed``: New offset of the printer's bed temperature in centigrade, max/min of +/-50°C.
select
Selects the printer's current tool. Additional parameters:
All of these commands may only be sent if the printer is currently operational and not printing. Otherwise a
:http:statuscode:`409` is returned.
* ``tool``: Tool to select, format ``tool{n}`` with ``n`` being the tool's index starting with 0.
extrude
Extrudes the given amount of filament from the currently selected tool. Additional parameters:
* ``amount``: The amount of filament to extrude in mm. May be negative to retract.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
**Example Target Temperature Request**
Set the printer's hotend target temperature to 220°C and the bed target temperature to 75°C.
Set the target temperature for the printer's first hotend to 220°C and the printer's second extruder to 205°C.
.. sourcecode:: http
POST /api/printer/heater HTTP/1.1
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "temp",
"temps": {
"hotend": 220,
"bed": 75
"command": "target",
"targets": {
"tool0": 220,
"tool1": 205
}
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Offset Temperature Request**
Set the offset for hotend temperatures to +10°C and for bed temperatures to -5°C.
Set the offset for temperatures on ``tool0`` to +10°C and on ``tool1`` to -5°C.
.. sourcecode:: http
POST /api/printer/heater HTTP/1.1
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
@@ -164,62 +327,62 @@ Issue a heater command
{
"command": "offset",
"offsets": {
"hotend": 10,
"bed": -5
"tool0": 10,
"tool1": -5
}
}
:json string command: The command to issue, either ``temp`` or ``offset``
:json object temps: ``temp`` command: The target temperatures to set. Valid properties are ``hotend`` and ``bed``
:json object offsets: ``offset`` command: The offset temperature to set. Valid properties are ``hotend`` and ``bed``
:statuscode 204: No error
:statuscode 400: If ``temps`` or ``offsets`` contains a property other than ``hotend`` or ``bed``, the
target or offset temperature is not a valid number or outside of the supported range, or if the
request is otherwise invalid.
:statuscode 409: If the printer is not operational.
.. sourcecode:: http
.. _sec-api-printer-feedercommand:
HTTP/1.1 204 No Content
Issue a feeder command
======================
**Example Tool Select Request**
.. http:post:: /api/printer/feeder
Feeder commands allow extrusion/extraction of filament. Available commands are:
extrude
Extrudes the given amount of filament. Additional parameters:
* ``amount``: The amount of filament to extrude in mm. May be negative to retract.
All of these commands may only be sent if the printer is currently operational and not printing. Otherwise a
:http:statuscode:`409` is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
**Example Extrude Request**
Extrudes 1mm of filament
Select the second hotend of the printer for any following ``extrude`` commands.
.. sourcecode:: http
POST /api/printer/feeder HTTP/1.1
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "select",
"tool": "tool1"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Extrude Request**
Extrude 5mm on the currently selected tool.
.. sourcecode:: http
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "extrude",
"amount": 1
"amount": 5
}
**Example Retract Request**
Retracts 3mm of filament
.. sourcecode:: http
POST /api/printer/feeder HTTP/1.1
HTTP/1.1 204 No Content
**Example Retract Request**
Retract 3mm of filament on the currently selected tool.
.. sourcecode:: http
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
@@ -229,16 +392,239 @@ Issue a feeder command
"amount": -3
}
:json string command: The command to issue, only ``extrude`` is supported right now.
:json number amount: ``extrude`` command: The amount of filament to extrude/retract in mm.
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``target``, ``offset``, ``select`` or ``extrude``.
:json object targets: ``target`` command: The target temperatures to set. Valid properties have to match the format ``tool{n}``.
:json object offsets: ``offset`` command: The offset temperature to set. Valid properties have to match the format ``tool{n}``.
:json object tool: ``select`` command: The tool to select, value has to match the format ``tool{n}``.
:json object amount: ``extrude`` command: The amount of filament to extrude from the currently selected tool.
:json number factor: ``flowrate`` command: The factor to apply to the flow rate, percentage between 75 and 125% as integer or float.
:statuscode 204: No error
:statuscode 400: If the value given for `amount` is not a valid number or the request is otherwise invalid.
:statuscode 409: If the printer is not operational or currently printing.
.. _sec-api-printer-toolstate:
Retrieve the current tool state
===============================
.. http:get:: /api/printer/tool
Retrieves the current temperature data (actual, target and offset) plus optionally a (limited) history (actual, target,
timestamp) for all of the printer's available tools.
It's also possible to retrieve the temperature history by supplying the ``history`` query parameter set to ``true``. The
amount of returned history data points can be limited using the ``limit`` query parameter.
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
.. note::
If you want both tool and bed temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
**Example**
Query the tool temperature data and also include the temperature history but limit it to two entries.
.. sourcecode:: http
GET /api/printer/tool?history=true&limit=2 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"tool0": {
"actual": 214.8821,
"target": 220.0,
"offset": 0
},
"tool1": {
"actual": 25.3,
"target": null,
"offset": 0
},
"history": [
{
"time": 1395651928,
"tool0": {
"actual": 214.8821,
"target": 220.0
},
"tool1": {
"actual": 25.3,
"target": null
}
},
{
"time": 1395651926,
"tool0": {
"actual": 212.32,
"target": 220.0
},
"tool1": {
"actual": 25.1
}
}
]
}
:query history: If set to ``true`` (or: ``yes``, ``y``, ``1``), history information will be included in the response
too. If no ``limit`` parameter is given, all available temperature history data will be returned.
:query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
will be returned. Will be ignored if ``history`` is not enabled.
:statuscode 200: No error
:statuscode 409: If the printer is not operational.
.. _sec-api-printer-bedcommand:
Issue a bed command
===================
.. http:post:: /api/printer/bed
Bed commands allow setting the temperature and temperature offsets for the printer's heated bed. Available commands
are:
target
Sets the given target temperature on the printer's tools. Additional parameters:
* ``target``: Target temperature to set.
offset
Sets the given temperature offset on the printer's tools. Additional parameters:
* ``offset``: Offset to set.
All of these commands may only be sent if the printer is currently operational. Otherwise a :http:statuscode:`409`
is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
**Example Target Temperature Request**
Set the target temperature for the printer's heated bed to 75°C.
.. sourcecode:: http
POST /api/printer/bed HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "target",
"target": 75
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Offset Temperature Request**
Set the temperature offset for the heated bed to -5°C.
.. sourcecode:: http
POST /api/printer/bed HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "offset",
"offset": -5
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``target`` or ``offset``.
:json object target: ``target`` command: The target temperature to set.
:json object offset: ``offset`` command: The offset temperature to set.
:statuscode 204: No error
:statuscode 400: If ``target`` or ``offset`` is not a valid number or outside of the supported range, or if the
request is otherwise invalid.
:statuscode 409: If the printer is not operational.
.. _sec-api-printer-bedstate:
Retrieve the current bed state
==============================
.. http:get:: /api/printer/bed
Retrieves the current temperature data (actual, target and offset) plus optionally a (limited) history (actual, target,
timestamp) for the printer's heated bed.
It's also possible to retrieve the temperature history by supplying the ``history`` query parameter set to ``true``. The
amount of returned history data points can be limited using the ``limit`` query parameter.
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
.. note::
If you want both tool and bed temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
**Example**
Query the bed temperature data and also include the temperature history but limit it to two entries.
.. sourcecode:: http
GET /api/printer/bed?history=true&limit=2 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"bed": {
"actual": 50.221,
"target": 70.0,
"offset": 5
},
"history": [
{
"time": 1395651928,
"bed": {
"actual": 50.221,
"target": 70.0
}
},
{
"time": 1395651926,
"bed": {
"actual": 49.1123,
"target": 70.0
}
}
]
}
:query history: If set to ``true`` (or: ``yes``, ``y``, ``1``), history information will be included in the response
too. If no ``limit`` parameter is given, all available temperature history data will be returned.
:query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
will be returned. Will be ignored if ``history`` is not enabled.
:statuscode 200: No error
:statuscode 409: If the printer is not operational.
.. _sec-api-printer-sdcommand:
Issue a SD command
==================
Issue an SD command
===================
.. http:post:: /api/printer/sd
@@ -279,6 +665,10 @@ Issue a SD command
"command": "init"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Refresh Request**
.. sourcecode:: http
@@ -292,6 +682,10 @@ Issue a SD command
"command": "refresh"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Release Request**
.. sourcecode:: http
@@ -305,6 +699,10 @@ Issue a SD command
"command": "release"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``init``, ``refresh`` or ``release``.
:statuscode 204: No error
:statuscode 409: If a ``refresh`` or ``release`` command is issued but the SD card has not been initialized (e.g.
@@ -324,14 +722,15 @@ Retrieve the current SD state
Returns a :http:statuscode:`200` with an :ref:`SD State Response <sec-api-printer-datamodel-sdstate>` in the body
upon success.
**Example Request**
**Example**
Read the current state of the SD card.
.. sourcecode:: http
GET /api/printer/sd HTTP/1.1
Host: example.com
**Example Response**
X-Api-Key: abcdef...
.. sourcecode:: http
@@ -345,15 +744,123 @@ Retrieve the current SD state
:statuscode 200: No error
: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:
Datamodel
=========
.. _sec-api-printer-datamodel-fullstate:
Full State Response
-------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``temperature``
- 0..1
- :ref:`Temperature State <sec-api-printer-datamodel-temps>`
- The printer's temperature state data
* - ``sd``
- 0..1
- :ref:`SD State <sec-api-printer-datamodel-sdstate>`
- The printer's sd state data
* - ``state``
- 0..1
- :ref:`Printer State <sec-api-datamodel-printer-state>`
- The printer's general state
.. _sec-api-printer-datamodel-temps:
Temperature State
-----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``tool{n}``
- 0..*
- :ref:`Temperature Data <sec-api-datamodel-printer-tempdata>`
- Current temperature stats for tool *n*. Enumeration starts at 0 for the first tool. Not included if querying
only bed state.
* - ``bed``
- 0..1
- :ref:`Temperature Data <sec-api-datamodel-printer-tempdata>`
- Current temperature stats for the printer's heated bed. Not included if querying only tool state.
* - ``history``
- 0..1
- List of :ref:`Historic Temperature Datapoint <sec-api-datamodel-printer-temphistory>`
- Temperature history
.. _sec-api-printer-datamodel-sdstate:
SD State Response
-----------------
SD State
--------
.. list-table::
:widths: 15 5 10 30
@@ -366,4 +873,38 @@ SD State Response
* - ``ready``
- 1
- 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`` and ``script``.
* - ``commands``
- 0..*
- Array of String
- Multiple commands to send to the printer (in the given order), mutually exclusive with ``command`` and ``script``.
* - ``script``
- 0..*
- String
- Name of the GCODE script template to send to the printer, mutually exclusive with ``command`` and ``commands``.
* - ``parameters``
- 0..1
- Map of key value pairs
- Key value pairs of parameters to replace in sent commands/provide to the script renderer
* - ``context``
- 0..1
- Map of key value pairs
- (only if ``script`` is set) additional template variables to provide to the script renderer
+6
View File
@@ -12,6 +12,12 @@
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../src/'))
import octoprint._version
from datetime import date
+43
View File
@@ -27,6 +27,26 @@ def package_data_dirs(source, sub_folders):
return dirs
def _recursively_handle_files(directory, file_matcher, folder_handler=None, file_handler=None):
applied_handler = False
for filename in os.listdir(directory):
path = os.path.join(directory, filename)
if file_handler is not None and file_matcher(filename):
file_handler(path)
applied_handler = True
elif os.path.isdir(path):
sub_applied_handler = _recursively_handle_files(path, file_matcher, folder_handler=folder_handler, file_handler=file_handler)
if sub_applied_handler:
applied_handler = True
if folder_handler is not None:
folder_handler(path, sub_applied_handler)
return applied_handler
class CleanCommand(Command):
description = "clean build artifacts"
user_options = []
@@ -39,14 +59,37 @@ class CleanCommand(Command):
pass
def run(self):
# build folder
if os.path.exists('build'):
print "Deleting build directory"
shutil.rmtree('build')
# eggs
eggs = glob.glob('OctoPrint*.egg-info')
for egg in eggs:
print "Deleting %s directory" % egg
shutil.rmtree(egg)
# 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
)
def get_cmdclass():
cmdclass = versioneer.get_cmdclass()
+1 -1
View File
@@ -293,7 +293,7 @@ class CommandTrigger(GenericEventListener):
def _executeGcodeCommand(self, command):
commands = [command]
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)
else:
self._logger.debug("Executing GCode command: %s" % command)
+7 -6
View File
@@ -628,12 +628,13 @@ class Printer():
bedTempOffset = None
result = {}
for tool in self._temp.keys():
result["tool%d" % tool] = {
"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._temp is not None:
for tool in self._temp.keys():
result["tool%d" % tool] = {
"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],
+21 -2
View File
@@ -17,8 +17,27 @@ def printerState():
if not printer.isOperational():
return make_response("Printer is not operational", 409)
# process excludes
excludes = []
if "exclude" in request.values:
excludeStr = request.values["exclude"]
if len(excludeStr.strip()) > 0:
excludes = filter(lambda x: x in ["temperature", "sd", "state"], map(lambda x: x.strip(), excludeStr.split(",")))
result = {}
result.update(_getTemperatureData(lambda x: x))
# add temperature information
if not "temperature" in excludes:
result.update({"temperature": _getTemperatureData(lambda x: x)})
# add sd information
if not "sd" in excludes and settings().getBoolean(["feature", "sdSupport"]):
result.update({"sd": {"ready": printer.isSdReady()}})
# add state information
if not "state" in excludes:
state = printer.getCurrentData()["state"]
result.update({"state": state})
return jsonify(result)
@@ -145,7 +164,7 @@ def printerBedCommand():
##~~ temperature offset
elif command == "offset":
offset = data["offsets"]
offset = data["offset"]
# make sure the offset is valid
if not isinstance(offset, (int, long, float)):
+8
View File
@@ -373,6 +373,14 @@ class ReverseProxied(object):
if scheme:
environ['wsgi.url_scheme'] = scheme
host = environ.get('HTTP_X_FORWARDED_HOST', '')
if not host:
host = settings().get(["server", "forwardedHost"])
if host:
environ['HTTP_HOST'] = host
return self.app(environ, start_response)
+7 -3
View File
@@ -30,8 +30,8 @@ default_settings = {
"log": False,
"timeout": {
"detection": 0.5,
"connection": 2,
"communication": 5,
"connection": 10,
"communication": 30,
"temperature": 5,
"sdStatus": 1
},
@@ -43,7 +43,8 @@ default_settings = {
"firstRun": True,
"secretKey": None,
"baseUrl": "",
"scheme": ""
"scheme": "",
"forwardedHost": ""
},
"webcam": {
"stream": None,
@@ -64,6 +65,9 @@ default_settings = {
"mobileSizeThreshold": 2 * 1024 * 1024, # 2MB
"sizeThreshold": 20 * 1024 * 1024, # 20MB
},
"gcodeAnalysis": {
"maxExtruders": 10
},
"feature": {
"temperatureGraph": True,
"waitForStartOnConnect": False,
@@ -514,6 +514,16 @@ GCODE.renderer = (function(){
}
zoomFactor = Math.min((canvas.width - 10) / bedWidth, (canvas.height - 10) / bedHeight);
var translationX, translationY;
if (renderOptions["bed"]["circular"]) {
translationX = canvas.width / 2;
translationY = canvas.height / 2;
} else {
translationX = (canvas.width - bedWidth * zoomFactor) / 2;
translationY = bedHeight * zoomFactor + (canvas.height - bedHeight * zoomFactor) / 2;
}
ctx.translate(translationX, translationY);
offsetModelX = 0;
offsetModelY = 0;
offsetBedX = 0;
@@ -201,7 +201,9 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel) {
} else {
var i = 0;
do {
output += "<strong>Filament (Tool " + i + "):</strong> " + formatFilament(data["gcodeAnalysis"]["filament"]["tool" + i]) + "<br>";
if (filament["tool" + i].hasOwnProperty("length") && filament["tool" + i]["length"] > 0) {
output += "<strong>Filament (Tool " + i + "):</strong> " + formatFilament(filament["tool" + i]) + "<br>";
}
i++;
} while (filament.hasOwnProperty("tool" + i));
}
@@ -129,10 +129,12 @@ function PrinterStateViewModel(loginStateViewModel) {
var i = 0;
do {
var key = "tool" + i;
result[i] = {
name: ko.observable("Tool " + i),
data: ko.observable(data.filament[key])
};
if (data.filament.hasOwnProperty(key) && data.filament[key].hasOwnProperty("length") && data.filament[key].length > 0) {
result.push({
name: ko.observable("Tool " + i),
data: ko.observable(data.filament[key])
});
}
i++;
} while (data.filament.hasOwnProperty("tool" + i));
}
+1 -1
View File
@@ -37,7 +37,7 @@
var CONFIG_GCODE_SIZE_THRESHOLD = {{ gcodeThreshold }};
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 + "/sockjs";
var SOCKJS_URI = "{{ url_for('index') }}" + "sockjs";
var SOCKJS_DEBUG = {% if debug -%} true; {% else %} false; {%- endif %}
</script>
</head>
+15 -5
View File
@@ -226,8 +226,12 @@ class Timelapse(object):
self._logger.warn("Cannot capture image, capture directory is unset")
return
if self._imageNumber is None:
self._logger.warn("Cannot capture image, image number is unset")
return
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._logger.debug("Capturing image to %s" % filename)
captureThread = threading.Thread(target=self._captureWorker, kwargs={"filename": filename})
@@ -236,10 +240,16 @@ class Timelapse(object):
return filename
def _captureWorker(self, filename):
eventManager().fire(Events.CAPTURE_START, {"file": filename});
urllib.urlretrieve(self._snapshotUrl, filename)
self._logger.debug("Image %s captured from %s" % (filename, self._snapshotUrl))
eventManager().fire(Events.CAPTURE_DONE, {"file": filename});
eventManager().fire(Events.CAPTURE_START, {"file": filename})
try:
urllib.urlretrieve(self._snapshotUrl, filename)
self._logger.debug("Image %s captured from %s" % (filename, self._snapshotUrl))
except:
self._logger.exception("Could not capture image %s from %s, decreasing image counter again" % (filename, self._snapshotUrl))
with self._captureMutex:
if self._imageNumber is not None and self._imageNumber > 0:
self._imageNumber -= 1
eventManager().fire(Events.CAPTURE_DONE, {"file": filename})
def _createMovie(self, success=True):
ffmpeg = settings().get(["webcam", "ffmpeg"])
+5 -11
View File
@@ -250,18 +250,13 @@ class MachineCom(object):
if self._state == self.STATE_CLOSED:
return "Closed"
if self._state == self.STATE_ERROR:
return "Error: %s" % (self.getShortErrorString())
return "Error: %s" % (self.getErrorString())
if self._state == self.STATE_CLOSED_WITH_ERROR:
return "Error: %s" % (self.getShortErrorString())
return "Error: %s" % (self.getErrorString())
if self._state == self.STATE_TRANSFERING_FILE:
return "Transfering file to SD"
return "?%d?" % (self._state)
def getShortErrorString(self):
if len(self._errorValue) < 20:
return self._errorValue
return self._errorValue[:20] + "..."
def getErrorString(self):
return self._errorValue
@@ -395,9 +390,8 @@ class MachineCom(object):
})
if self.isSdFileSelected():
if wasPaused:
self.sendCommand("M26 S0")
self._currentFile.setFilepos(0)
self.sendCommand("M26 S0")
self._currentFile.setFilepos(0)
self.sendCommand("M24")
else:
self._sendNext()
@@ -897,7 +891,7 @@ class MachineCom(object):
if self._resendDelta is not None:
self._resendNextCommand()
elif not self._commandQueue.empty() and not self.isStreaming():
self._sendCommand(self._commandQueue.get())
self._sendCommand(self._commandQueue.get(), True)
else:
self._sendNext()
elif line.lower().startswith("resend") or line.lower().startswith("rs"):
+33 -20
View File
@@ -73,7 +73,14 @@ class gcode(object):
if ';' in line:
comment = line[line.find(';')+1:].strip()
if comment.startswith("filament_diameter"):
self._filamentDiameter = float(comment.split("=", 1)[1].strip())
filamentValue = comment.split("=", 1)[1].strip()
try:
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"):
curaOptions = self._parseCuraProfileString(comment)
if "filament_diameter" in curaOptions:
@@ -85,23 +92,26 @@ class gcode(object):
T = getCodeInt(line, 'T')
if T is not None:
posOffset[0] -= offsets[currentExtruder]["x"] if currentExtruder < len(offsets) else 0
posOffset[1] -= offsets[currentExtruder]["y"] if currentExtruder < len(offsets) else 0
currentExtruder = T
posOffset[0] += offsets[currentExtruder]["x"] if currentExtruder < len(offsets) else 0
posOffset[1] += offsets[currentExtruder]["y"] if currentExtruder < len(offsets) else 0
if len(currentE) <= currentExtruder:
for i in range(len(currentE), currentExtruder + 1):
currentE.append(0.0)
if len(maxExtrusion) <= currentExtruder:
for i in range(len(maxExtrusion), currentExtruder + 1):
maxExtrusion.append(0.0)
if len(totalExtrusion) <= currentExtruder:
for i in range(len(totalExtrusion), currentExtruder + 1):
totalExtrusion.append(0.0)
if T > settings().getInt(["gcodeAnalysis", "maxExtruders"]):
self._logger.warn("GCODE tried to select tool %d, that looks wrong, ignoring for GCODE analysis" % T)
else:
posOffset[0] -= offsets[currentExtruder]["x"] if currentExtruder < len(offsets) else 0
posOffset[1] -= offsets[currentExtruder]["y"] if currentExtruder < len(offsets) else 0
currentExtruder = T
posOffset[0] += offsets[currentExtruder]["x"] if currentExtruder < len(offsets) else 0
posOffset[1] += offsets[currentExtruder]["y"] if currentExtruder < len(offsets) else 0
if len(currentE) <= currentExtruder:
for i in range(len(currentE), currentExtruder + 1):
currentE.append(0.0)
if len(maxExtrusion) <= currentExtruder:
for i in range(len(maxExtrusion), currentExtruder + 1):
maxExtrusion.append(0.0)
if len(totalExtrusion) <= currentExtruder:
for i in range(len(totalExtrusion), currentExtruder + 1):
totalExtrusion.append(0.0)
G = getCodeInt(line, 'G')
if G is not None:
@@ -239,13 +249,16 @@ def getCodeInt(line, code):
def getCodeFloat(line, code):
import math
n = line.find(code) + 1
if n < 1:
return None
m = line.find(' ', n)
try:
if m < 0:
return float(line[n:])
return float(line[n:m])
val = float(line[n:])
else:
val = float(line[n:m])
return val if not (math.isnan(val) or math.isinf(val)) else None
except:
return None