瀏覽代碼

INDEX PROTOCOL 추가 / 불필요한 update protocol 제거

YJ 6 年之前
父節點
當前提交
99d6382c59

+ 207 - 9
Basic_Terminal/Func/Bluecell_BootProtocol.cs

@@ -20,13 +20,108 @@ namespace RF_TRIO_PLL_ZIG
20 20
         bluecell_data,
21 21
 
22 22
     };
23
-    enum Updateseq
23
+    public enum Updateseq
24 24
     {
25 25
         Bluecell_Reset = 0,
26 26
         Bluecell_Firmupdate_start,
27 27
         Bluecell_Firmupdate_sending,
28 28
         Bluecell_Firmupdate_end,
29 29
     };
30
+    enum Bluecell_ProtIndex_p
31
+    {
32
+        Bluecell_Header = 0,
33
+        Bluecell_Type,
34
+        Bluecell_Length,
35
+        Bluecell_CrcIndex,
36
+        Bluecell_data,
37
+    }
38
+    enum Bluecell_Prot_t{
39
+        TYPE_BLUECELL_RESET = 0,
40
+        TYPE_BLUECELL_SET   = 1,
41
+        TYPE_BLUECELL_GET   = 2,
42
+    };
43
+    enum Bluecell_TypeIndex_t
44
+    {
45
+        ATT_1_8G_DL1 = 0,
46
+        ATT_1_8G_DL2,
47
+
48
+        ATT_1_8G_UL1,
49
+        ATT_1_8G_UL2,
50
+        ATT_1_8G_UL3,
51
+        ATT_1_8G_UL4,
52
+
53
+        ATT_2_1G_DL1,
54
+        ATT_2_1G_DL2,
55
+
56
+        ATT_2_1G_UL1,
57
+        ATT_2_1G_UL2,
58
+        ATT_2_1G_UL3,
59
+        ATT_2_1G_UL4,
60
+
61
+        ATT_3_5G_DL,
62
+        ATT_3_5G_UL,
63
+        ATT_3_5G_COM1,
64
+        ATT_3_5G_COM2,
65
+        ATT_3_5G_COM3,
66
+
67
+        PLL_1_8G_DL1_H,
68
+        PLL_1_8G_DL1_L,
69
+        PLL_1_8G_DL2_H,
70
+        PLL_1_8G_DL2_L,
71
+
72
+        PLL_2_1G_DL1_H,
73
+        PLL_2_1G_DL1_L,
74
+        PLL_2_1G_DL2_H,
75
+        PLL_2_1G_DL2_L,
76
+
77
+        PLL_3_5G_DL1_H,
78
+        PLL_3_5G_DL1_L,
79
+        PLL_3_5G_DL2_H,
80
+        PLL_3_5G_DL2_L,
81
+
82
+        PLL_LD_6_BIT,
83
+
84
+        DET_1_8G_DL_IN_H,
85
+        DET_1_8G_DL_IN_L,
86
+        DET_1_8G_DL_OUT_H,
87
+        DET_1_8G_DL_OUT_L,
88
+        DET_1_8G_UL_IN_H,
89
+        DET_1_8G_UL_IN_L,
90
+        DET_1_8G_UL_OUT_H,
91
+        DET_1_8G_UL_OUT_L,
92
+        DET_2_1G_DL_IN_H,
93
+        DET_2_1G_DL_IN_L,
94
+        DET_2_1G_DL_OUT_H,
95
+        DET_2_1G_DL_OUT_L,
96
+        DET_2_1G_UL_IN_H,
97
+        DET_2_1G_UL_IN_L,
98
+        DET_2_1G_UL_OUT_H,
99
+        DET_2_1G_UL_OUT_L,
100
+        DET_3_5G_DL_IN_H,
101
+        DET_3_5G_DL_IN_L,
102
+        DET_3_5G_DL_OUT_L,
103
+        DET_3_5G_DL_OUT_H,
104
+        DET_3_5G_UL_IN_H,
105
+        DET_3_5G_UL_IN_L,
106
+        DET_3_5G_UL_OUT_H,
107
+        DET_3_5G_UL_OUT_L,
108
+        RFU_TEMP_H,
109
+        RFU_TEMP_L,
110
+        _28V_DET_H,
111
+        _28V_DET_L,
112
+        ALARM_AC,
113
+        ALARM_DC,
114
+        PATH_EN_1_8G_DL,
115
+        PATH_EN_1_8G_UL,
116
+        PATH_EN_2_1G_DL,
117
+        PATH_EN_2_1G_UL,
118
+        PATH_EN_3_5G_L,
119
+        PATH_EN_3_5G_H,
120
+        PATH_EN_3_5G_DL,
121
+        PATH_EN_3_5G_UL,
122
+        PLL_ON_OFF_3_5G_H,
123
+        PLL_ON_OFF_3_5G_L,
124
+    };
30 125
     class Bluecell_BootProtocol
