소스 검색

HEX Text BOX 이미지 바로 그리 도록 수정 / Power On off 최초 이미지 수정

YJ 6 년 전
부모
커밋
d0e0a2f171

+ 22 - 22
Basic_Terminal/Func/Bluecell_BootProtocol.cs

@@ -119,10 +119,10 @@ namespace RF_TRIO_PLL_ZIG
119 119
         PATH_EN_1_8G_UL,
120 120
         PATH_EN_2_1G_DL,
121 121
         PATH_EN_2_1G_UL,
122
-        PATH_EN_3_5G_L,
123
-        PATH_EN_3_5G_H,
124 122
         PATH_EN_3_5G_DL,
125 123
         PATH_EN_3_5G_UL,
124
+        PATH_EN_3_5G_H,
125
+        PATH_EN_3_5G_L,
126 126
         PLL_ON_OFF_3_5G_H,
127 127
         PLL_ON_OFF_3_5G_L,
128 128
         T_SYNC_DL,
@@ -177,7 +177,7 @@ namespace RF_TRIO_PLL_ZIG
177 177
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length]       = BLUECELL_RESET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
178 178
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex]     = (byte)Bluecell_ProtIndex_p.Bluecell_data;
179 179
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data]         = crc16.STH30_CreateCrc(temp_buf, BLUECELL_RESET_LENGTH - 3);
180
-            temp_buf[1]     = BLUECELL_TAILER;
180
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1]     = BLUECELL_TAILER;
181 181
             this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
182 182
         }
183 183
         private byte Bluecell_BDA4601_Calc(double data)
@@ -451,59 +451,59 @@ namespace RF_TRIO_PLL_ZIG
451 451
 
452 452
             double double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_A.Text) * 4095;
453 453
             UInt16 temp = Convert.ToUInt16(double_temp / 4);
454
-            temp = Convert.ToUInt16(temp & 0xFF00);
454
+            temp = Convert.ToUInt16(temp & 0x0FFF);
455 455
 
456 456
 
457 457
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_H]
458
-                = Convert.ToByte(0x00 + Convert.ToByte(temp >> 8));
458
+                = Convert.ToByte(0x00 + Convert.ToByte((temp & 0xFF00) >> 8));
459 459
 
460 460
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_L] 
461 461
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_A.Text) * 4095) / 4) & 0x00FF);
462 462
 
463 463
             double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_B.Text) * 4095;
464 464
             temp = Convert.ToUInt16(double_temp / 4);
465
-            temp = Convert.ToUInt16(temp & 0xFF00);
465
+            temp = Convert.ToUInt16(temp & 0x0FFF);
466 466
 
467 467
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_H]
468
-                = Convert.ToByte(0x10 + Convert.ToByte(temp >> 8));
468
+                = Convert.ToByte(0x10 + Convert.ToByte((temp & 0xFF00) >> 8));
469 469
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_L]
470 470
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_B.Text) * 4095) / 4) & 0x00FF);
471 471
 
472 472
             double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_C.Text) * 4095;
473 473
             temp = Convert.ToUInt16(double_temp / 4);
474
-            temp = Convert.ToUInt16(temp & 0xFF00);
474
+            temp = Convert.ToUInt16(temp & 0x0FFF);
475 475
 
476 476
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_H]
477
-                = Convert.ToByte(0x20 + Convert.ToByte(temp >> 8));
477
+                = Convert.ToByte(0x20 + Convert.ToByte((temp & 0xFF00) >> 8));
478 478
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_L]
479 479
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_C.Text) * 4095) / 4) & 0x00FF);
480 480
 
481 481
 
482 482
             double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_D.Text) * 4095;
483 483
             temp = Convert.ToUInt16(double_temp / 4);
484
-            temp = Convert.ToUInt16(temp & 0xFF00);
484
+            temp = Convert.ToUInt16(temp & 0x0FFF);
485 485
 
486 486
 
