Ejemplo n.º 1
0
        public static bool GroupSynthesizers(KuscMessageParams.MESSAGE_REQUEST request, string data)
        {
            switch (request)
            {
            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_DOWN_SET:
                statusMsg = "System: Send syntesizer TX (Down) setting serial packet";
                KuscUtil.clear_cnt();
                break;

            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_UP_SET:
                statusMsg = "System: Send syntesizer RX (Up) setting serial packet";
                KuscUtil.clear_cnt();
                break;

            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_UP_OPER:
                KuscUtil.UpdateSynthUpOper();
                break;

            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_DOWN_OPER:
                KuscUtil.UpdateSynthDownOper();
                break;

            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_UP_READ_DATA:
                KuscUtil.ReadSynthUp(data);
                break;

            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_DOWN_READ_DATA:
                KuscUtil.ReadSynthDown(data);
                break;

            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_REQ_ANTHER_TX_REG:
                KuscUtil.ReqAntherTxRegister();
                break;

            case KuscMessageParams.MESSAGE_REQUEST.SYNTH_REQ_ANTHER_RX_REG:
                KuscUtil.ReqAntherRxRegister();
                break;
            }

            // Update status log and field:
            KuscUtil.UpdateStatusOk(statusMsg);

            return(true);
        }
Ejemplo n.º 2
0
        private void btnSetSyntUp_Click(object sender, EventArgs e)
        {
            if ((tbxSynthRxRf.Text != string.Empty) && (tbxSynthRxIf.Text != string.Empty) && (tbxSynthRxRf.Text.Length == 8) && (tbxSynthRxIf.Text.Length == 8) && (tbxSynthRxIf.Text[5] == '.') && (tbxSynthRxRf.Text[5] == '.'))
            {
                double fRf = KuscUtil.ParseDoubleFromString(tbxSynthRxRf.Text);
                double fIf = KuscUtil.ParseDoubleFromString(tbxSynthRxIf.Text);
                tbxSynthVcoOutRxPre.Text    = Math.Abs(fRf - fIf).ToString();
                tbxSynthVcoOutTRxAfter.Text = (Math.Abs(fRf - fIf) / 2).ToString("F2");

                WriteStatusOk(KuscCommon.MSG_SYNTH_OK_RX_FREQ_SENT);
                KuscUtil.clear_cnt();    ////yehuda
                if (fRf >= KuscCommon.SYNTH_RX_FRF_MIN_VALUE_MHZ && fRf <= KuscCommon.SYNTH_RX_FRF_MAX_VALUE_MHZ)
                {
                    if (fIf >= KuscCommon.SYNTH_RX_FIF_MIN_VALUE_MHZ && fIf <= KuscCommon.SYNTH_RX_FIF_MAX_VALUE_MHZ)
                    {
                        // Calc CP value and config synth TX register
                        Int32 cpVal = SetSynthCp(KuscCommon.SYNTH_TYPE.SYNTH_RX);

                        // Add info to system log
                        _kuscLogs.WriteLogMsgOk("MCU set synthesizer up (RX) vales");
                        if (cpVal > 0)
                        {
                            _kuscLogs.WriteLogMsgOk(string.Format("F_IF: {0} [MHz] \tF_RF: {1} [MHz] \tCP {2} [mA]", fRf, fIf, cbxSynthRxSetCp.Items[cpVal]));
                        }


                        dataList = _kuscSynth.GetDataRegisters(KuscCommon.SYNTH_TYPE.SYNTH_RX, fRf, fIf);
                        SendSynthRegisters(KuscCommon.SYNTH_TYPE.SYNTH_RX);
                    }
                    else
                    {
                        WriteStatusFail(string.Format("Please insert RX synthesizer F-IF between {0} and {1}", KuscCommon.SYNTH_RX_FIF_MIN_VALUE_MHZ, KuscCommon.SYNTH_RX_FIF_MAX_VALUE_MHZ));
                    }
                }
                else
                {
                    WriteStatusFail(string.Format("Please insert RX synthesizer F-RF between {0} and {1}", KuscCommon.SYNTH_RX_FRF_MIN_VALUE_MHZ, KuscCommon.SYNTH_RX_FRF_MAX_VALUE_MHZ));
                }
            }
            else
            {
                WriteStatusFail(KuscCommon.MSG_SYNTH_ERR_RX_INPUT_WRONG_FORMAT);
            }
        }