Browse Source

Merge branch 'master' of http://thinking.zicp.io:3000/Home/scbc_repos

sat23 4 years ago
parent
commit
f0d3497c66

+ 2 - 0
SATHelper/SATHelper/Global.cpp

@@ -260,6 +260,8 @@ namespace Global
 		// ¶ÁÈ¡ÅäÖÃÄÚÈÝ;
 		g_Config.enableTW = GetPrivateProfileInt(_T("SATHelper"), _T("enableTW"), 0, szConfigpath);
 		g_Config.useTW = GetPrivateProfileInt(_T("SATHelper"), _T("useTW"), 0, szConfigpath);
+		g_Config.useUB530 = GetPrivateProfileInt(_T("SATHelper"), _T("useUB530"), 1, szConfigpath);
+
 
 		GetPrivateProfileString(_T("SATHelper"), _T("MIInitBat"), NULL, szValue, MAX_PATH, szConfigpath);
 		if (_tcslen(szValue) == 0)

+ 1 - 0
SATHelper/SATHelper/Global.h

@@ -29,6 +29,7 @@ namespace Global
 		// 是否启用测试精灵;
 		bool enableTW;
 		bool useTW;
+		bool useUB530;
 		std::string strMIInitBat;
 		std::string strSCBCInitBat;
 		// script、tester、resource保存目录;

+ 14 - 11
SATHelper/SATHelper/MainFrm.cpp

@@ -350,18 +350,21 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
 #endif
 
 #if _USE_DLGVIEW_ // 第一个视图;
-	CCreateContext context;
-	m_pUB530View = new CChildFrame();
-	context.m_pLastView = NULL;
-	context.m_pCurrentFrame = this;
-	context.m_pCurrentDoc = m_pDoc;
-	context.m_pNewViewClass = RUNTIME_CLASS(CUB530View);
-	context.m_pNewDocTemplate = m_pDoc->GetDocTemplate();
-	if (m_pUB530View->LoadFrame(DLG_UB530VIEW, WS_MAXIMIZE | WS_CHILDWINDOW, this, &context))
+	if (Global::g_Config.useUB530)
 	{
-		//m_pUB530View->ShowWindow(SW_SHOWMAXIMIZED);
-		m_pUB530View->InitialUpdateFrame(context.m_pCurrentDoc, FALSE);
-		//m_pUB530View->MDIActivate();
+		CCreateContext context;
+		m_pUB530View = new CChildFrame();
+		context.m_pLastView = NULL;
+		context.m_pCurrentFrame = this;
+		context.m_pCurrentDoc = m_pDoc;
+		context.m_pNewViewClass = RUNTIME_CLASS(CUB530View);
+		context.m_pNewDocTemplate = m_pDoc->GetDocTemplate();
+		if (m_pUB530View->LoadFrame(DLG_UB530VIEW, WS_MAXIMIZE | WS_CHILDWINDOW, this, &context))
+		{
+			//m_pUB530View->ShowWindow(SW_SHOWMAXIMIZED);
+			m_pUB530View->InitialUpdateFrame(context.m_pCurrentDoc, FALSE);
+			//m_pUB530View->MDIActivate();
+		}
 	}
 #else
 	CCreateContext context;

+ 4 - 1
TestWizard/TestWizard/SynSerial.cpp

@@ -301,6 +301,8 @@ DWORD CSynSerial::WriteComm(IN BYTE * pWirteBuf, IN CONST INT32 nWriteSize)
 	ClearCommError(m_hSerialPort, &dwErrorFlags, &ComStat);	
 	// дǰ,ÇĺżŐťş´ćÇř;
 	PurgeComm(m_hSerialPort, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);
