- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
function lz_UploadMount:boolean;
var del_l,i,j,k,ng,l,typ:integer;
    pt:array[1..3]of integer;
begin
UpDiag:=0;
result:=true;
if I_AM_EMUL {or not I_AM_MAIN }then exit;
if Pult[1].Count+Pult[2].Count=0 then exit;
lg_UploadMount;
                     //  exit;
UpDiag:=1;
result:=false;
__UPLOADING:=true;
try
if not JustC(21,[])then exit;
sleep(1000);
//if (Pult[1].Count>0)and(Pult[2].Count>0)then ng:=3 else ng:=1;
//if not JustC(25,[ng])then exit;;
if not JustC(22,[])then exit;;
{группы}
if (Pult[1].Count>0)and(Pult[2].Count>0)then ng:=2 else ng:=1;
for i:=1 to 2 do
 begin
 if Pult[i].Count=0 then continue;
 k:=0;
 for j:=1 to 3 do pt[j]:=MainShow.Params[j];
 for j:=0 to Pult[i].Count-1 do
  with TMotor(Pult[i][j])do
   begin
   k:=k+(1 shl (ConvertTP(TP)-1));
   for L:=1 to 3 do if pt[L]>GParam(L)then pt[L]:=GParam(L);
   end;
 //маска
 AddI(k);
 //скорость
 AddSpeed(round(pt[1]*KOREDV));
 //ускорение разгона
 //ускорение торможения
 AddI((pt[2]shl 16)+pt[3]);
 //номер джойстика
 //функциональная клавиша
      {Кнопка}  {Джойстик}{повторы}  {тип группы}
 typ:=2;
 AddI((i shl 6)+(i shl 3)+(1 shl 10)+typ);
 end;
if not lz_Command(26,4,ng,[ng])then exit;;
CheckMountEffect;
{моторы}
lzData.Clear;
for i:=1 to 2 do
 for j:=0 to Pult[i].Count-1 do
  with TMotor(Pult[i][j])do
   begin
   if md_targ<0 then AddI((17 shl 16)+ConvertTP(TP))else AddI((18 shl 16)+ConvertTP(TP));
   if md_targ<GetMotorInfo(TP,1)then del_l:=-1 else del_l:=1;
   if md_targ<0 then
    begin
     AddI(-trunc(GParam(5)/KORED*65536));
     AddI(-trunc(GParam(4)/KORED*65536));
    end
   else
    begin
    AddI(-trunc((md_targ+del_l/2)/KORED*65536));
    AddSpeed(round(md_way*KOREDV));
    end
   end;
if not lz_Command(28,3,Pult[1].Count+Pult[2].Count,[Pult[1].Count+Pult[2].Count])then exit;
UpDiag:=2;
if not JustC(23,[])then exit;
(*EnterCriticalSection(csJoystick);
j_Changed:=true;
{J_Status[1]:=false;
J_Status[2]:=false;}
LastSign[1]:=-1;
LastSign[2]:=-1;
LeaveCriticalSection(csJoystick);*)
{if(Pult[1].Count>0)then if not JustC(36,[1,1])then exit;
if(Pult[2].Count>0)then if not JustC(36,[2,1])then exit;}
UpDiag:=0;
result:=true;
Uploaded:=true;
for i:=1 to 12 do
 FirstGr[i]:=0;
finally
__UPLOADING:=false;
if Uploaded then WaitZero;
end;
end;
                                 
        
            Случайно открыл свою первую рабочую программу. Забавно, как со временем меняется стиль программирования :)
В той что используется сейчас изменился протокол, так что прямого аналога нет, но примерно ту же функцию выполняет такой кусок:
----------------
procedure TMotion.GetTargetForPLC(M: TMotor; Mo: TNormalMotionData);
var
  Conf: TMotorConfig;
  ME: TElementMark;
  I: Integer;
  Ht, SP: Real;
begin
  if not Uploaded then
    exit;
  Conf := PLCConf.Motor(M.MotorNumber);
  ME := Mark.ElementByMotor(M.MotorNumber);
  SP := Panel.GetValue(Speed);
  // Проверка разрешений движения
  if (Panel.GetStatus <> psGo) or (not Condition.CheckMotion) or FailedSafe or
    (SP = 0) or (not ME.CheckMotion) then
    Mo.CommandID := mcStop
  else
    Mo.CommandID := mcGo;
  Mo.Accel := LimitVal(1, Conf.MotorTyp.ProgramToDrive(ktAccel,
    Limits.GetParam(TAccelParam).Minimum));
  Mo.Deccel := LimitVal(1, Conf.MotorTyp.ProgramToDrive(ktAccel,
    Limits.GetParam(TDeccelParam).Minimum));
  if SP >= 0 then
    Ht := Effect.OutputTarget(M)
  else
    Ht := ME.GetTargetForPLC(false);
  // M.StartPos.Value := 0.5;
  if M.PositionType.InheritsFrom(TAngleWithTu  rnsParam) then
    Ht := M.HackCircleTarget(Ht);
  Mo.Target := Conf.MotorTyp.ProgramToDrive(ktTarget, Ht);
  Mo.Speed := Conf.MotorTyp.ProgramToDrive(ktSpeed, abs(SP)); { }{ }{ }
  Mo.Time := 0;
  if SP >= 0 then
    Effect.ProcessCommand(M, Mo);
  Mo.Mask := M.Children + [M.MotorNumber];
  for I in Mo.Mask do
    GetMotor(I).RawCommand := Mo;
end;
----------------
        
        
ПИШИТЕ, ЗВОНИТЕ: 79046468333. СТРАНИЦА В ВК: vk.com/id41556
ПИШИТЕ, ЗВОНИТЕ: 79046468333. СТРАНИЦА В ВК: vk.com/id41556
Что это, Бэрримор? Глобальная переменная?