Skip to content

Commit

Permalink
Updating steam.py streaming script
Browse files Browse the repository at this point in the history
- Added push message capability to the stream.py streaming script. It
prints out as a `Debug:` string in the output.
  • Loading branch information
chamnit committed Dec 12, 2016
1 parent 5d79103 commit af17f00
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions doc/script/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
buffer layer to prevent buffer starvation.
CHANGELOG:
- 20161212: Added push message feedback for simple streaming
- 20140714: Updated baud rate to 115200. Added a settings
write mode via simple streaming method. MIT-licensed.
Expand All @@ -20,7 +21,7 @@
---------------------
The MIT License (MIT)
Copyright (c) 2012-2014 Sungeun K. Jeon
Copyright (c) 2012-2016 Sungeun K. Jeon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -98,8 +99,13 @@
l_block = line.strip() # Strip all EOL characters for consistency
if verbose: print 'SND: ' + str(l_count) + ':' + l_block,
s.write(l_block + '\n') # Send g-code block to grbl
grbl_out = s.readline().strip() # Wait for grbl response with carriage return
if verbose: print 'REC:',grbl_out
while 1:
grbl_out = s.readline().strip() # Wait for grbl response with carriage return
if grbl_out.find('ok') < 0 and grbl_out.find('error') < 0 :
print "\n Debug: ",grbl_out,
else :
if verbose: print 'REC:',grbl_out
break
else:
# Send g-code program via a more agressive streaming protocol that forces characters into
# Grbl's serial read buffer to ensure Grbl has immediate access to the next g-code command
Expand Down Expand Up @@ -135,4 +141,4 @@

# Close file and serial port
f.close()
s.close()
s.close()

0 comments on commit af17f00

Please sign in to comment.