|
@@ -30,13 +30,10 @@ CBlueFlashToolDlg::CBlueFlashToolDlg(CWnd* pParent /*=NULL*/) |
|
@@ -30,13 +30,10 @@ CBlueFlashToolDlg::CBlueFlashToolDlg(CWnd* pParent /*=NULL*/) |
|
30
|
//}}AFX_DATA_INIT
|
30
|
//}}AFX_DATA_INIT
|
|
31
|
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
31
|
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
|
32
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
32
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|
33
|
- for (int i=0;i<10;i++)
|
|
|
|
34
|
- {
|
|
|
|
35
|
- ifUartEnable[BLUE_TYPE_USB][i] = false;
|
|
|
|
36
|
- ifUartEnable[BLUE_TYPE_EAR][i] = false;
|
|
|
|
37
|
- }
|
33
|
+ memset(ifUartEnable,0,BLUE_TYPE_MAX*MAX_TOPWELL_DEVICE_NUM);
|
|
38
|
memcpy(strSignalFlashReady,"\xFC\x4F\x70\x74\x65\x6B\x20\x52\x4F\x4D\x20\x62\x6F\x6F\x74\x00",16);
|
34
|
memcpy(strSignalFlashReady,"\xFC\x4F\x70\x74\x65\x6B\x20\x52\x4F\x4D\x20\x62\x6F\x6F\x74\x00",16);
|
|
39
|
memcpy(strSignalFlashing,"\x50\x72\x6F\x67\x72\x61\x6D\x6D\x69\x6E\x67\x3A\x00",13);
|
35
|
memcpy(strSignalFlashing,"\x50\x72\x6F\x67\x72\x61\x6D\x6D\x69\x6E\x67\x3A\x00",13);
|
|
|
|
36
|
+ mystrAppcurrDir = GetCurrPath();
|
|
40
|
}
|
37
|
}
|
|
41
|
|
38
|
|
|
42
|
void CBlueFlashToolDlg::DoDataExchange(CDataExchange* pDX)
|
39
|
void CBlueFlashToolDlg::DoDataExchange(CDataExchange* pDX)
|
|
@@ -159,6 +156,7 @@ BEGIN_MESSAGE_MAP(CBlueFlashToolDlg, CDialog) |
|
@@ -159,6 +156,7 @@ BEGIN_MESSAGE_MAP(CBlueFlashToolDlg, CDialog) |
|
159
|
|
156
|
|
|
160
|
ON_WM_DESTROY()
|
157
|
ON_WM_DESTROY()
|
|
161
|
ON_BN_CLICKED(IDC_START_ALL, &CBlueFlashToolDlg::OnBnClickedStartAll)
|
158
|
ON_BN_CLICKED(IDC_START_ALL, &CBlueFlashToolDlg::OnBnClickedStartAll)
|
|
|
|
159
|
+ ON_BN_CLICKED(IDC_STOP_ALL, &CBlueFlashToolDlg::OnBnClickedStopAll)
|
|
162
|
END_MESSAGE_MAP()
|
160
|
END_MESSAGE_MAP()
|
|
163
|
|
161
|
|
|
164
|
/////////////////////////////////////////////////////////////////////////////
|
162
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -172,16 +170,18 @@ BOOL CBlueFlashToolDlg::OnInitDialog() |
|
@@ -172,16 +170,18 @@ BOOL CBlueFlashToolDlg::OnInitDialog() |
|
172
|
RECT rect_comport[BLUE_TYPE_MAX][MAX_TOPWELL_DEVICE_NUM];
|
170
|
RECT rect_comport[BLUE_TYPE_MAX][MAX_TOPWELL_DEVICE_NUM];
|
|
173
|
RECT rect_process_bar[BLUE_TYPE_MAX][MAX_TOPWELL_DEVICE_NUM];
|
171
|
RECT rect_process_bar[BLUE_TYPE_MAX][MAX_TOPWELL_DEVICE_NUM];
|
|
174
|
RECT rect_start_button[BLUE_TYPE_MAX][MAX_TOPWELL_DEVICE_NUM];
|
172
|
RECT rect_start_button[BLUE_TYPE_MAX][MAX_TOPWELL_DEVICE_NUM];
|
|
175
|
- RECT rect_SN_info[MAX_TOPWELL_DEVICE_NUM];
|
173
|
+ RECT rect_SN_info[BLUE_TYPE_MAX][MAX_TOPWELL_DEVICE_NUM];
|
|
176
|
RECT rect_this;
|
174
|
RECT rect_this;
|
|
177
|
CString m_strSettings;
|
175
|
CString m_strSettings;
|
|
178
|
|
176
|
|
|
179
|
CDialog::OnInitDialog();
|
177
|
CDialog::OnInitDialog();
|
|
180
|
|
178
|
|
|
|
|
179
|
+#ifdef __TOPWELL_EDIT_SN_ENABLE__
|
|
181
|
mybufferForFile = new BYTE [1024*1024*2];
|
180
|
mybufferForFile = new BYTE [1024*1024*2];
|
|
182
|
mybufferForFileUSB = new BYTE [1024*1024*2];
|
181
|
mybufferForFileUSB = new BYTE [1024*1024*2];
|
|
183
|
LoadBin((int)BLUE_TYPE_EAR);
|
182
|
LoadBin((int)BLUE_TYPE_EAR);
|
|
184
|
LoadBin((int)BLUE_TYPE_USB);
|
183
|
LoadBin((int)BLUE_TYPE_USB);
|
|
|
|
184
|
+#endif
|
|
185
|
GetWindowRect(&rect_this);
|
185
|
GetWindowRect(&rect_this);
|
|
186
|
myfontButton.CreateFont( 18,0,0,0,FW_NORMAL|FW_BOLD,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
|
186
|
myfontButton.CreateFont( 18,0,0,0,FW_NORMAL|FW_BOLD,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
|
|
187
|
DEFAULT_PITCH | FF_MODERN,_T("宋体") ) ;
|
187
|
DEFAULT_PITCH | FF_MODERN,_T("宋体") ) ;
|
|
@@ -200,26 +200,32 @@ BOOL CBlueFlashToolDlg::OnInitDialog() |
|
@@ -200,26 +200,32 @@ BOOL CBlueFlashToolDlg::OnInitDialog() |
|
200
|
{
|
200
|
{
|
|
201
|
for (loop2 = 0;loop2 <MAX_TOPWELL_DEVICE_NUM;loop2++)
|
201
|
for (loop2 = 0;loop2 <MAX_TOPWELL_DEVICE_NUM;loop2++)
|
|
202
|
{
|
202
|
{
|
|
203
|
- rect_pcb[loop1][loop2].left = 10+300*loop1;
|
|
|
|
204
|
- rect_comport[loop1][loop2].left = 30+300*loop1;
|
|
|
|
205
|
- rect_process_bar[loop1][loop2].left = 110+300*loop1;
|
|
|
|
206
|
- rect_start_button[loop1][loop2].left = 230+300*loop1;
|
203
|
+ rect_pcb[loop1][loop2].left = 10+400*loop1;
|
|
|
|
204
|
+ rect_comport[loop1][loop2].left = 30+400*loop1;
|
|
|
|
205
|
+ rect_process_bar[loop1][loop2].left = 110+400*loop1;
|
|
|
|
206
|
+ rect_start_button[loop1][loop2].left = 230+400*loop1;
|
|
|
|
207
|
+ rect_SN_info[loop1][loop2].left = 280+400*loop1;;
|
|
207
|
|
208
|
|
|
208
|
|
209
|
|
|
209
|
rect_pcb[loop1][loop2].right= rect_pcb[loop1][loop2].left+15;
|
210
|
rect_pcb[loop1][loop2].right= rect_pcb[loop1][loop2].left+15;
|
|
210
|
rect_comport[loop1][loop2].right = rect_comport[loop1][loop2].left+70;
|
211
|
rect_comport[loop1][loop2].right = rect_comport[loop1][loop2].left+70;
|
|
211
|
rect_process_bar[loop1][loop2].right = rect_process_bar[loop1][loop2].left+100;
|
212
|
rect_process_bar[loop1][loop2].right = rect_process_bar[loop1][loop2].left+100;
|
|
212
|
rect_start_button[loop1][loop2].right = rect_start_button[loop1][loop2].left+40;
|
213
|
rect_start_button[loop1][loop2].right = rect_start_button[loop1][loop2].left+40;
|
|
|
|
214
|
+ rect_SN_info[loop1][loop2].right = rect_SN_info[loop1][loop2].left+100;
|
|
213
|
|
215
|
|
|
214
|
rect_pcb[loop1][loop2].top = 30+25*loop2;
|
216
|
rect_pcb[loop1][loop2].top = 30+25*loop2;
|
|
215
|
rect_comport[loop1][loop2].top = 30+25*loop2;
|
217
|
rect_comport[loop1][loop2].top = 30+25*loop2;
|
|
216
|
rect_process_bar[loop1][loop2].top = 30+25*loop2;
|
218
|
rect_process_bar[loop1][loop2].top = 30+25*loop2;
|
|
217
|
rect_start_button[loop1][loop2].top = 30+25*loop2;
|
219
|
rect_start_button[loop1][loop2].top = 30+25*loop2;
|
|
|
|
220
|
+ rect_SN_info[loop1][loop2].top = 30+25*loop2;
|
|
218
|
|
221
|
|
|
219
|
rect_pcb[loop1][loop2].bottom= rect_pcb[loop1][loop2].top+20;
|
222
|
rect_pcb[loop1][loop2].bottom= rect_pcb[loop1][loop2].top+20;
|
|
220
|
rect_comport[loop1][loop2].bottom = rect_comport[loop1][loop2].top+200;
|
223
|
rect_comport[loop1][loop2].bottom = rect_comport[loop1][loop2].top+200;
|
|
221
|
rect_process_bar[loop1][loop2].bottom = rect_process_bar[loop1][loop2].top+20;
|
224
|
rect_process_bar[loop1][loop2].bottom = rect_process_bar[loop1][loop2].top+20;
|
|
222
|
rect_start_button[loop1][loop2].bottom = rect_start_button[loop1][loop2].top+20;
|
225
|
rect_start_button[loop1][loop2].bottom = rect_start_button[loop1][loop2].top+20;
|
|
|
|
226
|
+ rect_SN_info[loop1][loop2].bottom = rect_SN_info[loop1][loop2].top+20;
|
|
|
|
227
|
+
|
|
|
|
228
|
+
|
|
223
|
|
229
|
|
|
224
|
//PCB LED
|
230
|
//PCB LED
|
|
225
|
myctrlPcbState[loop1][loop2].Create(NULL, SS_BITMAP |WS_CHILD|WS_VISIBLE,
|
231
|
myctrlPcbState[loop1][loop2].Create(NULL, SS_BITMAP |WS_CHILD|WS_VISIBLE,
|
|
@@ -237,79 +243,67 @@ BOOL CBlueFlashToolDlg::OnInitDialog() |
|
@@ -237,79 +243,67 @@ BOOL CBlueFlashToolDlg::OnInitDialog() |
|
237
|
// Create a push button.
|
243
|
// Create a push button.
|
|
238
|
myctrlStartButton[loop1][loop2].Create("开始",WS_VISIBLE|BS_PUSHBUTTON,
|
244
|
myctrlStartButton[loop1][loop2].Create("开始",WS_VISIBLE|BS_PUSHBUTTON,
|
|
239
|
rect_start_button[loop1][loop2], this, IDC_BUTTON_START0+loop1*MAX_TOPWELL_DEVICE_NUM+loop2);
|
245
|
rect_start_button[loop1][loop2], this, IDC_BUTTON_START0+loop1*MAX_TOPWELL_DEVICE_NUM+loop2);
|
|
240
|
- //myctrlStartButton[loop1][loop2].set
|
|
|
|
241
|
- if (g_AppMainData.ary_myComPort[loop1][loop2]<2)
|
|
|
|
242
|
- myctrlStartButton[loop1][loop2].EnableWindow(FALSE);
|
|
|
|
243
|
- else
|
|
|
|
244
|
- {
|
|
|
|
245
|
- mycom[loop1][loop2].SetCommPort(g_AppMainData.ary_myComPort[loop1][loop2]); //选择com1
|
|
|
|
246
|
- mycom[loop1][loop2].SetInputMode(1);
|
|
|
|
247
|
- mycom[loop1][loop2].SetInputLen(512); //设置当前接收区数据长度为0
|
|
|
|
248
|
- mycom[loop1][loop2].SetOutBufferSize(512);//设置当前接收区数据长度为0
|
|
|
|
249
|
- mycom[loop1][loop2].SetSettings(m_strSettings); //波特率9600,无校验,8个数据位,1个停止位
|
|
|
|
250
|
- myctrlStartButton[loop1][loop2].EnableWindow(TRUE);
|
|
|
|
251
|
- }
|
|
|
|
252
|
-
|
|
|
|
253
|
- if (loop1 ==BLUE_TYPE_MAX-1 )
|
|
|
|
254
|
- {
|
|
|
|
255
|
- rect_SN_info[loop2].top = rect_start_button[loop1][loop2].top;
|
|
|
|
256
|
- rect_SN_info[loop2].left = rect_start_button[loop1][loop2].right + 15;
|
|
|
|
257
|
- rect_SN_info[loop2].right = rect_SN_info[loop2].left + 100;
|
|
|
|
258
|
- rect_SN_info[loop2].bottom = rect_start_button[loop1][loop2].bottom;
|
|
|
|
259
|
- myStaticSn[loop2].Create("SN号",WS_BORDER|WS_CHILD|WS_VISIBLE, rect_SN_info[loop2],
|
|
|
|
260
|
- this, IDC_STATIC_GROUP0+loop2);
|
|
|
|
261
|
- if (g_AppMainData.ary_myComPort[BLUE_TYPE_EAR][loop2]>2
|
|
|
|
262
|
- ||g_AppMainData.ary_myComPort[BLUE_TYPE_USB][loop2]>2)
|
|
|
|
263
|
- myStaticSn[loop2].EnableWindow(TRUE);
|
|
|
|
264
|
- else
|
|
|
|
265
|
- myStaticSn[loop2].EnableWindow(FALSE);
|
|
|
|
266
|
- }
|
246
|
+ myctrlStartButton[loop1][loop2].EnableWindow(FALSE);
|
|
|
|
247
|
+ myStaticSn[loop1][loop2].Create("文件名",WS_BORDER|WS_CHILD|WS_VISIBLE, rect_SN_info[loop1][loop2],
|
|
|
|
248
|
+ this, IDC_STATIC_GROUP0+loop1*MAX_TOPWELL_DEVICE_NUM+loop2);
|
|
267
|
}
|
249
|
}
|
|
268
|
}
|
250
|
}
|
|
269
|
//WM_DEVICECHANGE
|
251
|
//WM_DEVICECHANGE
|
|
270
|
|
252
|
|
|
271
|
GetDlgItem(IDC_STATIC_GROUP_DEBUG_INFO)->MoveWindow(0,rect_pcb[0][loop2-1].bottom+10,
|
253
|
GetDlgItem(IDC_STATIC_GROUP_DEBUG_INFO)->MoveWindow(0,rect_pcb[0][loop2-1].bottom+10,
|
|
272
|
- rect_start_button[loop1-1][loop2-1].right+250,310);
|
254
|
+ rect_SN_info[loop1-1][loop2-1].right+250,310);
|
|
273
|
GetDlgItem(IDC_STATIC_GROUP_DEBUG_INFO)->SetWindowText("运行日志");
|
255
|
GetDlgItem(IDC_STATIC_GROUP_DEBUG_INFO)->SetWindowText("运行日志");
|
|
274
|
mylistDebugInfo.MoveWindow(rect_pcb[0][loop2-1].left,rect_pcb[0][loop2-1].bottom+30,
|
256
|
mylistDebugInfo.MoveWindow(rect_pcb[0][loop2-1].left,rect_pcb[0][loop2-1].bottom+30,
|
|
275
|
- rect_start_button[loop1-1][loop2-1].right+230,300);
|
257
|
+ rect_SN_info[loop1-1][loop2-1].right+230,300);
|
|
276
|
|
258
|
|
|
277
|
GetDlgItem(IDC_STATIC_GROUP_EAR)->MoveWindow(0,5,
|
259
|
GetDlgItem(IDC_STATIC_GROUP_EAR)->MoveWindow(0,5,
|
|
278
|
- rect_start_button[0][loop2-1].right+15,
|
|
|
|
279
|
- rect_start_button[0][loop2-1].bottom+2);
|
260
|
+ rect_SN_info[0][loop2-1].right+15,
|
|
|
|
261
|
+ rect_SN_info[0][loop2-1].bottom+2);
|
|
280
|
GetDlgItem(IDC_STATIC_GROUP_EAR)->SetWindowText("耳机下载");
|
262
|
GetDlgItem(IDC_STATIC_GROUP_EAR)->SetWindowText("耳机下载");
|
|
281
|
GetDlgItem(IDC_STATIC_GROUP_USB)->MoveWindow(rect_pcb[loop1-1][0].left-10,5,
|
263
|
GetDlgItem(IDC_STATIC_GROUP_USB)->MoveWindow(rect_pcb[loop1-1][0].left-10,5,
|
|
282
|
- rect_start_button[0][loop2-1].right+10,
|
|
|
|
283
|
- rect_start_button[0][loop2-1].bottom+2);
|
264
|
+ rect_SN_info[0][loop2-1].right+10,
|
|
|
|
265
|
+ rect_SN_info[0][loop2-1].bottom+2);
|
|
284
|
GetDlgItem(IDC_STATIC_GROUP_USB)->SetWindowText("发射器下载");
|
266
|
GetDlgItem(IDC_STATIC_GROUP_USB)->SetWindowText("发射器下载");
|
|
285
|
|
267
|
|
|
286
|
|
268
|
|
|
287
|
|
269
|
|
|
288
|
GetDlgItem(IDC_START_ALL)->MoveWindow(
|
270
|
GetDlgItem(IDC_START_ALL)->MoveWindow(
|
|
289
|
- rect_start_button[loop1-1][loop2-1].right+150,
|
|
|
|
290
|
- rect_start_button[0][0].top+20,
|
271
|
+ rect_SN_info[loop1-1][loop2-1].right+50,
|
|
|
|
272
|
+ rect_SN_info[0][0].top+20,
|
|
291
|
100,50);
|
273
|
100,50);
|
|
292
|
GetDlgItem(IDC_STOP_ALL)->MoveWindow(
|
274
|
GetDlgItem(IDC_STOP_ALL)->MoveWindow(
|
|
293
|
- rect_start_button[loop1-1][loop2-1].right+150,
|
|
|
|
294
|
- rect_start_button[0][0].top+90,
|
275
|
+ rect_SN_info[loop1-1][loop2-1].right+50,
|
|
|
|
276
|
+ rect_SN_info[0][0].top+90,
|
|
295
|
100,50);
|
277
|
100,50);
|
|
296
|
GetDlgItem(IDC_BUTTON_INIT_COMPORT)->MoveWindow(
|
278
|
GetDlgItem(IDC_BUTTON_INIT_COMPORT)->MoveWindow(
|
|
297
|
- rect_start_button[loop1-1][loop2-1].right+150,
|
|
|
|
298
|
- rect_start_button[loop1-1][loop2-1].bottom-140,
|
279
|
+ rect_SN_info[loop1-1][loop2-1].right+50,
|
|
|
|
280
|
+ rect_SN_info[loop1-1][loop2-1].bottom-140,
|
|
299
|
100,50);
|
281
|
100,50);
|
|
300
|
GetDlgItem(IDC_BUTTON_SETTING)->MoveWindow(
|
282
|
GetDlgItem(IDC_BUTTON_SETTING)->MoveWindow(
|
|
301
|
- rect_start_button[loop1-1][loop2-1].right+150,
|
|
|
|
302
|
- rect_start_button[loop1-1][loop2-1].bottom-70,
|
283
|
+ rect_SN_info[loop1-1][loop2-1].right+50,
|
|
|
|
284
|
+ rect_SN_info[loop1-1][loop2-1].bottom-70,
|
|
303
|
100,50);
|
285
|
100,50);
|
|
304
|
|
286
|
|
|
305
|
GetDlgItem(IDC_START_ALL)->SetFont(&myfontButton);
|
287
|
GetDlgItem(IDC_START_ALL)->SetFont(&myfontButton);
|
|
306
|
GetDlgItem(IDC_STOP_ALL)->SetFont(&myfontButton);
|
288
|
GetDlgItem(IDC_STOP_ALL)->SetFont(&myfontButton);
|
|
307
|
GetDlgItem(IDC_BUTTON_INIT_COMPORT)->SetFont(&myfontButton);
|
289
|
GetDlgItem(IDC_BUTTON_INIT_COMPORT)->SetFont(&myfontButton);
|
|
308
|
GetDlgItem(IDC_BUTTON_SETTING)->SetFont(&myfontButton);
|
290
|
GetDlgItem(IDC_BUTTON_SETTING)->SetFont(&myfontButton);
|
|
309
|
- rect_this.right = rect_this.left + rect_start_button[loop1-1][loop2-1].right+260;
|
291
|
+ rect_this.right = rect_this.left + rect_SN_info[loop1-1][loop2-1].right+260;
|
|
310
|
rect_this.bottom = rect_this.top + rect_pcb[0][loop2-1].bottom+350;
|
292
|
rect_this.bottom = rect_this.top + rect_pcb[0][loop2-1].bottom+350;
|
|
311
|
MoveWindow(&rect_this);
|
293
|
MoveWindow(&rect_this);
|
|
312
|
|
294
|
|
|
|
|
295
|
+ myAryFlashSuc.RemoveAll();
|
|
|
|
296
|
+ if (g_AppMainData.firstID_binfile == g_AppMainData.lastID_binfile)
|
|
|
|
297
|
+ {
|
|
|
|
298
|
+ for (loop1 = 0; loop1 < 30000+1; loop1++)
|
|
|
|
299
|
+ myAryFlashFail.Add(0);
|
|
|
|
300
|
+ }
|
|
|
|
301
|
+ else
|
|
|
|
302
|
+ {
|
|
|
|
303
|
+ for (loop1 = g_AppMainData.firstID_binfile; loop1 < g_AppMainData.lastID_binfile+1; loop1++)
|
|
|
|
304
|
+ myAryFlashFail.Add(loop1);
|
|
|
|
305
|
+ }
|
|
|
|
306
|
+
|
|
313
|
|
307
|
|
|
314
|
|
308
|
|
|
315
|
|
309
|
|
|
@@ -360,9 +354,10 @@ void CBlueFlashToolDlg::OnButtonSetting() |
|
@@ -360,9 +354,10 @@ void CBlueFlashToolDlg::OnButtonSetting() |
|
360
|
{
|
354
|
{
|
|
361
|
CSysConfig dlg;
|
355
|
CSysConfig dlg;
|
|
362
|
dlg.DoModal();
|
356
|
dlg.DoModal();
|
|
|
|
357
|
+#ifdef __TOPWELL_EDIT_SN_ENABLE__
|
|
363
|
LoadBin((int)BLUE_TYPE_EAR);
|
358
|
LoadBin((int)BLUE_TYPE_EAR);
|
|
364
|
LoadBin((int)BLUE_TYPE_USB);
|
359
|
LoadBin((int)BLUE_TYPE_USB);
|
|
365
|
-
|
360
|
+#endif
|
|
366
|
UpdateGroupsCaptions();
|
361
|
UpdateGroupsCaptions();
|
|
367
|
|
362
|
|
|
368
|
}
|
363
|
}
|
|
@@ -371,7 +366,8 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
@@ -371,7 +366,8 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
371
|
{
|
366
|
{
|
|
372
|
CString strCaptionStatics;
|
367
|
CString strCaptionStatics;
|
|
373
|
int loop1 = 0,loop2 = 0;
|
368
|
int loop1 = 0,loop2 = 0;
|
|
374
|
- int SN_readwrite = g_AppMainData.SN_cur;
|
369
|
+ int binEarFileindex =0;
|
|
|
|
370
|
+ //int binUsbFileindex = g_AppMainData.LastUsbBin;
|
|
375
|
int sumPort = 0,sumForSn = 0;
|
371
|
int sumPort = 0,sumForSn = 0;
|
|
376
|
CButton * pbutton;
|
372
|
CButton * pbutton;
|
|
377
|
|
373
|
|
|
@@ -380,25 +376,23 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
@@ -380,25 +376,23 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
380
|
sumForSn = 0;
|
376
|
sumForSn = 0;
|
|
381
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
377
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
|
382
|
{
|
378
|
{
|
|
383
|
- sumForSn+=g_AppMainData.ary_myComPort[loop1][loop2];
|
|
|
|
384
|
- if (g_AppMainData.ary_myComPort[loop1][loop2] >1)
|
379
|
+ //if (g_AppMainData.ary_myComPort[loop1][loop2] >1)
|
|
|
|
380
|
+ if (ifUartEnable[loop1][loop2])
|
|
|
|
381
|
+ {
|
|
|
|
382
|
+ if (BLUE_TYPE_EAR== loop1)
|
|
|
|
383
|
+ strCaptionStatics.Format("RX_%04d.bin",myAryFlashFail.GetAt(binEarFileindex));
|
|
|
|
384
|
+ else
|
|
|
|
385
|
+ strCaptionStatics.Format("TX_%04d.bin",myAryFlashFail.GetAt(binEarFileindex));
|
|
|
|
386
|
+ myStaticSn[loop1][loop2].SetWindowText(strCaptionStatics);
|
|
385
|
myctrlStartButton[loop1][loop2].EnableWindow(TRUE);
|
387
|
myctrlStartButton[loop1][loop2].EnableWindow(TRUE);
|
|
|
|
388
|
+ }
|
|
386
|
else
|
389
|
else
|
|
|
|
390
|
+ {
|
|
|
|
391
|
+ myStaticSn[loop1][loop2].SetWindowText("无文件");
|
|
387
|
myctrlStartButton[loop1][loop2].EnableWindow(FALSE);
|
392
|
myctrlStartButton[loop1][loop2].EnableWindow(FALSE);
|
|
388
|
- sumPort+= g_AppMainData.ary_myComPort[loop1][loop2];
|
|
|
|
389
|
- }
|
|
|
|
390
|
- if (sumForSn)
|
|
|
|
391
|
- {
|
|
|
|
392
|
- myStaticSn[loop2].EnableWindow(TRUE);
|
|
|
|
393
|
- mySN_readwrite[loop2] = SN_readwrite++;
|
|
|
|
394
|
- strCaptionStatics.Format("%s%04x", g_AppMainData.SN_head, mySN_readwrite[loop2]);
|
|
|
|
395
|
- myStaticSn[loop2].SetWindowText(strCaptionStatics);
|
|
|
|
396
|
- }
|
|
|
|
397
|
- else
|
|
|
|
398
|
- {
|
|
|
|
399
|
- myStaticSn[loop2].EnableWindow(FALSE);
|
|
|
|
400
|
- mySN_readwrite[loop2] = -1;
|
|
|
|
401
|
- myStaticSn[loop2].SetWindowText("不可用");
|
393
|
+ }
|
|
|
|
394
|
+
|
|
|
|
395
|
+
|
|
402
|
}
|
396
|
}
|
|
403
|
}
|
397
|
}
|
|
404
|
GetDlgItem(IDC_START_ALL)->EnableWindow(sumPort> 0 ? TRUE: FALSE);
|
398
|
GetDlgItem(IDC_START_ALL)->EnableWindow(sumPort> 0 ? TRUE: FALSE);
|
|
@@ -419,12 +413,29 @@ void CBlueFlashToolDlg::OnCommMscommDebug() |
|
@@ -419,12 +413,29 @@ void CBlueFlashToolDlg::OnCommMscommDebug() |
|
419
|
void CBlueFlashToolDlg::OnBnClickedButtonInitComport()
|
413
|
void CBlueFlashToolDlg::OnBnClickedButtonInitComport()
|
|
420
|
{
|
414
|
{
|
|
421
|
int loop1 = 0, loop2 = 0;
|
415
|
int loop1 = 0, loop2 = 0;
|
|
422
|
- for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
416
|
+ CString strButtonText;
|
|
|
|
417
|
+ GetDlgItem(IDC_BUTTON_INIT_COMPORT)->GetWindowText(strButtonText);
|
|
|
|
418
|
+ if (strButtonText == "连接夹具")
|
|
423
|
{
|
419
|
{
|
|
424
|
- for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
420
|
+ for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
|
425
|
{
|
421
|
{
|
|
426
|
- OpenComport(loop1, loop2);
|
422
|
+ for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
|
|
|
423
|
+ {
|
|
|
|
424
|
+ OpenComport(loop1, loop2);
|
|
|
|
425
|
+ }
|
|
427
|
}
|
426
|
}
|
|
|
|
427
|
+ GetDlgItem(IDC_BUTTON_INIT_COMPORT)->SetWindowText("断开夹具");
|
|
|
|
428
|
+ }
|
|
|
|
429
|
+ else
|
|
|
|
430
|
+ {
|
|
|
|
431
|
+ for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
|
|
|
432
|
+ {
|
|
|
|
433
|
+ for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
|
|
|
434
|
+ {
|
|
|
|
435
|
+ CloseComport(loop1, loop2);
|
|
|
|
436
|
+ }
|
|
|
|
437
|
+ }
|
|
|
|
438
|
+ GetDlgItem(IDC_BUTTON_INIT_COMPORT)->SetWindowText("连接夹具");
|
|
428
|
}
|
439
|
}
|
|
429
|
UpdateGroupsCaptions();
|
440
|
UpdateGroupsCaptions();
|
|
430
|
}
|
441
|
}
|
|
@@ -434,7 +445,9 @@ void CBlueFlashToolDlg::OnBnClickedButtonInitComport() |
|
@@ -434,7 +445,9 @@ void CBlueFlashToolDlg::OnBnClickedButtonInitComport() |
|
434
|
void CBlueFlashToolDlg::OnDestroy()
|
445
|
void CBlueFlashToolDlg::OnDestroy()
|
|
435
|
{
|
446
|
{
|
|
436
|
CDialog::OnDestroy();
|
447
|
CDialog::OnDestroy();
|
|
|
|
448
|
+#ifdef __TOPWELL_EDIT_SN_ENABLE__
|
|
437
|
delete mybufferForFile;
|
449
|
delete mybufferForFile;
|
|
|
|
450
|
+#endif
|
|
438
|
g_pmainapp->SaveConfigs();
|
451
|
g_pmainapp->SaveConfigs();
|
|
439
|
}
|
452
|
}
|
|
440
|
|
453
|
|
|
@@ -445,7 +458,7 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
@@ -445,7 +458,7 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
445
|
CString m_strSettings;
|
458
|
CString m_strSettings;
|
|
446
|
int comopen_port;
|
459
|
int comopen_port;
|
|
447
|
//CMSComm *pctrlComToOpen = pctrlMSComm[earOrUsb][index];
|
460
|
//CMSComm *pctrlComToOpen = pctrlMSComm[earOrUsb][index];
|
|
448
|
- //m_strSettings.Format("%d,n,8,1", g_AppMainData.com_config.aBandrate);
|
461
|
+ m_strSettings.Format("%d,n,8,1", g_AppMainData.com_config.aBandrate);
|
|
449
|
comopen_port =g_AppMainData.ary_myComPort[earOrUsb][index] ;
|
462
|
comopen_port =g_AppMainData.ary_myComPort[earOrUsb][index] ;
|
|
450
|
if (comopen_port<2)
|
463
|
if (comopen_port<2)
|
|
451
|
{
|
464
|
{
|
|
@@ -467,6 +480,13 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
@@ -467,6 +480,13 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
467
|
return TRUE;
|
480
|
return TRUE;
|
|
468
|
}
|
481
|
}
|
|
469
|
}
|
482
|
}
|
|
|
|
483
|
+ mycom[earOrUsb][index].SetCommPort(g_AppMainData.ary_myComPort[earOrUsb][index]); //选择com1
|
|
|
|
484
|
+ mycom[earOrUsb][index].SetInputMode(1);
|
|
|
|
485
|
+ mycom[earOrUsb][index].SetInputLen(512); //设置当前接收区数据长度为0
|
|
|
|
486
|
+ mycom[earOrUsb][index].SetOutBufferSize(512);//设置当前接收区数据长度为0
|
|
|
|
487
|
+ mycom[earOrUsb][index].SetSettings(m_strSettings); //波特率9600,无校验,8个数据位,1个停止位
|
|
|
|
488
|
+
|
|
|
|
489
|
+
|
|
470
|
if (!mycom[earOrUsb][index].GetPortOpen())
|
490
|
if (!mycom[earOrUsb][index].GetPortOpen())
|
|
471
|
{
|
491
|
{
|
|
472
|
try
|
492
|
try
|
|
@@ -492,6 +512,33 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
@@ -492,6 +512,33 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
492
|
return true;
|
512
|
return true;
|
|
493
|
}
|
513
|
}
|
|
494
|
|
514
|
|
|
|
|
515
|
+
|
|
|
|
516
|
+
|
|
|
|
517
|
+// 打开COM口,
|
|
|
|
518
|
+bool CBlueFlashToolDlg::CloseComport(int earOrUsb, int index)
|
|
|
|
519
|
+{
|
|
|
|
520
|
+ int loop = 0;
|
|
|
|
521
|
+ CString m_strSettings;
|
|
|
|
522
|
+ int comopen_port;
|
|
|
|
523
|
+ comopen_port =g_AppMainData.ary_myComPort[earOrUsb][index] ;
|
|
|
|
524
|
+ if (comopen_port<2) return false;
|
|
|
|
525
|
+ try
|
|
|
|
526
|
+ {
|
|
|
|
527
|
+ if (mycom[earOrUsb][index].GetPortOpen())
|
|
|
|
528
|
+ mycom[earOrUsb][index].SetPortOpen(FALSE);
|
|
|
|
529
|
+ ifUartEnable[earOrUsb][index] = false;
|
|
|
|
530
|
+ }
|
|
|
|
531
|
+ catch (CException* e)
|
|
|
|
532
|
+ {
|
|
|
|
533
|
+ e->ReportError();
|
|
|
|
534
|
+ return FALSE;
|
|
|
|
535
|
+ }
|
|
|
|
536
|
+ return true;
|
|
|
|
537
|
+}
|
|
|
|
538
|
+
|
|
|
|
539
|
+
|
|
|
|
540
|
+
|
|
|
|
541
|
+
|
|
495
|
int CBlueFlashToolDlg::DBG_print(const char * strMsg, ...)
|
542
|
int CBlueFlashToolDlg::DBG_print(const char * strMsg, ...)
|
|
496
|
{
|
543
|
{
|
|
497
|
int var_tickcount = 0;
|
544
|
int var_tickcount = 0;
|
|
@@ -533,9 +580,9 @@ void CBlueFlashToolDlg::OnCommMscomm1(UINT nID) |
|
@@ -533,9 +580,9 @@ void CBlueFlashToolDlg::OnCommMscomm1(UINT nID) |
|
533
|
aDeviceType = BLUE_TYPE_USB;
|
580
|
aDeviceType = BLUE_TYPE_USB;
|
|
534
|
aIndex = nID - IDC_MSCOMM11;
|
581
|
aIndex = nID - IDC_MSCOMM11;
|
|
535
|
}
|
582
|
}
|
|
536
|
- if (pctrlMSComm[aDeviceType][aIndex]->GetCommEvent() == 2) //事件值为2表示接收缓冲区内有字符
|
583
|
+ if (mycom[aDeviceType][aIndex].GetCommEvent() == 2) //事件值为2表示接收缓冲区内有字符
|
|
537
|
{
|
584
|
{
|
|
538
|
- variant_inp = pctrlMSComm[aDeviceType][aIndex]->GetInput(); //读缓冲区
|
585
|
+ variant_inp = mycom[aDeviceType][aIndex].GetInput(); //读缓冲区
|
|
539
|
safearray_inp = variant_inp; //VARIANT型变量转换为ColeSafeArray型变量
|
586
|
safearray_inp = variant_inp; //VARIANT型变量转换为ColeSafeArray型变量
|
|
540
|
len = safearray_inp.GetOneDimSize(); //得到有效数据长度
|
587
|
len = safearray_inp.GetOneDimSize(); //得到有效数据长度
|
|
541
|
for (k = 0; k < len; k++)
|
588
|
for (k = 0; k < len; k++)
|
|
@@ -543,7 +590,12 @@ void CBlueFlashToolDlg::OnCommMscomm1(UINT nID) |
|
@@ -543,7 +590,12 @@ void CBlueFlashToolDlg::OnCommMscomm1(UINT nID) |
|
543
|
if(strstr((char *)rxdata, strSignalFlashReady) == NULL)
|
590
|
if(strstr((char *)rxdata, strSignalFlashReady) == NULL)
|
|
544
|
myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapWait);
|
591
|
myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapWait);
|
|
545
|
else
|
592
|
else
|
|
|
|
593
|
+ {
|
|
546
|
myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapReady);
|
594
|
myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapReady);
|
|
|
|
595
|
+ mytickcount[aDeviceType][aIndex][0] = GetTickCount();
|
|
|
|
596
|
+ if(myThreadData[aDeviceType][aIndex].StartThread)
|
|
|
|
597
|
+ myThreadData[aDeviceType][aIndex].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[aDeviceType][aIndex]);
|
|
|
|
598
|
+ }
|
|
547
|
if (strstr((char *)rxdata,strSignalFlashing) != NULL)
|
599
|
if (strstr((char *)rxdata,strSignalFlashing) != NULL)
|
|
548
|
{
|
600
|
{
|
|
549
|
strncpy(flash_process,(char *)(rxdata+12),3);
|
601
|
strncpy(flash_process,(char *)(rxdata+12),3);
|
|
@@ -568,15 +620,27 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -568,15 +620,27 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
568
|
|
620
|
|
|
569
|
|
621
|
|
|
570
|
|
622
|
|
|
571
|
- if(lParam == NULL) return -1; //如果线程参数位空, 直接退出
|
623
|
+ if(lParam == NULL)
|
|
|
|
624
|
+ {
|
|
|
|
625
|
+ pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
|
|
626
|
+ pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
|
|
627
|
+ return -1; //如果线程参数位空, 直接退出
|
|
|
|
628
|
+ }
|
|
572
|
aDeviceType = (BLUE_DEVICE_TYPE)pThreadData->blue_device_type;
|
629
|
aDeviceType = (BLUE_DEVICE_TYPE)pThreadData->blue_device_type;
|
|
573
|
aIndex = pThreadData->nIndex;
|
630
|
aIndex = pThreadData->nIndex;
|
|
574
|
pctrlMSComm = pThreadData->pctrlMSComm;
|
631
|
pctrlMSComm = pThreadData->pctrlMSComm;
|
|
575
|
- if (pctrlMSComm == NULL) return -1;
|
632
|
+ if (!pctrlMSComm)
|
|
|
|
633
|
+ {
|
|
|
|
634
|
+ pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
|
|
635
|
+ pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
|
|
636
|
+ return -1; //如果线程参数位空, 直接退出
|
|
|
|
637
|
+ }
|
|
576
|
|
638
|
|
|
577
|
if (!IsExistFile(pThreadData->Filename))
|
639
|
if (!IsExistFile(pThreadData->Filename))
|
|
578
|
{
|
640
|
{
|
|
579
|
pThreadData->pDlg->DBG_print("[%d]文件不存在, 请重新设定软件路径",__LINE__);
|
641
|
pThreadData->pDlg->DBG_print("[%d]文件不存在, 请重新设定软件路径",__LINE__);
|
|
|
|
642
|
+ pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
|
|
643
|
+ pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
580
|
return -1;
|
644
|
return -1;
|
|
581
|
}
|
645
|
}
|
|
582
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("停止");
|
646
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("停止");
|
|
@@ -590,11 +654,12 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -590,11 +654,12 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
590
|
|
654
|
|
|
591
|
for(loop=0;loop<numParts;loop++)
|
655
|
for(loop=0;loop<numParts;loop++)
|
|
592
|
{
|
656
|
{
|
|
593
|
- if (pThreadData->StopThread)
|
657
|
+ if (pThreadData->StartThread == false)
|
|
594
|
{// 检查是否有停止指令
|
658
|
{// 检查是否有停止指令
|
|
595
|
MyFile1.Close();
|
659
|
MyFile1.Close();
|
|
596
|
ByteArray_512.RemoveAll();
|
660
|
ByteArray_512.RemoveAll();
|
|
597
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
661
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
|
|
662
|
+ pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
598
|
return 0;
|
663
|
return 0;
|
|
599
|
}
|
664
|
}
|
|
600
|
|
665
|
|
|
@@ -605,7 +670,8 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -605,7 +670,8 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
605
|
ByteArray_512.SetAt(i, ByteBuf_512[i]); //把buf的1k数据转化为十六进制到array中,用于串口发送
|
670
|
ByteArray_512.SetAt(i, ByteBuf_512[i]); //把buf的1k数据转化为十六进制到array中,用于串口发送
|
|
606
|
pctrlMSComm->SetOutput((COleVariant) ByteArray_512); //发送
|
671
|
pctrlMSComm->SetOutput((COleVariant) ByteArray_512); //发送
|
|
607
|
Sleep (2); //等待接收端接收
|
672
|
Sleep (2); //等待接收端接收
|
|
608
|
- ::SendMessage(pThreadData->pDlg->m_hWnd,WM_UPDATEPOS,pThreadData->blue_device_type*10+pThreadData->nIndex,loop*100/numParts);
|
673
|
+ ::SendMessage(pThreadData->pDlg->m_hWnd,WM_UPDATEPOS,pThreadData->blue_device_type<<16|pThreadData->nIndex,loop*100/numParts);
|
|
|
|
674
|
+ if(!(loop&0x7f)) pThreadData->pDlg->DBG_print("线路 %d.%d下载中%d/%d",aDeviceType+1,aIndex+1,loop,numParts);
|
|
609
|
}
|
675
|
}
|
|
610
|
if (Partsremain>0)
|
676
|
if (Partsremain>0)
|
|
611
|
{
|
677
|
{
|
|
@@ -617,11 +683,15 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -617,11 +683,15 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
617
|
pctrlMSComm->SetOutput((COleVariant) ByteArray_512); //发送
|
683
|
pctrlMSComm->SetOutput((COleVariant) ByteArray_512); //发送
|
|
618
|
}
|
684
|
}
|
|
619
|
Sleep(1000); //等待接收端写30M数据到文件中
|
685
|
Sleep(1000); //等待接收端写30M数据到文件中
|
|
620
|
- ::SendMessage(pThreadData->pDlg->m_hWnd,WM_UPDATEPOS,pThreadData->blue_device_type*10+pThreadData->nIndex,100);
|
686
|
+ ::SendMessage(pThreadData->pDlg->m_hWnd,WM_UPDATEPOS,pThreadData->blue_device_type<<16|pThreadData->nIndex,100);
|
|
621
|
//任务结束, 清理现场
|
687
|
//任务结束, 清理现场
|
|
622
|
MyFile1.Close();
|
688
|
MyFile1.Close();
|
|
623
|
ByteArray_512.RemoveAll();
|
689
|
ByteArray_512.RemoveAll();
|
|
|
|
690
|
+
|
|
|
|
691
|
+ //pThreadData->pDlg->DBG_print("线路%d, %d 下载完成!!!",aDeviceType+1,aIndex+1);
|
|
|
|
692
|
+ pThreadData->pDlg->calcTImeWhenFinished(aDeviceType,aIndex);
|
|
624
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
693
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
|
|
694
|
+ pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
625
|
return 0;
|
695
|
return 0;
|
|
626
|
}
|
696
|
}
|
|
627
|
|
697
|
|
|
@@ -726,6 +796,15 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
@@ -726,6 +796,15 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
726
|
{
|
796
|
{
|
|
727
|
switch (message)
|
797
|
switch (message)
|
|
728
|
{
|
798
|
{
|
|
|
|
799
|
+ case WM_UPDATEPOS:
|
|
|
|
800
|
+ {
|
|
|
|
801
|
+ int colorstep = (255/100)*lParam;
|
|
|
|
802
|
+ int device_type = HIWORD(wParam);
|
|
|
|
803
|
+ int device_index = LOWORD(wParam);
|
|
|
|
804
|
+ myctrlProcess[device_type][device_index].SetPos(lParam);
|
|
|
|
805
|
+ myctrlProcess[device_type][device_index].SendMessage(PBM_SETBARCOLOR, 0, RGB(0, colorstep, 255-colorstep));//背景色为蓝色
|
|
|
|
806
|
+ }
|
|
|
|
807
|
+ break;
|
|
729
|
case WM_DEVICECHANGE:
|
808
|
case WM_DEVICECHANGE:
|
|
730
|
{
|
809
|
{
|
|
731
|
DEV_BROADCAST_HDR *pdevices_info = (DEV_BROADCAST_HDR *)lParam;
|
810
|
DEV_BROADCAST_HDR *pdevices_info = (DEV_BROADCAST_HDR *)lParam;
|
|
@@ -767,7 +846,10 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
@@ -767,7 +846,10 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
767
|
device_index = HIBYTE(LOWORD(itemdataCombo));
|
846
|
device_index = HIBYTE(LOWORD(itemdataCombo));
|
|
768
|
g_AppMainData.ary_myComPort[device_type][device_index] = LOBYTE(LOWORD(itemdataCombo));;
|
847
|
g_AppMainData.ary_myComPort[device_type][device_index] = LOBYTE(LOWORD(itemdataCombo));;
|
|
769
|
if (g_AppMainData.ary_myComPort[device_type][device_index] == 1)
|
848
|
if (g_AppMainData.ary_myComPort[device_type][device_index] == 1)
|
|
|
|
849
|
+ {
|
|
|
|
850
|
+ DBG_print("COM1不可用!");
|
|
770
|
g_AppMainData.ary_myComPort[device_type][device_index] = 0;
|
851
|
g_AppMainData.ary_myComPort[device_type][device_index] = 0;
|
|
|
|
852
|
+ }
|
|
771
|
}
|
853
|
}
|
|
772
|
UpdateGroupsCaptions();
|
854
|
UpdateGroupsCaptions();
|
|
773
|
}
|
855
|
}
|
|
@@ -784,18 +866,15 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
@@ -784,18 +866,15 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
784
|
if (!OpenComport(device_type, device_index))
|
866
|
if (!OpenComport(device_type, device_index))
|
|
785
|
return 0;
|
867
|
return 0;
|
|
786
|
}
|
868
|
}
|
|
|
|
869
|
+ #ifdef __TOPWELL_EDIT_SN_ENABLE__
|
|
787
|
if (SaveBin(device_type,device_index) == false)
|
870
|
if (SaveBin(device_type,device_index) == false)
|
|
788
|
{
|
871
|
{
|
|
789
|
DBG_print("生成文件失败");
|
872
|
DBG_print("生成文件失败");
|
|
790
|
return 0;
|
873
|
return 0;
|
|
791
|
}
|
874
|
}
|
|
792
|
- myStaticSn[device_index].GetWindowText(strtmsg);
|
|
|
|
793
|
-
|
|
|
|
794
|
- if (device_type == BLUE_TYPE_EAR)
|
|
|
|
795
|
- myThreadData[device_type][device_index].Filename.Format("%sEar%04x.bin",GetCurrPath(),mySN_readwrite[device_index]);
|
|
|
|
796
|
- else
|
|
|
|
797
|
- myThreadData[device_type][device_index].Filename.Format("%sDongle%04x.bin",GetCurrPath(),mySN_readwrite[device_index]);
|
|
|
|
798
|
-
|
875
|
+ #endif
|
|
|
|
876
|
+ myStaticSn[device_type][device_index].GetWindowText(strtmsg);
|
|
|
|
877
|
+ myThreadData[device_type][device_index].Filename = mystrAppcurrDir+"Bins\\ear\\"+strtmsg;
|
|
799
|
GetDlgItem(currID)->GetWindowText(strButonText);
|
878
|
GetDlgItem(currID)->GetWindowText(strButonText);
|
|
800
|
if (strButonText == "开始")
|
879
|
if (strButonText == "开始")
|
|
801
|
{
|
880
|
{
|
|
@@ -804,16 +883,19 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
@@ -804,16 +883,19 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
804
|
myThreadData[device_type][device_index].blue_device_type = (BYTE)
|
883
|
myThreadData[device_type][device_index].blue_device_type = (BYTE)
|
|
805
|
device_type;
|
884
|
device_type;
|
|
806
|
myThreadData[device_type][device_index].nIndex = device_index;
|
885
|
myThreadData[device_type][device_index].nIndex = device_index;
|
|
807
|
- myThreadData[device_type][device_index].StopThread = false;
|
|
|
|
808
|
- myThreadData[device_type][device_index].pctrlMSComm = pctrlMSComm[device_type][device_index];
|
|
|
|
809
|
- myThreadData[device_type][device_index].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[device_type][device_index]);
|
886
|
+ myThreadData[device_type][device_index].StartThread = true;
|
|
|
|
887
|
+ myThreadData[device_type][device_index].pctrlMSComm = &mycom[device_type][device_index];
|
|
|
|
888
|
+ //myThreadData[device_type][device_index].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[device_type][device_index]);
|
|
|
|
889
|
+ GetDlgItem(currID)->SetWindowText("停止");
|
|
810
|
}
|
890
|
}
|
|
811
|
else if (strButonText == "停止")
|
891
|
else if (strButonText == "停止")
|
|
812
|
{
|
892
|
{
|
|
813
|
- //DWORD threadExitcode;
|
|
|
|
814
|
- //GetExitCodeThread(m_hThread[aDeviceType][aIndex], &threadExitcode);
|
|
|
|
815
|
- //if (threadExitcode == STILL_ACTIVE) TerminateThread(m_hThread[aDeviceType][aIndex], 0);
|
|
|
|
816
|
- myThreadData[device_type][device_index].StopThread = true;
|
893
|
+ DWORD threadExitcode;
|
|
|
|
894
|
+ //TerminateThread(m_hThread[aDeviceType][aIndex], 0);
|
|
|
|
895
|
+ myThreadData[device_type][device_index].StartThread = false;
|
|
|
|
896
|
+ GetExitCodeThread(myThreadData[device_type][device_index].m_hThread, &threadExitcode);
|
|
|
|
897
|
+ if (threadExitcode != STILL_ACTIVE)
|
|
|
|
898
|
+ GetDlgItem(currID)->SetWindowText("开始");
|
|
817
|
}
|
899
|
}
|
|
818
|
}
|
900
|
}
|
|
819
|
}
|
901
|
}
|
|
@@ -828,6 +910,7 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
@@ -828,6 +910,7 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
828
|
void CBlueFlashToolDlg::OnBnClickedStartAll()
|
910
|
void CBlueFlashToolDlg::OnBnClickedStartAll()
|
|
829
|
{
|
911
|
{
|
|
830
|
int loop1,loop2;
|
912
|
int loop1,loop2;
|
|
|
|
913
|
+ CString strtmsg;
|
|
831
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
914
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
|
832
|
{
|
915
|
{
|
|
833
|
for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
916
|
for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
|
@@ -835,9 +918,15 @@ void CBlueFlashToolDlg::OnBnClickedStartAll() |
|
@@ -835,9 +918,15 @@ void CBlueFlashToolDlg::OnBnClickedStartAll() |
|
835
|
myThreadData[loop1][loop2].pDlg = this;
|
918
|
myThreadData[loop1][loop2].pDlg = this;
|
|
836
|
myThreadData[loop1][loop2].blue_device_type = (BYTE)loop1;
|
919
|
myThreadData[loop1][loop2].blue_device_type = (BYTE)loop1;
|
|
837
|
myThreadData[loop1][loop2].nIndex = loop2;
|
920
|
myThreadData[loop1][loop2].nIndex = loop2;
|
|
838
|
- myThreadData[loop1][loop2].StopThread = false;
|
|
|
|
839
|
- myThreadData[loop1][loop2].pctrlMSComm = pctrlMSComm[loop1][loop2];
|
|
|
|
840
|
- myThreadData[loop1][loop2].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[loop1][loop2]);
|
921
|
+ myThreadData[loop1][loop2].pctrlMSComm = &mycom[loop1][loop2];
|
|
|
|
922
|
+ myStaticSn[loop1][loop2].GetWindowText(strtmsg);
|
|
|
|
923
|
+ myThreadData[loop1][loop2].Filename = mystrAppcurrDir+"Bins\\ear\\"+strtmsg;
|
|
|
|
924
|
+
|
|
|
|
925
|
+ if (g_AppMainData.ary_myComPort[loop1][loop2] >2)
|
|
|
|
926
|
+ {
|
|
|
|
927
|
+ myThreadData[loop1][loop2].StartThread = true;
|
|
|
|
928
|
+ //myThreadData[loop1][loop2].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[loop1][loop2]);
|
|
|
|
929
|
+ }
|
|
841
|
}
|
930
|
}
|
|
842
|
}
|
931
|
}
|
|
843
|
|
932
|
|
|
@@ -861,17 +950,17 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
@@ -861,17 +950,17 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
861
|
itemdataComPortList=0;
|
950
|
itemdataComPortList=0;
|
|
862
|
itemdataComPortList = loop1<<16|loop2<<8;
|
951
|
itemdataComPortList = loop1<<16|loop2<<8;
|
|
863
|
myctrlComboComPort[loop1][loop2].SetItemData(0, itemdataComPortList);
|
952
|
myctrlComboComPort[loop1][loop2].SetItemData(0, itemdataComPortList);
|
|
864
|
- if (g_AppMainData.ary_myComPort[loop1][loop2] == 0)
|
953
|
+ if (g_AppMainData.ary_myComPort[loop1][loop2] <2)
|
|
865
|
myctrlComboComPort[loop1][loop2].SetCurSel(0);
|
954
|
myctrlComboComPort[loop1][loop2].SetCurSel(0);
|
|
866
|
- for (loop3 = 0; loop3 < myAryNoneOpenedPort.GetSize(); loop3++)
|
955
|
+ for (loop3 = 0; loop3 < myAryExistPort.GetSize(); loop3++)
|
|
867
|
{
|
956
|
{
|
|
868
|
CString strComName;
|
957
|
CString strComName;
|
|
869
|
- strComName.Format("COM%d",myAryNoneOpenedPort.GetAt(loop3));
|
958
|
+ strComName.Format("COM%d",myAryExistPort.GetAt(loop3));
|
|
870
|
int add_index = myctrlComboComPort[loop1][loop2].AddString(strComName);
|
959
|
int add_index = myctrlComboComPort[loop1][loop2].AddString(strComName);
|
|
871
|
itemdataComPortList=0;
|
960
|
itemdataComPortList=0;
|
|
872
|
- itemdataComPortList = loop1<<16|loop2<<8|add_index,myAryNoneOpenedPort.GetAt(loop3);
|
961
|
+ itemdataComPortList = loop1<<16|loop2<<8|add_index,myAryExistPort.GetAt(loop3);
|
|
873
|
myctrlComboComPort[loop1][loop2].SetItemData(add_index,itemdataComPortList);
|
962
|
myctrlComboComPort[loop1][loop2].SetItemData(add_index,itemdataComPortList);
|
|
874
|
- if (myAryNoneOpenedPort.GetAt(loop3) == g_AppMainData.ary_myComPort[loop1][loop2])
|
963
|
+ if (myAryExistPort.GetAt(loop3) == g_AppMainData.ary_myComPort[loop1][loop2])
|
|
875
|
{
|
964
|
{
|
|
876
|
myctrlComboComPort[loop1][loop2].SetCurSel(add_index);
|
965
|
myctrlComboComPort[loop1][loop2].SetCurSel(add_index);
|
|
877
|
}
|
966
|
}
|
|
@@ -880,6 +969,7 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
@@ -880,6 +969,7 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
880
|
}
|
969
|
}
|
|
881
|
}
|
970
|
}
|
|
882
|
|
971
|
|
|
|
|
972
|
+#ifdef __TOPWELL_EDIT_SN_ENABLE__
|
|
883
|
bool CBlueFlashToolDlg::LoadBin(int blueDeviceType)
|
973
|
bool CBlueFlashToolDlg::LoadBin(int blueDeviceType)
|
|
884
|
{
|
974
|
{
|
|
885
|
CFile MyFile1;
|
975
|
CFile MyFile1;
|
|
@@ -1008,4 +1098,51 @@ bool CBlueFlashToolDlg::SaveBin(int blueDeviceType,int index) |
|
@@ -1008,4 +1098,51 @@ bool CBlueFlashToolDlg::SaveBin(int blueDeviceType,int index) |
|
1008
|
MyFile1.Close();
|
1098
|
MyFile1.Close();
|
|
1009
|
|
1099
|
|
|
1010
|
}
|
1100
|
}
|
|
|
|
1101
|
+#endif
|
|
1011
|
|
1102
|
|
|
|
|
1103
|
+void CBlueFlashToolDlg::OnBnClickedStopAll()
|
|
|
|
1104
|
+{
|
|
|
|
1105
|
+ int loop1,loop2;
|
|
|
|
1106
|
+ CString strtmsg;
|
|
|
|
1107
|
+ DWORD threadExitcode;
|
|
|
|
1108
|
+ for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
|
|
|
1109
|
+ {
|
|
|
|
1110
|
+ for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
|
|
|
1111
|
+ {
|
|
|
|
1112
|
+ myThreadData[loop1][loop2].StartThread = false;
|
|
|
|
1113
|
+ GetExitCodeThread(myThreadData[loop1][loop2].m_hThread, &threadExitcode);
|
|
|
|
1114
|
+ if (threadExitcode != STILL_ACTIVE)
|
|
|
|
1115
|
+ myctrlStartButton[loop1][loop2].SetWindowText("开始");
|
|
|
|
1116
|
+ }
|
|
|
|
1117
|
+ }
|
|
|
|
1118
|
+}
|
|
|
|
1119
|
+
|
|
|
|
1120
|
+void CBlueFlashToolDlg::DeletePCB(int device_type, int index)
|
|
|
|
1121
|
+{
|
|
|
|
1122
|
+ myctrlPcbState[device_type][index].SetBitmap(myBitmapWait);
|
|
|
|
1123
|
+}
|
|
|
|
1124
|
+
|
|
|
|
1125
|
+void CBlueFlashToolDlg::calcTImeWhenFinished(int device_type, int index)
|
|
|
|
1126
|
+{
|
|
|
|
1127
|
+ char fileid[6];
|
|
|
|
1128
|
+ char *pchar;
|
|
|
|
1129
|
+ int loop;
|
|
|
|
1130
|
+ CString strOfFilename;
|
|
|
|
1131
|
+ memset(fileid,0,6);
|
|
|
|
1132
|
+ mytickcount[device_type][index][1] = GetTickCount();
|
|
|
|
1133
|
+ DBG_print("线路 %d %d 下载完成, 耗时 %d 秒",device_type+1,index+1,
|
|
|
|
1134
|
+ (mytickcount[device_type][index][1] -mytickcount[device_type][index][0] )/1000);
|
|
|
|
1135
|
+ mytickcount[device_type][index][0]=mytickcount[device_type][index][1] =0;
|
|
|
|
1136
|
+ myStaticSn[device_type][index].GetWindowText(strOfFilename);
|
|
|
|
1137
|
+ pchar = strOfFilename.GetBuffer(0);
|
|
|
|
1138
|
+ strncpy(fileid,pchar+3,4);
|
|
|
|
1139
|
+ for (loop = 0; loop < myAryFlashFail.GetSize(); loop++)
|
|
|
|
1140
|
+ {
|
|
|
|
1141
|
+ WORD thefileid = myAryFlashFail.GetAt(loop);
|
|
|
|
1142
|
+ if (atoi(fileid) == thefileid)
|
|
|
|
1143
|
+ {
|
|
|
|
1144
|
+ myAryFlashFail.RemoveAt(loop);
|
|
|
|
1145
|
+ myAryFlashSuc.Add(thefileid);
|
|
|
|
1146
|
+ }
|
|
|
|
1147
|
+ }
|
|
|
|
1148
|
+} |