Commit b9cfde9c authored by Andrey Filippov's avatar Andrey Filippov

added separate lights control, minor bug fixes

parent d14a3970
...@@ -4182,7 +4182,7 @@ if (MORE_BUTTONS) { ...@@ -4182,7 +4182,7 @@ if (MORE_BUTTONS) {
double rms_pure= FOCUSING_FIELD.calcErrorDiffY(focusing_fx, true); double rms_pure= FOCUSING_FIELD.calcErrorDiffY(focusing_fx, true);
System.out.println("rms="+rms+", rms_pure="+rms_pure+" - with old parameters may be well off."); System.out.println("rms="+rms+", rms_pure="+rms_pure+" - with old parameters may be well off.");
remoteNotifyComplete(); remoteNotifyComplete();
POWER_CONTROL.setPower("light","off"); POWER_CONTROL.lightsOff();
if (FOCUS_MEASUREMENT_PARAMETERS.scanRunLMA){ if (FOCUS_MEASUREMENT_PARAMETERS.scanRunLMA){
FOCUSING_FIELD.setAdjustMode(false,null); FOCUSING_FIELD.setAdjustMode(false,null);
boolean OK=FOCUSING_FIELD.LevenbergMarquardt( boolean OK=FOCUSING_FIELD.LevenbergMarquardt(
...@@ -5646,7 +5646,7 @@ if (MORE_BUTTONS) { ...@@ -5646,7 +5646,7 @@ if (MORE_BUTTONS) {
double [] allKT; double [] allKT;
if (!replayMode){ if (!replayMode){
remoteNotifyComplete(); remoteNotifyComplete();
POWER_CONTROL.setPower("light","off"); POWER_CONTROL.lightsOff();
lastKT=MOTORS.focusingHistory.temperatureLinearApproximation( lastKT=MOTORS.focusingHistory.temperatureLinearApproximation(
useLMA, useLMA,
runs, // number of last samples from history to use, 0 - use all runs, // number of last samples from history to use, 0 - use all
...@@ -5856,7 +5856,7 @@ if (MORE_BUTTONS) { ...@@ -5856,7 +5856,7 @@ if (MORE_BUTTONS) {
this.SYNC_COMMAND.stopRequested, this.SYNC_COMMAND.stopRequested,
UPDATE_STATUS); UPDATE_STATUS);
System.out.println ("GONIOMETER.scanAndAcquireI() "+(goniometerScanOK?"finished OK":"failed")); System.out.println ("GONIOMETER.scanAndAcquireI() "+(goniometerScanOK?"finished OK":"failed"));
POWER_CONTROL.setPower("light","off"); POWER_CONTROL.lightsOff();
return; return;
} }
......
...@@ -1801,8 +1801,9 @@ public class CalibrationHardwareInterface { ...@@ -1801,8 +1801,9 @@ public class CalibrationHardwareInterface {
} }
public static class PowerControl{ public static class PowerControl{
public boolean [] states={false,false,false}; public boolean [] states={false,false,false,false,false};
public String [] groups={"heater","fan","light"}; public int [] lightsChannels={2,3,4}; // which lights to control on on/off
public String [] groups={"heater","fan","light","light1","light2"};
public int debugLevel=1; public int debugLevel=1;
private String powerIP="192.168.0.80"; private String powerIP="192.168.0.80";
private double lightsDelay=5.0; private double lightsDelay=5.0;
...@@ -1871,7 +1872,7 @@ public class CalibrationHardwareInterface { ...@@ -1871,7 +1872,7 @@ public class CalibrationHardwareInterface {
} }
public boolean showDialog(String title, boolean control) { public boolean showDialog(String title, boolean control) {
GenericDialog gd = new GenericDialog(title); GenericDialog gd = new GenericDialog(title);
boolean heaterOn=false, fanOn=false, lightOn=false; boolean heaterOn=false, fanOn=false, lightOn=false, light1On=false, light2On=false;
gd.addCheckbox("Enable power control (heater, fan, lights) ", this.powerConrtolEnabled); gd.addCheckbox("Enable power control (heater, fan, lights) ", this.powerConrtolEnabled);
gd.addStringField("IP address of the power control",this.powerIP,15); gd.addStringField("IP address of the power control",this.powerIP,15);
gd.addNumericField("Delay after lights on", this.lightsDelay, 1,4,"sec"); gd.addNumericField("Delay after lights on", this.lightsDelay, 1,4,"sec");
...@@ -1879,6 +1880,8 @@ public class CalibrationHardwareInterface { ...@@ -1879,6 +1880,8 @@ public class CalibrationHardwareInterface {
if (control){ if (control){
gd.addCheckbox("Heater On", heaterOn); gd.addCheckbox("Heater On", heaterOn);
gd.addCheckbox("Fan On", fanOn); gd.addCheckbox("Fan On", fanOn);
gd.addCheckbox("Lights Top On", light1On);
gd.addCheckbox("Lights Bottom On", light2On);
gd.addCheckbox("Lights On", lightOn); gd.addCheckbox("Lights On", lightOn);
} }
WindowTools.addScrollBars(gd); WindowTools.addScrollBars(gd);
...@@ -1891,19 +1894,26 @@ public class CalibrationHardwareInterface { ...@@ -1891,19 +1894,26 @@ public class CalibrationHardwareInterface {
if (control){ if (control){
heaterOn=gd.getNextBoolean(); heaterOn=gd.getNextBoolean();
fanOn=gd.getNextBoolean(); fanOn=gd.getNextBoolean();
light1On=gd.getNextBoolean();
light2On=gd.getNextBoolean();
lightOn=gd.getNextBoolean(); lightOn=gd.getNextBoolean();
if (!gd.wasOKed()) { if (!gd.wasOKed()) {
setPower("heater",heaterOn?"on":"off"); setPower("heater",heaterOn?"on":"off");
setPower("fan",fanOn?"on":"off"); setPower("fan",fanOn?"on":"off");
setPower("light",lightOn?"on":"off"); setPower("light",lightOn?"on":"off");
setPower("light1",light1On?"on":"off");
setPower("light2",light2On?"on":"off");
} }
} }
return true; return true;
} }
public void lightsOnWithDelay(){ public void lightsOnWithDelay(){
if (this.states[2] || !this.powerConrtolEnabled) return; // already on // turn on only new
setPower("light","on"); boolean allOn=true;
System.out.print("Sleeping "+this.lightsDelay+" seconds to let lights stibilize on..."); for (int chn:this.lightsChannels) allOn&=this.states[chn];
if (allOn || !this.powerConrtolEnabled) return; // already on
for (int chn:this.lightsChannels) if (!this.states[chn]) setPower(this.groups[chn],"on");
System.out.print("Sleeping "+this.lightsDelay+" seconds to let lights stabilize on...");
try { try {
TimeUnit.MILLISECONDS.sleep((long) (1000*this.lightsDelay)); TimeUnit.MILLISECONDS.sleep((long) (1000*this.lightsDelay));
} catch (InterruptedException e) { } catch (InterruptedException e) {
...@@ -1914,6 +1924,11 @@ public class CalibrationHardwareInterface { ...@@ -1914,6 +1924,11 @@ public class CalibrationHardwareInterface {
} }
public void lightsOff(){
if (!this.powerConrtolEnabled) return; // already on
for (int chn:this.lightsChannels) if (this.states[chn]) setPower(this.groups[chn],"off");
}
public boolean isPowerControlEnabled(){ public boolean isPowerControlEnabled(){
return this.powerConrtolEnabled; return this.powerConrtolEnabled;
} }
......
...@@ -12127,8 +12127,9 @@ Which parameters affect which matrices ...@@ -12127,8 +12127,9 @@ Which parameters affect which matrices
// getCostsProperties(prefix,properties); // getCostsProperties(prefix,properties);
} }
void updateNumstations (int newNumStations){ void updateNumstations (int newNumStations){
System.out.println("updateNumstations("+newNumStations+"), was "+this.numStations); // System.out.println("updateNumstations("+newNumStations+"), was "+this.numStations);
if (newNumStations==this.numStations) return; if (newNumStations==this.numStations) return;
System.out.println("updateNumstations("+newNumStations+"), was "+this.numStations);
EyesisCameraParameters newData=this.clone(); EyesisCameraParameters newData=this.clone();
copyData( copyData(
newNumStations, newNumStations,
...@@ -333,7 +333,7 @@ public class FocusingField { ...@@ -333,7 +333,7 @@ public class FocusingField {
weightMode=2; // 1; // 0 - same weight, 1 - linear threshold difference, >1 - power of PSF radius weightMode=2; // 1; // 0 - same weight, 1 - linear threshold difference, >1 - power of PSF radius
weightRadius=0.0; //2.0; // Gaussian sigma in mm weightRadius=0.0; //2.0; // Gaussian sigma in mm
k_red=0.7; k_red=0.7;
k_blue=0.4; k_blue=0.3;
k_sag=1.0; k_sag=1.0;
k_tan=1.0; k_tan=1.0;
k_qualBFractionPeripheral=0.5; // relative weight of peripheral areas when optimizing qualB k_qualBFractionPeripheral=0.5; // relative weight of peripheral areas when optimizing qualB
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment