Ejemplo n.º 1
0
        private bool REF4095_Compensation()
        {
            if (vars.Optic_Compensation_Stop == false)
            {
                const double REF4095_Resolution = 0.04;
                double       REF4095_Margin     = DP213OCSet.Get_REF4095_Margin();
                double       Black_Limit_Lv     = DP213OCSet.Get_Black_Limit_Lv();
                byte         REF4095            = (byte)DP213_Static.REF4095_REF0_Max;

                Set_and_Send_VREF0_VREF4095(REF4095);

                while (REF4095 > 0)
                {
                    if (REF4095 == 0)
                    {
                        REF4095 += Convert.ToByte(REF4095_Margin / REF4095_Resolution);
                        Set_and_Send_VREF0_VREF4095(REF4095);
                        api.WriteLine("Black(REF4095) Compensation OK (Case 1)");
                        return(true);
                    }
                    else
                    {
                        double[] measured = api.measure_XYL(channel_num);
                        api.WriteLine("REF4095 / Lv : " + REF4095 + "/" + measured[2]);

                        if (measured[2] < Black_Limit_Lv)
                        {
                            REF4095--;
                            Set_and_Send_VREF0_VREF4095(REF4095);
                            continue;
                        }
                        else
                        {
                            REF4095 += Convert.ToByte(REF4095_Margin / REF4095_Resolution);
                            if (REF4095 > DP213_Static.REF4095_REF0_Max)
                            {
                                api.WriteLine("Black(REF4095) Compensation Fail (Black Margin Is Not Enough)");
                                return(false);
                            }
                            else
                            {
                                Set_and_Send_VREF0_VREF4095(REF4095);
                                api.WriteLine("Black(REF4095) Compensation OK (Case 2)");
                                return(true);
                            }
                        }
                    }
                }
                return(true);
            }
            return(false);
        }