Skip to content
Permalink
Browse files

specific fix for Ascom usb-focus

  • Loading branch information...
pchev committed Feb 19, 2019
1 parent 4677599 commit 1872446db9d4881fdb16fec0c6b5452303e4df0f
Showing with 9 additions and 6 deletions.
  1. +8 −1 src/cu_ascomfocuser.pas
  2. +1 −5 src/cu_focuser.pas
@@ -295,7 +295,7 @@ procedure T_ascomfocuser.FocusOut;

procedure T_ascomfocuser.SetPosition(p:integer);
{$ifdef mswindows}
var n: integer;
var n,np: integer;
{$endif}
begin
{$ifdef mswindows}
@@ -309,6 +309,13 @@ procedure T_ascomfocuser.SetPosition(p:integer);
V.Move(n);
FocuserLastTemp:=FocuserTemp;
WaitFocuserMoving(60000);
// Fix for usb-focus
if Fdevice='ASCOM.USB_Focus.Focuser' then begin
np:=GetPosition;
if (np<>n) then begin
msg('Error, new position is '+IntToStr(np)+' instead of '+IntToStr(n),0);
end; {fix for some poor written focuser drivers. The getposition is already sufficient to fix the problem, so message should never occur.}
end;
except
on E: Exception do msg('Error, can''t move to. ' + E.Message,0);
end;
@@ -135,18 +135,16 @@ procedure T_focuser.SetPositionInt(p:integer);
begin
msg(Format(rsFocuserMoveT, [inttostr(p)])+' + '+inttostr(FBacklash)+' '+rsBacklashComp);
SetPosition(p+FBacklash); // backlash IN, go OUT first
Wait(FDelay+0.1); // some focuser need a delay to refresh their position
end
else
begin
msg(Format(rsFocuserMoveT, [inttostr(p)])+' - '+inttostr(FBacklash)+' '+rsBacklashComp);
SetPosition(p-FBacklash); // backlash OUT, go IN first
Wait(FDelay+0.1); // some focuser need a delay to refresh their position
end;
end;
msg(Format(rsFocuserMoveT, [inttostr(p)]));
SetPosition(p); // go to final position
Wait(FDelay+0.1); //wait 100ms minimum for correct communication with some focusers
Wait(FDelay);
end;

procedure T_focuser.SetRelPositionInt(p:integer);
@@ -155,14 +153,12 @@ procedure T_focuser.SetRelPositionInt(p:integer);
if FBacklashDirection then begin // want to go OUT, backlash IN
msg(Format(rsFocuserMoveB, [inttostr(FFocusdirection*p)])+', '+rsBacklashComp+' + '+inttostr(FBacklash));
SetRelPosition(p+FBacklash); // go more OUT than required
Wait(FDelay+0.1); // some focuser need a delay to refresh their position
FocusIN; // go IN by backlash
SetRelPosition(FBacklash);
end
else begin // want to go IN, backlash OUT
msg(Format(rsFocuserMoveB, [inttostr(FFocusdirection*p)])+', '+rsBacklashComp+' - '+inttostr(FBacklash));
SetRelPosition(p+FBacklash); // go more IN than required
Wait(FDelay+0.1); // some focuser need a delay to refresh their position
FocusOUT; // go OUT by backlash
SetRelPosition(FBacklash)
end;

0 comments on commit 1872446

Please sign in to comment.
You can’t perform that action at this time.