Commit 1ef62d8ec983c621086981830b8017c81ca37965

Authored by xiemeng
1 parent 99164693

update 20210312

@@ -75,7 +75,8 @@ void GlobalInitialize() @@ -75,7 +75,8 @@ void GlobalInitialize()
75 PathRemoveFileSpec(g_appdata.FolderPath); 75 PathRemoveFileSpec(g_appdata.FolderPath);
76 else 76 else
77 GetCurrentDirectory(MAX_PATH, g_appdata.FolderPath); 77 GetCurrentDirectory(MAX_PATH, g_appdata.FolderPath);
78 - strcat(g_appdata.FolderPath,TOPWELL_TEMPBIN_DIR); 78 + //strcat(g_appdata.FolderPath,TOPWELL_TEMPBIN_DIR);
  79 + sprintf(g_appdata.FolderPath,"%s%s%d",g_appdata.FolderPath,TOPWELL_TEMPBIN_DIR,GetTickCount());
79 if (FALSE==(BOOL)PathFileExists(g_appdata.FolderPath)) //最后的\\号有无都没关系 80 if (FALSE==(BOOL)PathFileExists(g_appdata.FolderPath)) //最后的\\号有无都没关系
80 CreateDirectory(g_appdata.FolderPath, NULL); 81 CreateDirectory(g_appdata.FolderPath, NULL);
81 82
@@ -835,7 +835,7 @@ BOOL ResizeAllWindow(DWORD mainwidth, WORD mainheigh) @@ -835,7 +835,7 @@ BOOL ResizeAllWindow(DWORD mainwidth, WORD mainheigh)
835 rect_setting.right = mainwidth; 835 rect_setting.right = mainwidth;
836 rect_setting.bottom = SETTINGSFACTOR*gwBaseY; 836 rect_setting.bottom = SETTINGSFACTOR*gwBaseY;
837 837
838 - rect_info.left = mainwidth*2/3; 838 + rect_info.left = mainwidth/5;
839 rect_info.top = rect_setting.bottom; 839 rect_info.top = rect_setting.bottom;
840 rect_info.right = mainwidth; 840 rect_info.right = mainwidth;
841 rect_info.bottom = mainheigh; 841 rect_info.bottom = mainheigh;
@@ -316,7 +316,7 @@ void ReceiveFileText( LPCTSTR ); @@ -316,7 +316,7 @@ void ReceiveFileText( LPCTSTR );
316 // Buffer manipulation functions 316 // Buffer manipulation functions
317 // 317 //
318 void OutputABufferToWindow( HWND, char *, DWORD ); 318 void OutputABufferToWindow( HWND, char *, DWORD );
319 -void OutputABuffer( HWND, char *, DWORD ); 319 +void OutputABuffer( HWND, char * );
320 BOOL ClearTTYContents( void ); 320 BOOL ClearTTYContents( void );
321 321
322 // 322 //
@@ -158,9 +158,9 @@ HISTORY: Date: Author: Comment: @@ -158,9 +158,9 @@ HISTORY: Date: Author: Comment:
158 10/27/95 AllenD Wrote it 158 10/27/95 AllenD Wrote it
159 159
160 -----------------------------------------------------------------------------*/ 160 -----------------------------------------------------------------------------*/
161 -void OutputABuffer(HWND hTTY, char * lpBuf, DWORD dwBufLen) 161 +void OutputABuffer(HWND hTTY, char * lpBuf)
162 { 162 {
163 - dwBufLen = strlen(lpBuf); 163 + DWORD dwBufLen =strlen(lpBuf);
164 if (dwBufLen == 0) { 164 if (dwBufLen == 0) {
165 OutputDebugString("NULL Buffer in OutputABuffer\n\r"); 165 OutputDebugString("NULL Buffer in OutputABuffer\n\r");
166 return; 166 return;
@@ -117,7 +117,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV) @@ -117,7 +117,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV)
117 117
118 if (dwRead) 118 if (dwRead)
119 { 119 {
120 - OutputABuffer(hTTY, lpBuf, dwRead); 120 + OutputABuffer(hTTY, lpBuf);
121 } 121 }
122 } 122 }
123 } 123 }
@@ -198,7 +198,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV) @@ -198,7 +198,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV)
198 return 0; 198 return 0;
199 } 199 }
200 g_appdata.rgbBGColor = RGB(255, 255, 255); 200 g_appdata.rgbBGColor = RGB(255, 255, 255);
201 - OutputABuffer(hTTY, "进入下载模式\r\n", dwRead); 201 + OutputABuffer(hTTY, "进入下载模式\r\n");
202 g_appdata.DownloadReday = TRUE; 202 g_appdata.DownloadReday = TRUE;
203 if (strlen(g_appdata.szFileName) != 0) 203 if (strlen(g_appdata.szFileName) != 0)
204 TransferFileTextStart(g_appdata.szFileName); 204 TransferFileTextStart(g_appdata.szFileName);
@@ -207,7 +207,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV) @@ -207,7 +207,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV)
207 { 207 {
208 g_appdata.tickcountFinish = GetTickCount(); 208 g_appdata.tickcountFinish = GetTickCount();
209 g_appdata.rgbBGColor = RGB(50, 255, 50); 209 g_appdata.rgbBGColor = RGB(50, 255, 50);
210 - OutputABuffer(hTTY, "下载完成\r\n", dwRead); 210 + OutputABuffer(hTTY, "下载完成\r\n");
211 g_appdata.DownloadReday = FALSE; 211 g_appdata.DownloadReday = FALSE;
212 } 212 }
213 else if (strstr(lpBuf, "Programming:")) 213 else if (strstr(lpBuf, "Programming:"))
@@ -222,7 +222,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV) @@ -222,7 +222,7 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV)
222 strncpy(ascbufpercent, pchar_percent + 12, 2); 222 strncpy(ascbufpercent, pchar_percent + 12, 2);
223 Flashed_percent = atoi(ascbufpercent); 223 Flashed_percent = atoi(ascbufpercent);
224 sprintf(ascbufpercent, "下载已完成%d\r\n", Flashed_percent); 224 sprintf(ascbufpercent, "下载已完成%d\r\n", Flashed_percent);
225 - OutputABuffer(hTTY, ascbufpercent, dwRead); 225 + OutputABuffer(hTTY, ascbufpercent);
226 g_appdata.DownloadReday = FALSE; 226 g_appdata.DownloadReday = FALSE;
227 } 227 }
228 } 228 }
@@ -230,13 +230,13 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV) @@ -230,13 +230,13 @@ DWORD WINAPI ReaderAndStatusProc(LPVOID lpV)
230 { 230 {
231 //g_appdata.tickcountFinish = GetTickCount(); 231 //g_appdata.tickcountFinish = GetTickCount();
232 g_appdata.rgbBGColor = RGB(255, 50, 50); 232 g_appdata.rgbBGColor = RGB(255, 50, 50);
233 - OutputABuffer(hTTY, "下载失败\r\n", dwRead); 233 + OutputABuffer(hTTY, "下载失败\r\n");
234 g_appdata.DownloadReday = FALSE; 234 g_appdata.DownloadReday = FALSE;
235 } 235 }
236 else 236 else
237 { 237 {
238 g_appdata.rgbBGColor = RGB(255, 255, 255); 238 g_appdata.rgbBGColor = RGB(255, 255, 255);
239 - OutputABuffer(hTTY, lpBuf, dwRead); 239 + OutputABuffer(hTTY, lpBuf);
240 g_appdata.DownloadReday = FALSE; 240 g_appdata.DownloadReday = FALSE;
241 } 241 }
242 } 242 }
@@ -597,7 +597,7 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -597,7 +597,7 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
597 } 597 }
598 if (g_appdata.DownloadReday == FALSE) 598 if (g_appdata.DownloadReday == FALSE)
599 { 599 {
600 - MessageBox(ghwndMain, "请合上夹具", "提示!", MB_OK); 600 + //MessageBox(ghwndMain, "请合上夹具", "提示!", MB_OK);
601 return FALSE; 601 return FALSE;
602 } 602 }
603 603
@@ -611,6 +611,12 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -611,6 +611,12 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
611 { 611 {
612 ChangeConnection(hWndDlg, g_appdata.fConnected); 612 ChangeConnection(hWndDlg, g_appdata.fConnected);
613 SetWindowText(GetDlgItem(hWndDlg, IDC_BUTTON_CONNECT_UART), "断开夹具"); 613 SetWindowText(GetDlgItem(hWndDlg, IDC_BUTTON_CONNECT_UART), "断开夹具");
  614 + g_appdata.rgbBGColor = RGB(255, 255, 255);
  615 + OutputABuffer(ghWndTTY, "成功连接夹具 \n\r");
  616 + if (strcmp(g_appdata.szFileName,"") == 0)
  617 + OutputABuffer(ghWndTTY, "尚未设定软件路径 \n\r");
  618 + else
  619 + OutputABuffer(ghWndTTY, "软件已设定, 请下压夹具开始\n\r");
614 } 620 }
615 } 621 }
616 else 622 else
@@ -619,6 +625,9 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -619,6 +625,9 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
619 { 625 {
620 ChangeConnection(hWndDlg, g_appdata.fConnected); 626 ChangeConnection(hWndDlg, g_appdata.fConnected);
621 SetWindowText(GetDlgItem(hWndDlg, IDC_BUTTON_CONNECT_UART), "连接夹具"); 627 SetWindowText(GetDlgItem(hWndDlg, IDC_BUTTON_CONNECT_UART), "连接夹具");
  628 + g_appdata.rgbBGColor = RGB(255, 201, 14);
  629 + OutputABuffer(ghWndTTY, "夹具已断开, 请重新连接夹具\n\r");
  630 +
622 } 631 }
623 632
624 } 633 }
@@ -658,16 +658,15 @@ const char dft_bdaddr[6] = { 0x00,0x00,0x00,0x3F,0x9f,0x94 }; @@ -658,16 +658,15 @@ const char dft_bdaddr[6] = { 0x00,0x00,0x00,0x3F,0x9f,0x94 };
658 658
659 char macid_sub[3] = {0x9e, 0x8b, 0x0}; 659 char macid_sub[3] = {0x9e, 0x8b, 0x0};
660 660
661 -//int macid_company = 1; 661 +char macid_company[3] = {0x0, 0x1, 0x2};
662 662
663 663
664 664
665 //char *fData, 665 //char *fData,
666 -int fileCheck_fix_MACID( const char macid_sub[3]) 666 +int fileCheck_fix_MACID( const char macid_sub[3],const char macid_company[3])
667 { 667 {
668 int i; 668 int i;
669 int ret = FILE_CHCK_SUCCESSFUL; 669 int ret = FILE_CHCK_SUCCESSFUL;
670 - int macid_company = GetTickCount();  
671 char tempBinFileName[256]; 670 char tempBinFileName[256];
672 DWORD dwWritten; 671 DWORD dwWritten;
673 char *p = g_appdata.BufEarphoneBin + MAC_ADDR_OFFSET + BAUDRATE_DET_DATA_LEN + HEADER_LEN; 672 char *p = g_appdata.BufEarphoneBin + MAC_ADDR_OFFSET + BAUDRATE_DET_DATA_LEN + HEADER_LEN;
@@ -682,8 +681,7 @@ int fileCheck_fix_MACID( const char macid_sub[3]) @@ -682,8 +681,7 @@ int fileCheck_fix_MACID( const char macid_sub[3])
682 } 681 }
683 682
684 memcpy(baaddr, macid_sub, sizeof(macid_sub)); 683 memcpy(baaddr, macid_sub, sizeof(macid_sub));
685 - //macid_company = macid_company<<8;  
686 - memcpy(baaddr +3, &macid_company,3); 684 + memcpy(baaddr + (sizeof(macid_sub)), macid_company, sizeof(macid_company));
687 685
688 //memset(baaddr,0,sizeof(baaddr)); 686 //memset(baaddr,0,sizeof(baaddr));
689 //app_lcd_device.display_char (" ", 0, 0); 687 //app_lcd_device.display_char (" ", 0, 0);
@@ -893,7 +891,7 @@ DWORD WINAPI TransferThreadProc(LPVOID lpV) @@ -893,7 +891,7 @@ DWORD WINAPI TransferThreadProc(LPVOID lpV)
893 /**********************check file*********************************/ 891 /**********************check file*********************************/
894 //lpfileBuf = HeapAlloc(hDataHeap, 0, dwFileSize); 892 //lpfileBuf = HeapAlloc(hDataHeap, 0, dwFileSize);
895 pRead = g_appdata.BufEarphoneBin; 893 pRead = g_appdata.BufEarphoneBin;
896 - err = fileCheck_fix_MACID(macid_sub); 894 + err = fileCheck_fix_MACID(macid_sub,macid_company);
897 if (err == WRONG_FILE_FORMAT) 895 if (err == WRONG_FILE_FORMAT)
898 { 896 {
899 ErrorReporter("wrong file format!"); 897 ErrorReporter("wrong file format!");
Please register or login to post a comment