migration to a new hardware, adding additional configs

This commit is contained in:
Nikolay Khabarov
2017-06-26 04:14:50 +03:00
parent c02ec2ebd2
commit 2473d0cdba
10 changed files with 202 additions and 56 deletions
+4 -3
View File
@@ -7,10 +7,11 @@ G3 X110 Y110 I-5 J-5 ; full circle in one move
G2 X90 Y90 I-10 J-10 ; second half of circle
G2 X90 Y70 I-10 J-10 ; quarter of circle
G2 X90 Y90 I-10 J10 ; three quoter circle
G3 X90 Y90 Z 20 I-10 J-10 ; spiral
G3 X90 Y90 Z 20 I-10 J-10 F1000 ; spiral
f1800
G2 X92.07 Y85 I-5 J-5 ; small arc
G2 X90 Y90 I-7.07 J0; more then 270 degree arc
G18
G2 X90 Y90 K-5
G2 X90 Y90 K-5 F120
G19
G2 X90 Y90 K-5
G2 X90 Y90 K-5 F120
+2 -1
View File
@@ -2,7 +2,8 @@ g21
g90
; move to start position
g1x50y50f1800
z20
z20f120
f1800
g91
; run
x100
+22 -1
View File
@@ -63,7 +63,7 @@ class TestGMachine(unittest.TestCase):
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1F-1"))
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1F999999"))
m.do_command, GCode.parse_line("G1X100F999999"))
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1X-1Y0Z0"))
self.assertRaises(GMachineException,
@@ -71,6 +71,27 @@ class TestGMachine(unittest.TestCase):
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1X0Y0Z-1"))
def test_feed_rate(self):
m = GMachine()
self.assertRaises(GMachineException,
m.do_command, GCode.parse_line("G1X1F-1"))
m.do_command(GCode.parse_line("G1X100F"
+ str(MAX_VELOCITY_MM_PER_MIN_X)))
m.do_command(GCode.parse_line("G1Y100F"
+ str(MAX_VELOCITY_MM_PER_MIN_Y)))
m.do_command(GCode.parse_line("G1Z100F"
+ str(MAX_VELOCITY_MM_PER_MIN_Z)))
m.do_command(GCode.parse_line("G1E100F"
+ str(MAX_VELOCITY_MM_PER_MIN_E)))
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)
self.assertRaises(GMachineException, m.do_command, GCode.parse_line(s))
s = "G1Z0F" + str(MAX_VELOCITY_MM_PER_MIN_Z + 1)
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))
def test_g2_g3(self):
m = GMachine()
self.assertRaises(GMachineException,
+3 -3
View File
@@ -21,8 +21,8 @@ g21
g1y1
g1y-1
g90
g92x100y100z100
g92x100y100z100f240
m111
g1x98y98z98
(head should be in zero position, and last movement with 500 mm/min velocity)
g1x98y98z98f120
(head should be in zero position)
m2
+31 -4
View File
@@ -8,7 +8,10 @@ from cnc import hal_virtual
class TestPulses(unittest.TestCase):
def setUp(self):
self.v = STEPPER_MAX_VELOCITY_MM_PER_MIN
self.v = min(MAX_VELOCITY_MM_PER_MIN_X,
MAX_VELOCITY_MM_PER_MIN_Y,
MAX_VELOCITY_MM_PER_MIN_Z,
MAX_VELOCITY_MM_PER_MIN_E)
def tearDown(self):
pass
@@ -70,6 +73,14 @@ class TestPulses(unittest.TestCase):
for direction_i, px, py, pz, pe in g:
if direction_i:
dx, dy, dz, de = px, py, pz, pe
if STEPPER_INVERTED_X:
dx = -dx
if STEPPER_INVERTED_Y:
dy = -dy
if STEPPER_INVERTED_Z:
dz = -dz
if STEPPER_INVERTED_E:
de = -de
dir_requested = True
continue
if dir_requested: # ignore last change
@@ -235,7 +246,8 @@ class TestPulses(unittest.TestCase):
# is correct, since PulseGenerator is responsible for this, check only
# one child class.
m = Coordinates(TABLE_SIZE_X_MM, 0, 0, 0)
g = PulseGeneratorLinear(m, self.v)
velocity = 1000
g = PulseGeneratorLinear(m, velocity)
i = 0
lx = 0
lt, at, bt = None, None, None
@@ -249,8 +261,7 @@ class TestPulses(unittest.TestCase):
bt = px - lx
lx = px
i += 1
self.assertEqual(round(60.0 / lt / STEPPER_PULSES_PER_MM_X),
round(self.v))
self.assertEqual(round(60.0 / lt / STEPPER_PULSES_PER_MM_X), velocity)
self.assertGreater(at, lt)
self.assertGreater(bt, lt)
@@ -261,6 +272,14 @@ class TestPulses(unittest.TestCase):
dir_found = False
for direction, px, py, pz, pe in g:
if direction:
if STEPPER_INVERTED_X:
px = -px
if STEPPER_INVERTED_Y:
py = -py
if STEPPER_INVERTED_Z:
pz = -pz
if STEPPER_INVERTED_E:
pe = -pe
# should be once
self.assertFalse(dir_found)
dir_found = True
@@ -271,6 +290,14 @@ class TestPulses(unittest.TestCase):
dir_found = False
for direction, px, py, pz, pe in g:
if direction:
if STEPPER_INVERTED_X:
px = -px
if STEPPER_INVERTED_Y:
py = -py
if STEPPER_INVERTED_Z:
pz = -pz
if STEPPER_INVERTED_E:
pe = -pe
# should be once
self.assertFalse(dir_found)
dir_found = True