Skip to content

Commit

Permalink
regression bug fix - made upload to sd error checking way too aggressive
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrnt committed Oct 15, 2020
1 parent 139cc50 commit a7a56be
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# OctoPrint-FlashForge Changelog


## 0.2.6 (2020-10-15)
### Bug Fixes
* Regression bug - made Upload to SD error checking too aggressive causing it to fail on some printers.

## 0.2.5 (2020-10-13)
### New Feature
* Can connect to printer when it is already printing from SD and OctoPrint will recognize a print is in progress
Expand Down
6 changes: 3 additions & 3 deletions octoprint_flashforge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,13 @@ def process_upload():
self._serial_obj.enable_keep_alive(False)

# make sure heaters are off
ok, answer = self._serial_obj.sendcommand(b"M104 S0 T0", 1)
ok, answer = self._serial_obj.sendcommand(b"M104 S0 T0")
if not ok:
error = "{}: {}".format(errormsg, answer)
errormsg += " - printer busy."
else:
self._serial_obj.sendcommand(b"M104 S0 T1", 1)
self._serial_obj.sendcommand(b"M140 S0", 1)
self._serial_obj.sendcommand(b"M104 S0 T1")
self._serial_obj.sendcommand(b"M140 S0")

ok, answer = self._serial_obj.sendcommand(b"M28 %d 0:/user/%s" % (file_size, remote_name.encode()), 5000)
if not ok or b"open failed" in answer:
Expand Down
18 changes: 17 additions & 1 deletion octoprint_flashforge/flashforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@ def readraw(self, timeout=-1):
"""
Read everything available from the from the printer
Parameters:
timeout : max time to wait in ms
Returns:
String containing response from the printer
"""
Expand All @@ -585,7 +588,20 @@ def readraw(self, timeout=-1):
return data


def sendcommand(self, cmd, timeout=-1, readresponse=True):
def sendcommand(self, cmd, timeout=1000, readresponse=True):
"""
Send g-code to printer and wait for a response
Parameters:
cmd : FF formatted g-code command
timeout : max time to wait in ms
readresponse : true to return printer response
Returns:
True if printer responded with ok, indicating command was accepted
Optional : string containing response from the printer
"""

self._logger.debug("sendcommand() {}".format(cmd.decode()))

self.writeraw(b"~%s\r\n" % cmd)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "OctoPrint-FlashForge"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "0.2.5"
plugin_version = "0.2.6"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit a7a56be

Please sign in to comment.