auto velocity

This commit is contained in:
Nikolay Khabarov
2017-07-03 03:05:34 +03:00
parent f4ed33fc5c
commit baacf6dfdd
3 changed files with 92 additions and 38 deletions
+9 -2
View File
@@ -5,6 +5,7 @@ from cnc.gmachine import *
from cnc.coordinates import *
from cnc.heater import *
from cnc.pid import *
from cnc.config import *
class TestGMachine(unittest.TestCase):
@@ -64,8 +65,6 @@ class TestGMachine(unittest.TestCase):
self.assertEqual(m.position(), Coordinates(1, 2, 3, 4))
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1F-1"))
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1X100F999999"))
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1X-1Y0Z0"))
self.assertRaises(GMachineException,
@@ -74,6 +73,7 @@ class TestGMachine(unittest.TestCase):
m.do_command, GCode.parse_line("G1X0Y0Z-1"))
def test_feed_rate(self):
PulseGenerator.AUTO_VELOCITY_ADJUSTMENT = False
m = GMachine()
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1X1F-1"))
@@ -87,6 +87,8 @@ class TestGMachine(unittest.TestCase):
+ str(MAX_VELOCITY_MM_PER_MIN_Z)))
m.do_command(GCode.parse_line("G1E100F"
+ str(MAX_VELOCITY_MM_PER_MIN_E)))
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1X0F999999"))
s = "G1X0F" + str(MAX_VELOCITY_MM_PER_MIN_X + 1)
self.assertRaises(GMachineException, m.do_command, GCode.parse_line(s))
s = "G1Y0F" + str(MAX_VELOCITY_MM_PER_MIN_Y + 1)
@@ -95,6 +97,11 @@ class TestGMachine(unittest.TestCase):
self.assertRaises(GMachineException, m.do_command, GCode.parse_line(s))
s = "G1E0F" + str(MAX_VELOCITY_MM_PER_MIN_E + 1)
self.assertRaises(GMachineException, m.do_command, GCode.parse_line(s))
PulseGenerator.AUTO_VELOCITY_ADJUSTMENT = True
m.do_command(GCode.parse_line("G1X10Y10Z10F9999999999999999999"))
m.do_command(GCode.parse_line("G2I0.1F9999999999999999999"))
m.do_command(GCode.parse_line("G2I10F9999999999999999999"))
PulseGenerator.AUTO_VELOCITY_ADJUSTMENT = AUTO_VELOCITY_ADJUSTMENT
def test_g2_g3(self):
m = GMachine()