487 487
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_H]
488
-                = Convert.ToByte(0x30 + Convert.ToByte(temp >> 8));
488
+                = Convert.ToByte(0x30 + Convert.ToByte((temp & 0xFF00) >> 8));
489 489
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_L]
490 490
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_D.Text) * 4095) / 4) & 0x00FF); ;
491 491
 
492 492
             double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_E.Text) * 4095;
493 493
             temp = Convert.ToUInt16(double_temp / 4);
494
-            temp = Convert.ToUInt16(temp & 0xFF00);
494
+            temp = Convert.ToUInt16(temp & 0x0FFF);
495 495
 
496 496
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_H]
497
-                = Convert.ToByte(0x40 + Convert.ToByte(temp >> 8));
497
+                = Convert.ToByte(0x40 + Convert.ToByte((temp & 0xFF00) >> 8));
498 498
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_L]
499 499
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_E.Text) * 4095) / 4) & 0x00FF);
500 500
 
501 501
 
502 502
             double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_F.Text) * 4095;
503 503
             temp = Convert.ToUInt16(double_temp / 4);
504
-            temp = Convert.ToUInt16(temp & 0xFF00);
504
+            temp = Convert.ToUInt16(temp & 0x0FFF);
505 505
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_H]
506
-                = Convert.ToByte(0x50 + Convert.ToByte(temp >> 8));
506
+                = Convert.ToByte(0x50 + Convert.ToByte((temp & 0xFF00) >> 8));
507 507
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_L]
508 508
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_F.Text) * 4095) / 4) & 0x00FF);
509 509
 
@@ -511,21 +511,21 @@ namespace RF_TRIO_PLL_ZIG
511 511
 
512 512
             double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_G.Text) * 4095;
513 513
             temp = Convert.ToUInt16(double_temp / 4);
514
-            temp = Convert.ToUInt16(temp & 0xFF00);
514
+            temp = Convert.ToUInt16(temp & 0x0FFF);
515 515
 
516 516
 
517 517
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_H]
518
-                = Convert.ToByte(0x60 + Convert.ToByte(temp >> 8));
518
+                = Convert.ToByte(0x60 + Convert.ToByte((temp & 0xFF00) >> 8));
519 519
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_L] 
520 520
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_G.Text) * 4095) / 4) & 0x00FF);
521 521
 
522 522
 
523 523
             double_temp = Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_H.Text) * 4095;
524 524
             temp = Convert.ToUInt16(double_temp / 4);
525
-            temp = Convert.ToUInt16(temp & 0xFF00);
525
+            temp = Convert.ToUInt16(temp & 0x0FFF);
526 526
             
527 527
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_H]
528
-                = Convert.ToByte(0x70 + Convert.ToByte(temp >> 8));
528
+                = Convert.ToByte(0x70 + Convert.ToByte((temp & 0xFF00) >> 8));
529 529
             temp_buf[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_L] 
530 530
                 = Convert.ToByte(Convert.ToUInt16((Convert.ToDouble(main_Form.numericUpDown_DAC_VoltCtrl_H.Text) * 4095) / 4) & 0x00FF);
531 531
 
@@ -556,12 +556,12 @@ namespace RF_TRIO_PLL_ZIG
556 556
             this.serial = (Serial)serial;
557 557
             byte[] temp_buf = new byte[6];
558 558
 
559
-            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = 0xbe;
559
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
560 560
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = 2;
561 561
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = Convert.ToByte(temp_buf.Length - 3);
562 562
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
563
-            temp_buf[0] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
564
-            temp_buf[1] = 0xeb;
563
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex + 1] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
564
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex + 2] = BLUECELL_TAILER;
565 565
             this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
566 566
 
567 567
         }

+ 12 - 0
Basic_Terminal/Func/Data_Handler.cs

@@ -46,6 +46,7 @@ namespace RF_TRIO_PLL_ZIG
46 46
 
47 47
             return ret;
48 48
         }
49
+
49 50
         Serial serial;
50 51
         Main_Form main_Form; //= new Main_Form();
51 52
         public void Recv_dataCheck(object serial,object main_form, object fileDownload, byte[] data)
@@ -104,6 +105,17 @@ namespace RF_TRIO_PLL_ZIG
104 105
             }
