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
99a72b90
Commit
99a72b90
authored
9 years ago
by
Thomas Oster
Browse files
Options
Downloads
Patches
Plain Diff
Add possibility to invert X/Y axis
parent
a7121b7f
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/GenericGcodeDriver.java
+44
-4
44 additions, 4 deletions
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
with
44 additions
and
4 deletions
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
+
44
−
4
View file @
99a72b90
...
@@ -50,6 +50,8 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -50,6 +50,8 @@ public class GenericGcodeDriver extends LaserCutter {
protected
static
final
String
SETTING_BAUDRATE
=
"Baud Rate (Serial)"
;
protected
static
final
String
SETTING_BAUDRATE
=
"Baud Rate (Serial)"
;
protected
static
final
String
SETTING_BEDWIDTH
=
"Laserbed width"
;
protected
static
final
String
SETTING_BEDWIDTH
=
"Laserbed width"
;
protected
static
final
String
SETTING_BEDHEIGHT
=
"Laserbed height"
;
protected
static
final
String
SETTING_BEDHEIGHT
=
"Laserbed height"
;
protected
static
final
String
SETTING_FLIP_X
=
"Flip X Axis"
;
protected
static
final
String
SETTING_FLIP_Y
=
"Flip Y Axis"
;
protected
static
final
String
SETTING_HTTP_UPLOAD_URL
=
"HTTP Upload URL"
;
protected
static
final
String
SETTING_HTTP_UPLOAD_URL
=
"HTTP Upload URL"
;
protected
static
final
String
SETTING_LINEEND
=
"Lineend (CR,LF,CRLF)"
;
protected
static
final
String
SETTING_LINEEND
=
"Lineend (CR,LF,CRLF)"
;
protected
static
final
String
SETTING_MAX_SPEED
=
"Max speed (in mm/min)"
;
protected
static
final
String
SETTING_MAX_SPEED
=
"Max speed (in mm/min)"
;
...
@@ -95,6 +97,30 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -95,6 +97,30 @@ public class GenericGcodeDriver extends LaserCutter {
this
.
baudRate
=
baudRate
;
this
.
baudRate
=
baudRate
;
}
}
protected
boolean
flipXaxis
=
false
;
public
boolean
isFlipXaxis
()
{
return
flipXaxis
;
}
public
void
setFlipXaxis
(
boolean
flipXaxis
)
{
this
.
flipXaxis
=
flipXaxis
;
}
protected
boolean
flipYaxis
=
false
;
public
boolean
isFlipYaxis
()
{
return
flipYaxis
;
}
public
void
setFlipYaxis
(
boolean
flipYaxis
)
{
this
.
flipYaxis
=
flipYaxis
;
}
protected
String
httpUploadUrl
=
"http://10.10.10.100/upload"
;
protected
String
httpUploadUrl
=
"http://10.10.10.100/upload"
;
public
String
getHttpUploadUrl
()
public
String
getHttpUploadUrl
()
...
@@ -317,12 +343,16 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -317,12 +343,16 @@ public class GenericGcodeDriver extends LaserCutter {
}
}
}
}
protected
void
move
(
PrintStream
out
,
int
x
,
int
y
,
double
resolution
)
throws
IOException
{
protected
void
move
(
PrintStream
out
,
double
x
,
double
y
,
double
resolution
)
throws
IOException
{
x
=
isFlipXaxis
()
?
getBedWidth
()
-
Util
.
px2mm
(
x
,
resolution
)
:
Util
.
px2mm
(
x
,
resolution
);
y
=
isFlipYaxis
()
?
getBedHeight
()
-
Util
.
px2mm
(
y
,
resolution
)
:
Util
.
px2mm
(
y
,
resolution
);
currentSpeed
=
getTravel_speed
();
currentSpeed
=
getTravel_speed
();
sendLine
(
"G0 X%f Y%f F%d"
,
Util
.
px2mm
(
x
,
resolution
),
Util
.
px2mm
(
y
,
resolution
)
,
(
int
)
(
travel_speed
));
sendLine
(
"G0 X%f Y%f F%d"
,
x
,
y
,
(
int
)
(
travel_speed
));
}
}
protected
void
line
(
PrintStream
out
,
int
x
,
int
y
,
double
resolution
)
throws
IOException
{
protected
void
line
(
PrintStream
out
,
double
x
,
double
y
,
double
resolution
)
throws
IOException
{
x
=
isFlipXaxis
()
?
getBedWidth
()
-
Util
.
px2mm
(
x
,
resolution
)
:
Util
.
px2mm
(
x
,
resolution
);
y
=
isFlipYaxis
()
?
getBedHeight
()
-
Util
.
px2mm
(
y
,
resolution
)
:
Util
.
px2mm
(
y
,
resolution
);
String
append
=
""
;
String
append
=
""
;
if
(
nextPower
!=
currentPower
)
if
(
nextPower
!=
currentPower
)
{
{
...
@@ -334,7 +364,7 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -334,7 +364,7 @@ public class GenericGcodeDriver extends LaserCutter {
append
+=
String
.
format
(
Locale
.
US
,
" F%d"
,
(
int
)
(
max_speed
*
nextSpeed
/
100.0
));
append
+=
String
.
format
(
Locale
.
US
,
" F%d"
,
(
int
)
(
max_speed
*
nextSpeed
/
100.0
));
currentSpeed
=
nextSpeed
;
currentSpeed
=
nextSpeed
;
}
}
sendLine
(
"G1 X%f Y%f"
+
append
,
Util
.
px2mm
(
x
,
resolution
),
Util
.
px2mm
(
y
,
resolution
)
);
sendLine
(
"G1 X%f Y%f"
+
append
,
x
,
y
);
}
}
private
void
writeInitializationCode
()
throws
IOException
{
private
void
writeInitializationCode
()
throws
IOException
{
...
@@ -680,6 +710,8 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -680,6 +710,8 @@ public class GenericGcodeDriver extends LaserCutter {
SETTING_BEDWIDTH
,
SETTING_BEDWIDTH
,
SETTING_BEDHEIGHT
,
SETTING_BEDHEIGHT
,
SETTING_COMPORT
,
SETTING_COMPORT
,
SETTING_FLIP_X
,
SETTING_FLIP_Y
,
SETTING_HOST
,
SETTING_HOST
,
SETTING_HTTP_UPLOAD_URL
,
SETTING_HTTP_UPLOAD_URL
,
SETTING_IDENTIFICATION_STRING
,
SETTING_IDENTIFICATION_STRING
,
...
@@ -711,6 +743,10 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -711,6 +743,10 @@ public class GenericGcodeDriver extends LaserCutter {
return
this
.
getBedHeight
();
return
this
.
getBedHeight
();
}
else
if
(
SETTING_COMPORT
.
equals
(
attribute
))
{
}
else
if
(
SETTING_COMPORT
.
equals
(
attribute
))
{
return
this
.
getComport
();
return
this
.
getComport
();
}
else
if
(
SETTING_FLIP_X
.
equals
(
attribute
))
{
return
this
.
isFlipXaxis
();
}
else
if
(
SETTING_FLIP_Y
.
equals
(
attribute
))
{
return
this
.
isFlipYaxis
();
}
else
if
(
SETTING_HOST
.
equals
(
attribute
))
{
}
else
if
(
SETTING_HOST
.
equals
(
attribute
))
{
return
this
.
getHost
();
return
this
.
getHost
();
}
else
if
(
SETTING_HTTP_UPLOAD_URL
.
equals
(
attribute
))
{
}
else
if
(
SETTING_HTTP_UPLOAD_URL
.
equals
(
attribute
))
{
...
@@ -752,6 +788,10 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -752,6 +788,10 @@ public class GenericGcodeDriver extends LaserCutter {
this
.
setBedHeight
((
Double
)
value
);
this
.
setBedHeight
((
Double
)
value
);
}
else
if
(
SETTING_COMPORT
.
equals
(
attribute
))
{
}
else
if
(
SETTING_COMPORT
.
equals
(
attribute
))
{
this
.
setComport
((
String
)
value
);
this
.
setComport
((
String
)
value
);
}
else
if
(
SETTING_FLIP_X
.
equals
(
attribute
))
{
this
.
setFlipXaxis
((
Boolean
)
value
);
}
else
if
(
SETTING_FLIP_Y
.
equals
(
attribute
))
{
this
.
setFlipYaxis
((
Boolean
)
value
);
}
else
if
(
SETTING_HOST
.
equals
(
attribute
))
{
}
else
if
(
SETTING_HOST
.
equals
(
attribute
))
{
this
.
setHost
((
String
)
value
);
this
.
setHost
((
String
)
value
);
}
else
if
(
SETTING_HTTP_UPLOAD_URL
.
equals
(
attribute
))
{
}
else
if
(
SETTING_HTTP_UPLOAD_URL
.
equals
(
attribute
))
{
...
...
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