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) {
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.");
remoteNotifyComplete();
POWER_CONTROL.setPower("light","off");
POWER_CONTROL.lightsOff();
if (FOCUS_MEASUREMENT_PARAMETERS.scanRunLMA){
FOCUSING_FIELD.setAdjustMode(false,null);
boolean OK=FOCUSING_FIELD.LevenbergMarquardt(
......@@ -5646,7 +5646,7 @@ if (MORE_BUTTONS) {
double [] allKT;
if (!replayMode){
remoteNotifyComplete();
POWER_CONTROL.setPower("light","off");
POWER_CONTROL.lightsOff();
lastKT=MOTORS.focusingHistory.temperatureLinearApproximation(
useLMA,
runs, // number of last samples from history to use, 0 - use all
......@@ -5856,7 +5856,7 @@ if (MORE_BUTTONS) {
this.SYNC_COMMAND.stopRequested,
UPDATE_STATUS);
System.out.println ("GONIOMETER.scanAndAcquireI() "+(goniometerScanOK?"finished OK":"failed"));
POWER_CONTROL.setPower("light","off");
POWER_CONTROL.lightsOff();
return;
}
......
......@@ -1801,8 +1801,9 @@ public class CalibrationHardwareInterface {
}
public static class PowerControl{
public boolean [] states={false,false,false};
public String [] groups={"heater","fan","light"};
public boolean [] states={false,false,false,false,false};
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;
private String powerIP="192.168.0.80";
private double lightsDelay=5.0;
......@@ -1871,7 +1872,7 @@ public class CalibrationHardwareInterface {
}
public boolean showDialog(String title, boolean control) {
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.addStringField("IP address of the power control",this.powerIP,15);
gd.addNumericField("Delay after lights on", this.lightsDelay, 1,4,"sec");
......@@ -1879,6 +1880,8 @@ public class CalibrationHardwareInterface {
if (control){
gd.addCheckbox("Heater On", heaterOn);
gd.addCheckbox("Fan On", fanOn);
gd.addCheckbox("Lights Top On", light1On);
gd.addCheckbox("Lights Bottom On", light2On);
gd.addCheckbox("Lights On", lightOn);
}
WindowTools.addScrollBars(gd);
......@@ -1891,19 +1894,26 @@ public class CalibrationHardwareInterface {
if (control){
heaterOn=gd.getNextBoolean();
fanOn=gd.getNextBoolean();
light1On=gd.getNextBoolean();
light2On=gd.getNextBoolean();
lightOn=gd.getNextBoolean();
if (!gd.wasOKed()) {
setPower("heater",heaterOn?"on":"off");
setPower("fan",fanOn?"on":"off");
setPower("light",lightOn?"on":"off");
setPower("light1",light1On?"on":"off");
setPower("light2",light2On?"on":"off");
}
}
return true;
}
public void lightsOnWithDelay(){
if (this.states[2] || !this.powerConrtolEnabled) return; // already on
setPower("light","on");
System.out.print("Sleeping "+this.lightsDelay+" seconds to let lights stibilize on...");
// turn on only new
boolean allOn=true;
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 {
TimeUnit.MILLISECONDS.sleep((long) (1000*this.lightsDelay));
} catch (InterruptedException e) {
......@@ -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(){
return this.powerConrtolEnabled;
}
......
......@@ -12127,8 +12127,9 @@ Which parameters affect which matrices
// getCostsProperties(prefix,properties);
}
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;
System.out.println("updateNumstations("+newNumStations+"), was "+this.numStations);
EyesisCameraParameters newData=this.clone();
copyData(
newNumStations,
......@@ -333,7 +333,7 @@ public class FocusingField {
weightMode=2; // 1; // 0 - same weight, 1 - linear threshold difference, >1 - power of PSF radius
weightRadius=0.0; //2.0; // Gaussian sigma in mm
k_red=0.7;
k_blue=0.4;
k_blue=0.3;
k_sag=1.0;
k_tan=1.0;
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