Commit graph

174 commits

Author SHA1 Message Date
Gina Häußge
48d74ef2fd Improved handshake procedure on comm layer
"Hello" command sent to printer to trigger initial handshake can now be
configured. Commands that _always_ necessitate to be sent with checksum/
line number (e.g. M110 on Marlin) can be configured as such too.

Also fixed an issue causing the "Hello" command to not be actually enqueued
first thing on opening a connection. Seems to not have caused harm in the
wild, but was unintentional.
(cherry picked from commit 5c2ae37)
2016-03-09 11:23:50 +01:00
Gina Häußge
35e20162ec Revert "Improved connecting phase"
Improved connecting for some printers, destroyed it
completely for others, so this needs some more work/
thought before it's ready for prime time.

This reverts commit c82ec3d3af.
2016-02-22 13:33:34 +01:00
Gina Häußge
c82ec3d3af Improved connecting phase
M110 is now sent every second until either a connection is established or the connection
attempt times out. That should prevent connection handshakes from failing due to
some initial garbage on the line that swallows an ok.
2016-02-17 11:33:49 +01:00
Gina Häußge
21034b381c Cancelling a print that is not ongoing doesn't make sense 2016-02-16 10:04:06 +01:00
Gina Häußge
beb5850361 Only try to record recovery data if a print was ongoing 2016-02-16 10:03:02 +01:00
Gina Häußge
49f4a0c5b0 line == "ok" => line.startswith("ok")
Fixes an issue introduced with M109 fix that causes
"SD card ok" not to be parsed correctly anymore.
2016-02-16 09:23:25 +01:00
Gina Häußge
eb48a50139 Fixed wrong tracking of current tool for M109 Tn heat-ups 2016-02-15 19:44:21 +01:00
Gina Häußge
8069d08d3b Do not hiccup on manually sent M28 commands
In case of trying to switch to state printing with no selected file that
scenario is now caught by setting an internal manualStreaming flag.
That will stop the M105 polling until M29 is sent (through whatever
means).

Note that printing is not disabled... this is merely for testing stuff and
not encouraged to be used for actually streaming files to the printer,
use the built-in functionality for that!
2016-02-09 11:32:56 +01:00
Gina Häußge
9e8b5312d5 Persist print recovery data on print failures 2016-02-08 12:47:13 +01:00
Gina Häußge
6583691e85 Added setting to only cancel ongoing print on firmware error
Also added error popup in such a case so the error will be known even
if the terminal tab scrolled past it.
2016-02-01 18:02:21 +01:00
Gina Häußge
0e817d43cc Added option to ignore any errors reported by the firmware
Use this carefully. An error reported by your firmware usually hints
at something being off about your printer (e.g. thermistor troubles)
or the firmware not being fully compatible to OctoPrint since
it doesn't recognize a lot of commands.

If you print with this option enabled, it will still fail if you firmware goes
into lockdown, but now it will keep trying to send data to your printer.

That might cause issues. So best not use that option, only if you absolutely
have no other way to get some misbehaving printer to work with
OctoPrint.
2016-02-01 16:55:13 +01:00
Gina Häußge
570c66b6f3 Trigger command processing on unknown commands
We suffer from the same problem as commands being suppressed in the
send queue here. If a non-GCODE-command we send to the printer
produces no output, our _monitor loop will wait until the next response
produced by another command. Which we won't send though since
we are stuck waiting in the _monitor loop waiting for a response. Hence
we need to manually trigger further command processing from the
send loop here in order to ensure things keep going.
2015-12-17 10:44:43 +01:00
Gina Häußge
8a7d234571 Merge branch 'fix/commTimeoutOnSupressedScriptCommands' into maintenance 2015-12-08 14:24:47 +01:00
Gina Häußge
0982c8cc62 Ignore the "cannot (open|error) subdir" errors from Marlin 2015-12-07 09:26:25 +01:00
Gina Häußge
c0774d0dd8 Fix: Do not stall comm when a command is supressed while printing 2015-12-02 11:08:51 +01:00
Gina Häußge
93bbedae86 Only process bed temps & commands if printer profile has heated bed
Solves #1125
2015-11-30 11:11:35 +01:00
Salandora
9ed79adb8d Fix SD Support deactivated bug and added "unknown command" to the whitelist of errors 2015-11-17 19:32:34 +01:00
Gina Häußge
6b0dee26e5 Interpret M25 as a pause when not printing from SD too 2015-11-05 17:33:27 +01:00
Gina Häußge
45c92cb1f4 Fix: Open GCODE files als utf-8, replacing encoding errors
Also detect files that contain a BOM and strip it.
Internal handling of GCODE file contents switched to unicode.

 Should take care of #1077
