Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LibLaserCut
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Elektronikföreningen Admittansen
LibLaserCut
Commits
0d502bf1
Commit
0d502bf1
authored
9 years ago
by
Michael Adams
Browse files
Options
Downloads
Patches
Plain Diff
Better error handling during serial connection errors
parent
4a455f69
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
+42
-26
42 additions, 26 deletions
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
with
42 additions
and
26 deletions
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
+
42
−
26
View file @
0d502bf1
...
...
@@ -530,19 +530,23 @@ public class GenericGcodeDriver extends LaserCutter {
return
"Does not seem to be a "
+
getModelName
()+
" on "
+
i
.
getName
();
}
portIdentifier
=
i
;
pl
.
taskChanged
(
this
,
"Connected"
);
return
null
;
}
catch
(
PortInUseException
e
)
{
return
"Port in use "
+
i
.
getName
();
try
{
disconnect
(
""
);
}
catch
(
Exception
ex
)
{
System
.
out
.
println
(
ex
.
getMessage
());
}
return
"Port in use: "
+
i
.
getName
();
}
catch
(
IOException
e
)
{
return
"IO Error "
+
i
.
getName
();
try
{
disconnect
(
""
);
}
catch
(
Exception
ex
)
{
System
.
out
.
println
(
ex
.
getMessage
());
}
return
"IO Error from "
+
i
.
getName
()+
": "
+
e
.
getMessage
();
}
catch
(
PureJavaIllegalStateException
e
)
{
return
"Could not open "
+
i
.
getName
();
try
{
disconnect
(
""
);
}
catch
(
Exception
ex
)
{
System
.
out
.
println
(
ex
.
getMessage
());
}
return
"Could not open "
+
i
.
getName
()+
": "
+
e
.
getMessage
();
}
}
else
...
...
@@ -576,7 +580,12 @@ public class GenericGcodeDriver extends LaserCutter {
String
error
=
"No serial port found"
;
if
(
portIdentifier
==
null
&&
!
getComport
().
equals
(
"auto"
))
{
portIdentifier
=
CommPortIdentifier
.
getPortIdentifier
(
getComport
());
try
{
portIdentifier
=
CommPortIdentifier
.
getPortIdentifier
(
getComport
());
}
catch
(
NoSuchPortException
e
)
{
throw
new
IOException
(
"No such port: "
+
getComport
());
}
}
if
(
portIdentifier
!=
null
)
...
...
@@ -658,31 +667,38 @@ public class GenericGcodeDriver extends LaserCutter {
pl
.
taskChanged
(
this
,
"connecting..."
);
connect
(
pl
);
pl
.
taskChanged
(
this
,
"sending"
);
writeInitializationCode
();
pl
.
progressChanged
(
this
,
20
);
int
i
=
0
;
int
max
=
job
.
getParts
().
size
();
for
(
JobPart
p
:
job
.
getParts
())
{
if
(
p
instanceof
RasterPart
)
{
RasterPart
rp
=
(
RasterPart
)
p
;
LaserProperty
black
=
rp
.
getLaserProperty
();
LaserProperty
white
=
black
.
clone
();
white
.
setProperty
(
"power"
,
0.0f
);
p
=
convertRasterToVectorPart
((
RasterPart
)
p
,
black
,
white
,
p
.
getDPI
(),
false
);
}
if
(
p
instanceof
VectorPart
)
try
{
writeInitializationCode
();
pl
.
progressChanged
(
this
,
20
);
int
i
=
0
;
int
max
=
job
.
getParts
().
size
();
for
(
JobPart
p
:
job
.
getParts
())
{
//TODO: in direct mode use progress listener to indicate progress
//of individual job
writeVectorGCode
((
VectorPart
)
p
,
p
.
getDPI
());
if
(
p
instanceof
RasterPart
)
{
RasterPart
rp
=
(
RasterPart
)
p
;
LaserProperty
black
=
rp
.
getLaserProperty
();
LaserProperty
white
=
black
.
clone
();
white
.
setProperty
(
"power"
,
0.0f
);
p
=
convertRasterToVectorPart
((
RasterPart
)
p
,
black
,
white
,
p
.
getDPI
(),
false
);
}
if
(
p
instanceof
VectorPart
)
{
//TODO: in direct mode use progress listener to indicate progress
//of individual job
writeVectorGCode
((
VectorPart
)
p
,
p
.
getDPI
());
}
i
++;
pl
.
progressChanged
(
this
,
20
+
(
int
)
(
i
*(
double
)
60
/
max
));
}
i
++;
pl
.
progressChanged
(
this
,
20
+
(
int
)
(
i
*(
double
)
60
/
max
));
writeShutdownCode
();
disconnect
(
job
.
getName
()+
".gcode"
);
}
catch
(
IOException
e
)
{
pl
.
taskChanged
(
this
,
"disconnecting"
);
disconnect
(
job
.
getName
()+
".gcode"
);
throw
e
;
}
writeShutdownCode
();
disconnect
(
job
.
getName
()+
".gcode"
);
pl
.
taskChanged
(
this
,
"sent."
);
pl
.
progressChanged
(
this
,
100
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment