ソースを参照

测试中 。未进行编译

CHENJIE-PC\QiXiang_CHENJIE 3 年 前
コミット
4302069dc8
6 ファイル変更23 行追加31 行削除
  1. 0 1
      inc/UartTask.h
  2. 1 0
      inc/hal_module_adapter.h
  3. 3 3
      src/MainTask.c
  4. 1 6
      src/TcpTask.c
  5. 0 1
      src/UartTask.c
  6. 18 20
      src/hal_module_adapter.c

+ 0 - 1
inc/UartTask.h

@@ -21,7 +21,6 @@ typedef struct Uart_Write_Data_Type
     uint8_t Data[2];
 }Uart_Write_Data_Type;
 //全局变量输出区
-extern osMutexId_t UartMutex;
 extern QueueHandle_t UartWriteCmdHandle;
 //
 #define UART_WRITE_FLAG 0x01

+ 1 - 0
inc/hal_module_adapter.h

@@ -192,6 +192,7 @@ BOOL NB_ADC_Get(UINT32* adcValue, ADC_CHANNEL_TYPE adcChannel);
 void Debug_Del_Logfile(void);
 void Debug_Read_Logfile(UINT8 * rbuf,UINT16 FileSize);
 void Debug_printf(const UINT8 *format, ...);
+void Debug_GetSize(UINT16 *FileSize);
 #endif
 #ifdef BL_FILE_LOG
 void bluejoy_printf(BlLogLevel level, const UINT8 *format, ...);

+ 3 - 3
src/MainTask.c

@@ -110,7 +110,7 @@ static void MainTask(void* arg)
         printf("Wakeup_source:%d \n",Wakeup_source);
     #endif
     #ifdef DEBUGLOG
-    Debug_printf("Wakeup_source:%d \n",Wakeup_source);
+    Debug_printf("Wakeup-%d \n",Wakeup_source);
     #endif
 	appGetNVMSavedData();
     LoadAppDataInfo();
@@ -221,7 +221,7 @@ static void MainTask(void* arg)
                     }
                     i++;   
                 }
-                if(TcpService!=0x00||UDSSwitch==1||BMS_Fota_update_flag)
+                if(TcpService!=0x00||UDSSwitch==1||BMS_Fota_update_flag||battWorkState!=0)
                 {
                     xTimerReset(work_timer,0);
                 }
@@ -275,7 +275,7 @@ static void MainTask(void* arg)
                     printf("which slpstate can go now :%d \n",slpstate);
                 #endif
                 #ifdef DEBUGLOG
-                    Debug_printf("slpstate :%d \n",slpstate);
+                    Debug_printf("slp-%d  \n",slpstate);
                 #endif
                 slpManDeepSlpTimerStart(deepslpTimerID, AppNVMData.sleepTime*1000*60);
                 UINT8 sleeptime_count=0;

+ 1 - 6
src/TcpTask.c

@@ -36,8 +36,6 @@ UINT32 TcpService = 0;
 //全局变量输入区
 extern UINT32 Timer_count;
 extern volatile BOOL Sleep_flag;
-//extern UartReadMsgType UartReadMsg;
-extern osMutexId_t UartMutex;
 extern osMutexId_t GpsMutex;
 extern UINT8 GpsData[16];
 extern AppNVMDataType AppNVMData;
@@ -529,10 +527,7 @@ static void TcpDataInfoAssembleSend()
         DebugMsgtoTcpType DebugMsgInfo;
         UINT8 *SendBuffer = PNULL;
         UINT16 BufferLen = 0;
-        OSAFILE file;
-        file = OsaFopen("DebugFile","rb");
-        BufferLen = OsaFsize(file);
-        OsaFclose(file);
+        Debug_GetSize(BufferLen);
         UINT8 rbuf[BufferLen];
         #ifdef USING_PRINTF
             printf("BufferLen:%d!\n",BufferLen);

+ 0 - 1
src/UartTask.c

@@ -217,7 +217,6 @@ static void UartTask(void* arg)
                 Uart_Uds_LEN = Reg_Num*2;
                 memset(UartReadMsg.Header,0x00,Uart_Uds_LEN);
                 Uart_Recv_LEN = Uart_DataRecv_func((UINT8 *)&Uart_Read_Msg,UartReadMsg.Header);
-				//osMutexRelease(UartMutex);
 				if(Uart_Recv_LEN>0)
 				{
 					UartBattInfoRecvFlag =  TRUE;

+ 18 - 20
src/hal_module_adapter.c

@@ -262,32 +262,23 @@ void UTCToBeijing(UTC8TimeType* UTC8Time,unsigned int UTCyear,unsigned char UTCm
 }
 #include <stdarg.h>
 #ifdef DEBUGLOG
-static UINT8 DebugFileNux=0;
+static osMutexId_t DebugFileMux;
 static void Debug_Write_Logfile(UINT8 * buf)
 {
-	int32_t err;
 	UINT32 Count;
 	OSAFILE file;
-	while(DebugFileNux){
-		 osDelay(10/portTICK_PERIOD_MS);
-	}
-	DebugFileNux=1;
+	osMutexAcquire(DebugFileMux, osWaitForever)
 	file = OsaFopen("DebugFile","wb");
-	if(file==NULL){
-		DebugFileNux=0;
-		return;
-	}
-	if(OsaFseek(file, 0, SEEK_END) != 0)
+	if(file!=NULL)
 	{
-	    OsaFclose(file);
-	    DebugFileNux=0;
-	    return;
-	}
-	Count = OsaFwrite(buf, 1, strlen(buf), file);
-	if(Count != (strlen(buf))){
+		if(OsaFseek(file, 0, SEEK_END) == 0)
+		{
+			Count = OsaFwrite(buf, 1, strlen(buf), file);
+		}
+		OsaFclose(file);
 	}
-	OsaFclose(file);
-	DebugFileNux=0;
+	osMutexRelease(DebugFileMux);
+	return;
 }
 void Debug_printf(const UINT8 *format, ...)
  {
@@ -306,12 +297,19 @@ void Debug_printf(const UINT8 *format, ...)
 	memset(buf,0,128+1);
 	UTC8TimeType UTC8TimeStruct;
 	UTCToBeijing((UTC8TimeType *)&UTC8TimeStruct,year,month,day,hour,minute,sec);
-	sprintf((char *)buf,"%04d-%02d-%02d %02d:%02d:%02d ",UTC8TimeStruct.year,UTC8TimeStruct.month,UTC8TimeStruct.day,UTC8TimeStruct.hour,UTC8TimeStruct.minute,UTC8TimeStruct.second);
+	sprintf((char *)buf,"%02d-%02d %02d:%02d:%02d ",UTC8TimeStruct.month,UTC8TimeStruct.day,UTC8TimeStruct.hour,UTC8TimeStruct.minute,UTC8TimeStruct.second);
 	va_start(args, format);
 	vsnprintf(buf+strlen(buf), 128-strlen(buf), format, args);
 	va_end(args);
 	Debug_Write_Logfile(buf);
 }
+void Debug_GetSize(UINT16 *FileSize)
+{
+	OSAFILE file;
+	file = OsaFopen("DebugFile","rb");
+	FileSize = OsaFsize(file);
+	OsaFclose(file);
+}
 void Debug_Read_Logfile(UINT8 * rbuf,UINT16 FileSize)
 {
 	int32_t err;