123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- //Add code
- using System.IO;
- using System.IO.Ports;
- namespace RF_TRIO_PLL_ZIG
- {
- public partial class Main_Form : Form
- {
- Serial serial = new Serial(); // Uart Open
- Bluecell_BootProtocol bluecell_BootProtocol = new Bluecell_BootProtocol();
- Update_Serial file = new Update_Serial();
- public byte Tdd_T_Sync = 0;
-
- public Main_Form()
- {
- InitializeComponent();
- serial.Serial_Initialize(ref comboBox_Port);
- }
- private void Firmware_Update_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- //FileDownload file = new FileDownload();
- if (Ascii_checkBox.Checked == true)
- Ascii_checkBox.Checked = false;
- file.ShowFileOpenDialog(ref serial, ofd);
- }
- private void Crc16_Check_Click(object sender, EventArgs e)
- {
- #if false
- Crc16 crc16 = new Crc16();
- byte[] tempdata = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,0x0A };
- label1.Text = crc16.CRC16_Generate(tempdata, 11).ToString();
- #endif
- this.serial.Test_Serial();
- }
- private void Button_PortOpen_Click(object sender, EventArgs e)
- {
- bool ret = false;
- ret = Serial_connectiondisable(serial.Serial_PortOpen(ref button_PortOpen, ref comboBox_Port));
- if (ret == false && timer.Enabled == false)
- {
- timer.Start(); //타이머를 발동시킨다.
- }
- else if (timer.Enabled == true)
- {
- timer.Stop(); //타이머를 멈춘다.
- }
- else
- {
- /*NOP*/
- }
- serial.Serial_Main_Form_Get(this);
- }
- private void ComboBox_Port_SelectedIndexChanged(object sender, EventArgs e)
- {
- serial.Serial_Name = comboBox_Port.SelectedItem.ToString();
- }
- private void Button_terminal_Click(object sender, EventArgs e)
- {
- serial.Serial_TerminalOpen(serial);
- }
- public bool Serial_connectiondisable(Boolean on_off)
- {
- comboBox_Port.Enabled = on_off;
- comboBox_baudrate.Enabled = on_off;
- return on_off;
- }
- private delegate void BoolSet();
- public void TX_Light_ON()
- {
- this.pictureBox_G_TX.Visible = true;
- this.pictureBox_R_TX.Visible = false;
- }
- public void TX_Light_OFF()
- {
- this.pictureBox_R_TX.Visible = true;
- this.pictureBox_G_TX.Visible = false;
- }
- public void RX_Light_ON()
- {
- this.pictureBox_G_RX.Visible = true;
- this.pictureBox_R_RX.Visible = false;
- }
- public void RX_Light_OFF()
- {
- this.pictureBox_R_RX.Visible = true;
- this.pictureBox_G_RX.Visible = false;
- }
- Int64 Timer_Cnt = 0;
- Int32 ReqTimer_Cnt = 0;
- public bool TX_RX_Light = false;
-
-
- private void timer_Tick(object sender, EventArgs e)
- {
- Update_Serial update_Serial = null;
- bool req_set = false;
- if(update_Serial == null)
- {
- update_Serial = (Update_Serial)serial.FileDownloadClass_Get();
- if (update_Serial == null)
- req_set = true;
- else if(update_Serial.Update_ready == false)
- req_set = true;
- }
- if (req_set)
- {
- ReqTimer_Cnt++;
- }
- if (TX_RX_Light == true)
- {
- Timer_Cnt++;
- }
- if (Timer_Cnt < 1000)
- {
- if (this.pictureBox_G_TX.Visible == true)
- {
- TX_Light_OFF();
- }
- if (this.pictureBox_G_RX.Visible == true)
- {
- RX_Light_OFF();
- }
- Timer_Cnt = 0;
- TX_RX_Light = false;
- }
- if(ReqTimer_Cnt > 6)
- {
- bluecell_BootProtocol.Bluecell_RF_Status_Req(serial);
- ReqTimer_Cnt = 0;
- }
- }
- private void Main_Form_Load(object sender, EventArgs e)
- {
- pictureBox_PATH_1_8G_DL_ON.Visible = false;
- pictureBox_PATH_1_8G_UL_ON.Visible = false;
- pictureBox_PATH_2_1G_DL_ON.Visible = false;
- pictureBox_PATH_2_1G_UL_ON.Visible = false;
- pictureBox_PATH_3_5G_L_ON.Visible = false;
- pictureBox_PATH_3_5G_H_ON.Visible = false;
- pictureBox_PLL_ON_OFF_3_5G_L_ON.Visible = false;
- pictureBox_PLL_ON_OFF_3_5G_H_ON.Visible = false;
- pictureBox_PATH_3_5G_UL_ON.Visible = false;
- pictureBox_PATH_3_5G_DL_ON.Visible = false;
- pictureBox_PATH_1_8G_DL_OFF.Visible = !false;
- pictureBox_PATH_1_8G_UL_OFF.Visible = !false;
- pictureBox_PATH_2_1G_DL_OFF.Visible = !false;
- pictureBox_PATH_2_1G_UL_OFF.Visible = !false;
- pictureBox_PATH_3_5G_L_OFF.Visible = !false;
- pictureBox_PATH_3_5G_H_OFF.Visible = !false;
- pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible = !false;
- pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible = !false;
- pictureBox_PATH_3_5G_UL_OFF.Visible = !false;
- pictureBox_PATH_3_5G_DL_OFF.Visible = !false;
- pictureBox_G_RX.Visible = !false;
- pictureBox_G_TX.Visible = !false;
- }
- private delegate void StringSend(object label, String str);
- public void ADC_Voltage_Value_Set(byte[] data)
- {
- int temp_val = 0;
- double Volt_Calc_val = 3.3 / 4095;
- double ret = 0;
- try
- {
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_DL_IN, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_DL_OUT, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_UL_IN, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_UL_OUT, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_DL_IN, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_DL_OUT, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_UL_IN, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_UL_OUT, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_DL_IN, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_DL_OUT, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_UL_IN, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_UL_OUT, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t.RFU_TEMP_H] << 8) | (data[(int)Bluecell_TypeIndex_t.RFU_TEMP_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label_RFU_Temp, ret.ToString("N2") + "V");
- temp_val = (int)(data[(int)Bluecell_TypeIndex_t._28V_DET_H] << 8) | (data[(int)Bluecell_TypeIndex_t._28V_DET_L]);
- ret = temp_val * Volt_Calc_val;
- this.Invoke(new StringSend(Label_Text_Set), label_28V_Det, ret.ToString("N2") + "V");
- if (IamSetting_Get() == false)
- {
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL2];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL1];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL1, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL2];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL2, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL3];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL3, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL4];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL4, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_DL1];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL1, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_DL2];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL2, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL1];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL1, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL2];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL2, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL3];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL3, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL4];
- ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL4, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_DL];
- ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_DL, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_UL];
- ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_UL, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_COM1];
- ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM1, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_COM2];
- ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM2, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_COM3];
- ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM3, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_L]) / 10);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_1_8G_DL, temp_val.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_L]) / 10);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_1_8G_UL, temp_val.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_L]) / 10);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_2_1G_DL, temp_val.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_L]) / 10);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_2_1G_UL, temp_val.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_L]) / 10);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_3_5G_DL, temp_val.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_L]) / 10);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_3_5G_UL, temp_val.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_A, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_B, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret ), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_C, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_D, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_E, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_F, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_G, ret.ToString());
- temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_H] << 8;
- temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_L]) );
- ret = (temp_val & 0x0FFF) * 4;
- ret = ret / 4095;
- ret = Math.Round(Convert.ToDouble(ret), 1);
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_H, ret.ToString());
- PictureBox pic_on;
- PictureBox pic_off;
- pic_on = pictureBox_PATH_1_8G_DL_ON;
- pic_off = pictureBox_PATH_1_8G_DL_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_1_8G_DL] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PATH_1_8G_UL_ON;
- pic_off = pictureBox_PATH_1_8G_UL_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_1_8G_UL] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PATH_2_1G_DL_ON;
- pic_off = pictureBox_PATH_2_1G_DL_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_2_1G_DL] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PATH_2_1G_UL_ON;
- pic_off = pictureBox_PATH_2_1G_UL_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_2_1G_UL] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PATH_3_5G_DL_ON;
- pic_off = pictureBox_PATH_3_5G_DL_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_DL] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PATH_3_5G_UL_ON;
- pic_off = pictureBox_PATH_3_5G_UL_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_UL] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PATH_3_5G_H_ON;
- pic_off = pictureBox_PATH_3_5G_H_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_H] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PATH_3_5G_L_ON;
- pic_off = pictureBox_PATH_3_5G_L_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_L] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PLL_ON_OFF_3_5G_H_ON;
- pic_off = pictureBox_PLL_ON_OFF_3_5G_H_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_H] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- pic_on = pictureBox_PLL_ON_OFF_3_5G_L_ON;
- pic_off = pictureBox_PLL_ON_OFF_3_5G_L_OFF;
- if (data[(int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L] > 0)
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- if (data[(int)Bluecell_TypeIndex_t.T_SYNC_DL] > 0)
- {
- TDD_T_SYNC_Get();
- //this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
- }
- else
- {
- //this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
- }
- // this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL2]);
- }
- }
- catch { /*MessageBox.Show("What is this?");*/ }
- }
- private delegate void PictureBoxSend(object picon, object picoff, bool set);
- private void PictureBox_On_OFF_Set(object pic_on,object pic_off,bool set)
- {
-
- PictureBox picture_on = (PictureBox)pic_on;
- PictureBox picture_off = (PictureBox)pic_off;
- picture_on.Visible = set;
- picture_off.Visible =!set;
- }
- public void ReSetting_Values(byte[] temp_buf)
- {
- this.numericUpDown_ATT_1_8G_DL1.Text = temp_buf[(byte)Bluecell_TypeIndex_t.ATT_1_8G_DL1].ToString();
- /*this.numericUpDown_ATT_1_8G_DL2.Text;
- this.numericUpDown_ATT_1_8G_UL1.Text;
- this.numericUpDown_ATT_1_8G_UL2.Text;
- this.numericUpDown_ATT_1_8G_UL3.Text;
- this.numericUpDown_ATT_1_8G_UL4.Text;
- this.numericUpDown_ATT_2_1G_DL1.Text;
- this.numericUpDown_ATT_2_1G_DL2.Text;
- this.numericUpDown_ATT_2_1G_UL1.Text;
- this.numericUpDown_ATT_2_1G_UL2.Text;
- this.numericUpDown_ATT_2_1G_UL3.Text;
- this.numericUpDown_ATT_2_1G_UL4.Text;
- this.numericUpDown_ATT_3_5G_DL.Text;
- this.numericUpDown_ATT_3_5G_UL.Text;
- this.numericUpDown_ATT_3_5G_COM1.Text;
- this.numericUpDown_ATT_3_5G_COM2.Text;
- this.numericUpDown_ATT_3_5G_COM3.Text;*/
- }
- private void Label_Text_Set(object label, String str)
- {
- Label Temp_label = (Label)label;
- Temp_label.Text = str;
- }
- private void numeric_Text_Set(object numeric, String str)
- {
- NumericUpDown Temp_numeric = (NumericUpDown)numeric;
- Temp_numeric.Text = str;
- }
- private void ATT_Enter(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
-
- Button_Set_Click(sender, e);
- //to do
- }
- else
- {
- return;
- }
- }
- private void TDD_T_SYNC_Click(object sender, EventArgs e)
- {
- PictureBox pictureBox = (PictureBox)sender;
- Tdd_T_Sync = Convert.ToByte(pictureBox.Tag);
- bluecell_BootProtocol.Bluecell_BtnSet(this.serial, this);
- pictureBox_TDD_T_SYNC_UL_ON.Visible = !pictureBox_TDD_T_SYNC_UL_ON.Visible;
- pictureBox_TDD_T_SYNC_DL_OFF.Visible = !pictureBox_TDD_T_SYNC_DL_OFF.Visible;
- }
- private void TDD_T_SYNC_Get()
- {
- }
- const byte PATH_1_8G_DL_ON = 1;
- const byte PATH_1_8G_DL_OFF = 2;
- const byte PATH_1_8G_UL_ON = 3;
- const byte PATH_1_8G_UL_OFF = 4;
- const byte PATH_2_1G_DL_ON = 5;
- const byte PATH_2_1G_DL_OFF = 6;
- const byte PATH_2_1G_UL_ON = 7;
- const byte PATH_2_1G_UL_OFF = 8;
- const byte PATH_3_5G_DL_ON = 9;
- const byte PATH_3_5G_DL_OFF = 10;
- const byte PATH_3_5G_UL_ON = 11;
- const byte PATH_3_5G_UL_OFF = 12;
- const byte PATH_3_5G_H_ON = 13;
- const byte PATH_3_5G_H_OFF = 14;
- const byte PATH_3_5G_L_ON = 15;
- const byte PATH_3_5G_L_OFF = 16;
- const byte PLL_POWER_ONOFF_3_5G_H_ON = 17;
- const byte PLL_POWER_ONOFF_3_5G_H_OFF = 18;
- const byte PLL_POWER_ONOFF_3_5G_L_ON = 19;
- const byte PLL_POWER_ONOFF_3_5G_L_OFF = 20;
- private void Power_OnOff_Set(object sender, EventArgs e)
- {
- byte temp_tag = 0;
- PictureBox pictureBox = (PictureBox)sender;
- temp_tag = Convert.ToByte(pictureBox.Tag);
-
- switch (temp_tag)
- {
- case PATH_1_8G_DL_OFF:
- pictureBox_PATH_1_8G_DL_ON.Visible = true;
- break;
- case PATH_1_8G_DL_ON:
- pictureBox_PATH_1_8G_DL_OFF.Visible = true;
- break;
- case PATH_1_8G_UL_OFF:
- pictureBox_PATH_1_8G_UL_ON.Visible = true;
- break;
- case PATH_1_8G_UL_ON:
- pictureBox_PATH_1_8G_UL_OFF.Visible = true;
- break;
- case PATH_2_1G_DL_OFF:
- pictureBox_PATH_2_1G_DL_ON.Visible = true;
- break;
- case PATH_2_1G_DL_ON:
- pictureBox_PATH_2_1G_DL_OFF.Visible = true;
- break;
- case PATH_2_1G_UL_OFF:
- pictureBox_PATH_2_1G_UL_ON.Visible = true;
- break;
- case PATH_2_1G_UL_ON:
- pictureBox_PATH_2_1G_UL_OFF.Visible = true;
- break;
- case PATH_3_5G_DL_OFF:
- pictureBox_PATH_3_5G_DL_ON.Visible = true;
- break;
- case PATH_3_5G_DL_ON:
- pictureBox_PATH_3_5G_DL_OFF.Visible = true;
- break;
- case PATH_3_5G_UL_OFF:
- pictureBox_PATH_3_5G_UL_ON.Visible = true;
- break;
- case PATH_3_5G_UL_ON:
- pictureBox_PATH_3_5G_UL_OFF.Visible = true;
- break;
- case PATH_3_5G_H_OFF:
- pictureBox_PATH_3_5G_H_ON.Visible = true;
- break;
- case PATH_3_5G_H_ON:
- pictureBox_PATH_3_5G_H_OFF.Visible = true;
- break;
- case PATH_3_5G_L_OFF:
- pictureBox_PATH_3_5G_L_ON.Visible = true;
- break;
- case PATH_3_5G_L_ON:
- pictureBox_PATH_3_5G_L_OFF.Visible = true;
- break;
- case PLL_POWER_ONOFF_3_5G_H_ON:
- pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible = true;
- break;
- case PLL_POWER_ONOFF_3_5G_H_OFF:
- pictureBox_PLL_ON_OFF_3_5G_H_ON.Visible = true;
- break;
- case PLL_POWER_ONOFF_3_5G_L_ON:
- pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible = true;
- break;
- case PLL_POWER_ONOFF_3_5G_L_OFF:
- pictureBox_PLL_ON_OFF_3_5G_L_ON.Visible = true;
- break;
- }
- pictureBox.Visible = !pictureBox.Visible;
- bluecell_BootProtocol.Bluecell_BtnSet(this.serial, this);
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL1, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL2, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL3, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL4, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL1, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL2, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL1, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL2, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL3, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL4, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_DL, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_UL, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM1, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM2, "0.0");
- this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM3, "0.0");
- Button_Set_Click(sender, e);
- /*Crc16 crc16 = new Crc16();
- byte[] temp_buf = new byte[6];
- temp_buf[0] = 0xbe;
- temp_buf[1] = 2;
- temp_buf[2] = 4;
- temp_buf[3] = 5;
- temp_buf[4] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
- temp_buf[5] = 0xeb;
- serial.Serial_DataSend(temp_buf, temp_buf[2] + 2);*/
- }
- private void Button_Set_Click(object sender, EventArgs e)
- {
- bluecell_BootProtocol.Bluecell_BtnSet(this.serial, this);
- }
- private bool IamSetting = false;
- private void Activi_Change__Setting(object sender, EventArgs e)
- {
-
- IamSetting = true;
- }
- private void Activi_Change__SettingComplete(object sender, EventArgs e)
- {
- IamSetting = false;
- }
- public bool IamSetting_Get()
- {
- return IamSetting;
- }
- private void Cusor_DeFocus(object sender, EventArgs e)
- {
- GroupBox grp = (GroupBox)sender;
- grp.Focus();
- }
- private void button_Save_Click(object sender, EventArgs e)
- {
- Crc16 crc16 = new Crc16();
- byte[] temp_buf = new byte[6];
- temp_buf[0] = 0xbe;
- temp_buf[1] = 3;
- temp_buf[2] = 3;
- temp_buf[3] = 4;
- temp_buf[4] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
- temp_buf[5] = 0xeb;
- serial.Serial_DataSend(temp_buf, temp_buf[2] + 3);
- }
- }
- }
|