31 126
     {
32 127
         Serial serial;
@@ -40,14 +135,117 @@ namespace RF_TRIO_PLL_ZIG
40 135
 
41 136
 
42 137
         public const int bluecell_Firmupdate_sendlength = 1024;
43
-        public const byte bluecell_header    = 4;
44
-        public const byte bluecell_type      = 1;
45
-        public const byte bluecell_length    = 2;
46
-        public const byte bluecell_updatecnt = 2;
47
-        public const byte bluecell_crc16     = 2;
48
-        public const byte bluecell_nessarybyte = bluecell_header + bluecell_type + bluecell_length + bluecell_updatecnt + bluecell_crc16;
138
+
139
+        
49 140
         Crc16 crc16 = new Crc16();
50 141
 
142
+        public const byte BLUECELL_HEADER = 0xBE;
143
+        public const byte BLUECELL_TAILER = 0xEB;
144
+        const byte BLUECELL_RESET_LENGTH = 6;
145
+        const byte BLUECELL_FIX_DATA_LENGTH = 3;
146
+
147
+        public void Bluecell_Reset(object serial)
148
+        {
149
+            this.serial = (Serial)serial;
150
+            byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
151
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header]       = BLUECELL_HEADER;
152
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]         = (byte)Bluecell_Prot_t.TYPE_BLUECELL_RESET;
153
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length]       = BLUECELL_RESET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
154
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex]     = (byte)Bluecell_ProtIndex_p.Bluecell_data;
155
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data]         = crc16.STH30_CreateCrc(temp_buf, BLUECELL_RESET_LENGTH - 3);
156
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1]     = BLUECELL_TAILER;
157
+            this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
158
+        }
159
+        const byte BLUECELL_DATA_SET_LENGTH = 62;
160
+        public void Bluecell_BtnSet(object serial,object main_form)
161
+        {
162
+            Main_Form main_Form = (Main_Form)main_form;
163
+            this.serial = (Serial)serial;
164
+            byte[] temp_buf = new byte[BLUECELL_DATA_SET_LENGTH];
165
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header]   = BLUECELL_HEADER;
166
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]     = (byte)Bluecell_Prot_t.TYPE_BLUECELL_SET;
167
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length]   = BLUECELL_RESET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
168
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = (byte)BLUECELL_DATA_SET_LENGTH - 2;
169
+
170
+
171
+
172
+
173
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_DL1] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_DL1.Text);
174
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_DL2] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_DL2.Text);
175
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL1] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL1.Text);
176
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL2] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL2.Text);
177
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL3] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL3.Text);
178
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL4] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL4.Text);
179
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_DL1] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_DL1.Text);
180
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_DL2] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_DL2.Text);
181
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL1] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL1.Text);
182
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL2] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL2.Text);
183
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL3] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL3.Text);
184
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL4] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL4.Text);
185
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_DL] =
186
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_UL] =
187
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM1] =
188
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM2] =
189
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM3] =
190
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL1_H] =
191
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL1_L] =
192
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL2_H] =
193
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL2_L] =
194
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL1_H] =
195
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL1_L] =
196
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL2_H] =
197
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL2_L] =
198
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL1_H] =
199
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL1_L] =
200
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL2_H] =
201
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL2_L] =
202
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_LD_6_BIT] =
203
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_H] =
204
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_L] =
205
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_H] =
206
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_L] =
207
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_H] =
208
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_L] =
209
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_H] =
210
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_L] =
211
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_H] =
212
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_L] =
213
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_H] =
214
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_L] =
215
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_H] =
216
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_L] =
217
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_H] =
218
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_L] =
219
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_H] =
220
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_L] =
221
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_L] =
222
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_H] =
223
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_H] =
224
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_L] =
225
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_H] =
226
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_L] =
227
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.RFU_TEMP_H] =
228
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.RFU_TEMP_L] =
229
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._28V_DET_H] =
230
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._28V_DET_L] =
231
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ALARM_AC] =
232
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ALARM_DC] =
233
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_1_8G_DL] =
234
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_1_8G_UL] =
235
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_2_1G_DL] =
236
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_2_1G_UL] =
237
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_L] =
238
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_H] =
239
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_DL] =
240
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_UL] =
241
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_H] =
242
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L] =
243
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L + 1] = crc16.STH30_CreateCrc(temp_buf, BLUECELL_RESET_LENGTH - 3);
244
+
245
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = BLUECELL_TAILER;
246
+            this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
247
+        }
248
+#if false
51 249
         public int Bluecell_Firmupdate_sendlength() {
52 250
             return bluecell_Firmupdate_sendlength;
53 251
         }