105 106
             else/* * * * * * * * * * * * * *API RECV 부분 * * * * * * * * * * * * *  */
106 107
             {
108
+                Header_Check = HeaderCheck(data);
109
+                if (Header_Check == false)
110
+                {
111
+                    return;
112
+                }
113
+                Crc_Check = CrcCheck(data);
114
+                if (Crc_Check == 0)
115
+                {
116
+                    return;
117
+                }
118
+
107 119
                 bluecell_BootProtocol.Bluecell_RF_Status_Get(this.serial,this.main_Form, data);
108 120
 
109 121
             }

+ 6 - 6
Basic_Terminal/Wnd/Debug.Designer.cs

@@ -49,7 +49,7 @@
49 49
             this.tbReceived.Name = "tbReceived";
50 50
             this.tbReceived.ReadOnly = true;
51 51
             this.tbReceived.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
52
-            this.tbReceived.Size = new System.Drawing.Size(800, 403);
52
+            this.tbReceived.Size = new System.Drawing.Size(1230, 403);
53 53
             this.tbReceived.TabIndex = 63;
54 54
             this.tbReceived.Text = "";
55 55
             // 
@@ -64,7 +64,7 @@
64 64
             this.groupBox1.Controls.Add(this.textBox_senddata);
65 65
             this.groupBox1.Location = new System.Drawing.Point(13, 410);
66 66
             this.groupBox1.Name = "groupBox1";
67
-            this.groupBox1.Size = new System.Drawing.Size(787, 89);
67
+            this.groupBox1.Size = new System.Drawing.Size(1217, 89);
68 68
             this.groupBox1.TabIndex = 64;
69 69
             this.groupBox1.TabStop = false;
70 70
             this.groupBox1.Text = "보내는 문자열";
@@ -113,7 +113,7 @@
113 113
             // 
114 114
             // button_Clear
115 115
             // 
116
-            this.button_Clear.Location = new System.Drawing.Point(702, 20);
116
+            this.button_Clear.Location = new System.Drawing.Point(1140, 19);
117 117
             this.button_Clear.Name = "button_Clear";
118 118
             this.button_Clear.Size = new System.Drawing.Size(71, 23);
119 119
             this.button_Clear.TabIndex = 2;
@@ -123,7 +123,7 @@
123 123
             // 
124 124
             // button_Send
125 125
             // 
126
-            this.button_Send.Location = new System.Drawing.Point(702, 53);
126
+            this.button_Send.Location = new System.Drawing.Point(1140, 52);
127 127
             this.button_Send.Name = "button_Send";
128 128
             this.button_Send.Size = new System.Drawing.Size(71, 23);
129 129
             this.button_Send.TabIndex = 1;
@@ -135,14 +135,14 @@
135 135
             // 
136 136
             this.textBox_senddata.Location = new System.Drawing.Point(7, 54);
137 137
             this.textBox_senddata.Name = "textBox_senddata";
138
-            this.textBox_senddata.Size = new System.Drawing.Size(688, 21);
138
+            this.textBox_senddata.Size = new System.Drawing.Size(1115, 21);
139 139
             this.textBox_senddata.TabIndex = 0;
140 140
             // 
141 141
             // Debug
142 142
             // 
143 143
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
144 144
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
145
-            this.ClientSize = new System.Drawing.Size(802, 511);
145
+            this.ClientSize = new System.Drawing.Size(1242, 511);
146 146
             this.Controls.Add(this.groupBox1);
147 147
             this.Controls.Add(this.tbReceived);
148 148
             this.Name = "Debug";

+ 9 - 6
Basic_Terminal/Wnd/Debug.cs

@@ -104,17 +104,20 @@ namespace RF_TRIO_PLL_ZIG
104 104
             
105 105
             int nLimitLines = Convert.ToInt32(LineLimit); //제한 라인 수
106 106
             try