2015-10-05 19:43:40 +02:00
Gina Häußge
37950cb466 Fixing some more merge errors 2015-08-28 08:58:12 +02:00
Gina Häußge
2824b967ff Fixed a merge error 2015-08-28 08:20:20 +02:00
Gina Häußge
9299cb54a4 Improved M112 handling
Use new synchronized sending method and also make sure that heaters
will get disabled in case M112 is NOT understood by the firmware
before disconnecting. That's about all we can do for now.
(cherry picked from commit 5406b2b)
2015-08-28 08:12:12 +02:00
Gina Häußge
b965d4cbde comm: Synchronized write access to line number
New method wraps line sending and incrementing
(cherry picked from commit f8e72c9)
2015-08-28 08:11:56 +02:00
Mark Walker
7d922f3c77 Clean up the comment
(cherry picked from commit f519070)
2015-08-28 08:09:16 +02:00
Mark Walker
7e894d2ac2 ClearableQueue redundant with self.close
Closing the printer connection and then reopening (when the users clicks
connect) will create a new fresh MachineCom object so the queues will
start out empty.  Plus ClearableQueue was even more tied to the Queue
implementation that the current _get/_put overrides.
(cherry picked from commit e7584cd)
2015-08-28 08:09:02 +02:00
Mark Walker
948e20b269 Send M112 to printer immediately
Address #1031 with an immediate send of M112 followed by closing the
serial connection to reset the host state
(cherry picked from commit 3d1d745)
2015-08-28 08:08:26 +02:00
Gina Häußge
2247f30c87 Fixed indentation after a merge error 2015-08-24 15:30:26 +02:00
Gina Häußge
f9a0cb94f7 Moved new resend setting into feature section
That's where all other protocol specific settings are currently located.
Will be migrated at a later date into the printer profile instead (that
makes way more sense).
(cherry picked from commit d0f61e5)
2015-08-24 14:59:44 +02:00
Gina Häußge
e689a2c733 Handle Repetier resend repetitions
Repetier might resend the same resend request to make sure it arrives.
This commit makes OctoPrint not react to such a repeated request and
instead ignore up to a configurable amount of repeated requests for
the same (current) line.
(cherry picked from commit 6f83695)
2015-08-24 14:59:11 +02:00
Gina Häußge
d07c81f312 Fixed regex groups for GCODE parameters
(cherry picked from commit 168d32e)
2015-08-24 14:56:40 +02:00
Gina Häußge
59993bfca4 Fixed & refactored temperature parsing
T-only lines were not properly parsed. Should now be fixed to
be associated to currently selected extruder. Also added unit
tests for the temperature parsing.

While at it also extracted regexes and added unit tests for command
parsing (gcode & parameters)
(cherry picked from commit f6a259f)
2015-08-24 14:55:42 +02:00
Salandora
0782dda20f Add Repetier's Format Error to exception whitelist
(cherry picked from commit d037379)
2015-08-24 14:54:28 +02:00
Gina Häußge
5f53b704dd Use connection closing flag only for exception handling
Otherwise we kill the beforePrinterDisconnected gcode script...

See #1021
(cherry picked from commit 2fe956e)
2015-08-24 14:44:56 +02:00
Gina Häußge
e8ef0ba8a4 Properly handle serial close on Macs
Readline could still be stuck in a read loop, leading to an exception on Mac
when closing the connection from another thread. This should now be captured
correctly.

