|
|
@@ -5,9 +5,9 @@ using System.Linq;
|
|
5
|
5
|
using System.Text;
|
|
6
|
6
|
using System.Threading.Tasks;
|
|
7
|
7
|
|
|
8
|
|
-
|
|
9
|
8
|
using System.Windows.Forms;
|
|
10
|
9
|
|
|
|
10
|
+
|
|
11
|
11
|
namespace Basic_Terminal
|
|
12
|
12
|
{
|
|
13
|
13
|
class Update_Serial
|
|
|
@@ -30,8 +30,8 @@ namespace Basic_Terminal
|
|
30
|
30
|
const int POLYNOMIAL = 0x131; // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
|
|
31
|
31
|
Bluecell_BootProtocol Bluecell_BootProtocol = new Bluecell_BootProtocol();
|
|
32
|
32
|
Download_bar download_Bar = new Download_bar();
|
|
33
|
|
-
|
|
34
|
|
-
|
|
|
33
|
+ private delegate void StringSend(string Text);
|
|
|
34
|
+ private delegate void VoidSend();
|
|
35
|
35
|
OpenFileDialog ofd;
|
|
36
|
36
|
Serial serial;
|
|
37
|
37
|
|
|
|
@@ -84,7 +84,6 @@ namespace Basic_Terminal
|
|
84
|
84
|
|
|
85
|
85
|
Firmware_byte_load = File.ReadAllBytes(this.ofd.FileName);
|
|
86
|
86
|
FirmTotalcnt = Firmware_byte_load.Length / Termianl_Controller_FirmwareUpdateLen;
|
|
87
|
|
- // for (int i = 0; i < Termianl_Controller_FirmwareUpdateLen; i++)
|
|
88
|
87
|
|
|
89
|
88
|
FirmCurrcnt = 0;
|
|
90
|
89
|
PreFirmSendingcnt = 0;
|
|
|
@@ -95,18 +94,14 @@ namespace Basic_Terminal
|
|
95
|
94
|
tempdata[2] = 0x02;
|
|
96
|
95
|
tempdata[3] = STH30_CreateCrc(tempdata, tempdata[2]);
|
|
97
|
96
|
tempdata[4] = 0xeb;
|
|
98
|
|
- /*try
|
|
99
|
|
- {
|
|
100
|
|
- serialPort1.Write(tempdata, 0, 5);
|
|
101
|
|
- }
|
|
102
|
|
- catch { MessageBox.Show("Port Open Failed!!!"); }*/
|
|
|
97
|
+
|
|
103
|
98
|
this.serial.Serial_DataSend(tempdata, 5);
|
|
104
|
99
|
try
|
|
105
|
100
|
{
|
|
106
|
101
|
// Controller_Debug.Controller_TX_TextLoad(tempdata);
|
|
107
|
102
|
}
|
|
108
|
103
|
catch { }
|
|
109
|
|
- //download_Bar.ShowDialog();
|
|
|
104
|
+ download_Bar.ShowDialog();
|
|
110
|
105
|
/*Update_label.Visible = true;
|
|
111
|
106
|
progressBar1.Visible = true;*/
|
|
112
|
107
|
return fileFullName;
|
|
|
@@ -159,9 +154,12 @@ namespace Basic_Terminal
|
|
159
|
154
|
}
|
|
160
|
155
|
temp_data[temp_data[2] + 1] = STH30_CreateCrc(temp_data, temp_data[2]);
|
|
161
|
156
|
temp_data[temp_data[2] + 2] = blucell_etx;
|
|
162
|
|
- /*ownload_Bar.ShowDialog();
|
|
163
|
|
- download_Bar.Progressbar("0 %");
|
|
164
|
|
- download_Bar.Close();*/
|
|
|
157
|
+ /*ownload_Bar.ShowDialog();*/
|
|
|
158
|
+ this.download_Bar.Invoke(new StringSend(this.download_Bar.Progressbar), "0 %");
|
|
|
159
|
+ //download_Bar.Progressbar("0 %");
|
|
|
160
|
+
|
|
|
161
|
+ this.download_Bar.FormClosed(this.download_Bar);
|
|
|
162
|
+
|
|
165
|
163
|
/*Update_label.Text = "0%";
|
|
166
|
164
|
Update_label.Visible = false;
|
|
167
|
165
|
progressBar1.Visible = false;
|
|
|
@@ -204,13 +202,15 @@ namespace Basic_Terminal
|
|
204
|
202
|
int tempupdateret = Firmware_byte_load.Length / 100;
|
|
205
|
203
|
tempupdateret = FirmSendingcnt / tempupdateret;
|
|
206
|
204
|
//CheckForIllegalCrossThreadCalls = false;
|
|
207
|
|
- //Update_label.Text = Convert.ToString(tempupdateret) + "%";
|
|
|
205
|
+ this.download_Bar.Update_Percent(Convert.ToString(tempupdateret));
|
|
208
|
206
|
if (pretempupdateret != tempupdateret)
|
|
209
|
207
|
{
|
|
210
|
208
|
|
|
211
|
|
- for (int i = 0; i < tempupdateret - pretempupdateret; i++)
|
|
|
209
|
+ for (int i = 0; i <= tempupdateret - this.download_Bar.Update_get(); i++)
|
|
212
|
210
|
{
|
|
213
|
|
- // progressBar1.PerformStep();
|
|
|
211
|
+ this.download_Bar.PerformStepup(this.download_Bar);
|
|
|
212
|
+ //this.download_Bar.PerformStepinc(tempupdateret);
|
|
|
213
|
+ // progressBar1.PerformStep();
|
|
214
|
214
|
}
|
|
215
|
215
|
|
|
216
|
216
|
pretempupdateret = tempupdateret;
|