Parcourir la source

Serial Debug 창 떠있을 때 Ascii 동작 안하도록 수정 / binary 확장자 추가 / radiobutton Ascii > hex 메소드 추가

Dialog 내부 지역함수로 변경
YJ il y a 6 ans
Parent
commit
2bb5be66ad

+ 11 - 3
Basic_Terminal/Func/Serial.cs

@@ -73,7 +73,7 @@ namespace Basic_Terminal
73 73
        
74 74
         public void Serial_DataRecvFunction(object sender, SerialDataReceivedEventArgs e)
75 75
         {
76
-            if (Debug.RadioButton_ascii.Checked == true)
76
+            if (this.Debug.Created && Debug.RadioButton_ascii.Checked == true)
77 77
             {
78 78
                 string data = serialPort.ReadExisting();
79 79
                 if (Debug.Created)
@@ -93,8 +93,11 @@ namespace Basic_Terminal
93 93
 
94 94
                 if (nLnegth > 0)
95 95
                 {
96
-                    string tmpSTR = Encoding.Default.GetString(btdata).TrimEnd('\0');
97
-                    Debug.Invoke(new StringSend(Debug.Data_Recv_Str), Str2hex(tmpSTR, true));
96
+                    if (this.Debug.Created)
97
+                    {
98
+                        string tmpSTR = Encoding.Default.GetString(btdata).TrimEnd('\0');
99
+                        Debug.Invoke(new StringSend(Debug.Data_Recv_Str), Str2hex(tmpSTR, true));
100
+                    }
98 101
                     data_Handler.Recv_dataCheck(this.fileDownload, btdata);
99 102
                    
100 103
                     // 이부분에서 데이타 처리하는 부분으로 전송하여 사용하면 됨
@@ -177,5 +180,10 @@ namespace Basic_Terminal
177 180
             //this.serialPort.Write(tempdata.ToString());
178 181
 
179 182
         }
183
+        public void debug_hextoasciiConvert()
184
+        {
185
+            if(this.Debug.Created)
186
+                this.Debug.hex_to_ascii_radiobuttonConvert();
187
+        }
180 188
     }
181 189
 }

+ 4 - 2
Basic_Terminal/Func/Update_Serial.cs

@@ -58,8 +58,8 @@ namespace Basic_Terminal
58 58
             this.serial = (Serial)serial;
59 59
             //파일오픈창 생성 및 설정
60 60
             this.ofd.Title = "업데이터 파일 탐색기";
61
-            this.ofd.FileName = "STM32F103_Termianl_Controller";
62
-            this.ofd.Filter = "bin 파일 (*.bin) | *.bin; | 모든 파일 (*.*) | *.*";
61
+            this.ofd.FileName = "*.binary";
62
+            this.ofd.Filter = "binary 파일 (*.binary) | *.binary; |bin 파일 (*.bin) | *.bin; | 모든 파일 (*.*) | *.*";
63 63
 
64 64
             //파일 오픈창 로드
65 65
             DialogResult dr = this.ofd.ShowDialog();
@@ -73,6 +73,7 @@ namespace Basic_Terminal
73 73
                 string fileFullName = this.ofd.FileName;
74 74
                 //File경로만 가지고 온다.
75 75
                 string filePath = fileFullName.Replace(fileName, "");
76
+                this.serial.debug_hextoasciiConvert();
76 77
 
77 78
                 //출력 예제용 로직
78 79
                 //  label1.Text = "File Name  : " + fileName;
@@ -263,5 +264,6 @@ namespace Basic_Terminal
263 264
             }
264 265
             return (byte)crc;
265 266
         }
267
+        
266 268
     }
267 269
 }

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

@@ -48,10 +48,10 @@
48 48
             this.tbReceived.MaxLength = 0;
49 49
             this.tbReceived.Name = "tbReceived";
50 50
             this.tbReceived.ReadOnly = true;
51
+            this.tbReceived.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
51 52
             this.tbReceived.Size = new System.Drawing.Size(800, 403);
52 53
             this.tbReceived.TabIndex = 63;
53 54
             this.tbReceived.Text = "";
54
-            this.tbReceived.WordWrap = false;
55 55
             // 
56 56
             // groupBox1
57 57
             // 

+ 5 - 0
Basic_Terminal/Wnd/Debug.cs

@@ -160,5 +160,10 @@ namespace Basic_Terminal
160 160
             }
161 161
             finally { }
162 162
         }
163
+        public void hex_to_ascii_radiobuttonConvert()
164
+        {
165
+            radioButton_hex.Checked = true;
166
+            radioButton_ascii.Checked = false;
167
+        }
163 168
     }
164 169
 }

+ 2 - 2
Basic_Terminal/Wnd/Main_Form.cs

@@ -17,7 +17,7 @@ namespace Basic_Terminal
17 17
     public partial class Main_Form : Form
18 18
     {
19 19
         Serial serial = new Serial(); // Uart Open
20
-        OpenFileDialog ofd = new OpenFileDialog();
20
+        
21 21
         Update_Serial file = new Update_Serial();
22 22
         public Main_Form()
23 23
         {
@@ -27,7 +27,7 @@ namespace Basic_Terminal
27 27
        
28 28
         private void Firmware_Update_Click(object sender, EventArgs e)
29 29
         {
30
-            
30
+            OpenFileDialog ofd = new OpenFileDialog();
31 31
             //FileDownload file = new FileDownload();
32 32
             if (Ascii_checkBox.Checked == true)
33 33
                 Ascii_checkBox.Checked = false;