Fixes #1021
(cherry picked from commit c829b27)
2015-08-24 14:44:31 +02:00
Gina Häußge
cc14b77487 Use connection closing flag only for exception handling
Otherwise we kill the beforePrinterDisconnected gcode script...

See #1021
(cherry picked from commit 2fe956e)
2015-08-14 09:00:40 +02:00
Gina Häußge
7f10c317f1 Properly handle serial close on Macs
Readline could still be stuck in a read loop, leading to an exception on Mac
when closing the connection from another thread. This should now be captured
correctly.

Fixes #1021
(cherry picked from commit c829b27)
2015-08-14 09:00:19 +02:00
Gina Häußge
ba1f8c58b4 Log exception on error while reading from serial
(cherry picked from commit ac3409a)
2015-08-14 08:55:29 +02:00
Gina Häußge
96aad9d34f Better resilience against errors within plugins
(cherry picked from commit 75992ef)
2015-07-14 09:26:20 +02:00
Gina Häußge
a5bf3c3be1 Log serial write exceptions to octoprint.log
(cherry picked from commit 367ba06)
2015-07-07 18:39:54 +02:00
Gina Häußge
8735b10653 Better resilience against senseless polling intervals
(cherry picked from commit 6600d24)
2015-07-05 16:50:33 +02:00
Gina Häußge
4dc9d0a536 Fix: SD card errors shouldn't not cause disconnect
If the SD card fails to initialize with a volume.init failure, that's
not a reason to break off all diplomatic relations with the printer.
(cherry picked from commit 9caf13d)
2015-06-29 10:19:50 +02:00
Gina Häußge
0c54eaf176 Fix: Use Exception, not BaseException
Custom exception should be derived from Exception, not BaseException.

Not only is this specified in the python documentation, but also
tornado will be able to handle Exceptions in requests perfectly fine
and return an HTTP 500 for them, but crash hard (as in, server shut
down follows) for BaseExceptions.
(cherry picked from commit 29b047b)
2015-06-28 02:24:47 +02:00
Gina Häußge
fca8becb20 More informative errors when serial connection fails 2015-06-24 08:55:27 +02:00
Gina Häußge
b714c59004 Allow specification of known long running commands through settings
This should allow users to adjust the behaviour of the communication stack more granularly in case the regular settings which only consider G4, G28, G29, G30, G32 to be real long runners without output are not sufficient.
2015-06-03 12:34:00 +02:00
Gina Häußge
f2192ba232 Fix: Re-open detected serial port with specified baudrate
The serial port was previously kept open from the Stk500 initialization, which defaults to 115200 baud.

Closes #892
2015-05-29 11:36:36 +02:00
Gina Häußge
1a80aa854f Fix: "gcode" var was not properly parsed for queuing and queued command phases
Thanks @C-o-r-E for the heads-up
2015-05-28 20:20:51 +02:00
Gina Häußge
61af59cca1 New hooks for command processing in comm layer
Added phase specific hooks for queuing, queued, sending and sent phases of a command ("octoprint.comm.protocol.gcode.<phase>"). Removed old queuing phase hook and declared as obsolete hook in plugin manager to prevent plugins that depend on it from being enabled.

Adding those new hooks also necessitated refactoring the whole command processing, made it more modular and added phase specific handler functions that allow handling all blocking commands centrally for example.
2015-05-28 17:06:24 +02:00
Gina Häußge
046fffdd14 Fixed a deadlock in the communication layer when pausing via M0
Using reentrant locks to allow sending of additional commands
2015-05-28 16:10:48 +02:00
Gina Häußge
3ac2d5dd34 Fixed Z-Timelapse for Z changes on `G1` moves
Solves #909
2015-05-26 18:46:50 +02:00
Mark Walker
50c95e439d Only eat two characters when the error indicator is '!!' 2015-05-20 20:06:24 -07:00