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
dbda272b
Commit
dbda272b
authored
7 years ago
by
Admittansen
Browse files
Options
Downloads
Patches
Plain Diff
Changes for admittansen
parent
cedcd558
No related branches found
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/Lasersaur.java
+29
-4
29 additions, 4 deletions
src/com/t_oster/liblasercut/drivers/Lasersaur.java
with
29 additions
and
4 deletions
src/com/t_oster/liblasercut/drivers/Lasersaur.java
+
29
−
4
View file @
dbda272b
...
...
@@ -39,6 +39,7 @@ import purejavacomm.SerialPort;
public
class
Lasersaur
extends
LaserCutter
{
private
static
final
String
SETTING_COMPORT
=
"COM-Port/Device"
;
private
static
final
String
SETTING_BAUDRATE
=
"Serial baudrate"
;
private
static
final
String
SETTING_BEDWIDTH
=
"Laserbed width"
;
private
static
final
String
SETTING_BEDHEIGHT
=
"Laserbed height"
;
private
static
final
String
SETTING_FLIPX
=
"X axis goes right to left (yes/no)"
;
...
...
@@ -126,7 +127,7 @@ public class Lasersaur extends LaserCutter {
public
void
setFlipXaxis
(
boolean
flipXaxis
)
{
this
.
flipXaxis
=
flipXaxis
;
}
protected
String
comPort
=
"ttyUSB0"
;
protected
String
comPort
=
"
/dev/
ttyUSB0"
;
/**
* Get the value of port
...
...
@@ -146,6 +147,19 @@ public class Lasersaur extends LaserCutter {
this
.
comPort
=
comPort
;
}
protected
int
baudRate
=
57600
;
public
int
getBaudRate
()
{
return
baudRate
;
}
public
void
setBaudRate
(
int
baudRate
)
{
this
.
baudRate
=
baudRate
;
}
private
byte
[]
generateVectorGCode
(
VectorPart
vp
,
double
resolution
)
throws
UnsupportedEncodingException
{
ByteArrayOutputStream
result
=
new
ByteArrayOutputStream
();
PrintStream
out
=
new
PrintStream
(
result
,
true
,
"US-ASCII"
);
...
...
@@ -175,6 +189,7 @@ public class Lasersaur extends LaserCutter {
private
void
setSpeed
(
PrintStream
out
,
int
speedInPercent
)
{
if
(
speedInPercent
!=
currentSpeed
)
{
out
.
printf
(
Locale
.
US
,
"G0 F%d\n"
,
(
int
)
((
double
)
speedInPercent
*
this
.
getLaserRate
()
/
100
));
out
.
printf
(
Locale
.
US
,
"G1 F%d\n"
,
(
int
)
((
double
)
speedInPercent
*
this
.
getLaserRate
()
/
100
));
currentSpeed
=
speedInPercent
;
}
...
...
@@ -386,7 +401,7 @@ public class Lasersaur extends LaserCutter {
}
SerialPort
port
=
(
SerialPort
)
tmp
;
port
.
setFlowControlMode
(
SerialPort
.
FLOWCONTROL_NONE
);
port
.
setSerialPortParams
(
9600
,
SerialPort
.
DATABITS_8
,
SerialPort
.
STOPBITS_1
,
SerialPort
.
PARITY_NONE
);
port
.
setSerialPortParams
(
getBaudRate
()
,
SerialPort
.
DATABITS_8
,
SerialPort
.
STOPBITS_1
,
SerialPort
.
PARITY_NONE
);
out
=
new
BufferedOutputStream
(
port
.
getOutputStream
());
pl
.
taskChanged
(
this
,
"sending"
);
writeJob
(
out
,
job
,
pl
,
port
);
...
...
@@ -429,7 +444,9 @@ public class Lasersaur extends LaserCutter {
public
List
<
Double
>
getResolutions
()
{
if
(
resolutions
==
null
)
{
resolutions
=
Arrays
.
asList
(
new
Double
[]{
500
d
250
d
,
500
d
,
1000
d
,
});
}
return
resolutions
;
...
...
@@ -479,6 +496,7 @@ public class Lasersaur extends LaserCutter {
SETTING_BEDHEIGHT
,
SETTING_FLIPX
,
SETTING_COMPORT
,
SETTING_BAUDRATE
,
SETTING_LASER_RATE
,
SETTING_SEEK_RATE
,
SETTING_RASTER_WHITESPACE
,
...
...
@@ -495,6 +513,8 @@ public class Lasersaur extends LaserCutter {
return
this
.
getAddSpacePerRasterLine
();
}
else
if
(
SETTING_COMPORT
.
equals
(
attribute
))
{
return
this
.
getComPort
();
}
else
if
(
SETTING_BAUDRATE
.
equals
(
attribute
))
{
return
this
.
getBaudRate
();
}
else
if
(
SETTING_FLIPX
.
equals
(
attribute
))
{
return
this
.
isFlipXaxis
();
}
else
if
(
SETTING_LASER_RATE
.
equals
(
attribute
))
{
...
...
@@ -515,6 +535,8 @@ public class Lasersaur extends LaserCutter {
this
.
setAddSpacePerRasterLine
((
Double
)
value
);
}
else
if
(
SETTING_COMPORT
.
equals
(
attribute
))
{
this
.
setComPort
((
String
)
value
);
}
else
if
(
SETTING_BAUDRATE
.
equals
(
attribute
))
{
this
.
setBaudRate
((
Integer
)
value
);
}
else
if
(
SETTING_LASER_RATE
.
equals
(
attribute
))
{
this
.
setLaserRate
((
Double
)
value
);
}
else
if
(
SETTING_SEEK_RATE
.
equals
(
attribute
))
{
...
...
@@ -532,6 +554,7 @@ public class Lasersaur extends LaserCutter {
public
LaserCutter
clone
()
{
Lasersaur
clone
=
new
Lasersaur
();
clone
.
comPort
=
comPort
;
clone
.
baudRate
=
baudRate
;
clone
.
laserRate
=
laserRate
;
clone
.
seekRate
=
seekRate
;
clone
.
bedHeight
=
bedHeight
;
...
...
@@ -543,6 +566,8 @@ public class Lasersaur extends LaserCutter {
@Override
public
void
saveJob
(
PrintStream
fileOutputStream
,
LaserJob
job
)
throws
UnsupportedOperationException
,
IllegalJobException
,
Exception
{
writeJob
(
new
BufferedOutputStream
(
fileOutputStream
),
job
,
null
,
null
);
currentPower
=
-
1
;
currentSpeed
=
-
1
;
writeJob
(
new
BufferedOutputStream
(
fileOutputStream
),
job
,
null
,
null
);
}
}
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