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
f2ff2c54
Commit
f2ff2c54
authored
12 years ago
by
Max Gaukler
Browse files
Options
Downloads
Patches
Plain Diff
improved dummy driver: configurable behaviour for calculating estimated time, added some comments
parent
5d2c3db2
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/Dummy.java
+25
-8
25 additions, 8 deletions
src/com/t_oster/liblasercut/drivers/Dummy.java
with
25 additions
and
8 deletions
src/com/t_oster/liblasercut/drivers/Dummy.java
+
25
−
8
View file @
f2ff2c54
/**
* This file is part of VisiCut. Copyright (C) 2012 Thomas Oster
* <thomas.oster@rwth-aachen.de> RWTH Aachen University - 52062 Aachen, Germany
* and others.
*
* VisiCut is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
...
...
@@ -21,17 +22,17 @@ package com.t_oster.liblasercut.drivers;
import
com.t_oster.liblasercut.*
;
import
java.io.BufferedOutputStream
;
import
java.util.*
;
import
java.lang.System
;
/**
* This class implements a d
river for the LAOS Lasercutter board. Currently it
*
supports the simple code and the G-Code, which may be used in the future
.
*
* @author Thomas Oster <thomas.oster@rwth-aachen.de>
* This class implements a d
ummy driver that accepts laserjobs and prints debug information about them.
*
You can use it to test the VisiCut GUI without having a real lasercutter
.
*
* @author
Max Gaukler <development@maxgaukler.de>, based on the LAOS driver by
Thomas Oster <thomas.oster@rwth-aachen.de>
*/
public
class
Dummy
extends
LaserCutter
{
private
static
final
String
SETTING_BEDWIDTH
=
"Laserbed width"
;
private
static
final
String
SETTING_BEDHEIGHT
=
"Laserbed height"
;
private
static
final
String
SETTING_RUNTIME
=
"Fake estimated run-time in seconds (-1 to disable)"
;
@Override
public
String
getModelName
()
{
return
"Dummy"
;
...
...
@@ -47,6 +48,8 @@ public class Dummy extends LaserCutter {
pl
.
taskChanged
(
this
,
"sending"
);
pl
.
taskChanged
(
this
,
"sent."
);
System
.
out
.
println
(
"dummy-driver got LaserJob: "
);
// TODO don't just print the parts and settins, but also the commands
// TODO if you have too much time, also implement some preview output (svg animation???) - would be nice for testing optimisations
for
(
JobPart
p
:
job
.
getParts
())
{
if
(
p
instanceof
VectorPart
)
...
...
@@ -91,14 +94,21 @@ public class Dummy extends LaserCutter {
@Override
public
int
estimateJobDuration
(
LaserJob
job
)
{
return
1234
;
// instead of really calculating some duration, just print the number configured from the settings
// if <0, act as if the driver can not calculate a job duration
if
(!
canEstimateJobDuration
())
{
throw
new
RuntimeException
(
"cannot estimate job duration (dummy driver: fake runtime is set to negative value)"
);
}
// return bogus value to test codepaths of GUI
return
fakeRunTime
;
}
private
List
<
Double
>
resolutions
;
protected
int
fakeRunTime
=
-
1
;
@Override
public
boolean
canEstimateJobDuration
()
{
return
true
;
return
(
fakeRunTime
>=
0
)
;
}
@Override
...
...
@@ -152,7 +162,8 @@ public class Dummy extends LaserCutter {
}
private
static
String
[]
settingAttributes
=
new
String
[]{
SETTING_BEDWIDTH
,
SETTING_BEDHEIGHT
SETTING_BEDHEIGHT
,
SETTING_RUNTIME
};
@Override
...
...
@@ -166,6 +177,8 @@ public class Dummy extends LaserCutter {
return
this
.
getBedWidth
();
}
else
if
(
SETTING_BEDHEIGHT
.
equals
(
attribute
))
{
return
this
.
getBedHeight
();
}
else
if
(
SETTING_RUNTIME
.
equals
(
attribute
))
{
return
this
.
fakeRunTime
;
}
return
null
;
}
...
...
@@ -176,7 +189,10 @@ public class Dummy extends LaserCutter {
this
.
setBedWidth
((
Double
)
value
);
}
else
if
(
SETTING_BEDHEIGHT
.
equals
(
attribute
))
{
this
.
setBedHeight
((
Double
)
value
);
}
else
if
(
SETTING_RUNTIME
.
equals
(
attribute
))
{
this
.
fakeRunTime
=
Integer
.
parseInt
(
value
.
toString
());
}
}
@Override
...
...
@@ -184,6 +200,7 @@ public class Dummy extends LaserCutter {
Dummy
clone
=
new
Dummy
();
clone
.
bedHeight
=
bedHeight
;
clone
.
bedWidth
=
bedWidth
;
clone
.
fakeRunTime
=
this
.
fakeRunTime
;
return
clone
;
}
}
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