@@ -115,6 +313,6 @@ namespace RF_TRIO_PLL_ZIG
115 313
             return fix_data;
116 314
         }
117 315
 
316
+#endif
317
+    }
118 318
     }
119
-
120
-}

+ 0 - 146
Basic_Terminal/Func/FileDownload.cs

@@ -1,146 +0,0 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6
-
7
-using System.Windows.Forms;
8
-using System.IO;
9
-using System.IO.Ports;
10
-namespace RF_TRIO_PLL_ZIG
11
-{
12
-    enum DataSeq
13
-    {
14
-        UpdateResetOK = 0,
15
-        UpdateStartOK,
16
-        UpdateSendingOK,
17
-        UpdateEndOK,
18
-    }
19
-    class FileDownload
20
-    {
21
-        
22
-        Bluecell_BootProtocol Bluecell_BootProtocol = new Bluecell_BootProtocol();
23
-        byte[] All_update_data;
24
-        /***
25
-         *Data File open
26
-        */
27
-        OpenFileDialog ofd;
28
-        Serial serial;
29
-
30
-        public bool Update_ready = false;
31
-        
32
-        public string ShowFileOpenDialog(ref object serial,object ofd)
33
-        {
34
-            this.ofd = (OpenFileDialog)ofd;
35
-            this.serial = (Serial)serial;
36
-            this.ofd.Title = "업데이터 파일 탐색기";//파일오픈창 생성 및 설정
37
-            this.ofd.FileName = "*.bin";
38
-            //ofd.Filter = "bin 파일 (*.bin) | *.bin; | 모든 파일 (*.*) | *.*";
39
-            this.ofd.Filter = "bin 파일 (*.bin) | *.bin;";
40
-            DialogResult dr = this.ofd.ShowDialog();            //파일 오픈창 로드
41
-            if (dr == DialogResult.OK)//OK버튼 클릭시
42
-            {
43
-                string fileName = this.ofd.SafeFileName;                //File명과 확장자를 가지고 온다.
44
-                string fileFullName = this.ofd.FileName;//File경로와 File명을 모두 가지고 온다.
45
-                string filePath = fileFullName.Replace(fileName, "");//File경로만 가지고 온다.
46
-               
47
-
48
-                this.serial.FileDownloadClass_Get(this);
49
-                All_update_data = File.ReadAllBytes(this.ofd.FileName);
50
-                Bluecell_BootProtocol.Boot_Reset(this.serial, All_update_data);
51
-                //byte[] updatedata = Bluecell_BootProtocol.Boot_DataSending(All_update_data, (Bluecell_BootProtocol.bluecell_Firmupdate_sendlength - 11), (UInt16)0);
52
-                //this.serial.Serial_DataSend(updatedata);
53
-
54
-                Update_ready = true;
55
-                return fileFullName;
56
-            }
57
-            else if (dr == DialogResult.Cancel)//취소버튼 클릭시 또는 ESC키로 파일창을 종료 했을경우
58
-            {
59
-                return "";
60
-            }
61
-            return "";
62
-        }
63
-
64
-#if false
65
-        public void Recv_dataCheck(byte[] data)
66
-        {
67
-            Boolean HeaderCheck = Serial_HeaderCheck(data);
68
-            int DataAckcnt = data[(int)Bluepro_t.bluecell_type + 1];
69
-            if (HeaderCheck == false)
70
-            {
71
-                return;
72
-            }
73
-            else
74
-            {
75
-                DataSeq seq = DataSeq.UpdateResetOK;
76
-                switch (seq)
77
-                {
78
-                    case DataSeq.UpdateSendingOK:
79
-                        UpdateFileSend(data, DataAckcnt);
80
-                        break;
81
-                    case DataSeq.UpdateEndOK:
82
-                        break;
83
-                    default:
84
-                        break;
85
-                }
86
-            }
87
-        }
88
-#endif
89
-        int sourceindex = 0;
90
-        public void UpdateFileSend(byte[] data,int cnt)
91
-        {
92
-            if (this.serial == null)
93
-                return;
94
-            /*Define*/
95
-            int Quotient = 0, remainder = 0;
96
-           
97
-            byte[] updatedata = new byte[Bluecell_BootProtocol.bluecell_Firmupdate_sendlength];
98
-            /*Filse size */
99
-            Quotient = All_update_data.Length / (Bluecell_BootProtocol.bluecell_Firmupdate_sendlength - 11);
100
-            remainder = All_update_data.Length % (Bluecell_BootProtocol.bluecell_Firmupdate_sendlength - 11);
101
-            /*file copy*/
102
-            // Header : 4byte + Type : 1byte + Length : 2byte + update_cnt : 2byte = 9byte  /* CRC :2byte  */ : Total : 11byte
103
-            Array.Copy(All_update_data, sourceindex, updatedata, Bluecell_BootProtocol.bluecell_nessarybyte - 2, (Bluecell_BootProtocol.bluecell_Firmupdate_sendlength - 11)); 
104
-            /*file write*/
105
-            if (remainder > 0 && cnt > Quotient)
106
-            {
107
-                this.serial.Serial_DataSend(data, remainder);
108
-                sourceindex = 0;
109
-                All_update_data = null;
110
-            }
111
-            else
112
-            {
113
-                data = Bluecell_BootProtocol.Boot_DataSending(updatedata, (Bluecell_BootProtocol.bluecell_Firmupdate_sendlength - 11), (UInt16)cnt);
114
-                this.serial.Serial_DataSend(data,Bluecell_BootProtocol.bluecell_Firmupdate_sendlength);
115
-                /*send index modify*/
116
-                sourceindex = (cnt + 1)  * (Bluecell_BootProtocol.bluecell_Firmupdate_sendlength - 11);
117
-            }
118
-        }
119
-        public static string AsciiToHex(string asciiString)
120
-        {
121
-            StringBuilder builder = new StringBuilder();
122
-            foreach (char c in asciiString)
123
-            {
124
-                builder.Append(Convert.ToInt32(c).ToString("X"));
125
-            }
126
-            return builder.ToString();
127
-        }
128
-
129
-        public Boolean Serial_HeaderCheck(byte[] data)
130
-        {
131
-            Boolean ret = false;
132
-
133
-            if (data[(int)Bluepro_t.bluecell_header0] == Bluecell_BootProtocol.Bluecell_Header0
134
-                && data[(int)Bluepro_t.bluecell_header1] == Bluecell_BootProtocol.Bluecell_Header1
135
-                && data[(int)Bluepro_t.bluecell_header2] == Bluecell_BootProtocol.Bluecell_Header2
136
-                && data[(int)Bluepro_t.bluecell_header3] == Bluecell_BootProtocol.Bluecell_Header3
137
-                )/*모든 Header OK */
138
-            {
139
-                ret = true;
140
-            }
141
-            return ret;
142
-        }
143
-
144
-       
145
-    }
146
-}

