Skip to content

Commit

Permalink
Installers now uninstall M3D Fio before installing M33 Fio
Browse files Browse the repository at this point in the history
  • Loading branch information
donovan6000 committed Jul 8, 2016
1 parent aea640c commit a348ef4
Show file tree
Hide file tree
Showing 41 changed files with 175 additions and 156 deletions.
5 changes: 5 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changelog:

V0.36.1 July 7, 2016

* Fixed issue with how the bed height offset wouldn't get cleared when calibrating before print
* Linux installer now works on Debian and Fedora Linux distros. Thanks Enygma2002!

V0.36 July 6, 2016

* Fixed issue where the shared library would be reloaded whenever a client would connect to OctoPrint
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ M33 Fio has been discontinued on June 21st, 2016. I no longer feel like developi
### 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 V0.36 released on July 6th, 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 V0.36.1 released on July 7th, 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
3 changes: 2 additions & 1 deletion installers/Linux/90-micro-3d-local.rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Run the following commands to install this rule
# cp ./90-micro-3d-local.rules /etc/udev/rules.d/
# sudo /etc/init.d/udev restart
# sudo udevadm control --reload-rules
# sudo udevadm trigger

ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2404", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
3 changes: 2 additions & 1 deletion installers/Linux/91-micro-3d-heatbed-local.rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Run the following commands to install this rule
# cp ./91-micro-3d-heatbed-local.rules /etc/udev/rules.d/
# sudo /etc/init.d/udev restart
# sudo udevadm control --reload-rules
# sudo udevadm trigger

ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
Binary file modified installers/Linux/install.zip
Binary file not shown.
Binary file modified installers/Linux/uninstall.zip
Binary file not shown.
22 changes: 11 additions & 11 deletions installers/OS X/com.octoprint.app.plist
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.octoprint.app</string>
<key>ProgramArguments</key>
<array>
<string>path to octoprint</string>
<dict>
<key>Label</key>
<string>com.octoprint.app</string>
<key>ProgramArguments</key>
<array>
<string>path to octoprint</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions installers/OS X/command line tools installer.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [[ "$osx_vers" -ge 9 ]]; then
# Remove the temp file

if [[ -f "$cmd_line_tools_temp_file" ]]; then
rm "$cmd_line_tools_temp_file"
rm "$cmd_line_tools_temp_file"
fi
fi

Expand Down Expand Up @@ -59,4 +59,4 @@ if [[ "$osx_vers" -eq 7 ]] || [[ "$osx_vers" -eq 8 ]]; then
rm "$TOOLS"
fi

exit 0
exit 0
3 changes: 2 additions & 1 deletion installers/OS X/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Request elevated privileges
[ "$(whoami)" != "root" ] && exec sudo -- "$0" "$@"
[ "$(whoami)" != "root" ] && exec sudo "$0" "$@"

# Check if not run as root
if [ "$(id -u)" != "0" ]; then
Expand Down Expand Up @@ -103,6 +103,7 @@ else
rm master.zip

# Install M33 Fio
echo 'y' | sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/pip uninstall OctoPrint-M3DFio
echo 'y' | sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/pip uninstall OctoPrint-M33Fio
curl -LOk https://github.com/donovan6000/M33-Fio/archive/master.zip
while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/pip install master.zip --user
Expand Down
3 changes: 2 additions & 1 deletion installers/OS X/uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Request elevated privileges
[ "$(whoami)" != "root" ] && exec sudo -- "$0" "$@"
[ "$(whoami)" != "root" ] && exec sudo "$0" "$@"

# Check if not run as root
if [ "$(id -u)" != "0" ]; then
Expand All @@ -18,6 +18,7 @@ else
sudo -u $SUDO_USER launchctl unload /Library/LaunchAgents/com.octoprint.app.plist

# Uninstall M33 Fio
echo 'y' | sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/pip uninstall OctoPrint-M3DFio
echo 'y' | sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/pip uninstall OctoPrint-M33Fio

# Uninstall OctoPrint
Expand Down
Binary file modified installers/Windows/install.zip
Binary file not shown.
Binary file modified installers/Windows/uninstall.zip
Binary file not shown.
63 changes: 37 additions & 26 deletions octoprint_m33fio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def __init__(self) :
self.currentSerialPort = None
self.providedFirmwares = {}
self.printerColor = "Black"
self.camera = None
self.lastLineNumberSent = None
self.initializingPrinterConnection = False
self.startingMidPrintFilamentChange = False
Expand Down Expand Up @@ -846,6 +845,18 @@ def on_after_startup(self) :

