]> wolfpit.net Git - hardware/fuck_tomatoes/.git/commitdiff
Minimized G-Code package size to fit another detection point into each package
authorMichael Reeves <michaelreeves808@gmail.com>
Sat, 23 Feb 2019 06:34:53 +0000 (22:34 -0800)
committerMichael Reeves <michaelreeves808@gmail.com>
Sat, 23 Feb 2019 06:34:53 +0000 (22:34 -0800)
- Added limit to amount of allowed package points (4)

Printer.py
Tests.py
__pycache__/Printer.cpython-37.pyc
utils/Gcode.py
utils/__pycache__/Gcode.cpython-37.pyc

index 0dd0b09a1734884714b0adcd64258db34b0c05ab..19a9dc661dc56f9f806160dc11b2856147c235aa 100644 (file)
@@ -38,9 +38,10 @@ class Printer():
        def write(self, xy):
                self.writePoint(self.adjustXY(xy))
 
-       #Cannot send packages with over 3 locations at once,
+       #Cannot send packages with over 4 locations at once,
        #it overflows the printer's serial buffer because it's a peice of dog shit
        def sendPackage(self, points):
+               if points.count > 4: points = points[:4]
                package = Gcode.buildGcodePackage(list(map(self.adjustXY, points)), (self.max_X, self.max_Y))
                self.writePackage(package)
 
index 22d289af98456a3f86794a36a3b16c9211593fd9..148bc7aca3a7d3b1b2b9428c2d119dcf1429fb49 100644 (file)
--- a/Tests.py
+++ b/Tests.py
@@ -3,8 +3,9 @@ from utils import Gcode
 
 testPoints = [
     (176, 204),
-    (306, 208),
-    (176, 204) 
+    (306, 150),
+    (176, 204), 
+    (306, 150)
 ]
 
 start_time = time.time()
index 04190197d6391dc79cf887c6b858f24bd25405aa..7df0b25d6c341a809a117bc7fa5e7c9a1152dae8 100644 (file)
Binary files a/__pycache__/Printer.cpython-37.pyc and b/__pycache__/Printer.cpython-37.pyc differ
index 8f88f1979dbb9862fd5bcb0b08f9546abaff73a0..64d658e1df5e3e13d13a8f038faf1c4dc918dce9 100644 (file)
@@ -5,7 +5,7 @@ def buildGcodePackage(points, xyMax):
                for point in points:
                        if Geometry.pointWithinBounds(point, xyMax):
                                x,y = point
-                               package += 'G0 X{:.3f} Y{:.3f}\n'.format(x, y)
+                               package += 'G0 X{:.1f} Y{:.1f}\n'.format(x, y)
                                package += 'M106 S300\nG4 P500\nM107\n'
-               package += 'G0 F5000 X0 Y0\n'
+               package += 'G0 X0 Y0\n'
                return package
\ No newline at end of file
index 7009844eebe72e5a025546707f85e73cf61e93d0..16d5239ecde99a8d62a0b7be9b9881ad2baa8a8d 100644 (file)
Binary files a/utils/__pycache__/Gcode.cpython-37.pyc and b/utils/__pycache__/Gcode.cpython-37.pyc differ