+
+	memset(pWirteBuf, 0, nWriteSize);
 	if ( !WriteFile(m_hSerialPort, pWirteBuf, nWriteSize, &dwBytesWritten, &m_wrOverlapped) )
 	{
 		DWORD dwError = GetLastError();
@@ -354,6 +356,7 @@ DWORD CSynSerial::ReadComm(IN BYTE *pReadBuf, IN CONST DWORD& dwReadSize, WORD t
 		PurgeComm(m_hSerialPort, PURGE_TXABORT|PURGE_TXCLEAR);
 	}
 
+	memset(pReadBuf, 0, dwReadSize);
 	if ( !ReadFile(m_hSerialPort, pReadBuf, dwReadSize, &dwRealRead, &m_wrOverlapped) ) {
 		if ( GetLastError() == ERROR_IO_PENDING ) {
 			while(!GetOverlappedResult(m_hSerialPort, &m_wrOverlapped, &dwRealRead, FALSE)){
@@ -367,7 +370,7 @@ DWORD CSynSerial::ReadComm(IN BYTE *pReadBuf, IN CONST DWORD& dwReadSize, WORD t
 	}
 
 #ifdef __CONSOLE__
-	printf("ReadFile Len=%d, Buffer=%s\n", dwRealRead, pReadBuf);
+	printf("Error=%ld, ReadFile Len=%d, Buffer=%s\n", dwError, dwRealRead, pReadBuf);
 #endif
 
 	return dwRealRead;

+ 19 - 2
TestWizard/TestWizard/TestWizard.cpp

@@ -55,6 +55,8 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 		{
 			if ( OpenXML("D:\\SAT\\resource\\RCU\\TW\\G_AP_0F_IR.xml") == 0 )
 			{
+				SendCmd("*about");
+				Sleep(1000);
 				SendKey("POWER");
 			}
 
@@ -411,12 +413,19 @@ TESTWIZARD_API bool SendCmd(LPCTSTR strCommand)
 	// ·â×°·¢ËͰü;
 	byte szSendData[MAX_PATH] = {0};
 	_stprintf_s((TCHAR*)szSendData, MAX_PATH, _T("%s\r"), strCommand);
-
+#ifdef __CONSOLE__
+	DWORD dwTickCout = GetTickCount();
+#endif
 	DWORD dwNumberOfBytesWritten = g_synSerial.WriteComm(szSendData, _tcslen((TCHAR*)szSendData));
 	if ( dwNumberOfBytesWritten != _tcslen((TCHAR*)szSendData) )
 		return false;
 
+	memset(szSendData, 0, MAX_PATH);
 	DWORD dwNumberOfBytesRead = g_synSerial.ReadComm(szSendData, MAX_PATH);
+#ifdef __CONSOLE__
+	dwTickCout = GetTickCount() - dwTickCout;
+	printf("Time consuming=%ld\n\n", dwTickCout);
+#endif
 	return true;
 }
 
@@ -432,12 +441,19 @@ TESTWIZARD_API bool SendKey(LPCTSTR lpKeyName)
 	// ·â×°·¢ËͰü;
 	byte szSendData[MAX_PATH] = {0};
 	_stprintf_s((TCHAR*)szSendData, MAX_PATH, _T("*INPUT %s %s\r"), pkeyItem->keyType.c_str(), pkeyItem->keyCode.c_str());
-
+#ifdef __CONSOLE__
+	DWORD dwTickCout = GetTickCount();
+#endif
 	DWORD dwNumberOfBytesWritten = g_synSerial.WriteComm(szSendData, _tcslen((TCHAR*)szSendData));
 	if ( dwNumberOfBytesWritten != _tcslen((TCHAR*)szSendData) )
 		return false;
 
+	memset(szSendData, 0, MAX_PATH);
 	DWORD dwNumberOfBytesRead = g_synSerial.ReadComm(szSendData, MAX_PATH);
+#ifdef __CONSOLE__
+	dwTickCout = GetTickCount() - dwTickCout;
+	printf("Time consuming=%ld\n\n", dwTickCout);
+#endif
 	return dwNumberOfBytesRead ? true : false;
 }
 
@@ -517,6 +533,7 @@ TESTWIZARD_API bool SendSwitch(int nIndex /*=0*/)
 	if ( dwNumberOfBytesWritten != _tcslen((TCHAR*)szSendData) )
 		return false;
 
+	memset(szSendData, 0, MAX_PATH);
 	DWORD dwNumberOfBytesRead = g_usbSwitch.ReadComm(szSendData, MAX_PATH);
 	return dwNumberOfBytesRead ? true : false;
 }