along with this program. If not, see <http://www.gnu.org/licenses/>.
=end
-
+$debug = false
require 'serialport'
# print("DBG 0.0: ")
# print(line)
# sleep 1
- $sp.print("shavs_set a \r")
+ $sp.print("shavs_set #{$algo_select} \r")
# line = $sp.readlines()
# print("DBG 0.1: ")
# print(line)
begin
line = $sp.gets()
line = "" if line==nil
-# puts("DBG g: "+line)
+ puts("DBG g: "+line) if $debug
end while not /[\s]*MD[\s]*=.*/.match(line)
return line
end
begin
lb=file.gets()
end while not (file.eof or (/[\s]*Len[\s]*=.*/.match(lb)))
-# puts("DBG sending: "+lb);
+ puts("DBG sending: "+lb) if $debug
return if file.eof
$sp.print(lb.strip)
$sp.print("\r")
lb=file.gets()
end while not (file.eof or (/[\s]*Msg[\s]*=.*/.match(lb)))
return if file.eof
-# puts("DBG sending: "+lb);
+ puts("DBG sending: "+lb) if $debug
$sp.print(lb.strip)
avr_md = get_md()
begin
end
-if ARGV.size < 5
+if ARGV.size < 6
STDERR.print <<EOF
- Usage: ruby #{$0} port bps nbits stopb testfile ...
+ Usage: ruby #{$0} port bps nbits stopb algo_select testfile ...
EOF
exit(1)
end
$linewidth = 64
$sp = SerialPort.new(ARGV[0], ARGV[1].to_i, ARGV[2].to_i, ARGV[3].to_i, SerialPort::NONE);
$sp.read_timeout=1000; # 5 minutes
-
+$algo_select = ARGV[4]
#irb
init_system()
-for i in (4..(ARGV.size-1))
+for i in (5..(ARGV.size-1))
run_test(ARGV[i])
puts("")
end
+ $sp.print("EXIT\r");
#exit(0);