コード例 #1
0
ファイル: UserControl8.cs プロジェクト: 6555355/Scan_yan1
 /// <summary>
 /// 波形映射表读取
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void m_Button_ReadWaveMapping_Click(object sender, EventArgs e)
 {
     FileLog("Wave mapping Read");
     ControlsEnable(false);              //按钮无效化
     EpsonLCD.PrepareReadWaveMapping();
 }
コード例 #2
0
ファイル: UserControl8.cs プロジェクト: 6555355/Scan_yan1
        public void ProceedKernelMessage(IntPtr wParam, IntPtr lParam)
        {
            CoreMsgEnum kParam = (CoreMsgEnum)wParam.ToInt32();

            switch (kParam)
            {
            case CoreMsgEnum.HardPanelDirty:
            {
                Ep6Cmd cmd = (Ep6Cmd)lParam.ToInt32();
                switch (cmd)
                {
                case Ep6Cmd.EP6_CMD_T_WAVE_READ_READY:
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_READ_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_READ_READY 波形预读完成");

                    int TotalLength = EpsonLCD.GetWaveDataTotalLength();
                    m_WaveData.NewParse2(HBTypeName, EpsonLCD.GetWaveData(TotalLength), m_CycleValue);

                    //保存刚刚获得的波形数据,在幅值方式为电压改变时有用
                    m_OriginalWaveSnips = new List <WaveDataSnip>(m_WaveData.WaveDatas);

                    ////导入Wave和NM数据
                    //ImportWaveNMData();

                    //btnIFSSave.Enabled = true;
                    //m_Button_Import.Enabled = true;
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_SET_READY:
                {
                    //波形发送完成,发送幅值
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_SET_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_SET_READY 波形发送完成,发送幅值");

                    if (m_Waves.Count == 0)
                    {
                        break;
                    }

                    WaveDataEx WaveData = m_Waves[0];

                    m_AmplitudeToSends.Clear();
                    foreach (IAmplitude Amplitude in WaveData.Amplitudes)
                    {
                        m_AmplitudeToSends.Add(Amplitude);
                    }

                    if (0 == m_AmplitudeToSends.Count)
                    {
                        throw new Exception("0 == m_AmplitudeToSends.Count");
                    }

                    int Length = EpsonLCD.WriteAmplitudeData(m_AmplitudeToSends[0].GetBytes());
                    EpsonLCD.SetAmplitudeTotalLength(Length);
                }
                break;

                case Ep6Cmd.EP6_CMD_T_SWING_READY:
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_SWING_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_SWING_READY 幅值下发完成");
                    if (m_AmplitudeToSends.Count > 0)
                    {
                        m_AmplitudeToSends.RemoveAt(0);
                    }
                    if (m_AmplitudeToSends.Count > 0)
                    {
                        int Length = EpsonLCD.WriteAmplitudeData(m_AmplitudeToSends[0].GetBytes());
                        EpsonLCD.SetAmplitudeTotalLength(Length);
                    }
                    else
                    {
                        //幅值发送完成,发送新增加节点信息,暂时为空
                        byte[] NewNode = new byte[2];

                        NewNode[0] = 0xFF;

                        int Length = EpsonLCD.WriteNewAddNodeData(NewNode);

                        EpsonLCD.SetNewAddNodeTotalLength(1);
                    }
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_POINT_FINISH:
                {
                    //新添加节点数据发送完成命令
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_POINT_FINISH");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_POINT_FINISH 新添加节点数据发送完成命令");

                    int Length = EpsonLCD.WriteWaveMappingData(ConstructWaveMapping());
                    EpsonLCD.SetWaveMappingTotalLength(Length);
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_NAME_READY:
                    //预读波形名字就绪,开始读波形名字
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_NAME_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_NAME_READY 预读波形命令下发完成");

                    //取得波形名字总长度
                    int TotalSize = EpsonLCD.GetWaveNameTotalLength();

                    //取得波形名字数据
                    ParseWaveName(EpsonLCD.GetWaveNameData(TotalSize), TotalSize);

                    //预读映射表命令
                    EpsonLCD.PrepareReadWaveMapping();
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_NAME_FINISH:
                    //波形名字发送完成命令
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_NAME_FINISH");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_NAME_FINISH 波形名字修改发送完成命令");
                    MessageBox.Show(ResString.GetResString("Wave_Info_WaveNameUpdataFinish"), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ControlsEnable(true);
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_CHANNEL_FINISH:
                    //波形映射表完成命令
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_CHANNEL_FINISH");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_CHANNEL_FINISH 波形映射表完成命令");
                    //获得波形映射总长度
                    int TotalSize = EpsonLCD.GetWaveMappingTotalLength();
                    if (0 == TotalSize)
                    {
                        MessageBox.Show(ResString.GetResString("Wave_Info_ReadWaveMapping0Length"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    //取得波形映射数据
                    ParseWaveMapping(EpsonLCD.GetWaveMappingData(TotalSize), TotalSize);

                    if (m_ImportMappingFlag == false)
                    {
                        //用户自定义
                        CustomInitialize();
                        //界面上所有控件显示
                        this.Visible = true;
                        //波形映射导入完成
                        m_ImportMappingFlag = true;
                    }
                    else
                    {
                        MessageBox.Show(ResString.GetResString("Wave_Info_WaveMappingReadFinish"), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ControlsEnable(true);
                        m_ComboBox_Channel_SelectedIndexChanged(null, null);
                        m_ComboBox_VSD_SelectedIndexChanged(null, null);
                    }
                }
                break;
                }
            }
            break;

            case CoreMsgEnum.Status_Change:
            {
                int status = lParam.ToInt32();
                if ((JetStatusEnum)status == JetStatusEnum.Ready && IsAutoWave && IsAutoPrint && !IsAutoStop)
                {
                    IsAutoPrint = false;
                    AutoUpdateVave();
                }
                else if ((JetStatusEnum)status == JetStatusEnum.Busy && IsAutoWave && !IsAutoPrint && !IsAutoStop)
                {
                    IsAutoPrint = true;
                }
                break;
            }
            }
        }