+ 4 - 2
Basic_Terminal/Func/Update_Serial.cs

@@ -90,13 +90,15 @@ namespace RF_TRIO_PLL_ZIG
90 90
                 PreFirmSendingcnt = 0;
91 91
                 FirmSendingcnt = 0;
92 92
                 Update_ready = true;
93
+                Bluecell_BootProtocol.Bluecell_Reset(this.serial);
94
+            /*    
93 95
                 tempdata[0] = 0xbe;
94 96
                 tempdata[1] = Termianl_Reset;
95 97
                 tempdata[2] = 0x02;
96 98
                 tempdata[3] = STH30_CreateCrc(tempdata, tempdata[2]);
97 99
                 tempdata[4] = 0xeb;
98 100
                
99
-                this.serial.Serial_DataSend(tempdata, 5);
101
+                this.serial.Serial_DataSend(tempdata, 5);*/
100 102
                 try
101 103
                 {
102 104
                    // Controller_Debug.Controller_TX_TextLoad(tempdata);
@@ -231,7 +233,7 @@ namespace RF_TRIO_PLL_ZIG
231 233
         public void Termianl__Operate(byte[] Text)
232 234
         {
233 235
             byte Type = 0;
234
-            Type = Text[Bluecell_BootProtocol.bluecell_type];
236
+            Type = Text[(int)Bluecell_ProtIndex_p.Bluecell_Type];
235 237
             switch (Type)
236 238
             {
237 239
                

+ 0 - 1
Basic_Terminal/RF_TRIO_PLL_ZIG.csproj

@@ -49,7 +49,6 @@
49 49
     <Compile Include="Func\Bluecell_BootProtocol.cs" />
50 50
     <Compile Include="Func\Crc16.cs" />
51 51
     <Compile Include="Func\Data_Handler.cs" />
52
-    <Compile Include="Func\FileDownload.cs" />
53 52
     <Compile Include="Func\Update_Serial.cs" />
54 53
     <Compile Include="Properties\Resources.Designer.cs">
55 54
       <AutoGen>True</AutoGen>

文件差異過大導致無法顯示
+ 288 - 287
Basic_Terminal/Wnd/Main_Form.Designer.cs


+ 6 - 1
Basic_Terminal/Wnd/Main_Form.cs

@@ -17,7 +17,7 @@ namespace RF_TRIO_PLL_ZIG
17 17
     public partial class Main_Form : Form
18 18
     {
19 19
         Serial serial = new Serial(); // Uart Open
20
-        
20
+        Bluecell_BootProtocol bluecell_BootProtocol = new Bluecell_BootProtocol;
21 21
         Update_Serial file = new Update_Serial();
22 22
         public Main_Form()
23 23
         {
@@ -82,5 +82,10 @@ namespace RF_TRIO_PLL_ZIG
82 82
         {
83 83
 
84 84
         }
85
+
86
+        private void button_Set_Click(object sender, EventArgs e)
87
+        {
88
+            bluecell_BootProtocol.Bluecell_BtnSet(this.serial);
89
+        }
85 90
     }
86 91
 }