Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
447a735d
Commit
447a735d
authored
Sep 24, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding heater/fan control for thermal focal distance measurements
parent
d3195f8c
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
242 additions
and
23 deletions
+242
-23
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+95
-14
CalibrationHardwareInterface.java
src/main/java/CalibrationHardwareInterface.java
+91
-4
LensAdjustment.java
src/main/java/LensAdjustment.java
+56
-5
No files found.
src/main/java/Aberration_Calibration.java
View file @
447a735d
This diff is collapsed.
Click to expand it.
src/main/java/CalibrationHardwareInterface.java
View file @
447a735d
...
...
@@ -1797,12 +1797,99 @@ public class CalibrationHardwareInterface {
throw
new
RuntimeException
(
ie
);
}
}
}
public
static
class
PowerControl
{
public
int
debugLevel
=
1
;
private
String
powerIP
=
"192.168.0.80"
;
private
final
String
urlFormat
=
"http://%s/insteon/index.php?cmd=%s&group=%s"
;
private
final
String
rootElement
=
"Document"
;
public
boolean
powerConrtolEnabled
=
false
;
public
void
setProperties
(
String
prefix
,
Properties
properties
){
properties
.
setProperty
(
prefix
+
"powerIP"
,
this
.
powerIP
+
""
);
properties
.
setProperty
(
prefix
+
"powerConrtolEnabled"
,
this
.
powerConrtolEnabled
+
""
);
}
//Integer.decode(string)
public
void
getProperties
(
String
prefix
,
Properties
properties
){
if
(
properties
.
getProperty
(
prefix
+
"powerIP"
)!=
null
)
this
.
powerIP
=
properties
.
getProperty
(
prefix
+
"powerIP"
);
if
(
properties
.
getProperty
(
prefix
+
"powerConrtolEnabled"
)!=
null
)
this
.
powerConrtolEnabled
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"powerConrtolEnabled"
));
}
public
boolean
setPower
(
String
group
,
String
state
){
if
(!
powerConrtolEnabled
)
{
System
.
out
.
println
(
"=== Power control is disabled ==="
);
return
false
;
}
String
url
=
String
.
format
(
urlFormat
,
this
.
powerIP
,
state
,
group
);
if
(
this
.
debugLevel
>
2
)
System
.
out
.
println
(
"setPower: "
+
url
);
Document
dom
=
null
;
try
{
DocumentBuilderFactory
dbf
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
db
=
dbf
.
newDocumentBuilder
();
dom
=
db
.
parse
(
url
);
if
(!
dom
.
getDocumentElement
().
getNodeName
().
equals
(
rootElement
))
{
System
.
out
.
println
(
"Root element: expected \""
+
rootElement
+
"\", got \""
+
dom
.
getDocumentElement
().
getNodeName
()+
"\""
);
IJ
.
showMessage
(
"Error"
,
"Root element: expected \""
+
rootElement
+
"\", got \""
+
dom
.
getDocumentElement
().
getNodeName
()+
"\""
);
return
false
;
}
// boolean responceError= (dom.getDocumentElement().getElementsByTagName("error").getLength()!=0);
// if (responceError) {
// System.out.println("ERROR: register write ("+url+") FAILED" );
// IJ.showMessage("Error","register write ("+url+") FAILED");
// return false;
// }
}
catch
(
MalformedURLException
e
){
System
.
out
.
println
(
"Please check the URL:"
+
e
.
toString
()
);
return
false
;
}
catch
(
IOException
e1
){
IJ
.
showStatus
(
""
);
String
error
=
e1
.
getMessage
();
if
(
error
==
null
||
error
.
equals
(
""
))
error
=
""
+
e1
;
IJ
.
showMessage
(
"setPower ERROR"
,
""
+
error
);
return
false
;
}
catch
(
ParserConfigurationException
pce
)
{
pce
.
printStackTrace
();
return
false
;
}
catch
(
SAXException
se
)
{
se
.
printStackTrace
();
return
false
;
}
return
true
;
}
public
boolean
showDialog
(
String
title
,
boolean
control
)
{
GenericDialog
gd
=
new
GenericDialog
(
title
);
boolean
heaterOn
=
false
,
fanOn
=
false
;
gd
.
addCheckbox
(
"Enable power control (heater, fan) "
,
this
.
powerConrtolEnabled
);
gd
.
addStringField
(
"IP address of the power control"
,
this
.
powerIP
,
15
);
if
(
control
){
gd
.
addCheckbox
(
"Heater On"
,
heaterOn
);
gd
.
addCheckbox
(
"Fan On"
,
fanOn
);
}
WindowTools
.
addScrollBars
(
gd
);
if
(
control
)
gd
.
enableYesNoCancel
(
"OK"
,
"Control Power"
);
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
false
;
this
.
powerConrtolEnabled
=
gd
.
getNextBoolean
();
this
.
powerIP
=
gd
.
getNextString
();
if
(
control
){
heaterOn
=
gd
.
getNextBoolean
();
fanOn
=
gd
.
getNextBoolean
();
if
(!
gd
.
wasOKed
())
{
setPower
(
"heater"
,
heaterOn
?
"on"
:
"off"
);
setPower
(
"fan"
,
fanOn
?
"on"
:
"off"
);
}
}
return
true
;
}
public
boolean
isPowerControlEnabled
(){
return
this
.
powerConrtolEnabled
;
}
public
void
setDebugLevel
(
int
debugLevel
){
this
.
debugLevel
=
debugLevel
;
}
}
public
static
class
LaserPointers
{
public
int
debugLevel
=
1
;
...
...
src/main/java/LensAdjustment.java
View file @
447a735d
...
...
@@ -330,6 +330,12 @@ public class LensAdjustment {
public
boolean
lensDistanceShowResults
=
true
;
// show results window from foca
public
boolean
lensDistanceMoveToGoal
=
true
;
// Move to targetMicrons
public
boolean
powerControlEnable
=
true
;
public
double
powerControlMaximalTemperature
=
60.0
;
public
double
powerControlHeaterOnMinutes
=
10.0
;
public
double
powerControlNeitherOnMinutes
=
5.0
;
public
double
powerControlFanOnMinutes
=
15.0
;
public
String
uvLasersIP
=
"192.168.0.236"
;
// IP address of the camera with UV LEDs and aiming lasers are connected
public
int
uvLasersBus
=
0
;
// 0 if 103641 board is connected to the sensor port (through 10-359), 1 - to 10369
public
double
[]
uvLasersCurrents
={
40.0
,
40.0
,
40.0
,
40.0
};
// default LED on currents (mA)
...
...
@@ -546,6 +552,11 @@ public class LensAdjustment {
boolean
lensDistanceInteractive
,
// Open dialog when calibrating focal distance
boolean
lensDistanceShowResults
,
// show results window from foca
boolean
lensDistanceMoveToGoal
,
// Move to targetMicrons
boolean
powerControlEnable
,
double
powerControlMaximalTemperature
,
double
powerControlHeaterOnMinutes
,
double
powerControlNeitherOnMinutes
,
double
powerControlFanOnMinutes
,
String
uvLasersIP
,
// IP address of the camera with UV LEDs and aiming lasers are connected
int
uvLasersBus
,
// 0 if 103641 board is connected to the sensor port (through 10-359), 1 - to 10369
double
[]
uvLasersCurrents
,
// default LED on currents (mA)
...
...
@@ -692,6 +703,11 @@ public class LensAdjustment {
this
.
lensDistanceInteractive
=
lensDistanceInteractive
;
// Open dialog when calibrating focal distance
this
.
lensDistanceShowResults
=
lensDistanceShowResults
;
// show results window from foca
this
.
lensDistanceMoveToGoal
=
lensDistanceMoveToGoal
;
// Move to targetMicrons
this
.
powerControlEnable
=
powerControlEnable
;
this
.
powerControlMaximalTemperature
=
powerControlMaximalTemperature
;
this
.
powerControlHeaterOnMinutes
=
powerControlHeaterOnMinutes
;
this
.
powerControlNeitherOnMinutes
=
powerControlNeitherOnMinutes
;
this
.
powerControlFanOnMinutes
=
powerControlFanOnMinutes
;
this
.
uvLasersIP
=
new
String
(
uvLasersIP
);
// IP address of the camera with UV LEDs and aiming lasers are connected
this
.
uvLasersBus
=
uvLasersBus
;
// 0 if 103641 board is connected to the sensor port (through 10-359), 1 - to 10369
this
.
uvLasersCurrents
=
uvLasersCurrents
.
clone
();
// default LED on currents (mA)
...
...
@@ -840,6 +856,11 @@ public class LensAdjustment {
this
.
lensDistanceInteractive
,
// Open dialog when calibrating focal distance
this
.
lensDistanceShowResults
,
// show results window from foca
this
.
lensDistanceMoveToGoal
,
// Move to targetMicrons
this
.
powerControlEnable
,
this
.
powerControlMaximalTemperature
,
this
.
powerControlHeaterOnMinutes
,
this
.
powerControlNeitherOnMinutes
,
this
.
powerControlFanOnMinutes
,
this
.
uvLasersIP
,
// IP address of the camera with UV LEDs and aiming lasers are connected
this
.
uvLasersBus
,
// 0 if 103641 board is connected to the sensor port (through 10-359), 1 - to 10369
this
.
uvLasersCurrents
,
// default LED on currents (mA)
...
...
@@ -992,7 +1013,13 @@ public class LensAdjustment {
properties
.
setProperty
(
prefix
+
"lensDistanceInteractive"
,
this
.
lensDistanceInteractive
+
""
);
properties
.
setProperty
(
prefix
+
"lensDistanceShowResults"
,
this
.
lensDistanceShowResults
+
""
);
properties
.
setProperty
(
prefix
+
"lensDistanceMoveToGoal"
,
this
.
lensDistanceMoveToGoal
+
""
);
properties
.
setProperty
(
prefix
+
"powerControlEnable"
,
this
.
powerControlEnable
+
""
);
properties
.
setProperty
(
prefix
+
"powerControlMaximalTemperature"
,
this
.
powerControlMaximalTemperature
+
""
);
properties
.
setProperty
(
prefix
+
"powerControlHeaterOnMinutes"
,
this
.
powerControlHeaterOnMinutes
+
""
);
properties
.
setProperty
(
prefix
+
"powerControlNeitherOnMinutes"
,
this
.
powerControlNeitherOnMinutes
+
""
);
properties
.
setProperty
(
prefix
+
"powerControlFanOnMinutes"
,
this
.
powerControlFanOnMinutes
+
""
);
properties
.
setProperty
(
prefix
+
"uvLasersIP"
,
this
.
uvLasersIP
);
properties
.
setProperty
(
prefix
+
"uvLasersBus"
,
this
.
uvLasersBus
+
""
);
properties
.
setProperty
(
prefix
+
"uvLasersCurrents_0"
,
this
.
uvLasersCurrents
[
0
]+
""
);
...
...
@@ -1275,6 +1302,18 @@ public class LensAdjustment {
this
.
lensDistanceShowResults
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lensDistanceShowResults"
));
if
(
properties
.
getProperty
(
prefix
+
"lensDistanceMoveToGoal"
)!=
null
)
this
.
lensDistanceMoveToGoal
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lensDistanceMoveToGoal"
));
if
(
properties
.
getProperty
(
prefix
+
"powerControlEnable"
)!=
null
)
this
.
powerControlEnable
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"powerControlEnable"
));
if
(
properties
.
getProperty
(
prefix
+
"powerControlMaximalTemperature"
)!=
null
)
this
.
powerControlMaximalTemperature
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"powerControlMaximalTemperature"
));
if
(
properties
.
getProperty
(
prefix
+
"powerControlHeaterOnMinutes"
)!=
null
)
this
.
powerControlHeaterOnMinutes
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"powerControlHeaterOnMinutes"
));
if
(
properties
.
getProperty
(
prefix
+
"powerControlNeitherOnMinutes"
)!=
null
)
this
.
powerControlNeitherOnMinutes
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"powerControlNeitherOnMinutes"
));
if
(
properties
.
getProperty
(
prefix
+
"powerControlFanOnMinutes"
)!=
null
)
this
.
powerControlFanOnMinutes
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"powerControlFanOnMinutes"
));
if
(
properties
.
getProperty
(
prefix
+
"uvLasersIP"
)!=
null
)
this
.
uvLasersIP
=
properties
.
getProperty
(
prefix
+
"uvLasersIP"
);
...
...
@@ -1528,12 +1567,18 @@ public class LensAdjustment {
gd
.
addCheckbox
(
"Show results window from focal distance calibration"
,
this
.
lensDistanceShowResults
);
gd
.
addCheckbox
(
"Move motors together to the requested microns from the \"best focus\""
,
this
.
lensDistanceMoveToGoal
);
gd
.
addCheckbox
(
"Enable power control for heater and fan"
,
this
.
powerControlEnable
);
gd
.
addNumericField
(
"Maximal allowed temperature"
,
this
.
powerControlMaximalTemperature
,
3
,
5
,
"C"
);
gd
.
addNumericField
(
"Heater ON time"
,
this
.
powerControlHeaterOnMinutes
,
1
,
5
,
"min"
);
gd
.
addNumericField
(
"Both heater and fan OFF time"
,
this
.
powerControlNeitherOnMinutes
,
1
,
5
,
"min"
);
gd
.
addNumericField
(
"Fan ON time"
,
this
.
powerControlFanOnMinutes
,
1
,
5
,
"min"
);
gd
.
addStringField
(
"IP address of the camera with 103641 board (UV LEDs and lasers) are attached"
,
this
.
uvLasersIP
,
40
);
gd
.
addNumericField
(
"I2C bus where LED/laser board is attached (0 - through 10359, 1 - through 10369)"
,
this
.
uvLasersBus
,
0
);
gd
.
addNumericField
(
"UV LED1 \"on\" current (left/near when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addNumericField
(
"UV LED2 \"on\" current (right/near when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addNumericField
(
"UV LED3 \"on\" current (right/far when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addNumericField
(
"UV LED4 \"on\" current (left/far when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addNumericField
(
"UV LED1 \"on\" current (left/near when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addNumericField
(
"UV LED2 \"on\" current (right/near when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addNumericField
(
"UV LED3 \"on\" current (right/far when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addNumericField
(
"UV LED4 \"on\" current (left/far when looking from the target)"
,
this
.
uvLasersCurrents
[
0
],
3
,
5
,
"mA"
);
gd
.
addMessage
(
""
);
gd
.
addNumericField
(
"Minimal correction movement to initiate final series of corrections - focus/tilt mode"
,
this
.
minCorr
,
1
,
5
,
"motors steps"
);
...
...
@@ -1700,6 +1745,12 @@ public class LensAdjustment {
this
.
lensDistanceInteractive
=
gd
.
getNextBoolean
();
this
.
lensDistanceShowResults
=
gd
.
getNextBoolean
();
this
.
lensDistanceMoveToGoal
=
gd
.
getNextBoolean
();
this
.
powerControlEnable
=
gd
.
getNextBoolean
();
this
.
powerControlMaximalTemperature
=
gd
.
getNextNumber
();
this
.
powerControlHeaterOnMinutes
=
gd
.
getNextNumber
();
this
.
powerControlNeitherOnMinutes
=
gd
.
getNextNumber
();
this
.
powerControlFanOnMinutes
=
gd
.
getNextNumber
();
this
.
uvLasersIP
=
gd
.
getNextString
();
this
.
uvLasersBus
=
(
int
)
gd
.
getNextNumber
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment