Commit 02eeb6f984a35cd2088e336bdefb92a1d22d1416

Authored by xiemeng
1 parent 6c5745bf

update 0315

@@ -98,6 +98,7 @@ struct TTYInfoStruct @@ -98,6 +98,7 @@ struct TTYInfoStruct
98 DWORD rgbBGColor ; 98 DWORD rgbBGColor ;
99 BOOL DownloadReday; 99 BOOL DownloadReday;
100 DWORD tickcountFinish; //Íê³ÉÏÂÔØµÄʱ¼ä 100 DWORD tickcountFinish; //Íê³ÉÏÂÔØµÄʱ¼ä
  101 + BYTE unOpenedPortAry[255];
101 char szFileName[MAX_PATH]; 102 char szFileName[MAX_PATH];
102 #endif 103 #endif
103 } TTYInfo; 104 } TTYInfo;
@@ -78,7 +78,7 @@ BEGIN @@ -78,7 +78,7 @@ BEGIN
78 CONTROL "No Writing",IDC_NOWRITINGCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,89,58,10 78 CONTROL "No Writing",IDC_NOWRITINGCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,89,58,10
79 CONTROL "No Status",IDC_NOSTATUSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,109,54,10 79 CONTROL "No Status",IDC_NOSTATUSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,109,54,10
80 CONTROL "No Events",IDC_NOEVENTSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,99,68,10 80 CONTROL "No Events",IDC_NOEVENTSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,99,68,10
81 - PUSHBUTTON "Send",IDC_SENDBTN,100,0,50,12 81 + PUSHBUTTON "Send",IDC_SENDBTN,100,0,50,12,NOT WS_VISIBLE
82 EDITTEXT IDC_STATIC_BINPATH,0,13,192,12,ES_AUTOHSCROLL | ES_READONLY 82 EDITTEXT IDC_STATIC_BINPATH,0,13,192,12,ES_AUTOHSCROLL | ES_READONLY
83 PUSHBUTTON "select file",IDC_BUTTON2_SEC_BINFILE,50,0,50,12 83 PUSHBUTTON "select file",IDC_BUTTON2_SEC_BINFILE,50,0,50,12
84 END 84 END
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 Version="9.00" 4 Version="9.00"
5 Name="MyMTTTY" 5 Name="MyMTTTY"
6 ProjectGUID="{DB698040-BB0E-4432-BEF5-5101ED44C10B}" 6 ProjectGUID="{DB698040-BB0E-4432-BEF5-5101ED44C10B}"
  7 + RootNamespace="MyMTTTY"
7 TargetFrameworkVersion="0" 8 TargetFrameworkVersion="0"
8 > 9 >
9 <Platforms> 10 <Platforms>
@@ -57,7 +58,7 @@ @@ -57,7 +58,7 @@
57 AssemblerListingLocation=".\Release/" 58 AssemblerListingLocation=".\Release/"
58 ObjectFile=".\Release/" 59 ObjectFile=".\Release/"
59 ProgramDataBaseFileName=".\Release/" 60 ProgramDataBaseFileName=".\Release/"
60 - WarningLevel="3" 61 + WarningLevel="1"
61 SuppressStartupBanner="true" 62 SuppressStartupBanner="true"
62 /> 63 />
63 <Tool 64 <Tool
@@ -73,7 +74,7 @@ @@ -73,7 +74,7 @@
73 /> 74 />
74 <Tool 75 <Tool
75 Name="VCLinkerTool" 76 Name="VCLinkerTool"
76 - OutputFile=".\Release/MyMTTTY.exe" 77 + OutputFile=".\Release/BlueFlashTool.exe"
77 LinkIncremental="1" 78 LinkIncremental="1"
78 SuppressStartupBanner="true" 79 SuppressStartupBanner="true"
79 ProgramDatabaseFile=".\Release/MyMTTTY.pdb" 80 ProgramDatabaseFile=".\Release/MyMTTTY.pdb"
@@ -165,7 +166,7 @@ @@ -165,7 +166,7 @@
165 /> 166 />
166 <Tool 167 <Tool
167 Name="VCLinkerTool" 168 Name="VCLinkerTool"
168 - OutputFile=".\Debug/MyMTTTY.exe" 169 + OutputFile=".\Debug/BlueFlashTool.exe"
169 LinkIncremental="2" 170 LinkIncremental="2"
170 SuppressStartupBanner="true" 171 SuppressStartupBanner="true"
171 GenerateDebugInformation="true" 172 GenerateDebugInformation="true"
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
19 -----------------------------------------------------------------------------*/ 19 -----------------------------------------------------------------------------*/
20 20
21 #include <windows.h> 21 #include <windows.h>
  22 +#include <commctrl.h>
22 #include "mttty.h" 23 #include "mttty.h"
23 24
24 #define AMOUNT_TO_READ 512 25 #define AMOUNT_TO_READ 512
@@ -239,6 +240,8 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV) @@ -239,6 +240,8 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV)
239 strncpy(ascbufpercent, pchar_percent + 12, 2); 240 strncpy(ascbufpercent, pchar_percent + 12, 2);
240 Flashed_percent = atoi(ascbufpercent); 241 Flashed_percent = atoi(ascbufpercent);
241 sprintf(ascbufpercent, "下载已完成%d\r\n", Flashed_percent); 242 sprintf(ascbufpercent, "下载已完成%d\r\n", Flashed_percent);
  243 + PostMessage(GetDlgItem(ghWndStatusDlg, IDC_TRANSFERPROGRESS), PBM_SETPOS, Flashed_percent, 0);
  244 +
242 OutputABuffer(hTTY, ascbufpercent); 245 OutputABuffer(hTTY, ascbufpercent);
243 TTYInfo.DownloadReday = FALSE; 246 TTYInfo.DownloadReday = FALSE;
244 } 247 }
@@ -78,13 +78,9 @@ BOOL CALLBACK GetADWORDProc( HWND, UINT, WPARAM, LPARAM ); @@ -78,13 +78,9 @@ BOOL CALLBACK GetADWORDProc( HWND, UINT, WPARAM, LPARAM );
78 DCB dcbTemp; 78 DCB dcbTemp;
79 79
80 #ifdef __OPTEK_EDIT__ 80 #ifdef __OPTEK_EDIT__
81 -char * szBaud[] = {  
82 - "115200*1", "115200*2", "115200*4", "115200*8"  
83 -}; 81 +//char * szBaud[] = { "115200*1", "115200*2", "115200*4", "115200*8" };
84 82
85 -DWORD BaudTable[] = {  
86 - (CBR_115200)*1,(CBR_115200)*2,(CBR_115200)*4,(CBR_115200)*8  
87 -} ; 83 +//DWORD BaudTable[] = { (CBR_115200)*1,(CBR_115200)*2,(CBR_115200)*4,(CBR_115200)*8 } ;
88 84
89 #else 85 #else
90 char * szBaud[] = { 86 char * szBaud[] = {
@@ -277,20 +273,15 @@ void UpdateTTYInfo() @@ -277,20 +273,15 @@ void UpdateTTYInfo()
277 char gszPort_Temp[20] = {0}; 273 char gszPort_Temp[20] = {0};
278 #endif 274 #endif
279 GetDlgItemText(ghWndToolbarDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort)); 275 GetDlgItemText(ghWndToolbarDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort));
280 -#ifdef __OPTEK_EDIT__ 276 +#if 0//def __OPTEK_EDIT__
281 if (gszPort[3] - '0' > 0 && gszPort[4] - '0' > 0) 277 if (gszPort[3] - '0' > 0 && gszPort[4] - '0' > 0)
282 { 278 {
283 wsprintf(gszPort_Temp,"\\\\.\\%s%d","COM", (gszPort[3] - '0' )*10 + (gszPort[4] - '0')); 279 wsprintf(gszPort_Temp,"\\\\.\\%s%d","COM", (gszPort[3] - '0' )*10 + (gszPort[4] - '0'));
284 memset(gszPort, 20, sizeof(char)); 280 memset(gszPort, 20, sizeof(char));
285 strcpy(gszPort, gszPort_Temp); 281 strcpy(gszPort, gszPort_Temp);
286 - /*MessageBox(NULL, gszPort, "TEST---", MB_OK);*/  
287 } 282 }
288 #endif 283 #endif
289 - BAUDRATE(TTYInfo) = GetdwTTYItem( ghWndToolbarDlg,  
290 - IDC_BAUDCOMBO,  
291 - szBaud,  
292 - BaudTable,  
293 - sizeof(BaudTable)/sizeof(BaudTable[0])); 284 + //BAUDRATE(TTYInfo) = GetdwTTYItem( ghWndToolbarDlg, IDC_BAUDCOMBO, szBaud, BaudTable, sizeof(BaudTable)/sizeof(BaudTable[0]));
294 285
295 PARITY(TTYInfo) = GetbTTYItem( ghWndToolbarDlg, 286 PARITY(TTYInfo) = GetbTTYItem( ghWndToolbarDlg,
296 IDC_PARITYCOMBO, 287 IDC_PARITYCOMBO,
@@ -539,13 +530,13 @@ BOOL SettingsDlgInit( HWND hDlg ) @@ -539,13 +530,13 @@ BOOL SettingsDlgInit( HWND hDlg )
539 { 530 {
540 char szBuffer[ MAXLEN_TEMPSTR ], szTemp[ MAXLEN_TEMPSTR ] ; 531 char szBuffer[ MAXLEN_TEMPSTR ], szTemp[ MAXLEN_TEMPSTR ] ;
541 WORD wCount, wMaxCOM, wPosition ; 532 WORD wCount, wMaxCOM, wPosition ;
542 -#ifdef __OPTEK_EDIT__ 533 +#if 0//def __OPTEK_EDIT__
543 int cmdT[MAXPORTS]; 534 int cmdT[MAXPORTS];
544 #endif 535 #endif
545 wMaxCOM = MAXPORTS ; 536 wMaxCOM = MAXPORTS ;
546 strcpy(szTemp, "COM"); 537 strcpy(szTemp, "COM");
547 538
548 -#ifdef __OPTEK_EDIT__ 539 +#if 0//def __OPTEK_EDIT__
549 memset(cmdT,0,sizeof(cmdT)); 540 memset(cmdT,0,sizeof(cmdT));
550 EnumAllComPort(cmdT); 541 EnumAllComPort(cmdT);
551 //for (int i=0;i<10;i++) 542 //for (int i=0;i<10;i++)
@@ -557,7 +548,7 @@ BOOL SettingsDlgInit( HWND hDlg ) @@ -557,7 +548,7 @@ BOOL SettingsDlgInit( HWND hDlg )
557 // fill port combo box and make initial selection 548 // fill port combo box and make initial selection
558 // 549 //
559 for (wCount = 0; wCount < wMaxCOM; wCount++) { 550 for (wCount = 0; wCount < wMaxCOM; wCount++) {
560 -#ifdef __OPTEK_EDIT__ 551 +#if 0//def __OPTEK_EDIT__
561 //wsprintf( szBuffer, "%s%d", (LPSTR) szTemp, wCount + 1 ) ; 552 //wsprintf( szBuffer, "%s%d", (LPSTR) szTemp, wCount + 1 ) ;
562 if (cmdT[wCount]) 553 if (cmdT[wCount])
563 { 554 {
@@ -566,9 +557,14 @@ BOOL SettingsDlgInit( HWND hDlg ) @@ -566,9 +557,14 @@ BOOL SettingsDlgInit( HWND hDlg )
566 (LPARAM) (LPSTR) szBuffer ) ; 557 (LPARAM) (LPSTR) szBuffer ) ;
567 } 558 }
568 #else 559 #else
569 - wsprintf( szBuffer, "%s%d", (LPSTR) szTemp, wCount + 1 ) ; 560 + for (wCount = 0; wCount < 255; wCount++)
  561 + {
  562 + if (TTYInfo.unOpenedPortAry[wCount] == 0)
  563 + continue;;
  564 + wsprintf( szBuffer, "%s%d", (LPSTR) szTemp, TTYInfo.unOpenedPortAry[wCount] ) ;
570 SendDlgItemMessage( hDlg, IDC_PORTCOMBO, CB_ADDSTRING, 0, 565 SendDlgItemMessage( hDlg, IDC_PORTCOMBO, CB_ADDSTRING, 0,
571 (LPARAM) (LPSTR) szBuffer ) ; 566 (LPARAM) (LPSTR) szBuffer ) ;
  567 + }
572 #endif 568 #endif
573 } 569 }
574 570
@@ -580,10 +576,7 @@ BOOL SettingsDlgInit( HWND hDlg ) @@ -580,10 +576,7 @@ BOOL SettingsDlgInit( HWND hDlg )
580 // 576 //
581 // fill baud combo box and make initial selection 577 // fill baud combo box and make initial selection
582 // 578 //
583 - FillComboBox( GetDlgItem( hDlg, IDC_BAUDCOMBO ),  
584 - szBaud, BaudTable,  
585 - sizeof( BaudTable ) / sizeof( BaudTable[ 0 ] ),  
586 - BAUDRATE( TTYInfo ) ) ; 579 + //FillComboBox( GetDlgItem( hDlg, IDC_BAUDCOMBO ), szBaud, BaudTable, sizeof( BaudTable ) / sizeof( BaudTable[ 0 ] ), BAUDRATE( TTYInfo ) ) ;
587 580
588 // 581 //
589 // fill data bits combo box and make initial selection 582 // fill data bits combo box and make initial selection
@@ -816,34 +809,22 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -816,34 +809,22 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
816 fRet = FALSE; 809 fRet = FALSE;
817 break; 810 break;
818 case IDC_BUTTON2_SEC_BINFILE: 811 case IDC_BUTTON2_SEC_BINFILE:
819 -{  
820 - if (strlen(TTYInfo.szFileName) == 0)  
821 { 812 {
822 - #ifdef __OPTEK_EDIT__  
823 - char * szFilter = "bin Files\0*.bin\0";  
824 - #else  
825 - char * szFilter = "Text Files\0*.TXT\0";  
826 - #endif 813 + char *szFilter = "bin Files\0*.bin\0";
827 OPENFILENAME ofn = { 0 }; 814 OPENFILENAME ofn = { 0 };
828 ofn.lStructSize = sizeof(OPENFILENAME); 815 ofn.lStructSize = sizeof(OPENFILENAME);
829 ofn.hwndOwner = ghWndTTY; 816 ofn.hwndOwner = ghWndTTY;
830 ofn.lpstrFilter = szFilter; 817 ofn.lpstrFilter = szFilter;
831 ofn.lpstrFile = TTYInfo.szFileName; 818 ofn.lpstrFile = TTYInfo.szFileName;
832 ofn.nMaxFile = MAX_PATH; 819 ofn.nMaxFile = MAX_PATH;
833 - #ifdef __OPTEK_EDIT__  
834 - ofn.lpstrTitle = "Select file";  
835 - #else  
836 - ofn.lpstrTitle = "Send File";  
837 - #endif 820 + ofn.lpstrTitle = "Select File";
838 ofn.Flags = OFN_FILEMUSTEXIST; 821 ofn.Flags = OFN_FILEMUSTEXIST;
839 if (!GetOpenFileName(&ofn)) break; 822 if (!GetOpenFileName(&ofn)) break;
840 if (strlen(TTYInfo.szFileName) != 0) 823 if (strlen(TTYInfo.szFileName) != 0)
841 { 824 {
842 SetWindowText(GetDlgItem(hWndDlg, IDC_STATIC_BINPATH), TTYInfo.szFileName); 825 SetWindowText(GetDlgItem(hWndDlg, IDC_STATIC_BINPATH), TTYInfo.szFileName);
843 - ShowWindow(GetDlgItem(hWndDlg, IDC_BUTTON2_SEC_BINFILE),0);  
844 - //SetWindowText(GetDlgItem(hWndDlg, IDC_BUTTON2_SEC_BINFILE), "ÏÂÔØÈí¼þ"); 826 + //ShowWindow(GetDlgItem(hWndDlg, IDC_BUTTON2_SEC_BINFILE), 0);
845 } 827 }
846 -  
847 #ifdef __OPTEK_EDIT__ 828 #ifdef __OPTEK_EDIT__
848 UpdateStatus(TTYInfo.szFileName); 829 UpdateStatus(TTYInfo.szFileName);
849 #else 830 #else
@@ -851,9 +832,8 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -851,9 +832,8 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
851 TransferFileTextStart(TTYInfo.szFileName); 832 TransferFileTextStart(TTYInfo.szFileName);
852 #endif 833 #endif
853 } 834 }
854 - } break;  
855 -  
856 -#ifdef __OPTEK_EDIT__ 835 + break;
  836 + #ifdef __OPTEK_EDIT__
857 case IDC_SENDBTN: // send button pressed 837 case IDC_SENDBTN: // send button pressed
858 if (!EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_PORTCOMBO), FALSE)) 838 if (!EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_PORTCOMBO), FALSE))
859 { 839 {
@@ -874,7 +854,7 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -874,7 +854,7 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
874 } 854 }
875 fRet = FALSE; 855 fRet = FALSE;
876 break; 856 break;
877 -#endif 857 + #endif
878 case IDC_COMMEVENTSBTN: // comm events button pressed 858 case IDC_COMMEVENTSBTN: // comm events button pressed
879 DialogBox(ghInst, MAKEINTRESOURCE(IDD_COMMEVENTSDLG), ghwndMain, CommEventsProc); 859 DialogBox(ghInst, MAKEINTRESOURCE(IDD_COMMEVENTSDLG), ghwndMain, CommEventsProc);
880 fRet = FALSE; 860 fRet = FALSE;
@@ -251,6 +251,8 @@ void TransferFileTextStart(LPCTSTR lpstrFileName) @@ -251,6 +251,8 @@ void TransferFileTextStart(LPCTSTR lpstrFileName)
251 HMENU hMenu; 251 HMENU hMenu;
252 UINT MenuFlags ; 252 UINT MenuFlags ;
253 253
  254 + //if (TRANSFERRING(TTYInfo)) return;
  255 +
254 // 256 //
255 // open the file 257 // open the file
256 // 258 //
@@ -797,7 +799,7 @@ int fileCheck(char *fData,char *dataLen) @@ -797,7 +799,7 @@ int fileCheck(char *fData,char *dataLen)
797 baaddr[2] = (unsigned char)(ticks.LowPart>>16)&0x000000ff; 799 baaddr[2] = (unsigned char)(ticks.LowPart>>16)&0x000000ff;
798 800
799 wsprintf(szMessage, "bt bdaddr:0x%02x%02x%02x%02x%02x%02x\r\n",baaddr[5],baaddr[4],baaddr[3],baaddr[2],baaddr[1],baaddr[0]); 801 wsprintf(szMessage, "bt bdaddr:0x%02x%02x%02x%02x%02x%02x\r\n",baaddr[5],baaddr[4],baaddr[3],baaddr[2],baaddr[1],baaddr[0]);
800 - UpdateStatus(szMessage); 802 + OutputABuffer(ghWndTTY, szMessage);
801 } 803 }
802 else 804 else
803 { 805 {
@@ -928,8 +930,11 @@ DWORD WINAPI TransferThreadProc(LPVOID lpV) @@ -928,8 +930,11 @@ DWORD WINAPI TransferThreadProc(LPVOID lpV)
928 // set up transfer metrics 930 // set up transfer metrics
929 if (!GetTransferSizes(hFileHandle, &dwPacketSize, &dwMaxPackets, &dwFileSize)) 931 if (!GetTransferSizes(hFileHandle, &dwPacketSize, &dwMaxPackets, &dwFileSize))
930 fAborting = TRUE; 932 fAborting = TRUE;
931 - else {  
932 - SendMessage(hWndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, dwMaxPackets+1)); 933 + else
  934 + {
  935 +
  936 + SendMessage(hWndProgress, PBM_SETRANGE32, (WPARAM)0, (LPARAM)(100));
  937 + //SendMessage(hWndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
933 SendMessage(hWndProgress, PBM_SETSTEP, (WPARAM) 1, 0); 938 SendMessage(hWndProgress, PBM_SETSTEP, (WPARAM) 1, 0);
934 SendMessage(hWndProgress, PBM_SETPOS, 0, 0); 939 SendMessage(hWndProgress, PBM_SETPOS, 0, 0);
935 } 940 }
@@ -341,8 +341,6 @@ void WriterFile(PWRITEREQUEST pWrite) @@ -341,8 +341,6 @@ void WriterFile(PWRITEREQUEST pWrite)
341 // 341 //
342 // update progress indicator (even if aborting) 342 // update progress indicator (even if aborting)
343 // 343 //
344 - if (!PostMessage(pWrite->hWndProgress, PBM_STEPIT, 0, 0))  
345 - ErrorReporter("PostMessage (file transfer status)");  
346 344
347 return; 345 return;
348 } 346 }
Please register or login to post a comment