/// <summary> /// 执行忙扫。 /// </summary> /// <param name="Service"></param> /// <param name="opts"></param> private static void Step1(SystemServiceClient Service, Options opts) { var cycle = 0; var powerPrev = Service.__SSC_Powermeter_Read(opts.PowerMeterCaption); __redo_rectscan: Service.__SSC_LogInfo($"开始面扫描搜索初始光...cycle({cycle})"); cycle++; //PerformAlignment(Service, // new Func<string, object>[] {Service.__SSC_DoRectAreaScan}, // opts, // new[] {opts.ProfileNameBlindSearch}, // SSC_PMRangeEnum.RANGE1, double.NaN, 2); var ret = Service.__SSC_DoRectAreaScan(opts.ProfileNameBlindSearch); Thread.Sleep(200); // Service.__SSC_Powermeter_SetRange(PM_CAPTION, SSC_PMRangeEnum.AUTO); //var power = Service.__SSC_Powermeter_Read(opts.PowerMeterCaption); var power = ret.PeakValue; Service.__SSC_LogInfo($"最大功率:{power}mV"); // The exit condition is power > -15dBm //if (power < opts.PowerThreRectAreaScan) if (power < 3000) { if (power - powerPrev > 5) { cycle--; powerPrev = power; goto __redo_rectscan; } if (cycle == 1) { Service.__SSC_LogWarn("搜索失败,Z轴-20um重新搜索..."); Service.__SSC_MoveAxis("Lens", "Z", SSC_MoveMode.REL, 100, -20); goto __redo_rectscan; } if (cycle == 2) { Service.__SSC_LogWarn("搜索失败,Z轴+40um重新搜索..."); Service.__SSC_MoveAxis("Lens", "Z", SSC_MoveMode.REL, 100, 40); goto __redo_rectscan; } throw new Exception("无法找到初始功率, 请检查Lens位置。"); } else { Service.__SSC_LogInfo("重新搜索峰值..."); var maxCycle = 0; while (true) { ret = Service.__SSC_DoRectAreaScan(opts.ProfileNameBlindSearchSmallStep); if (ret.PeakValue > 3000) { break; } else { if (maxCycle > 5) { throw new Exception("无法找到初始功率, 请检查Lens位置。"); } } maxCycle++; } } }