Example #1
0
	def __init__(self, logger = None, settings = None, printer = None, port = None, baudrate = None, timeout = 0):
		if logger is None:
			self._logger = logging.getLogger(__name__)
		else:
			self._logger = logger
		self._settings = settings
		self._printer = printer
		if not gpx:
			self._logger.info("Unable to import gpx module")
			raise ValueError("Unable to import gpx module")
		self.port = port
		self.baudrate = self._baudrate = baudrate
		self.timeout = timeout
		self._logger.info("GPXPrinter created, port: %s, baudrate: %s" % (self.port, self.baudrate))
		self.outgoing = Queue.Queue()
		self.baudrateError = False;
		profile_folder = os.path.join(self._settings.global_get_basefolder("base"), "gpxProfiles")
		if not os.path.isdir(profile_folder):
			os.makedirs(profile_folder)
		self.profile_path = os.path.join(profile_folder, "gpx.ini")
		log_path = os.path.join(self._settings.global_get_basefolder("logs"), "gpx.log")
		try:
			self._append(gpx.connect(port, baudrate, self.profile_path, log_path,
				self._logger.getEffectiveLevel() == logging.DEBUG))
		except Exception as e:
			self._logger.info("gpx.connect raised exception = %s" % e)
			raise
		self._regex_linenumber = re.compile("N(\d+)")
Example #2
0
 def __init__(self, gpx_plugin, port=None, baudrate=None, timeout=0):
     self._logger = gpx_plugin._logger
     self._settings = gpx_plugin._settings
     self._printer = gpx_plugin._printer
     self._bot_cancelled = False
     if not gpx:
         self._logger.warn("Unable to import gpx module")
         raise ValueError("Unable to import gpx module")
     self.port = port
     self.baudrate = self._baudrate = baudrate
     self.timeout = timeout
     self._logger.info("GPXPrinter created, port: %s, baudrate: %s" %
                       (self.port, self.baudrate))
     self.outgoing = Queue.Queue()
     self.baudrateError = False
     data_folder = gpx_plugin.get_plugin_data_folder()
     self.profile_path = os.path.join(data_folder, "gpx.ini")
     log_path = self._settings.get_plugin_logfile_path()
     self._regex_linenumber = re.compile("N(\d+)")
     try:
         self._logger.debug("Calling gpx.connect")
         self._append(
             gpx.connect(port, baudrate, self.profile_path, log_path,
                         self._settings.get_boolean(["verbose"])))
         time.sleep(float(self._settings.get(["connection_pause"])))
         self._append(gpx.start())
         self._logger.info("gpx.connect succeeded")
     except Exception as e:
         self._logger.info("gpx.connect raised exception = %s" % e)
         raise
Example #3
0
 def __init__(self, gpx_plugin, port=None, baudrate=None, timeout=0):
     self._logger = gpx_plugin._logger
     self._settings = gpx_plugin._settings
     self._printer = gpx_plugin._printer
     self._bot_cancelled = False
     if not gpx:
         self._logger.warn("Unable to import gpx module")
         raise ValueError("Unable to import gpx module")
     self.port = port
     self.baudrate = self._baudrate = baudrate
     self.timeout = timeout
     self._logger.info("GPXPrinter created, port: %s, baudrate: %s" % (self.port, self.baudrate))
     self.outgoing = Queue.Queue()
     self.baudrateError = False
     data_folder = gpx_plugin.get_plugin_data_folder()
     self.profile_path = os.path.join(data_folder, "gpx.ini")
     log_path = self._settings.get_plugin_logfile_path()
     self._regex_linenumber = re.compile("N(\d+)")
     try:
         self._logger.debug("Calling gpx.connect")
         self._append(
             gpx.connect(port, baudrate, self.profile_path, log_path, self._settings.get_boolean(["verbose"]))
         )
         time.sleep(float(self._settings.get(["connection_pause"])))
         self._append(gpx.start())
         self._logger.info("gpx.connect succeeded")
     except Exception as e:
         self._logger.info("gpx.connect raised exception = %s" % e)
         raise
Example #4
0
	def __init__(self, gpx_plugin, port = None, baudrate = None, timeout = 0):
		self._logger = gpx_plugin._logger
		self._settings = gpx_plugin._settings
		self._printer = gpx_plugin._printer
		if not gpx:
			self._logger.info("Unable to import gpx module")
			raise ValueError("Unable to import gpx module")
		self.port = port
		self.baudrate = self._baudrate = baudrate
		self.timeout = timeout
		self._logger.info("GPXPrinter created, port: %s, baudrate: %s" % (self.port, self.baudrate))
		self.outgoing = Queue.Queue()
		self.baudrateError = False;
		data_folder = gpx_plugin.get_plugin_data_folder()
		self.profile_path = os.path.join(data_folder, "gpx.ini")
		log_path = self._settings.get_plugin_logfile_path()
		self._regex_linenumber = re.compile("N(\d+)")
		try:
			self._logger.info("Calling gpx.connect")
			self._append(gpx.connect(port, baudrate, self.profile_path, log_path,
				self._logger.getEffectiveLevel() == logging.DEBUG))
			self._logger.info("gpx.connect succeeded")
		except Exception as e:
			self._logger.info("gpx.connect raised exception = %s" % e)
			raise
Example #5
0
from math import *
import imp, sys
import time

#if using pyplusplus
# f  = open('libnifalcon_python.dylib', 'rb')
# fd = imp.load_module('falcondevice', f, 'libnifalcon_python.dylib', ('libnifalcon_python.dylib', 'rb', imp.C_EXTENSION))
# fdd = fd.FalconDeviceBridge()
#if using swig
from pynifalcon import *
import gpx

gpx.connect('/dev/ttyACM1')


fdd = FalconDeviceBridge()
print "Devices attached: %d" % (fdd.getCount())
if fdd.getCount() is 0:
    print "No devices attached, exiting..."
    sys.exit()

if not fdd.open(0):
    print "Cannot open device, exiting..."
    sys.exit()

if not fdd.loadFirmware():
    print "Cannot load firmware, exiting..."
    sys.exit()

pos_fv = FalconVec3d()
force_fv = FalconVec3d()
Example #6
0
#!/usr/bin/python2

import gpx

gpx.connect('/dev/ttyACM0', 115200, 'gpx.ini')

#gpx.write('G1 Z10')
#gpx.write('G1 Z20; fooo')

print "connected"



def home():
    setup_gcode = """
T0; set primary extruder
M73 P0; enable show build progress
M104 S42 T0; set nozzle heater to first layer temperature
G21; set units to mm  -- maybe unnecessary
G162 X Y F6000; home XY axes maximum
G161 Z F9000; home Z axis minimum
G92 Z0; set Z to 0
M132 X Y Z A B; Recall stored home offsets -- unknown
G90; set positioning to absolute -- default

G1 X-95 Y-73 Z30 F14000; move to waiting position (front left corner of print bed)
;G130 X0 Y0 A0 B0; set stepper motor vref to lower value while heating
;M6 T0; wait for bed and extruder to heat up
;G130 X127 Y127 A127 B127; set stepper motor vref to defaults
;M108 T0 R3; set extruder speed
;G92 E0; set E to 0
Example #7
0
import gpx
gpx.connect("/dev/ttyACM0", 0, "/home/pi/gpx.ini")
print gpx.write("M105")
print gpx.write("M114")
print gpx.write("G91")
gpx.disconnect()