Skip to content

Commit

Permalink
Merge pull request #174 from donovan6000/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
donovan6000 authored Jul 29, 2016
2 parents 9e65423 + 40fe5b6 commit 52d81ae
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 67 deletions.
4 changes: 4 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changelog:

V1.4 July 19, 2016

* Really fixed compatibility with OctoPrint V1.2.14

V1.3 July 28, 2016

* Provides iMe V00.00.01.06 printer firmware
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ OctoPrint plugin that provides the world's first platform independent software s
### Description
M33 Fio is a plugin for [OctoPrint](http://octoprint.org/) that extends its capabilities to make it fully compatible with the Micro 3D printer. Both OctoPrint and M33 Fio can run on Windows, OS X, and Linux, so this solution is the first platform independent option available for this printer.

The latest version of M33 Fio is V1.3 released on July 28th, 2016, and an entire changelog for it can be found [here](https://raw.githubusercontent.com/donovan6000/M33-Fio/master/Changelog).
The latest version of M33 Fio is V1.4 released on July 29th, 2016, and an entire changelog for it can be found [here](https://raw.githubusercontent.com/donovan6000/M33-Fio/master/Changelog).

### Features
* Platform independent
Expand Down
Binary file modified installers/Linux/install.zip
Binary file not shown.
1 change: 1 addition & 0 deletions installers/OS X/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ else

# Install OctoPrint
sudo -u $SUDO_USER launchctl unload /Library/LaunchAgents/com.octoprint.app.plist
echo 'y' | sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/pip uninstall OctoPrint
curl -LOk https://github.com/foosel/OctoPrint/archive/master.zip
sudo -u $SUDO_USER unzip master.zip
cd OctoPrint-master
Expand Down
Binary file modified installers/Windows/install.zip
Binary file not shown.
78 changes: 13 additions & 65 deletions octoprint_m33fio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3463,6 +3463,9 @@ def emptyCommandQueue(self) :
# Process write
def processWrite(self, data) :

# Set return value
returnValue = len(data)

# Log sent data
self._m33fio_logger.debug("Original Sent: " + data)

Expand Down Expand Up @@ -3559,7 +3562,7 @@ def processWrite(self, data) :
self.numberWrapCounter = 0

# Return
return
return returnValue

# Initialize variables
endWaitingAfterSend = False
Expand Down Expand Up @@ -3851,7 +3854,7 @@ def processWrite(self, data) :
self.sendCommandsWithLineNumbers(commands)

# Return
return
return returnValue

# Otherwise
else :
Expand Down Expand Up @@ -3925,7 +3928,7 @@ def processWrite(self, data) :
self.enableSleep()

# Return
return
return returnValue

# Check if using iMe firmware
if self.currentFirmwareType == "iMe" :
Expand Down Expand Up @@ -4004,13 +4007,20 @@ def processWrite(self, data) :

# Send message
self._plugin_manager.send_plugin_message(self._identifier, dict(value = "Show Mid-Print Filament Change"))

# Return
return returnValue

# Process read
def processRead(self) :

# Get response
response = self.originalRead()

# Reset consecutive timeouts
if self._printer._comm is not None and hasattr(self._printer._comm, "_consecutive_timeouts") and response is not None and response.strip() is not '' :
self._printer._comm._consecutive_timeouts = 0

# Log received data
self._m33fio_logger.debug("Original Response: " + response)

Expand Down Expand Up @@ -9130,65 +9140,6 @@ def download(self, file) :
# Return file
return flask.send_from_directory(self.get_plugin_data_folder().replace('\\', '/'), file)

# Do send without checksum
def doSendWithoutChecksum(self, cmd) :

# This function is taken from OctoPrint's maintenance branch
if self._printer._comm is None or self._printer._comm._serial is None:
return

self._printer._comm._log("Send: " + str(cmd))

cmd += "\n"
written = 0
passes = 0
while written < len(cmd):
to_send = cmd[written:]
old_written = written

try:
result = self._printer._comm._serial.write(to_send)
if result is None or not isinstance(result, int):
# probably some plugin not returning the written bytes, assuming all of them
written += len(cmd)
else:
written += result
except serial.SerialTimeoutException:
self._printer._comm._log("Serial timeout while writing to serial port, trying again.")
try:
result = self._printer._comm._serial.write(to_send)
if result is None or not isinstance(result, int):
# probably some plugin not returning the written bytes, assuming all of them
written += len(cmd)
else:
written += result
except:
if not self._printer._comm._connection_closing:
self._printer._comm._logger.exception("Unexpected error while writing to serial port")
self._printer._comm._log("Unexpected error while writing to serial port: %s" % (get_exception_string()))
self._printer._comm._errorValue = get_exception_string()
self._printer._comm.close(is_error=True)
break
except:
if not self._printer._comm._connection_closing:
self._printer._comm._logger.exception("Unexpected error while writing to serial port")
self._printer._comm._log("Unexpected error while writing to serial port: %s" % (get_exception_string()))
self._printer._comm._errorValue = get_exception_string()
self._printer._comm.close(is_error=True)
break

if old_written == written:
# nothing written this pass
passes += 1
if passes > self._printer._comm._max_write_passes:
# nothing written in max consecutive passes, we give up
message = "Could not write anything to the serial port in {} tries, something appears to be wrong with the printer communication".format(self._printer._comm._max_write_passes)
self._printer._comm._logger.error(message)
self._printer._comm._log(message)
self._printer._comm._errorValue = "Could not write to serial port"
self._printer._comm.close(is_error=True)
break

# Auto connect
def autoConnect(self, comm_instance, port, baudrate, read_timeout, *args, **kwargs) :

Expand All @@ -9198,9 +9149,6 @@ def autoConnect(self, comm_instance, port, baudrate, read_timeout, *args, **kwar
# Return
return

# Replace do send with checksum to fix connection issue
comm_instance._do_send_without_checksum = self.doSendWithoutChecksum

# Set baudrate if not specified
if not baudrate or baudrate == 0 :
baudrate = 115200
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
plugin_identifier = "m33fio"
plugin_package = "octoprint_%s" % plugin_identifier
plugin_name = "OctoPrint-M33Fio"
plugin_version = "1.3"
plugin_version = "1.4"
plugin_description = "Makes OctoPrint fully compatible with the Micro 3D printer"
plugin_author = "donovan6000"
plugin_author_email = "[email protected]"
Expand Down

0 comments on commit 52d81ae

Please sign in to comment.