Minor bug fixes and updates. Line number tracking.
- Line number tracking was getting truncated at 255, since it was using wrong variable type. Fixed it with a trunc(). - Increased the max number line allowed by Grbl to 9999999 from the g-code standard 99999. The latter seems to be an arbitrary number, so we are allowing larger ones for at least one known use case scenario. - Created a new test directory to contain some testing g-code to proof the firmware. Only got started with one test case so far. More will be inserted as needed. - Some other commenting updates to clarify certain aspects of the code.
This commit is contained in:
25
test/test.py
Normal file
25
test/test.py
Normal file
@ -0,0 +1,25 @@
|
||||
import random
|
||||
import serial
|
||||
import time
|
||||
ser = serial.Serial('/dev/tty.usbmodem24111', 115200, timeout=0.001)
|
||||
time.sleep(1)
|
||||
outstanding = 0
|
||||
data = ''
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
data += ser.read()
|
||||
pos = data.find('\n')
|
||||
if pos == -1:
|
||||
line = ''
|
||||
else:
|
||||
line = data[0:pos + 1]
|
||||
data = data[pos + 1:]
|
||||
if line == '' and outstanding < 3:
|
||||
while outstanding < 3:
|
||||
ser.write("G0 Z%0.3f\n" % (0.01 * (random.random() - 0.5)))
|
||||
#ser.write("M3\n")
|
||||
outstanding += 1
|
||||
continue
|
||||
if line == 'ok\r\n':
|
||||
outstanding -= 1
|
||||
print outstanding, repr(line.rstrip())
|
Reference in New Issue
Block a user