📄 mainfrm.pas
字号:
if IRE30Enable then
begin
SendToPGPort('RUN PAT '+IntToStr(IREP30)+';');
Delay(PatternDelay);
GammaTable.Cells[2,4] := FloatToStr(MeasIRE);
Colorx[4] := Sx;
Colory[4] := Sy;
if (StrToFloat(GammaTable.Cells[1,4]) < StrToFloat(GammaTable.Cells[2,4])) and (StrToFloat(GammaTable.Cells[2,4]) > StrToFloat(GammaTable.Cells[3,4])) then
begin
bError := true;
Status[4] := 'FAIL';
end
else
begin
//bError := false;
Status[4] := 'PASS';
end;
if bStop then
begin
result := false;
exit;
end;
end;
if IRE20Enable then
begin
SendToPGPort('RUN PAT '+IntToStr(IREP20)+';');
Delay(PatternDelay);
GammaTable.Cells[2,3] := FloatToStr(MeasIRE);
Colorx[3] := Sx;
Colory[3] := Sy;
if (StrToFloat(GammaTable.Cells[1,3]) < StrToFloat(GammaTable.Cells[2,3])) and (StrToFloat(GammaTable.Cells[2,3]) > StrToFloat(GammaTable.Cells[3,3])) then
begin
bError := true;
Status[3] := 'FAIL';
end
else
begin
//bError := false;
Status[3] := 'PASS';
end;
if bStop then
begin
result := false;
exit;
end;
end;
if IRE10Enable then
begin
SendToPGPort('RUN PAT '+IntToStr(IREP10)+';');
Delay(PatternDelay);
GammaTable.Cells[2,2] := FloatToStr(MeasIRE);
Colorx[2] := Sx;
Colory[2] := Sy;
if (StrToFloat(GammaTable.Cells[1,2]) < StrToFloat(GammaTable.Cells[2,2])) and (StrToFloat(GammaTable.Cells[2,2]) > StrToFloat(GammaTable.Cells[3,2])) then
begin
bError := true;
Status[2] := 'FAIL';
end
else
begin
//bError := false;
Status[2] := 'PASS';
end;
if bStop then
begin
result := false;
exit;
end;
end;
if IRE0Enable then
begin
SendToPGPort('RUN PAT '+IntToStr(IREP0)+';');
Delay(PatternDelay);
GammaTable.Cells[2,1] := FloatToStr(MeasIRE);
Colorx[1] := Sx;
Colory[1] := Sy;
end;
result := true;
end;
//------------------------------------------------------------------------------
procedure TForm1.ShowStatus(Status : Byte);
begin
case Status of
0:
begin
ResultStatus.Caption := 'MEASURE';
ResultStatus.Color := clBtnFace;
end;
1:
begin
ResultStatus.Caption := 'FAIL';
ResultStatus.Color := clRed;
ResultStatus.Font.Size := 42;
end;
2:
begin
ResultStatus.Caption := 'PASS';
ResultStatus.Color := clGreen;
ResultStatus.Font.Size := 42;
end;
end;
end;
//------------------------------------------------------------------------------
procedure TForm1.COMPUTERClick(Sender: TObject);
begin
if (GammaData.Text = '') then
begin
ShowMessage('Pls input the gamma data');
exit;
end;
if GammaTable.Cells[4,11] = '' then
begin
ShowMessage('Pls use Ca210 to get the max lv');
exit;
end;
Lv := StrToFloat(GammaTable.Cells[4,11]);
GammaTable.Cells[4,10] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),90));
GammaTable.Cells[4,9] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),80));
GammaTable.Cells[4,8] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),70));
GammaTable.Cells[4,7] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),60));
GammaTable.Cells[4,6] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),50));
GammaTable.Cells[4,5] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),40));
GammaTable.Cells[4,4] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),30));
GammaTable.Cells[4,3] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),20));
GammaTable.Cells[4,2] := FloatToStr(CompGamma(Lv,StrToFloat(GammaData.Text),10));
end;
//------------------------------------------------------------------------------
procedure TForm1.ClearGammaDataClick(Sender: TObject);
begin
if GammaTable.Cells[1,11] <> '' then
begin
ClearData;
end
else
begin
ShowMessage('1111');
exit;
end;
end;
//------------------------------------------------------------------------------
function TForm1.HeaderOfGrid:String;
var
temp : String;
begin
temp := 'Serial Num';
temp := temp + #9 + 'MIN 1.9' + #9 + 'MEASURE' + #9 + 'MAX 3.0' + #9 + 'IRE';
temp := temp + #9 + 'Colorx'+#9 + 'Colory'+ #9 + 'RESULT';
result := temp;
end;
//------------------------------------------------------------------------------
function TForm1.WriteToTxt:Boolean;
var
Path : String;
F : Textfile;
i,j : Integer;
str : String;
begin
Path := GetCurrentDir+'\'+'result_data\';
ForceDirectories(Path);
Path := Path+FormatDateTime('YYYYMMDD',Date)+' Gamma.xls';
if not FileExists(Path) then
begin
AssignFile(F,Path);
Rewrite(F);
WriteLn(F,HeaderOfGrid);
CloseFile(F);
end;
begin
AssignFile(F,Path);
Append(F);
str := SerialNum.Text+' '+CheckSrcname;
for i := 1 to 11 do
begin
for j := 1 to 3 do
begin
str := str + #9 + GammaTable.Cells[j,i];
end;
str := str + #9 + GammaTable.Cells[0,i];
str := str + #9 + IntToStr(Trunc(Colorx[i]))+ #9 + IntToStr(Trunc(Colory[i]))+ #9 + Status[i];
str := str + #13;
end;
WriteLn(F,str);
CloseFile(F);
result := true;
end;
end;
//------------------------------------------------------------------------------
procedure TForm1.ReadIniClick(Sender: TObject);
var
inifile:Tinifile;
filename:string;
begin
filename:=ExtractFilePath(application.ExeName)+'Config.ini';
if not FileExists(filename) then
begin
Application.MessageBox('ini文件不存在','错误提示',mb_ok+mb_iconinformation);
Application.Terminate;
end;
inifile:=Tinifile.Create(filename);
try
try
with inifile do
begin
PCTiming:=StrToInt(ReadString('TPConfig','PCTiming',''));
AVTiming:=StrToInt(ReadString('TPConfig','AVTiming',''));
CPTiming:=StrToInt(ReadString('TPConfig','CPTiming',''));
CSTiming:=StrToInt(ReadString('TPConfig','CSTiming',''));
HDMITiming:=StrToInt(ReadString('TPConfig','HDMITiming',''));
TimingDelay:=StrToInt(ReadString('TPConfig','TimingDelay',''));
IREP0:=StrToInt(ReadString('TPConfig','0IREP',''));
IREP10:=StrToInt(ReadString('TPConfig','10IREP',''));
IREP20:=StrToInt(ReadString('TPConfig','20IREP',''));
IREP30:=StrToInt(ReadString('TPConfig','30IREP',''));
IREP40:=StrToInt(ReadString('TPConfig','40IREP',''));
IREP50:=StrToInt(ReadString('TPConfig','50IREP',''));
IREP60:=StrToInt(ReadString('TPConfig','60IREP',''));
IREP70:=StrToInt(ReadString('TPConfig','70IREP',''));
IREP80:=StrToInt(ReadString('TPConfig','80IREP',''));
IREP90:=StrToInt(ReadString('TPConfig','90IREP',''));
IREP100:=StrToInt(ReadString('TPConfig','100IREP',''));
PatternDelay:=StrToInt(ReadString('TPConfig','PatternDelay',''));
IRE100Lv:=StrToFloat(ReadString('TPConfig','100IRELv',''));
IRE0Lv:=StrToFloat(ReadString('TPConfig','0IRELv',''));
IRE0Enable:=StrToBool(ReadString('TPConfig','0IREEnable',''));
Sel0.Checked := IRE0Enable;
IRE10Enable:=StrToBool(ReadString('TPConfig','10IREEnable',''));
Sel1.Checked := IRE10Enable;
IRE20Enable:=StrToBool(ReadString('TPConfig','20IREEnable',''));
Sel2.Checked := IRE20Enable;
IRE30Enable:=StrToBool(ReadString('TPConfig','30IREEnable',''));
Sel3.Checked := IRE30Enable;
IRE40Enable:=StrToBool(ReadString('TPConfig','40IREEnable',''));
Sel4.Checked := IRE40Enable;
IRE50Enable:=StrToBool(ReadString('TPConfig','50IREEnable',''));
Sel5.Checked := IRE50Enable;
IRE60Enable:=StrToBool(ReadString('TPConfig','60IREEnable',''));
Sel6.Checked := IRE60Enable;
IRE70Enable:=StrToBool(ReadString('TPConfig','70IREEnable',''));
Sel7.Checked := IRE70Enable;
IRE80Enable:=StrToBool(ReadString('TPConfig','80IREEnable',''));
Sel8.Checked := IRE80Enable;
IRE90Enable:=StrToBool(ReadString('TPConfig','90IREEnable',''));
Sel9.Checked := IRE90Enable;
IRE100Enable:=StrToBool(ReadString('TPConfig','100IREEnable',''));
Sel10.Checked := IRE100Enable;
end;
finally
inifile.Free;
BeginMes.Enabled := true;
WriteIni.Enabled := true;
ShowInf('Read Inifile OK!');
end;
except
Application.MessageBox('读取ini文件错误','信息',mb_ok+mb_iconinformation);
Application.Terminate;
end;
end;
//------------------------------------------------------------------------------
procedure TForm1.Memo1DblClick(Sender: TObject);
begin
Memo1.Clear;
end;
//------------------------------------------------------------------------------
function TForm1.CheckSrcname:String;
begin
if SelAV.Checked then
begin
result := 'AV';
end
else
if SelCS.Checked then
begin
result := 'Componsite';
end
else
if SelCP.Checked then
begin
result := 'Component';
end
else
if SelHDMI.Checked then
begin
result := 'HDMI';
end
else
if SelPC.Checked then
begin
result := 'PC';
end
else
begin
result := 'No Src';
end;
end;
//------------------------------------------------------------------------------
procedure TForm1.WriteIniClick(Sender: TObject);
var
inifile:Tinifile;
filename:string;
begin
filename:=ExtractFilePath(application.ExeName)+'Config.ini';
if not FileExists(filename) then
begin
Application.MessageBox('ini文件不存在','错误提示',mb_ok+mb_iconinformation);
Application.Terminate;
end;
inifile:=Tinifile.Create(filename);
try
try
with inifile do
begin
WriteString('TPConfig','0IREEnable',BoolToStr(Sel0.Checked,true));
WriteString('TPConfig','10IREEnable',BoolToStr(Sel1.Checked,true));
WriteString('TPConfig','20IREEnable',BoolToStr(Sel2.Checked,true));
WriteString('TPConfig','30IREEnable',BoolToStr(Sel3.Checked,true));
WriteString('TPConfig','40IREEnable',BoolToStr(Sel4.Checked,true));
WriteString('TPConfig','50IREEnable',BoolToStr(Sel5.Checked,true));
WriteString('TPConfig','60IREEnable',BoolToStr(Sel6.Checked,true));
WriteString('TPConfig','70IREEnable',BoolToStr(Sel7.Checked,true));
WriteString('TPConfig','80IREEnable',BoolToStr(Sel8.Checked,true));
WriteString('TPConfig','90IREEnable',BoolToStr(Sel9.Checked,true));
WriteString('TPConfig','100IREEnable',BoolToStr(Sel10.Checked,true));
end;
finally
inifile.Free;
BeginMes.Enabled := true;
ShowInf('Write Inifile OK!');
end;
except
Application.MessageBox('读取ini文件错误','信息',mb_ok+mb_iconinformation);
Application.Terminate;
end;
end;
//------------------------------------------------------------------------------
initialization
Ca210On := false;
Com2On := false;
//------------------------------------------------------------------------------
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -