e8a6bfd179
- Added machine position reporting to status queries. This will be further developed with part positioning/offsets and maintaining location upon reset. - System variables refactored into a global struct for better readability. - Removed old obsolete Ruby streaming scripts. These were no longer compatible. Updated Python streaming scripts. - Fixed printFloat() and other printing functions. - Decreased planner buffer back to 18 blocks and increased TX serial buffer to 64 bytes. Need the memory space for future developments. - Begun adding run-time modes to grbl, where block delete toggle, mm/in reporting modes, jog modes, etc can be set during runtime. Will be fleshed out and placed into EEPROM when everything is added.
50 lines
1.1 KiB
Ruby
50 lines
1.1 KiB
Ruby
require 'rubygems'
|
|
require 'optparse'
|
|
require 'serialport'
|
|
|
|
|
|
options_parser = OptionParser.new do |opts|
|
|
opts.banner = "Usage: stream [options] gcode-file"
|
|
opts.on('-v', '--verbose', 'Output more information') do
|
|
$verbose = true
|
|
end
|
|
|
|
opts.on('-p', '--prebuffer', 'Prebuffer commands') do
|
|
$prebuffer = true
|
|
end
|
|
|
|
opts.on('-h', '--help', 'Display this screen') do
|
|
puts opts
|
|
exit
|
|
end
|
|
end
|
|
options_parser.parse!
|
|
if ARGV.empty?
|
|
puts options_parser
|
|
exit
|
|
end
|
|
|
|
# SerialPort.open('/dev/tty.FireFly-A964-SPP-1', 115200) do |sp|
|
|
SerialPort.open('/dev/tty.usbserial-A700e0GO', 9600) do |sp|
|
|
sp.write("\r\n\r\n");
|
|
sleep 1
|
|
ARGV.each do |file|
|
|
puts "Processing file #{file}"
|
|
prebuffer = $prebuffer ? 20 : 0
|
|
File.readlines(file).each do |line|
|
|
next if line.strip == ''
|
|
puts line.strip
|
|
sp.write("#{line.strip}\r\n");
|
|
if prebuffer == 0
|
|
begin
|
|
result = sp.gets.strip
|
|
puts "Grbl >> #{result}" #unless result == 'ok'
|
|
end while !(result =~ /^ok|^error/)
|
|
else
|
|
prebuffer -= 1
|
|
end
|
|
end
|
|
end
|
|
puts "Done."
|
|
sleep 500
|
|
end |