107
-            {
107
+            {/*
108
+                try
109
+                {
110
+                    SendMessage(this.Handle, WM_SETREDRAW, false, 0);
111
+                }
112
+                catch (Exception e) { MessageBox.Show(e.StackTrace); }*/
108 113
                 for (int i = 0; i < text.Length; i++)
109 114
                 {
110 115
                     AppendMessage += Convert.ToString(text[i], 16);
116
+                    AppendMessage += " ";
111 117
                 }
118
+                AppendMessage += "\r\n";
112 119
                 tbReceived.AppendText(AppendMessage);
113
-                try
114
-                {
115
-                    SendMessage(this.Handle, WM_SETREDRAW, false, 0);
116
-                }
117
-                catch { return; }
120
+               
118 121
                 if (tbReceived.Lines.Length > nLimitLines)
119 122
                 {
120 123
                     LinkedList<string> tempLines = new LinkedList<string>(tbReceived.Lines);

+ 20 - 5
Basic_Terminal/Wnd/Main_Form.Designer.cs

@@ -194,6 +194,7 @@
194 194
             this.label36 = new System.Windows.Forms.Label();
195 195
             this.label38 = new System.Windows.Forms.Label();
196 196
             this.label23 = new System.Windows.Forms.Label();
197
+            this.button_Save = new System.Windows.Forms.Button();
197 198
             this.groupBox9.SuspendLayout();
198 199
             this.groupBox8.SuspendLayout();
199 200
             this.groupBox7.SuspendLayout();
@@ -1682,9 +1683,9 @@
1682 1683
             this.groupBox_TDD.Controls.Add(this.pictureBox_TDD_T_SYNC_DL_ON);
1683 1684
             this.groupBox_TDD.Controls.Add(this.pictureBox_TDD_T_SYNC_UL_ON);
1684 1685
             this.groupBox_TDD.Controls.Add(this.pictureBox_TDD_T_SYNC_UL_OFF);
1685
-            this.groupBox_TDD.Location = new System.Drawing.Point(12, 306);
1686
+            this.groupBox_TDD.Location = new System.Drawing.Point(12, 398);
1686 1687
             this.groupBox_TDD.Name = "groupBox_TDD";
1687
-            this.groupBox_TDD.Size = new System.Drawing.Size(225, 166);
1688
+            this.groupBox_TDD.Size = new System.Drawing.Size(225, 74);
1688 1689
             this.groupBox_TDD.TabIndex = 107;
1689 1690
             this.groupBox_TDD.TabStop = false;
1690 1691
             this.groupBox_TDD.Text = "Tdd";
@@ -2055,11 +2056,12 @@
2055 2056
             // 
2056 2057
             // button1
2057 2058
             // 
2058
-            this.button1.Location = new System.Drawing.Point(383, 31);
2059
+            this.button1.Font = new System.Drawing.Font("굴림", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
2060
+            this.button1.Location = new System.Drawing.Point(365, 20);
2059 2061
             this.button1.Name = "button1";
2060
-            this.button1.Size = new System.Drawing.Size(75, 23);
2062
+            this.button1.Size = new System.Drawing.Size(116, 50);
2061 2063
             this.button1.TabIndex = 110;
2062
-            this.button1.Text = "Test";
2064
+            this.button1.Text = "ATTEN ZERO SET";
2063 2065
             this.button1.UseVisualStyleBackColor = true;
2064 2066
             this.button1.Click += new System.EventHandler(this.button1_Click);
2065 2067
             // 
@@ -2397,12 +2399,24 @@
2397 2399
             this.label23.TabIndex = 100;
2398 2400
             this.label23.Text = "V out G";
2399 2401
             // 
2402
+            // button_Save
2403
+            // 
2404
+            this.button_Save.Font = new System.Drawing.Font("굴림", 15F, System.Drawing.FontStyle.Bold);
2405
+            this.button_Save.Location = new System.Drawing.Point(12, 306);
2406
+            this.button_Save.Name = "button_Save";
2407
+            this.button_Save.Size = new System.Drawing.Size(225, 87);
2408
+            this.button_Save.TabIndex = 111;
2409
+            this.button_Save.Text = "SAVE";
2410
+            this.button_Save.UseVisualStyleBackColor = true;
2411
+            this.button_Save.Click += new System.EventHandler(this.button_Save_Click);
2412
+            // 
2400 2413
             // Main_Form
2401 2414
             // 
2402 2415
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
2403 2416
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
2404 2417
             this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
2405 2418
             this.ClientSize = new System.Drawing.Size(1185, 840);
2419
+            this.Controls.Add(this.button_Save);
2406 2420
             this.Controls.Add(this.button1);
2407 2421
             this.Controls.Add(this.button_Set);
2408 2422
             this.Controls.Add(this.groupBox3);
@@ -2683,6 +2697,7 @@
2683 2697
         private System.Windows.Forms.Label label36;
2684 2698
         private System.Windows.Forms.Label label38;
2685 2699
         private System.Windows.Forms.Label label23;
2700
+        private System.Windows.Forms.Button button_Save;
2686 2701
     }
2687 2702
 }
2688 2703
 

+ 256 - 78
Basic_Terminal/Wnd/Main_Form.cs

@@ -104,42 +104,45 @@ namespace RF_TRIO_PLL_ZIG
104 104
             this.pictureBox_R_RX.Visible = true;
105 105
             this.pictureBox_G_RX.Visible = false;
106 106
         }
107
-
107
+        Int64 TimerCnt = 0;
108 108
         private void timer_Tick(object sender, EventArgs e)
109 109
         {
110
-            
111
-            if (this.pictureBox_G_TX.Visible == true)
112
-            {
113
-                TX_Light_OFF();
114
-            }
115
-            if (this.pictureBox_G_RX.Visible == true)
110
+            TimerCnt++;
111
+            if (TimerCnt > 500)
116 112
             {
117
-                RX_Light_OFF();
113
+                if (this.pictureBox_G_TX.Visible == true)
114
+                {
115
+                    TX_Light_OFF();
116
+                }
117
+                if (this.pictureBox_G_RX.Visible == true)
118
+                {
119
+                    RX_Light_OFF();
120
+                }
118 121
             }
119 122
         }
120 123
         private void Main_Form_Load(object sender, EventArgs e)
121 124
         {
122
-            pictureBox_PATH_1_8G_DL_ON.Visible = !false;
123
-            pictureBox_PATH_1_8G_UL_ON.Visible = !false;
124
-            pictureBox_PATH_2_1G_DL_ON.Visible = !false;
125
-            pictureBox_PATH_2_1G_UL_ON.Visible = !false;
126
-            pictureBox_PATH_3_5G_L_ON.Visible = !false;
127
-            pictureBox_PATH_3_5G_H_ON.Visible = !false;
128
-            pictureBox_PLL_ON_OFF_3_5G_L_ON.Visible = !false;
129
-            pictureBox_PLL_ON_OFF_3_5G_H_ON.Visible = !false;
130
-            pictureBox_PATH_3_5G_UL_ON.Visible = !false;
131
-            pictureBox_PATH_3_5G_DL_ON.Visible = !false;
132
-
133
-            pictureBox_PATH_1_8G_DL_OFF.Visible = false;
134
-            pictureBox_PATH_1_8G_UL_OFF.Visible = false;
135
-            pictureBox_PATH_2_1G_DL_OFF.Visible = false;
136
-            pictureBox_PATH_2_1G_UL_OFF.Visible = false;
137
-            pictureBox_PATH_3_5G_L_OFF.Visible = false;
138
-            pictureBox_PATH_3_5G_H_OFF.Visible = false;
139
-            pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible = false;
140
-            pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible = false;
141
-            pictureBox_PATH_3_5G_UL_OFF.Visible = false;
142
-            pictureBox_PATH_3_5G_DL_OFF.Visible = false;
125
+            pictureBox_PATH_1_8G_DL_ON.Visible = false;
126
+            pictureBox_PATH_1_8G_UL_ON.Visible = false;
127
+            pictureBox_PATH_2_1G_DL_ON.Visible = false;
128
+            pictureBox_PATH_2_1G_UL_ON.Visible = false;
129
+            pictureBox_PATH_3_5G_L_ON.Visible = false;
130
+            pictureBox_PATH_3_5G_H_ON.Visible = false;
131
+            pictureBox_PLL_ON_OFF_3_5G_L_ON.Visible = false;
132
+            pictureBox_PLL_ON_OFF_3_5G_H_ON.Visible = false;
133
+            pictureBox_PATH_3_5G_UL_ON.Visible = false;
134
+            pictureBox_PATH_3_5G_DL_ON.Visible = false;
135
+
136
+            pictureBox_PATH_1_8G_DL_OFF.Visible = !false;
137
+            pictureBox_PATH_1_8G_UL_OFF.Visible = !false;
138
+            pictureBox_PATH_2_1G_DL_OFF.Visible = !false;
139
+            pictureBox_PATH_2_1G_UL_OFF.Visible = !false;
140
+            pictureBox_PATH_3_5G_L_OFF.Visible = !false;
141
+            pictureBox_PATH_3_5G_H_OFF.Visible = !false;
142
+            pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible = !false;
143
+            pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible = !false;
144
+            pictureBox_PATH_3_5G_UL_OFF.Visible = !false;
145
+            pictureBox_PATH_3_5G_DL_OFF.Visible = !false;
143 146
 
144 147
             pictureBox_G_RX.Visible = !false;
145 148
             pictureBox_G_TX.Visible = !false;        
@@ -280,64 +283,198 @@ namespace RF_TRIO_PLL_ZIG
280 283
                     ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val);
281 284
                     this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM3, ret.ToString());
