mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-13 20:35:53 +08:00
Duet upload improved to work with DuetWiFi and Duet 0.6(ethernet). Thanks to @rob-miller for testing and fix. (#4033)
This commit is contained in:
parent
98fca9090b
commit
5fbb245b97
@ -1865,22 +1865,30 @@ sub send_gcode {
|
||||
],
|
||||
);
|
||||
}else{
|
||||
$res = $ua->post(
|
||||
"http://" . $self->{config}->print_host . "/rr_upload?name=0:/gcodes/" . basename($path) . "&time=1234567890123",
|
||||
Content_Type => 'form-data',
|
||||
Content => [
|
||||
# OctoPrint doesn't like Windows paths so we use basename()
|
||||
# Also, since we need to read from filesystem we process it through encode_path()
|
||||
file => [ $path, basename($path) ],
|
||||
],
|
||||
);
|
||||
if ($self->{send_gcode_file_print}) {
|
||||
$res = $ua->get(
|
||||
"http://" . $self->{config}->print_host . "/rr_gcode?gcode=M32%20" . basename($path),
|
||||
);
|
||||
# slurp the file we would send into a string - should be someplace to reference this but could not find it?
|
||||
local $/=undef;
|
||||
open my $gch,$path;
|
||||
my $gcode=<$gch>;
|
||||
close($gch);
|
||||
|
||||
# get the time string
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
my $t = sprintf("%4d-%02d-%02dT%02d:%02d:%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec);
|
||||
|
||||
my $req = HTTP::Request->new(POST => "http://" . $self->{config}->print_host . "/rr_upload?name=0:/gcodes/" . basename($path) . "&time=$t",);
|
||||
$req->content( $gcode );
|
||||
$res = $ua->request($req);
|
||||
|
||||
if ($res->is_success) {
|
||||
if ($self->{send_gcode_file_print}) {
|
||||
$res = $ua->get(
|
||||
"http://" . $self->{config}->print_host . "/rr_gcode?gcode=M32%20" . basename($path),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$self->statusbar->StopBusy;
|
||||
|
||||
if ($res->is_success) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user