# Unload shared library
self.unloadSharedLibrary()

# Otherwise
else :

# Turn off using shared library setting
self._settings.set_boolean(["UseSharedLibrary"], False)

# Check if not using Linux
if not platform.uname()[0].startswith("Linux") :

# Turn off use GPIO setting
self._settings.set_boolean(["UseGpio"], False)

# Set reminders on initial OctoPrint instance
currentPort = self.getListenPort(psutil.Process(os.getpid()))
Expand Down Expand Up @@ -901,8 +912,8 @@ def on_after_startup(self) :

# Set file locations
self.setFileLocations()
# Check if not using a Micro 3D printer

# Check if not using a Micro 3D printer
if self._settings.get_boolean(["NotUsingAMicro3DPrinter"]) :

# Disable printer callbacks
Expand Down Expand Up @@ -942,7 +953,7 @@ def loadSharedLibrary(self, isUsable = False) :
# Unload shared library if it was already loaded
self.unloadSharedLibrary()

# Check if using shared library of checking if it is usable
# Check if using shared library or checking if it is usable
if self._settings.get_boolean(["UseSharedLibrary"]) or isUsable :

# Check if running on Linux
Expand Down Expand Up @@ -1030,13 +1041,13 @@ def loadSharedLibrary(self, isUsable = False) :
self.sharedLibrary.getMinYExtruderHigh.restype = ctypes.c_double
self.sharedLibrary.getMinZExtruder.restype = ctypes.c_double
self.sharedLibrary.collectPrintInformation.restype = ctypes.c_bool
self.sharedLibrary.preprocess.restype = ctypes.c_char_p
self.sharedLibrary.getDetectedFanSpeed.restype = ctypes.c_ubyte
self.sharedLibrary.getDetectedMidPrintFilamentChange.restype = ctypes.c_bool
self.sharedLibrary.getObjectSuccessfullyCentered.restype = ctypes.c_bool
# Return true
return True
self.sharedLibrary.preprocess.restype = ctypes.c_char_p
self.sharedLibrary.getDetectedFanSpeed.restype = ctypes.c_ubyte
self.sharedLibrary.getDetectedMidPrintFilamentChange.restype = ctypes.c_bool
self.sharedLibrary.getObjectSuccessfullyCentered.restype = ctypes.c_bool

# Return true
return True

# Return false
return False
Expand Down Expand Up @@ -1807,7 +1818,7 @@ def on_api_command(self, command, data) :

# Enable printer callbacks
if self not in self._printer._callbacks :
self._printer.register_callback(self)
self._printer.register_callback(self)

# Send response
if error :
Expand Down Expand Up @@ -1889,7 +1900,7 @@ def on_api_command(self, command, data) :

# Enable printer callbacks
if self not in self._printer._callbacks :
self._printer.register_callback(self)
self._printer.register_callback(self)

# Send response
if error :
Expand Down Expand Up @@ -1967,7 +1978,7 @@ def on_api_command(self, command, data) :

# Enable printer callbacks
if self not in self._printer._callbacks :
self._printer.register_callback(self)
self._printer.register_callback(self)

# Send response
if error :
Expand Down Expand Up @@ -2140,7 +2151,7 @@ def on_api_command(self, command, data) :

# Enable printer callbacks
if self not in self._printer._callbacks :
self._printer.register_callback(self)
self._printer.register_callback(self)

# Send response
if self.eeprom is None :
Expand Down Expand Up @@ -2240,7 +2251,7 @@ def on_api_command(self, command, data) :

# Enable printer callbacks
if self not in self._printer._callbacks :
self._printer.register_callback(self)
self._printer.register_callback(self)

# Send response
if error :
Expand Down Expand Up @@ -2355,10 +2366,10 @@ def on_api_command(self, command, data) :

# Write printer settings to file
output = open(fileDestination, "wb")
output.write(yaml.dump(printerSettings, default_flow_style = True))
output.close()
# Return location
output.write(yaml.dump(printerSettings, default_flow_style = True))
output.close()

# Return location
return flask.jsonify(dict(value = "OK", path = "m33fio/download/" + destinationName))

# Otherwise check if parameter is to set printer settings
Expand Down Expand Up @@ -2553,7 +2564,7 @@ def on_api_command(self, command, data) :

# Enable printer callbacks
if self not in self._printer._callbacks :
self._printer.register_callback(self)
self._printer.register_callback(self)

# Send response
if error :
Expand Down Expand Up @@ -3117,7 +3128,7 @@ def updateFirmware(self, connection, encryptedRom, romVersion) :
if (oldFirmwareType == "M3D" or oldFirmwareType == "M3D Mod") and newFirmwareType == "iMe" :

# Get current Z value from EEPROM
currentValueZ = self.eepromGetInt("lastRecordedZValue")
currentValueZ = self.eepromGetInt("lastRecordedZValue")

# Convert current Z to single-precision floating-point format used by iMe firmware
currentValueZ /= 5170.635833481
Expand Down Expand Up @@ -4139,7 +4150,7 @@ def processRead(self) :
elif response[6 : 10].isdigit() :
response = "ok An error has occured\n"
else :
response = "ok " + response[6 :].strip()
response = "ok " + response[6 :].strip()

# Check if waiting for a command to be processed
if self.lastLineNumberSent is not None and self.lastLineNumberSent % 0x10000 in self.sentCommands :
Expand Down Expand Up @@ -4524,7 +4535,6 @@ def on_event(self, event, payload) :
if platform.uname()[0].startswith("Linux") :
self._plugin_manager.send_plugin_message(self._identifier, dict(value = "Enable GPIO Settings"))
else :
self._settings.set_boolean(["UseGpio"], False)
self._plugin_manager.send_plugin_message(self._identifier, dict(value = "Disable GPIO Settings"))

# Send message for enabling/disabling GPIO buttons
Expand Down Expand Up @@ -7597,6 +7607,7 @@ def preprocess(self, input, output = None, lastCommand = False) :
if self._settings.get_boolean(["CalibrateBeforePrint"]) :
newCommands.append(Command("M618 S" + str(self.eepromOffsets["bedHeightOffset"]["offset"]) + " T" + str(self.eepromOffsets["bedHeightOffset"]["bytes"]) + " P" + str(self.floatToInt(0)), "PREPARATION", "MID-PRINT CENTER VALIDATION PREPARATION"))
newCommands.append(Command("M619 S" + str(self.eepromOffsets["bedHeightOffset"]["offset"]) + " T" + str(self.eepromOffsets["bedHeightOffset"]["bytes"]), "PREPARATION", "MID-PRINT CENTER VALIDATION PREPARATION"))
self._settings.set_float(["BedHeightOffset"], 0)
newCommands.append(Command("G91", "PREPARATION", "MID-PRINT CENTER VALIDATION PREPARATION"))
newCommands.append(Command("G0 Z3 F90", "PREPARATION", "MID-PRINT CENTER VALIDATION PREPARATION"))
newCommands.append(Command("G90", "PREPARATION", "MID-PRINT CENTER VALIDATION PREPARATION"))
Expand Down Expand Up @@ -9157,8 +9168,8 @@ def setGpioPinHigh(self) :

# Check if WiringPi isn't installed
except OSError as exception :
if exception.errno == os.errno.ENOENT :
if exception.errno == os.errno.ENOENT :

# Try using file system to access the port
os.system("echo \"" + str(gpioPin) + "\" > /sys/class/gpio/export")
os.system("echo \"out\" > /sys/class/gpio/gpio" + str(gpioPin) + "/direction")
Expand Down
2 changes: 1 addition & 1 deletion octoprint_m33fio/gcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def getBinary(self) :

# Set sums
sum1 = (sum1 + struct.unpack("B", request[index])[0]) % 0xFF
sum2 = (sum1 + sum2) % 0xFF
sum2 = (sum1 + sum2) % 0xFF

# Append Fletcher 16 checksum checksum to request
request += chr(sum1)
Expand Down
1 change: 1 addition & 0 deletions octoprint_m33fio/static/css/m33fio.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
position: relative;
right: 30px;
top: 5px;
border-color: #E5E5E5;
}

#navbar_plugin_m33fio > a {
Expand Down
10 changes: 4 additions & 6 deletions octoprint_m33fio/static/js/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@

// FIXME: normals don't seem to be quite right

faces.push( new THREE.Face3( vs[ 0 ], vs[ k ], vs[ k + 1 ], [ ns[ 0 ].clone(), ns[ k ++ ].clone(), ns[ k ].clone() ], clr ) );
faces.push( new THREE.Face3( vs[ 0 ], vs[ k ], vs[ k + 1 ], [ ns[ 0 ].clone(), ns[ k ++ ].clone(), ns[ k ].clone() ], clr ) );

}

Expand Down Expand Up @@ -2701,8 +2701,7 @@

} else {

console.error( "Shader.prototype.parse: Invalid value for attribute 'bumptype' (" + bumpType +
") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'" );
console.error( "Shader.prototype.parse: Invalid value for attribute 'bumptype' (" + bumpType + ") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'" );
this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );

}
Expand Down Expand Up @@ -4324,8 +4323,7 @@
}

var animationBounds = calcAnimationBounds();
var skeleton = visualScene.getChildById( instanceCtrl.skeleton[ 0 ], true ) ||
visualScene.getChildBySid( instanceCtrl.skeleton[ 0 ], true );
var skeleton = visualScene.getChildById( instanceCtrl.skeleton[ 0 ], true ) || visualScene.getChildBySid( instanceCtrl.skeleton[ 0 ], true );

//flatten the skeleton into a list of bones
var bonelist = flattenSkeleton( skeleton );
Expand Down Expand Up @@ -4378,7 +4376,7 @@
var weights = skinController.skin.weights;

//hook up the skin weights
// TODO - this might be a good place to choose greatest 4 weights
// TODO - this might be a good place to choose greatest 4 weights
for ( var i = 0; i < weights.length; i ++ ) {

var indicies = new THREE.Vector4( weights[ i ][ 0 ] ? weights[ i ][ 0 ].joint : 0, weights[ i ][ 1 ] ? weights[ i ][ 1 ].joint : 0, weights[ i ][ 2 ] ? weights[ i ][ 2 ].joint : 0, weights[ i ][ 3 ] ? weights[ i ][ 3 ].joint : 0 );
Expand Down
2 changes: 1 addition & 1 deletion octoprint_m33fio/static/js/OBJLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ THREE.OBJLoader.prototype.parse = function ( data ) {

for ( var j = 0; j < 3; j++ ) {

vertex = vertices[ triangles[ i ][ j ] - 1 ];
vertex = vertices[ triangles[ i ][ j ] - 1 ];

geometry.vertices.push( new THREE.Vector3( parseFloat( vertex[ 0 ] ), parseFloat( vertex[ 1 ] ), parseFloat( vertex[ 2 ] ) ) );

Expand Down
10 changes: 4 additions & 6 deletions octoprint_m33fio/static/js/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@
// min(camera displacement, camera rotation in radians)^2 > EPS
// using small-angle approximation cos(x/2) = 1 - x^2 / 8

if ( zoomChanged ||
lastPosition.distanceToSquared( this.object.position ) > EPS ||
8 * ( 1 - lastQuaternion.dot( this.object.quaternion ) ) > EPS ) {
if ( zoomChanged || lastPosition.distanceToSquared( this.object.position ) > EPS || 8 * ( 1 - lastQuaternion.dot( this.object.quaternion ) ) > EPS ) {

lastPosition.copy( this.object.position );
lastQuaternion.copy( this.object.quaternion );
Expand All @@ -299,9 +297,9 @@
// the "up" direction as +Y, unlike the TrackballControls. Touch on tablet and phones is
// supported.
//
// Orbit - left mouse / touch: one finger move
// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
// Pan - right mouse, or arrow keys / touch: three finter swipe
// Orbit - left mouse / touch: one finger move
// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
// Pan - right mouse, or arrow keys / touch: three finter swipe

THREE.OrbitControls = function ( object, domElement ) {

Expand Down
2 changes: 1 addition & 1 deletion octoprint_m33fio/static/js/STLLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ THREE.STLLoader.prototype.parseBinary = function ( data ) {
}

offset += 2;

geometry.faces.push( new THREE.Face3( i * 3, i * 3 + 1, i * 3 + 2 ) );

}
Expand Down
Loading

0 comments on commit a348ef4

Please sign in to comment.