282 285
 
283
-                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_H] << 8 | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_L];
286
+                    temp_val  =  data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_H] << 8;
287
+                    temp_val  = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_L]) / 10);
284 288
                     this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_1_8G_DL, temp_val.ToString());
285 289
 
286
-                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_H] << 8 | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_L];
290
+                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_H] << 8;
291
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_L]) / 10);
287 292
                     this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_1_8G_UL, temp_val.ToString());
288 293
 
289
-                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_H] << 8 | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_L];
294
+                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_H] << 8;
295
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_L]) / 10);
290 296
                     this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_2_1G_DL, temp_val.ToString());
291 297
 
292
-                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_H] << 8 | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_L];
298
+                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_H] << 8;
299
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_L]) / 10);
293 300
                     this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_2_1G_UL, temp_val.ToString());
294 301
 
295
-                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_H] << 8 | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_L];
302
+                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_H] << 8;
303
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_L]) / 10);
296 304
                     this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_3_5G_DL, temp_val.ToString());
297 305
 
298
-                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_H] << 8 | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_L];
306
+                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_H] << 8;
307
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_L]) / 10);
299 308
                     this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_3_5G_UL, temp_val.ToString());
300 309
 
301
-/*                    temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_H] << 8 | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_L];
302
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
303
-
304
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
305
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
306
-
307
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
308
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
309
-
310
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
311
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
312
-
313
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
314
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
315
-
316
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
317
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
318
-
319
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
320
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
321
-
322
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
323
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
324
-
325
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
326
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
327
-
328
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
329
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
330
-
331
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
332
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
333
-
334
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
335
-                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, temp_val.ToString());
336
-
337
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
338
-                    */
339
-
340
-                    temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1];
310
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_H] << 8;
311
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_L]) );
312
+                    ret = (temp_val & 0x0FFF) * 4;
313
+                    ret = ret / 4095;
314
+                    ret = Math.Round(Convert.ToDouble(ret), 1);
315
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_A, ret.ToString());
316
+
317
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_H] << 8;
318
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_L]) );
319
+                    ret = (temp_val & 0x0FFF) * 4;
320
+                    ret = ret / 4095;
321
+                    ret = Math.Round(Convert.ToDouble(ret), 1);
322
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_B, ret.ToString());
323
+
324
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_H] << 8;
325
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_L]) );
326
+                    ret = (temp_val & 0x0FFF) * 4;
327
+                    ret = ret / 4095;
328
+                    ret = Math.Round(Convert.ToDouble(ret ), 1);
329
+
330
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_C, ret.ToString());
331
+
332
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_H] << 8;
333
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_L]) );
334
+                    ret = (temp_val & 0x0FFF) * 4;
335
+                    ret = ret / 4095;
336
+                    ret = Math.Round(Convert.ToDouble(ret), 1);
337
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_D, ret.ToString());
338
+
339
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_H] << 8;
340
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_L]) );
341
+                    ret = (temp_val & 0x0FFF) * 4;
342
+                    ret = ret / 4095;
343
+                    ret = Math.Round(Convert.ToDouble(ret), 1);
344
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_E, ret.ToString());
345
+
346
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_H] << 8;
347
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_L]) );
348
+                    ret = (temp_val & 0x0FFF) * 4;
349
+                    ret = ret / 4095;
350
+                    ret = Math.Round(Convert.ToDouble(ret), 1);
351
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_F, ret.ToString());
352
+
353
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_H] << 8;
354
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_L]) );
355
+                    ret = (temp_val & 0x0FFF) * 4;
356
+                    ret = ret / 4095;
357
+                    ret = Math.Round(Convert.ToDouble(ret), 1);
358
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_G, ret.ToString());
359
+
360
+                    temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_H] << 8;
361
+                    temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_L]) );
362
+                    ret = (temp_val & 0x0FFF) * 4;
363
+                    ret = ret / 4095;
364
+                    ret = Math.Round(Convert.ToDouble(ret), 1);
365
+                    this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_H, ret.ToString());
366
+
367
+                    PictureBox pic_on;
368
+                    PictureBox pic_off;
369
+                    pic_on = pictureBox_PATH_1_8G_DL_ON;
370
+                    pic_off = pictureBox_PATH_1_8G_DL_OFF;
371
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_1_8G_DL] > 0)
372
+                    {
373
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
374
+                    }
375
+                    else
376
+                    {
377
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
378
+                    }
379
+
380
+                    pic_on = pictureBox_PATH_1_8G_UL_ON;
381
+                    pic_off = pictureBox_PATH_1_8G_UL_OFF;
382
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_1_8G_UL] > 0)
383
+                    {
384
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
385
+                    }
386
+                    else
387
+                    {
388
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
389
+                    }
390
+
391
+                    pic_on = pictureBox_PATH_2_1G_DL_ON;
392
+                    pic_off = pictureBox_PATH_2_1G_DL_OFF;
393
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_2_1G_DL] > 0)
394
+                    {
395
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
396
+                    }
397
+                    else
398
+                    {
399
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
400
+                    }
401
+
402
+                    pic_on = pictureBox_PATH_2_1G_UL_ON;
403
+                    pic_off = pictureBox_PATH_2_1G_UL_OFF;
404
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_2_1G_UL] > 0)
405
+                    {
406
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
407
+                    }
408
+                    else
409
+                    {
410
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
411
+                    }
412
+
413
+                    pic_on = pictureBox_PATH_3_5G_DL_ON;
414
+                    pic_off = pictureBox_PATH_3_5G_DL_OFF;
415
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_DL] > 0)
416
+                    {
417
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
418
+                    }
419
+                    else
420
+                    {
421
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
422
+                    }
423
+
424
+                    pic_on = pictureBox_PATH_3_5G_UL_ON;
425
+                    pic_off = pictureBox_PATH_3_5G_UL_OFF;
426
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_UL] > 0)
427
+                    {
428
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
429
+                    }
430
+                    else
431
+                    {
432
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
433
+                    }
434
+
435
+                    pic_on = pictureBox_PATH_3_5G_H_ON;
436
+                    pic_off = pictureBox_PATH_3_5G_H_OFF;
437
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_H] > 0)
438
+                    {
439
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
440
+                    }
441
+                    else
442
+                    {
443
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
444
+                    }
445
+
446
+                    pic_on = pictureBox_PATH_3_5G_L_ON;
447
+                    pic_off = pictureBox_PATH_3_5G_L_OFF;
448
+                    if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_L] > 0)
449
+                    {
450
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
451
+                    }
452
+                    else
453
+                    {
454
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
455
+                    }
456
+
457
+                    pic_on = pictureBox_PLL_ON_OFF_3_5G_H_ON;
458
+                    pic_off = pictureBox_PLL_ON_OFF_3_5G_H_OFF;
459
+                    if (data[(int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_H] > 0)
460
+                    {
461
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
462
+                    }
463
+                    else
464
+                    {
465
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
466
+                    }
467
+
468
+                    pic_on = pictureBox_PLL_ON_OFF_3_5G_L_ON;
469
+                    pic_off = pictureBox_PLL_ON_OFF_3_5G_L_OFF;
470
+                    if (data[(int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L] > 0)
471
+                    {
472
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true);
473
+                    }
474
+                    else
475
+                    {
476
+                        this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false);
477
+                    }
341 478
                     // this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL2]);
