Skip to content

Commit

Permalink
Protect again wrong setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pchev committed Apr 7, 2018
1 parent b629aeb commit ac9b80e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/fu_preview.pas
Expand Up @@ -219,7 +219,7 @@ function Tf_preview.ControlExposure(exp:double; binx,biny: integer):boolean;
ControlExposureOK:=false;
camera.AddFrames:=false;
Camera.StartExposure(exp);
endt:=now+60/secperday;
endt:=now+(exp+30)/secperday;
while WaitExposure and(now<endt) and (not CancelAutofocus) do begin
Sleep(100);
Application.ProcessMessages;
Expand Down
15 changes: 7 additions & 8 deletions src/pu_main.pas
Expand Up @@ -4313,8 +4313,8 @@ procedure Tf_main.MenuOptionsClick(Sender: TObject);
end;
for i:=1 to FilterList.Count-1 do begin
f_option.FilterList.Cells[0,i]:=FilterList[i];
f_option.FilterList.Cells[1,i]:=config.GetValue('/Filters/Offset'+IntToStr(i),'0');
f_option.FilterList.Cells[2,i]:=config.GetValue('/Filters/ExpFact'+IntToStr(i),'1.0');
f_option.FilterList.Cells[1,i]:=FormatFloat(f0,config.GetValue('/Filters/Offset'+IntToStr(i),0));
f_option.FilterList.Cells[2,i]:=FormatFloat(f1,config.GetValue('/Filters/ExpFact'+IntToStr(i),1.0));
end;
f_option.FilterList.Row:=0;
f_option.FilterList.Col:=0;
Expand Down Expand Up @@ -4455,12 +4455,8 @@ procedure Tf_main.MenuOptionsClick(Sender: TObject);
config.SetValue('/Filters/Num',n);
for i:=1 to n do begin
config.SetValue('/Filters/Filter'+IntToStr(i),FilterList[i]);
buf:=trim(f_option.FilterList.Cells[1,i]);
if not IsNumber(buf) then buf:='0';
config.SetValue('/Filters/Offset'+IntToStr(i),buf);
buf:=trim(f_option.FilterList.Cells[2,i]);
if not IsNumber(buf) then buf:='1.0';
config.SetValue('/Filters/ExpFact'+IntToStr(i),buf);
config.SetValue('/Filters/Offset'+IntToStr(i),StrToIntDef(trim(f_option.FilterList.Cells[1,i]),0));
config.SetValue('/Filters/ExpFact'+IntToStr(i),StrToFloatDef(trim(f_option.FilterList.Cells[2,i]),1.0));
end;
config.SetValue('/StarAnalysis/AutoFocusMode',f_option.Autofocusmode.ItemIndex);
config.SetValue('/StarAnalysis/AutofocusMinSpeed',f_option.AutofocusMinSpeed.Value);
Expand Down Expand Up @@ -6856,6 +6852,9 @@ procedure Tf_main.cmdAutofocus(var ok: boolean);
f_starprofile.ChkAutofocusDown(false);
exit;
end;
// protect again wrong settting
if AutofocusExposureFact<=0 then AutofocusExposureFact:=1;
if AutofocusExposure<=0 then AutofocusExposure:=1;
// start a new exposure as the current frame is probably not a preview
f_preview.Exposure:=AutofocusExposure*AutofocusExposureFact;
f_preview.Binning.Text:=inttostr(AutofocusBinning)+'x'+inttostr(AutofocusBinning);
Expand Down

0 comments on commit ac9b80e

Please sign in to comment.