|
@@ -31,8 +31,8 @@ CBlueFlashToolDlg::CBlueFlashToolDlg(CWnd* pParent /*=NULL*/) |
|
@@ -31,8 +31,8 @@ CBlueFlashToolDlg::CBlueFlashToolDlg(CWnd* pParent /*=NULL*/) |
|
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
|
memset(ifUartEnable,0,BLUE_TYPE_MAX*MAX_TOPWELL_DEVICE_NUM);
|
33
|
memset(ifUartEnable,0,BLUE_TYPE_MAX*MAX_TOPWELL_DEVICE_NUM);
|
|
34
|
- memcpy(strSignalFlashReady,"\xFC\x4F\x70\x74\x65\x6B\x20\x52\x4F\x4D\x20\x62\x6F\x6F\x74\x00",16);
|
|
|
|
35
|
- memcpy(strSignalFlashing,"\x50\x72\x6F\x67\x72\x61\x6D\x6D\x69\x6E\x67\x3A\x00",13);
|
34
|
+ memcpy(strSignalFlashReady,"ROM boot",16);
|
|
|
|
35
|
+ memcpy(strSignalFlashing,"Programming:97",20);
|
|
36
|
mystrAppcurrDir = GetCurrPath();
|
36
|
mystrAppcurrDir = GetCurrPath();
|
|
37
|
}
|
37
|
}
|
|
38
|
|
38
|
|
|
@@ -373,10 +373,10 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
@@ -373,10 +373,10 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
373
|
|
373
|
|
|
374
|
for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
374
|
for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
|
375
|
{
|
375
|
{
|
|
376
|
- sumForSn = 0;
|
|
|
|
377
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
376
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
|
378
|
{
|
377
|
{
|
|
379
|
//if (g_AppMainData.ary_myComPort[loop1][loop2] >1)
|
378
|
//if (g_AppMainData.ary_myComPort[loop1][loop2] >1)
|
|
|
|
379
|
+ sumPort += ifUartEnable[loop1][loop2];
|
|
380
|
if (ifUartEnable[loop1][loop2])
|
380
|
if (ifUartEnable[loop1][loop2])
|
|
381
|
{
|
381
|
{
|
|
382
|
if (BLUE_TYPE_EAR== loop1)
|
382
|
if (BLUE_TYPE_EAR== loop1)
|
|
@@ -402,7 +402,7 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
@@ -402,7 +402,7 @@ void CBlueFlashToolDlg::UpdateGroupsCaptions() |
|
402
|
BEGIN_EVENTSINK_MAP(CBlueFlashToolDlg, CDialog)
|
402
|
BEGIN_EVENTSINK_MAP(CBlueFlashToolDlg, CDialog)
|
|
403
|
ON_EVENT(CBlueFlashToolDlg, IDC_MSCOMM0, 1, CBlueFlashToolDlg::OnCommMscommDebug, VTS_NONE)
|
403
|
ON_EVENT(CBlueFlashToolDlg, IDC_MSCOMM0, 1, CBlueFlashToolDlg::OnCommMscommDebug, VTS_NONE)
|
|
404
|
//ON_EVENT(CBlueFlashToolDlg, IDC_MSCOMM1, 1, CBlueFlashToolDlg::OnCommMscomm1, VTS_NONE)
|
404
|
//ON_EVENT(CBlueFlashToolDlg, IDC_MSCOMM1, 1, CBlueFlashToolDlg::OnCommMscomm1, VTS_NONE)
|
|
405
|
- ON_EVENT_RANGE(CBlueFlashToolDlg, IDC_MSCOMM1,IDC_MSCOMM1+20, 1 /* OnComm */, OnCommMscomm1, VTS_I4 )
|
405
|
+ ON_EVENT_RANGE(CBlueFlashToolDlg, IDC_MSCOMM1,IDC_MSCOMM1+50, 1 /* OnComm */, OnCommMscomm1, VTS_I4 )
|
|
406
|
END_EVENTSINK_MAP()
|
406
|
END_EVENTSINK_MAP()
|
|
407
|
|
407
|
|
|
408
|
|
408
|
|
|
@@ -448,6 +448,7 @@ void CBlueFlashToolDlg::OnDestroy() |
|
@@ -448,6 +448,7 @@ void CBlueFlashToolDlg::OnDestroy() |
|
448
|
#ifdef __TOPWELL_EDIT_SN_ENABLE__
|
448
|
#ifdef __TOPWELL_EDIT_SN_ENABLE__
|
|
449
|
delete mybufferForFile;
|
449
|
delete mybufferForFile;
|
|
450
|
#endif
|
450
|
#endif
|
|
|
|
451
|
+ //myAryFlashFail.Serialize();
|
|
451
|
g_pmainapp->SaveConfigs();
|
452
|
g_pmainapp->SaveConfigs();
|
|
452
|
}
|
453
|
}
|
|
453
|
|
454
|
|
|
@@ -482,8 +483,8 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
@@ -482,8 +483,8 @@ bool CBlueFlashToolDlg::OpenComport(int earOrUsb, int index) |
|
482
|
}
|
483
|
}
|
|
483
|
mycom[earOrUsb][index].SetCommPort(g_AppMainData.ary_myComPort[earOrUsb][index]); //选择com1
|
484
|
mycom[earOrUsb][index].SetCommPort(g_AppMainData.ary_myComPort[earOrUsb][index]); //选择com1
|
|
484
|
mycom[earOrUsb][index].SetInputMode(1);
|
485
|
mycom[earOrUsb][index].SetInputMode(1);
|
|
485
|
- mycom[earOrUsb][index].SetInputLen(512); //设置当前接收区数据长度为0
|
|
|
|
486
|
- mycom[earOrUsb][index].SetOutBufferSize(512);//设置当前接收区数据长度为0
|
486
|
+ mycom[earOrUsb][index].SetInputLen(BLUE_UART_INPUTBUFFER_SIZE); //设置当前接收区数据长度为0
|
|
|
|
487
|
+ mycom[earOrUsb][index].SetOutBufferSize(512);
|
|
487
|
mycom[earOrUsb][index].SetSettings(m_strSettings); //波特率9600,无校验,8个数据位,1个停止位
|
488
|
mycom[earOrUsb][index].SetSettings(m_strSettings); //波特率9600,无校验,8个数据位,1个停止位
|
|
488
|
|
489
|
|
|
489
|
|
490
|
|
|
@@ -560,46 +561,76 @@ int CBlueFlashToolDlg::DBG_print(const char * strMsg, ...) |
|
@@ -560,46 +561,76 @@ int CBlueFlashToolDlg::DBG_print(const char * strMsg, ...) |
|
560
|
void CBlueFlashToolDlg::OnCommMscomm1(UINT nID)
|
561
|
void CBlueFlashToolDlg::OnCommMscomm1(UINT nID)
|
|
561
|
{
|
562
|
{
|
|
562
|
// TODO: Add your control notification handler code here
|
563
|
// TODO: Add your control notification handler code here
|
|
563
|
- VARIANT variant_inp;
|
|
|
|
564
|
CMSComm * apctrlMSComm;
|
564
|
CMSComm * apctrlMSComm;
|
|
|
|
565
|
+ VARIANT variant_inp_com_msg;
|
|
565
|
COleSafeArray safearray_inp;
|
566
|
COleSafeArray safearray_inp;
|
|
566
|
LONG len, k;
|
567
|
LONG len, k;
|
|
567
|
- BYTE rxdata[512]; //设置BYTE数组 An 8-bit integerthat is not signed.
|
|
|
|
568
|
- BLUE_DEVICE_TYPE aDeviceType ;//设备类型
|
568
|
+ int aDeviceType ;//设备类型
|
|
569
|
int aIndex; //设备索引
|
569
|
int aIndex; //设备索引
|
|
570
|
- char flash_process[4];
|
|
|
|
571
|
- memset(rxdata,0,512);
|
|
|
|
572
|
- memset(flash_process,0,4);
|
|
|
|
573
|
- if (nID >= IDC_MSCOMM1 && nID <= IDC_MSCOMM10)
|
|
|
|
574
|
- {
|
|
|
|
575
|
- aDeviceType = BLUE_TYPE_EAR;
|
|
|
|
576
|
- aIndex = nID - IDC_MSCOMM1;
|
|
|
|
577
|
- }
|
|
|
|
578
|
- if (nID >= IDC_MSCOMM11 && nID <= IDC_MSCOMM20)
|
|
|
|
579
|
- {
|
|
|
|
580
|
- aDeviceType = BLUE_TYPE_USB;
|
|
|
|
581
|
- aIndex = nID - IDC_MSCOMM11;
|
|
|
|
582
|
- }
|
570
|
+ //char flash_process[4];
|
|
|
|
571
|
+ char message_rev[BLUE_UART_INPUTBUFFER_SIZE];
|
|
|
|
572
|
+ char onecharOfBuf;
|
|
|
|
573
|
+ char *pmybufferFromUart;
|
|
|
|
574
|
+ memset(message_rev,0,BLUE_UART_INPUTBUFFER_SIZE);
|
|
|
|
575
|
+ aDeviceType = (nID - IDC_MSCOMM1)/MAX_TOPWELL_DEVICE_NUM;
|
|
|
|
576
|
+ aIndex = (nID - IDC_MSCOMM1)%MAX_TOPWELL_DEVICE_NUM;
|
|
|
|
577
|
+ pmybufferFromUart = (char *)mybufferFromUart[aDeviceType][aIndex];
|
|
|
|
578
|
+ if (strlen(pmybufferFromUart) >= BLUE_UART_INPUTBUFFER_SIZE)
|
|
|
|
579
|
+ memset(pmybufferFromUart,0,BLUE_UART_INPUTBUFFER_SIZE);
|
|
583
|
if (mycom[aDeviceType][aIndex].GetCommEvent() == 2) //事件值为2表示接收缓冲区内有字符
|
580
|
if (mycom[aDeviceType][aIndex].GetCommEvent() == 2) //事件值为2表示接收缓冲区内有字符
|
|
584
|
{
|
581
|
{
|
|
585
|
- variant_inp = mycom[aDeviceType][aIndex].GetInput(); //读缓冲区
|
|
|
|
586
|
- safearray_inp = variant_inp; //VARIANT型变量转换为ColeSafeArray型变量
|
582
|
+ variant_inp_com_msg = mycom[aDeviceType][aIndex].GetInput(); //读缓冲区
|
|
|
|
583
|
+ safearray_inp = variant_inp_com_msg; //VARIANT型变量转换为ColeSafeArray型变量
|
|
587
|
len = safearray_inp.GetOneDimSize(); //得到有效数据长度
|
584
|
len = safearray_inp.GetOneDimSize(); //得到有效数据长度
|
|
588
|
for (k = 0; k < len; k++)
|
585
|
for (k = 0; k < len; k++)
|
|
589
|
- safearray_inp.GetElement(&k, rxdata + k); //转换为BYTE型数组
|
|
|
|
590
|
- if(strstr((char *)rxdata, strSignalFlashReady) == NULL)
|
586
|
+ {
|
|
|
|
587
|
+ safearray_inp.GetElement(&k, &onecharOfBuf);
|
|
|
|
588
|
+ if (onecharOfBuf != 0 && onecharOfBuf != 10)
|
|
|
|
589
|
+ {//把UART接收缓冲区的一个非零字节保存下来
|
|
|
|
590
|
+ pmybufferFromUart[strlen(pmybufferFromUart)] = onecharOfBuf;
|
|
|
|
591
|
+ }
|
|
|
|
592
|
+ else
|
|
|
|
593
|
+ {// 如果UART缓冲区的这个字节是0, 则表示结束 , 开始解析该命令
|
|
|
|
594
|
+ if (strlen(pmybufferFromUart))
|
|
|
|
595
|
+ strcpy(message_rev,pmybufferFromUart);
|
|
|
|
596
|
+ memset(pmybufferFromUart,0,BLUE_UART_INPUTBUFFER_SIZE);
|
|
|
|
597
|
+ }
|
|
|
|
598
|
+ }
|
|
|
|
599
|
+ // 最后一个字符没有结尾, 接着读下一次UART的缓冲区
|
|
|
|
600
|
+ if (onecharOfBuf != 0 && onecharOfBuf != 10)
|
|
|
|
601
|
+ return;
|
|
|
|
602
|
+ //pmessage_rev = safearray_inp.;
|
|
|
|
603
|
+ if (strlen(message_rev) == 0)
|
|
|
|
604
|
+ {
|
|
591
|
myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapWait);
|
605
|
myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapWait);
|
|
592
|
- else
|
606
|
+ return;
|
|
|
|
607
|
+ }
|
|
|
|
608
|
+ DBG_print("线路 %d %s",g_AppMainData.ary_myComPort[aDeviceType][aIndex],message_rev);
|
|
|
|
609
|
+ if(strstr(message_rev, strSignalFlashReady) != NULL)
|
|
593
|
{
|
610
|
{
|
|
|
|
611
|
+ CString strtmsg;
|
|
594
|
myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapReady);
|
612
|
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]);
|
613
|
+
|
|
|
|
614
|
+ myStaticSn[aDeviceType][aIndex].GetWindowText(strtmsg);
|
|
|
|
615
|
+ myThreadData[aDeviceType][aIndex].Filename = mystrAppcurrDir+"Bins\\ear\\"+strtmsg;
|
|
|
|
616
|
+
|
|
|
|
617
|
+ mytickcount[aDeviceType][aIndex] = GetTickCount();
|
|
|
|
618
|
+ myThreadData[aDeviceType][aIndex].pDlg = this;
|
|
|
|
619
|
+ myThreadData[aDeviceType][aIndex].blue_device_type = (BYTE)aDeviceType;
|
|
|
|
620
|
+ myThreadData[aDeviceType][aIndex].nIndex = aIndex;
|
|
|
|
621
|
+ myThreadData[aDeviceType][aIndex].StartThread = BLUE_THREAD_READY;
|
|
|
|
622
|
+ myThreadData[aDeviceType][aIndex].pctrlMSComm = &mycom[aDeviceType][aDeviceType];
|
|
|
|
623
|
+ myThreadData[aDeviceType][aIndex].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[aDeviceType][aIndex]);
|
|
|
|
624
|
+ myctrlStartButton[aDeviceType][aIndex].SetWindowText("停止");
|
|
598
|
}
|
625
|
}
|
|
599
|
- if (strstr((char *)rxdata,strSignalFlashing) != NULL)
|
626
|
+ else if (strstr((char *)message_rev,strSignalFlashing) != NULL)
|
|
600
|
{
|
627
|
{
|
|
601
|
- strncpy(flash_process,(char *)(rxdata+12),3);
|
|
|
|
602
|
- myctrlProcess[aDeviceType][aIndex].SetPos(atoi(flash_process));
|
628
|
+ myctrlProcess[aDeviceType][aIndex].SetPos(atoi(message_rev+12)*10);
|
|
|
|
629
|
+ }
|
|
|
|
630
|
+ else
|
|
|
|
631
|
+ {
|
|
|
|
632
|
+ DBG_print("线路 %d %s",g_AppMainData.ary_myComPort[aDeviceType][aIndex],message_rev);
|
|
|
|
633
|
+ myctrlPcbState[aDeviceType][aIndex].SetBitmap(myBitmapWait);
|
|
603
|
}
|
634
|
}
|
|
604
|
}
|
635
|
}
|
|
605
|
}
|
636
|
}
|
|
@@ -617,20 +648,23 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -617,20 +648,23 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
617
|
int Partsremain ;// 按512分割之后的尾数
|
648
|
int Partsremain ;// 按512分割之后的尾数
|
|
618
|
int loop; //循环读取文件的计数器
|
649
|
int loop; //循环读取文件的计数器
|
|
619
|
CMSComm *pctrlMSComm;
|
650
|
CMSComm *pctrlMSComm;
|
|
620
|
-
|
651
|
+ CFile MyFile1;
|
|
|
|
652
|
+ BOOL res_openfile;
|
|
621
|
|
653
|
|
|
622
|
|
654
|
|
|
623
|
if(lParam == NULL)
|
655
|
if(lParam == NULL)
|
|
624
|
{
|
656
|
{
|
|
625
|
- pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
|
|
626
|
- pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
657
|
+ pThreadData->StartThread = BLUE_THREAD_STOP;
|
|
627
|
return -1; //如果线程参数位空, 直接退出
|
658
|
return -1; //如果线程参数位空, 直接退出
|
|
628
|
}
|
659
|
}
|
|
|
|
660
|
+ pThreadData->StartThread = BLUE_THREAD_DOING;
|
|
629
|
aDeviceType = (BLUE_DEVICE_TYPE)pThreadData->blue_device_type;
|
661
|
aDeviceType = (BLUE_DEVICE_TYPE)pThreadData->blue_device_type;
|
|
630
|
aIndex = pThreadData->nIndex;
|
662
|
aIndex = pThreadData->nIndex;
|
|
|
|
663
|
+
|
|
631
|
pctrlMSComm = pThreadData->pctrlMSComm;
|
664
|
pctrlMSComm = pThreadData->pctrlMSComm;
|
|
632
|
if (!pctrlMSComm)
|
665
|
if (!pctrlMSComm)
|
|
633
|
{
|
666
|
{
|
|
|
|
667
|
+ pThreadData->StartThread = BLUE_THREAD_STOP;
|
|
634
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
668
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
635
|
pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
669
|
pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
636
|
return -1; //如果线程参数位空, 直接退出
|
670
|
return -1; //如果线程参数位空, 直接退出
|
|
@@ -638,13 +672,22 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -638,13 +672,22 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
638
|
|
672
|
|
|
639
|
if (!IsExistFile(pThreadData->Filename))
|
673
|
if (!IsExistFile(pThreadData->Filename))
|
|
640
|
{
|
674
|
{
|
|
|
|
675
|
+ pThreadData->StartThread = BLUE_THREAD_STOP;
|
|
641
|
pThreadData->pDlg->DBG_print("[%d]文件不存在, 请重新设定软件路径",__LINE__);
|
676
|
pThreadData->pDlg->DBG_print("[%d]文件不存在, 请重新设定软件路径",__LINE__);
|
|
642
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
677
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
643
|
pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
678
|
pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
644
|
return -1;
|
679
|
return -1;
|
|
645
|
}
|
680
|
}
|
|
646
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("停止");
|
681
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("停止");
|
|
647
|
- CFile MyFile1(pThreadData->Filename,CFile::modeRead);
|
682
|
+ res_openfile = MyFile1.Open(pThreadData->Filename,CFile::modeRead|CFile::shareDenyNone);
|
|
|
|
683
|
+ if (!res_openfile)
|
|
|
|
684
|
+ {
|
|
|
|
685
|
+ pThreadData->StartThread = BLUE_THREAD_STOP;
|
|
|
|
686
|
+ pThreadData->pDlg->DBG_print("[%d]文件打开失败",__LINE__);
|
|
|
|
687
|
+ pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
|
|
688
|
+ pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
|
|
689
|
+ return -1;
|
|
|
|
690
|
+ }
|
|
648
|
//获得文件大小
|
691
|
//获得文件大小
|
|
649
|
Length = MyFile1.GetLength();
|
692
|
Length = MyFile1.GetLength();
|
|
650
|
numParts = Length/512; //文件按512分割块数
|
693
|
numParts = Length/512; //文件按512分割块数
|
|
@@ -656,6 +699,7 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -656,6 +699,7 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
656
|
{
|
699
|
{
|
|
657
|
if (pThreadData->StartThread == false)
|
700
|
if (pThreadData->StartThread == false)
|
|
658
|
{// 检查是否有停止指令
|
701
|
{// 检查是否有停止指令
|
|
|
|
702
|
+ pThreadData->StartThread = BLUE_THREAD_STOP;
|
|
659
|
MyFile1.Close();
|
703
|
MyFile1.Close();
|
|
660
|
ByteArray_512.RemoveAll();
|
704
|
ByteArray_512.RemoveAll();
|
|
661
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
705
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
@@ -692,6 +736,7 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
@@ -692,6 +736,7 @@ UINT BlueFlashThreadProc(LPVOID lParam) |
|
692
|
pThreadData->pDlg->calcTImeWhenFinished(aDeviceType,aIndex);
|
736
|
pThreadData->pDlg->calcTImeWhenFinished(aDeviceType,aIndex);
|
|
693
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
737
|
pThreadData->pDlg->myctrlStartButton[aDeviceType][aIndex].SetWindowText("开始");
|
|
694
|
pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
738
|
pThreadData->pDlg->DeletePCB(aDeviceType,aIndex);
|
|
|
|
739
|
+ pThreadData->StartThread = BLUE_THREAD_STOP;
|
|
695
|
return 0;
|
740
|
return 0;
|
|
696
|
}
|
741
|
}
|
|
697
|
|
742
|
|
|
@@ -798,11 +843,11 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
@@ -798,11 +843,11 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
798
|
{
|
843
|
{
|
|
799
|
case WM_UPDATEPOS:
|
844
|
case WM_UPDATEPOS:
|
|
800
|
{
|
845
|
{
|
|
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));//背景色为蓝色
|
846
|
+ int colorstep = (255/100)*lParam;
|
|
|
|
847
|
+ int device_type = HIWORD(wParam);
|
|
|
|
848
|
+ int device_index = LOWORD(wParam);
|
|
|
|
849
|
+ myctrlProcess[device_type][device_index].SetPos(lParam);
|
|
|
|
850
|
+ myctrlProcess[device_type][device_index].SendMessage(PBM_SETBARCOLOR, 0, RGB(0, colorstep, 255-colorstep));//背景色为蓝色
|
|
806
|
}
|
851
|
}
|
|
807
|
break;
|
852
|
break;
|
|
808
|
case WM_DEVICECHANGE:
|
853
|
case WM_DEVICECHANGE:
|
|
@@ -873,26 +918,15 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
@@ -873,26 +918,15 @@ LRESULT CBlueFlashToolDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam |
|
873
|
return 0;
|
918
|
return 0;
|
|
874
|
}
|
919
|
}
|
|
875
|
#endif
|
920
|
#endif
|
|
876
|
- myStaticSn[device_type][device_index].GetWindowText(strtmsg);
|
|
|
|
877
|
- myThreadData[device_type][device_index].Filename = mystrAppcurrDir+"Bins\\ear\\"+strtmsg;
|
|
|
|
878
|
GetDlgItem(currID)->GetWindowText(strButonText);
|
921
|
GetDlgItem(currID)->GetWindowText(strButonText);
|
|
879
|
if (strButonText == "开始")
|
922
|
if (strButonText == "开始")
|
|
880
|
{
|
923
|
{
|
|
881
|
- //pThreadData = new FLASH_THREAD_DATA;
|
|
|
|
882
|
- myThreadData[device_type][device_index].pDlg = this;
|
|
|
|
883
|
- myThreadData[device_type][device_index].blue_device_type = (BYTE)
|
|
|
|
884
|
- device_type;
|
|
|
|
885
|
- myThreadData[device_type][device_index].nIndex = 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("停止");
|
|
|
|
890
|
}
|
924
|
}
|
|
891
|
else if (strButonText == "停止")
|
925
|
else if (strButonText == "停止")
|
|
892
|
{
|
926
|
{
|
|
893
|
DWORD threadExitcode;
|
927
|
DWORD threadExitcode;
|
|
894
|
//TerminateThread(m_hThread[aDeviceType][aIndex], 0);
|
928
|
//TerminateThread(m_hThread[aDeviceType][aIndex], 0);
|
|
895
|
- myThreadData[device_type][device_index].StartThread = false;
|
929
|
+ myThreadData[device_type][device_index].StartThread = BLUE_THREAD_STOP;
|
|
896
|
GetExitCodeThread(myThreadData[device_type][device_index].m_hThread, &threadExitcode);
|
930
|
GetExitCodeThread(myThreadData[device_type][device_index].m_hThread, &threadExitcode);
|
|
897
|
if (threadExitcode != STILL_ACTIVE)
|
931
|
if (threadExitcode != STILL_ACTIVE)
|
|
898
|
GetDlgItem(currID)->SetWindowText("开始");
|
932
|
GetDlgItem(currID)->SetWindowText("开始");
|
|
@@ -924,7 +958,8 @@ void CBlueFlashToolDlg::OnBnClickedStartAll() |
|
@@ -924,7 +958,8 @@ void CBlueFlashToolDlg::OnBnClickedStartAll() |
|
924
|
|
958
|
|
|
925
|
if (g_AppMainData.ary_myComPort[loop1][loop2] >2)
|
959
|
if (g_AppMainData.ary_myComPort[loop1][loop2] >2)
|
|
926
|
{
|
960
|
{
|
|
927
|
- myThreadData[loop1][loop2].StartThread = true;
|
961
|
+ myThreadData[loop1][loop2].StartThread = BLUE_THREAD_READY;
|
|
|
|
962
|
+ myctrlStartButton[loop1][loop2].SetWindowText("停止");
|
|
928
|
//myThreadData[loop1][loop2].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[loop1][loop2]);
|
963
|
//myThreadData[loop1][loop2].m_hThread = AfxBeginThread(BlueFlashThreadProc, &myThreadData[loop1][loop2]);
|
|
929
|
}
|
964
|
}
|
|
930
|
}
|
965
|
}
|
|
@@ -939,8 +974,16 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
@@ -939,8 +974,16 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
939
|
int loop1,loop2,loop3;
|
974
|
int loop1,loop2,loop3;
|
|
940
|
DWORD itemdataComPortList;
|
975
|
DWORD itemdataComPortList;
|
|
941
|
int sumPort = 0;
|
976
|
int sumPort = 0;
|
|
|
|
977
|
+ CString strinfo;
|
|
942
|
|
978
|
|
|
943
|
QuerySerialPortStatusEx(myAryExistPort,myAryNoneOpenedPort,myAryAlreadyOpenedPort,myAryNotExistPort,1,254);
|
979
|
QuerySerialPortStatusEx(myAryExistPort,myAryNoneOpenedPort,myAryAlreadyOpenedPort,myAryNotExistPort,1,254);
|
|
|
|
980
|
+
|
|
|
|
981
|
+ for (loop1 = 0;loop1< myAryExistPort.GetSize();loop1++)
|
|
|
|
982
|
+ {
|
|
|
|
983
|
+ strinfo.Format("%d",myAryExistPort.GetAt(loop1));
|
|
|
|
984
|
+ mylistDebugInfo.AddString(strinfo);
|
|
|
|
985
|
+ }
|
|
|
|
986
|
+
|
|
944
|
for (loop1 = 0;loop1<BLUE_TYPE_MAX; loop1++)
|
987
|
for (loop1 = 0;loop1<BLUE_TYPE_MAX; loop1++)
|
|
945
|
{
|
988
|
{
|
|
946
|
for (loop2 = 0;loop2 <MAX_TOPWELL_DEVICE_NUM;loop2++)
|
989
|
for (loop2 = 0;loop2 <MAX_TOPWELL_DEVICE_NUM;loop2++)
|
|
@@ -958,7 +1001,7 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
@@ -958,7 +1001,7 @@ void CBlueFlashToolDlg::UartDeviceChange(void) |
|
958
|
strComName.Format("COM%d",myAryExistPort.GetAt(loop3));
|
1001
|
strComName.Format("COM%d",myAryExistPort.GetAt(loop3));
|
|
959
|
int add_index = myctrlComboComPort[loop1][loop2].AddString(strComName);
|
1002
|
int add_index = myctrlComboComPort[loop1][loop2].AddString(strComName);
|
|
960
|
itemdataComPortList=0;
|
1003
|
itemdataComPortList=0;
|
|
961
|
- itemdataComPortList = loop1<<16|loop2<<8|add_index,myAryExistPort.GetAt(loop3);
|
1004
|
+ itemdataComPortList = loop1<<16|loop2<<8|myAryExistPort.GetAt(loop3);
|
|
962
|
myctrlComboComPort[loop1][loop2].SetItemData(add_index,itemdataComPortList);
|
1005
|
myctrlComboComPort[loop1][loop2].SetItemData(add_index,itemdataComPortList);
|
|
963
|
if (myAryExistPort.GetAt(loop3) == g_AppMainData.ary_myComPort[loop1][loop2])
|
1006
|
if (myAryExistPort.GetAt(loop3) == g_AppMainData.ary_myComPort[loop1][loop2])
|
|
964
|
{
|
1007
|
{
|
|
@@ -1105,11 +1148,12 @@ void CBlueFlashToolDlg::OnBnClickedStopAll() |
|
@@ -1105,11 +1148,12 @@ void CBlueFlashToolDlg::OnBnClickedStopAll() |
|
1105
|
int loop1,loop2;
|
1148
|
int loop1,loop2;
|
|
1106
|
CString strtmsg;
|
1149
|
CString strtmsg;
|
|
1107
|
DWORD threadExitcode;
|
1150
|
DWORD threadExitcode;
|
|
|
|
1151
|
+ mylistDebugInfo.ResetContent();
|
|
1108
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
1152
|
for (loop1 = 0; loop1 < BLUE_TYPE_MAX; loop1++)
|
|
1109
|
{
|
1153
|
{
|
|
1110
|
for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
1154
|
for (loop2 = 0; loop2 < MAX_TOPWELL_DEVICE_NUM; loop2++)
|
|
1111
|
{
|
1155
|
{
|
|
1112
|
- myThreadData[loop1][loop2].StartThread = false;
|
1156
|
+ myThreadData[loop1][loop2].StartThread = BLUE_THREAD_STOP;
|
|
1113
|
GetExitCodeThread(myThreadData[loop1][loop2].m_hThread, &threadExitcode);
|
1157
|
GetExitCodeThread(myThreadData[loop1][loop2].m_hThread, &threadExitcode);
|
|
1114
|
if (threadExitcode != STILL_ACTIVE)
|
1158
|
if (threadExitcode != STILL_ACTIVE)
|
|
1115
|
myctrlStartButton[loop1][loop2].SetWindowText("开始");
|
1159
|
myctrlStartButton[loop1][loop2].SetWindowText("开始");
|
|
@@ -1129,10 +1173,8 @@ void CBlueFlashToolDlg::calcTImeWhenFinished(int device_type, int index) |
|
@@ -1129,10 +1173,8 @@ void CBlueFlashToolDlg::calcTImeWhenFinished(int device_type, int index) |
|
1129
|
int loop;
|
1173
|
int loop;
|
|
1130
|
CString strOfFilename;
|
1174
|
CString strOfFilename;
|
|
1131
|
memset(fileid,0,6);
|
1175
|
memset(fileid,0,6);
|
|
1132
|
- mytickcount[device_type][index][1] = GetTickCount();
|
|
|
|
1133
|
DBG_print("线路 %d %d 下载完成, 耗时 %d 秒",device_type+1,index+1,
|
1176
|
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;
|
1177
|
+ (GetTickCount() -mytickcount[device_type][index] )/1000);
|
|
1136
|
myStaticSn[device_type][index].GetWindowText(strOfFilename);
|
1178
|
myStaticSn[device_type][index].GetWindowText(strOfFilename);
|
|
1137
|
pchar = strOfFilename.GetBuffer(0);
|
1179
|
pchar = strOfFilename.GetBuffer(0);
|
|
1138
|
strncpy(fileid,pchar+3,4);
|
1180
|
strncpy(fileid,pchar+3,4);
|