342 479
 
343 480
                 }
@@ -346,6 +483,15 @@ namespace RF_TRIO_PLL_ZIG
346 483
 
347 484
             catch { /*MessageBox.Show("What is this?");*/ }
348 485
         }
486
+        private delegate void PictureBoxSend(object picon, object picoff, bool set);
487
+        private void PictureBox_On_OFF_Set(object pic_on,object pic_off,bool set)
488
+        {
489
+            
490
+            PictureBox picture_on = (PictureBox)pic_on;
491
+            PictureBox picture_off = (PictureBox)pic_off;
492
+            picture_on.Visible = set;
493
+            picture_off.Visible =!set;
494
+        }
349 495
         public void ReSetting_Values(byte[] temp_buf)
350 496
         {
351 497
             this.numericUpDown_ATT_1_8G_DL1.Text = temp_buf[(byte)Bluecell_TypeIndex_t.ATT_1_8G_DL1].ToString();
@@ -498,7 +644,25 @@ namespace RF_TRIO_PLL_ZIG
498 644
 
499 645
         private void button1_Click(object sender, EventArgs e)
500 646
         {
501
-            Crc16 crc16 = new Crc16();
647
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, "0.0");
648
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, "0.0");
649
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL1, "0.0");
650
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL2, "0.0");
651
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL3, "0.0");
652
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL4, "0.0");
653
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL1, "0.0");
654
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL2, "0.0");
655
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL1, "0.0");
656
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL2, "0.0");
657
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL3, "0.0");
658
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL4, "0.0");
659
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_DL, "0.0");
660
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_UL, "0.0");
661
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM1, "0.0");
662
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM2, "0.0");
663
+            this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM3, "0.0");
664
+            Button_Set_Click(sender, e);
665
+            /*Crc16 crc16 = new Crc16();
502 666
             byte[] temp_buf = new byte[6];
503 667
             temp_buf[0] = 0xbe;
504 668
             temp_buf[1] = 2;
@@ -506,7 +670,8 @@ namespace RF_TRIO_PLL_ZIG
506 670
             temp_buf[3] = 5;
507 671
             temp_buf[4] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
508 672
             temp_buf[5] = 0xeb;
509
-            serial.Serial_DataSend(temp_buf, temp_buf[2] + 2);
673
+            serial.Serial_DataSend(temp_buf, temp_buf[2] + 2);*/
674
+
510 675
         }
511 676
 
512 677
 
@@ -536,6 +701,19 @@ namespace RF_TRIO_PLL_ZIG
536 701
             GroupBox grp = (GroupBox)sender;
537 702
             grp.Focus();
538 703
         }
539
-           
704
+
705
+        private void button_Save_Click(object sender, EventArgs e)
706
+        {
707
+            Crc16 crc16 = new Crc16();
708
+            byte[] temp_buf = new byte[6];
709
+
710
+            temp_buf[0] = 0xbe;
711
+            temp_buf[1] = 3;
712
+            temp_buf[2] = 3;
713
+            temp_buf[3] = 4;
714
+            temp_buf[4] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
715
+            temp_buf[5] = 0xeb;
716
+            serial.Serial_DataSend(temp_buf, temp_buf[2] + 3);
717
+        }
540 718
     }
541 719
 }