mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Finished GCodeSender
This commit is contained in:
@@ -10,17 +10,27 @@ BEGIN {
|
||||
|
||||
use Slic3r;
|
||||
|
||||
die "Usage: send-gcode.pl SERIALPORT BAUDRATE GCODE_FILE\n"
|
||||
if @ARGV != 3;
|
||||
|
||||
my $serial = Slic3r::GCode::Sender->new($ARGV[0], $ARGV[1]);
|
||||
1 until $serial->is_connected;
|
||||
print "Connected to printer\n";
|
||||
|
||||
$serial->send($ARGV[2]);
|
||||
|
||||
exit;
|
||||
|
||||
while (1) {
|
||||
$serial->send("1");
|
||||
sleep 1;
|
||||
$serial->send("0");
|
||||
sleep 1;
|
||||
{
|
||||
local $/ = "\n";
|
||||
Slic3r::open(\my $fh, '<', $ARGV[2])
|
||||
or die "Unable to open $ARGV[2]: $!\n";
|
||||
binmode $fh, ':utf8';
|
||||
while (<$fh>) {
|
||||
$serial->send($_);
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
|
||||
while ((my $queue_size = $serial->queue_size) > 0) {
|
||||
printf "Queue size: %d\n", $queue_size;
|
||||
}
|
||||
$serial->disconnect;
|
||||
|
||||
__END__
|
||||
|
||||
Reference in New Issue
Block a user