mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 05:24:01 -06:00
Finished GCodeSender
This commit is contained in:
parent
8b438dc0de
commit
b126f92f41
7 changed files with 222 additions and 68 deletions
|
@ -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__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue