/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * File Name          : freertos.c
  * Description        : Code for freertos applications
  ******************************************************************************
  * This notice applies to any and all portions of this file
  * that are not between comment pairs USER CODE BEGIN and
  * USER CODE END. Other portions of this file, whether 
  * inserted by the user or by software development tools
  * are owned by their respective copyright owners.
  *
  * Copyright (c) 2019 STMicroelectronics International N.V. 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without 
  * modification, are permitted, provided that the following conditions are met:
  *
  * 1. Redistribution of source code must retain the above copyright notice, 
  *    this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. Neither the name of STMicroelectronics nor the names of other 
  *    contributors to this software may be used to endorse or promote products 
  *    derived from this software without specific written permission.
  * 4. This software, including modifications and/or derivative works of this 
  *    software, must execute solely and exclusively on microcontroller or
  *    microprocessor devices manufactured by or for STMicroelectronics.
  * 5. Redistribution and use of this software other than as permitted under 
  *    this license is void and will automatically terminate your rights under 
  *    this license. 
  *
  * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 
  * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
  * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
  * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 
  * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Includes ------------------------------------------------------------------*/
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"
#include <stdlib.h>
#include <math.h>
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "spi.h"
#include "tim.h"
#include "TerminalSlave485.h"
#include "TerminalSlave485_jt808.h"
#include "KeySlave485.h"
#include "CollectMaster485.h"
#include "ScreenMaster485.h"
#include "Elec_Seal.h"
#include "Dwin.h"
#include "func_fatfs_record.h"
#include "func_lfs_record.h"
#include "func_queue_record.h"
#include "Data_deal.h"
#include "DS1302.h"
#include "DS1302Drv.h"
#include "usart.h"
#include <string.h> //memset函数
#include "func_spi_w25qxx.h"
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
#define	DEBUG_FREERTOS_TASK 	0
/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
void DisplayRunInfo(uint32_t FunDebugCode000);
void DisplaySensorInfo(void);
void DisplayValveInfo(void);
//void formatStr(uint16_t  bufTextCang01_IO[],uint8_t  Cang02_IO[],uint8_t cangNum);
int formatStr(uint16_t *bufTextCang02_IO000, uint8_t *Cang02_IO000, uint8_t cangNum);

int formatStrCang01(uint16_t *bufTextCang01_IO000, uint8_t *Cang01_IO000, uint8_t cangNum); //可以显示兼容的老式协议

SDateTime m_datetime;
//SDateTime sys_datetime;

static int FRAM_cnt = 0;
uint8_t vt_disp_type=0;
uint32_t cntUsage = 0; //统计cpu利用率
/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN Variables */
osThreadId Uart2_CommHandle;
osThreadId Usart1_TerminalHandle; ////Task_Usart1_Terminal
osThreadId Data_ProcessHandle;
osThreadId DispSensorData_Handle;

//osThreadId VoicePlay_Handle;		 //语音播报任务
osThreadId Task_GetCPU_Usage_Handle; //

osThreadId task_record_Handle;		 //记录任务

/* 互斥信号量句柄 */
SemaphoreHandle_t xSemaphore_uart4 = NULL; //串口4  语音播报器与按键接在一个总线上

unsigned char scrData[32];

uint16_t bufText00[256];
uint16_t bufText01Password[256];
uint32_t totalRunTimeCnt; //累计运行时间

uint16_t bufTextCang01_IO[256];
uint16_t bufTextCang02_IO[256];
uint16_t bufTextCang03_IO[256];
uint16_t bufTextCang04_IO[256];

uint16_t bufTextSensorInfo[1024]; //模拟量类的传感器信息  温度  液位  压力等

uint8_t Cang01_IO[64];
uint8_t Cang02_IO[64];
uint8_t Cang03_IO[64];
uint8_t Cang04_IO[64];

uint8_t (*ptrIO_EachCang)[64];

uint8_t Cang05_IO[64];
uint8_t Cang06_IO[64];
uint8_t Cang07_IO[64];
uint8_t Cang08_IO[64];

sT2C_ALL_Sensor_Data_Each_Cang *pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data01;
//uint8_t CangNum_tskUart3=1;

/* USER CODE END Variables */

/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */

void ControllerConfig_Init(void)
{
	//	uint8_t t000;
	int i000;
	uni_float uni_flo001_init;
	extern float Zero_Of_LiquidMeter[8]; //8个仓的雷达液位计零点参数
	extern sT2C_RemoteCaliDat T2C_RemoteCaliDat001;

	//滑动窗口采样时间10--900秒(2字节)；液位波动2--10mm(2字节)，是否启用(2字节)。选用哪一个仓位的液位计进行稳油判断(0--7)(1字节)。
	CabinetNumForWenYou = FM25L16B_ReadByte(ADDR_Auto_OilStatic_Judgement + 7);
	; //读取用于稳油判断的液位计的仓位号

	//运行总时间
	totalRunTimeCnt = (FM25L16B_ReadByte(ADDR_TotalRunTime + 0) << 24) + (FM25L16B_ReadByte(ADDR_TotalRunTime + 1) << 16) + (FM25L16B_ReadByte(ADDR_TotalRunTime + 2) << 8) + (FM25L16B_ReadByte(ADDR_TotalRunTime + 3));

	if (CabinetNumForWenYou > 8)
	{ //异常处理机制   如果仓位号>8则强制其为1，并且
		CabinetNumForWenYou = 1;
		FM25L16B_WriteByte(ADDR_Auto_OilStatic_Judgement + 6, CabinetNumForWenYou);
	}

	Config_info_all.Config_fun_id = FM25L16B_ReadByte(ADDR_Config_fun_id);
	if (Config_info_all.Config_fun_id == 0xff)
	{
		Config_info_all.Config_fun_id = 0;
		//FM25L16B_WriteByte(7,Config_info_all.Config_fun_id);
		FM25L16B_WriteByte(ADDR_Config_fun_id, Config_info_all.Config_fun_id);
	}
	Baseval_ID = FM25L16B_ReadByte(ADDR_Baseval_ID);
	if ((Baseval_ID != 1) && (Baseval_ID != 2)) //一般采集板的加装不会超过2个
	{
		Baseval_ID = 1; //默认一个初始化
		FM25L16B_WriteByte(ADDR_Baseval_ID, Baseval_ID);
	}
	StoreNumber = FM25L16B_ReadByte(ADDR_StoreNumber);
	if ((StoreNumber <= 0) || (StoreNumber > 8))
	{
		StoreNumber = 3; //默认3仓
		FM25L16B_WriteByte(ADDR_StoreNumber, StoreNumber);
	}
	all_Store = StoreNumber;
	Config_info_all.All_number = all_Store;
	Config_info_all.Collection_id = Baseval_ID;
	Config_info_all.ManHole_Big_info = FM25L16B_ReadByte(ADDR_ManHole_Big_info);
	if ((Config_info_all.ManHole_Big_info == 0xFF) || (Config_info_all.ManHole_Big_info == 0))
	{
		Config_info_all.ManHole_Big_info = 0x03;
		FM25L16B_WriteByte(ADDR_ManHole_Big_info, Config_info_all.ManHole_Big_info);
	}
	Config_info_all.ManHole_small_info = FM25L16B_ReadByte(ADDR_ManHole_small_info);
	if ((Config_info_all.ManHole_small_info == 0xFF) || (Config_info_all.ManHole_small_info == 0))
	{
		Config_info_all.ManHole_small_info = 0x03;
		FM25L16B_WriteByte(ADDR_ManHole_small_info, Config_info_all.ManHole_small_info);
	}
	Config_info_all.Dump_info = FM25L16B_ReadByte(ADDR_Dump_info);
	if ((Config_info_all.Dump_info == 0xFF) || (Config_info_all.Dump_info == 0))
	{
		Config_info_all.Dump_info = 0x03;
		FM25L16B_WriteByte(ADDR_Dump_info, Config_info_all.Dump_info);
	}
	Config_info_all.HaiDiFa_info = FM25L16B_ReadByte(ADDR_Foot_info);
	if ((Config_info_all.HaiDiFa_info == 0xFF) || (Config_info_all.HaiDiFa_info == 0))
	{
		Config_info_all.HaiDiFa_info = 0x03;
		FM25L16B_WriteByte(ADDR_Foot_info, Config_info_all.HaiDiFa_info);
	}
	Config_info_all.Auto_Seal_Time = (FM25L16B_ReadByte(ADDR_AutoSealed_Time + 0) << 8) | FM25L16B_ReadByte(ADDR_AutoSealed_Time + 1);
	if ((Config_info_all.Auto_Seal_Time == 0xFFFF) || (Config_info_all.Auto_Seal_Time == 0))
	{
		Config_info_all.Auto_Seal_Time = 300; //自动施封----对应于5分钟，300秒
											  //		FM25L16B_WriteByte(14,(Config_info_all.Auto_Seal_Time>>8)&0xFF);
											  //		FM25L16B_WriteByte(15,Config_info_all.Auto_Seal_Time&0xFF);
		FM25L16B_WriteByte(ADDR_AutoSealed_Time + 0, (Config_info_all.Auto_Seal_Time >> 8) & 0xFF);
		FM25L16B_WriteByte(ADDR_AutoSealed_Time + 1, Config_info_all.Auto_Seal_Time & 0xFF);
	}
	if ((Config_info_all.Config_fun_id & 0x20) == 0x20) //断电保存   掉电保存电子铅封状态；下次上电自动读取
	{
		if (FM25L16B_ReadByte(ADDR_Auto_sealedOK_ID) != 0x00)
		{
			Full_Oil_allinfo.Auto_sealedOK_ID = FM25L16B_ReadByte(ADDR_Auto_sealedOK_ID);
		}

		//Full_Oil_allinfo.Break_sealing_Id=~Full_Oil_allinfo.Auto_sealedOK_ID;

		if (FM25L16B_ReadByte(ADDR_Break_sealing_Id) != 0x00)
		{
			Full_Oil_allinfo.Break_sealing_Id = FM25L16B_ReadByte(ADDR_Break_sealing_Id);
		}
	}

	//		  //读取车牌号
	//			t000=FM25L16B_ReadByte(30);
	//
	//
	//			//省域代码，一个汉字2字节
	//			CarLicensePlate[0]=CarLicCodeArray[t000][6];
	//			CarLicensePlate[1]=CarLicCodeArray[t000][7];
	//
	//			//字母及数字代码
	//			CarLicensePlate[2]=FM25L16B_ReadByte(31);
	//			CarLicensePlate[3]=FM25L16B_ReadByte(32);
	//			CarLicensePlate[4]=FM25L16B_ReadByte(33);
	//			CarLicensePlate[5]=FM25L16B_ReadByte(34);
	//			CarLicensePlate[6]=FM25L16B_ReadByte(35);
	//			CarLicensePlate[7]=FM25L16B_ReadByte(36);

	//读取车牌号
	//			t000=FM25L16B_ReadByte(ADDR_CarPlate_Number+0);

	//省域代码，一个汉字2字节
	CarLicensePlate[0] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 0); //CarLicCodeArray[t000][6];
	CarLicensePlate[1] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 1); //CarLicCodeArray[t000][7];

	//字母及数字代码
	CarLicensePlate[2] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 2);
	CarLicensePlate[3] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 3);
	CarLicensePlate[4] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 4);
	CarLicensePlate[5] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 5);
	CarLicensePlate[6] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 6);
	CarLicensePlate[7] = FM25L16B_ReadByte(ADDR_CarPlate_Number + 7);
	__nop();

	//读取调试状态；确定是否执行某些命令
	//			dbgArray[0]=FM25L16B_ReadByte(37);
	//			dbgArray[1]=FM25L16B_ReadByte(38);
	//
	//
	//
	//
	//			dbgArray[2]=FM25L16B_ReadByte(39);
	//			dbgArray[3]=FM25L16B_ReadByte(40);
	//			dbgArray[4]=FM25L16B_ReadByte(41);
	//			dbgArray[5]=FM25L16B_ReadByte(42);
	//			dbgArray[6]=FM25L16B_ReadByte(43);
	//			dbgArray[7]=FM25L16B_ReadByte(43);//未实现，保留用所以同上一行

	dbgArray[0] = FM25L16B_ReadByte(ADDR_DebugControll + 0);
	dbgArray[1] = FM25L16B_ReadByte(ADDR_DebugControll + 1);
	dbgArray[2] = FM25L16B_ReadByte(ADDR_DebugControll + 2);
	dbgArray[3] = FM25L16B_ReadByte(ADDR_DebugControll + 3);
	dbgArray[4] = FM25L16B_ReadByte(ADDR_DebugControll + 4);
	dbgArray[5] = FM25L16B_ReadByte(ADDR_DebugControll + 5);
	dbgArray[6] = FM25L16B_ReadByte(ADDR_DebugControll + 6);
	dbgArray[7] = FM25L16B_ReadByte(ADDR_DebugControll + 7);

	//读取8个仓的液位计零点参数  转换为int16类型，以便发送给采集器
	for (i000 = 0; i000 < 8; i000++)
	{
		uni_flo001_init.array_u8[3] = FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter + 0 + i000 * 4);
		uni_flo001_init.array_u8[2] = FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter + 1 + i000 * 4);
		uni_flo001_init.array_u8[1] = FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter + 2 + i000 * 4);
		uni_flo001_init.array_u8[0] = FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter + 3 + i000 * 4);

		OffsetYewei[i000] = uni_flo001_init.flo_Data;		  //(FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+0)<<8)  +  FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+1);
		Zero_Of_LiquidMeter[i000] = uni_flo001_init.flo_Data; //
	}

	__nop();
	//读取8个仓的罐容表零点参数  转换为int16类型，以便发送给采集器
	for (i000 = 0; i000 < 8; i000++)
	{
		uni_flo001_init.array_u8[3] = FM25L16B_ReadByte(ADDR_Zero_Of_TankCapacity + 0 + i000 * 4);
		uni_flo001_init.array_u8[2] = FM25L16B_ReadByte(ADDR_Zero_Of_TankCapacity + 1 + i000 * 4);
		uni_flo001_init.array_u8[1] = FM25L16B_ReadByte(ADDR_Zero_Of_TankCapacity + 2 + i000 * 4);
		uni_flo001_init.array_u8[0] = FM25L16B_ReadByte(ADDR_Zero_Of_TankCapacity + 3 + i000 * 4);

		OffsetTankCapacity[i000] = uni_flo001_init.flo_Data; //(FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+0)<<8)  +  FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+1);
	}

	__nop();
	//读取膨胀系数
	for (i000 = 0; i000 < 8; i000++)
	{
		uni_flo001_init.array_u8[3] = FM25L16B_ReadByte(ADDR_OiLType_Data + 0 + i000 * 4);
		uni_flo001_init.array_u8[2] = FM25L16B_ReadByte(ADDR_OiLType_Data + 1 + i000 * 4);
		uni_flo001_init.array_u8[1] = FM25L16B_ReadByte(ADDR_OiLType_Data + 2 + i000 * 4);
		uni_flo001_init.array_u8[0] = FM25L16B_ReadByte(ADDR_OiLType_Data + 3 + i000 * 4);

		ExpansionRatio[i000] = uni_flo001_init.flo_Data; //(FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+0)<<8)  +  FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+1);
	}

	__NOP();

	//读取数据显示来源

	uni_flo001_init.array_u8[3] = FM25L16B_ReadByte(ADDR_DataSource_LiquidoMeter + 0 + 0 * 4);
	uni_flo001_init.array_u8[2] = FM25L16B_ReadByte(ADDR_DataSource_LiquidoMeter + 1 + 0 * 4);
	uni_flo001_init.array_u8[1] = FM25L16B_ReadByte(ADDR_DataSource_LiquidoMeter + 2 + 0 * 4);
	uni_flo001_init.array_u8[0] = FM25L16B_ReadByte(ADDR_DataSource_LiquidoMeter + 3 + 0 * 4);

	data_Src_To_Disp = uni_flo001_init.u32Dat; //(FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+0)<<8)  +  FM25L16B_ReadByte(ADDR_Zero_Of_LiquidMeter+1);
	__NOP();

	addr_ext_controllBoard = (FM25L16B_ReadByte(ADDR_Extended_ContBoard + 0) << 24) + (FM25L16B_ReadByte(ADDR_Extended_ContBoard + 1) << 16) +
							 (FM25L16B_ReadByte(ADDR_Extended_ContBoard + 2) << 8) + (FM25L16B_ReadByte(ADDR_Extended_ContBoard + 3));

	__NOP();

	FM25L16B_Read_N_Bytes(ADDR_RunAn_AlarmThreshold, T2C_RemoteCaliDat001.PayLoadData, 44);
	//解析8个浮点数数据
	for (i000 = 0; i000 < 11; i000++)
	{
		//下边4行代码顺序是反的   终端发过来的数据为1=0x3f800000
		uni_flo001_init.array_u8[3] = T2C_RemoteCaliDat001.PayLoadData[0 + i000 * 4];
		uni_flo001_init.array_u8[2] = T2C_RemoteCaliDat001.PayLoadData[1 + i000 * 4];
		uni_flo001_init.array_u8[1] = T2C_RemoteCaliDat001.PayLoadData[2 + i000 * 4];
		uni_flo001_init.array_u8[0] = T2C_RemoteCaliDat001.PayLoadData[3 + i000 * 4];

		AlarmArrayData[i000] = uni_flo001_init.flo_Data;
	}
	__nop();

	AlarmOfPressureThreshold_Upper = AlarmArrayData[0];
	AlarmOfPressureThreshold_Lower = AlarmArrayData[1];
	AlarmOfTempeThreshold_Upper = AlarmArrayData[2];
	AlarmOfTempeThreshold_Lower = AlarmArrayData[3];

	BiasOfTempe = AlarmArrayData[4];
	PressureWindowsSpan = AlarmArrayData[5];
	PressurePositiveThreshold = AlarmArrayData[6];
	PressureNegativeThreshold = AlarmArrayData[7];

	BiasOfPressure = AlarmArrayData[8];
	AlgType = (uint32_t)AlarmArrayData[9];

	FM25L16B_Read_N_Bytes(ADDR_USART1_RE_TIMEOUT, T2C_RemoteCaliDat001.PayLoadData, 4);
	for (i000 = 0; i000 < 1; i000++)
	{
		//下边4行代码顺序是反的   终端发过来的数据为1=0x3f800000
		uni_flo001_init.array_u8[3] = T2C_RemoteCaliDat001.PayLoadData[0 + i000 * 4];
		uni_flo001_init.array_u8[2] = T2C_RemoteCaliDat001.PayLoadData[1 + i000 * 4];
		uni_flo001_init.array_u8[1] = T2C_RemoteCaliDat001.PayLoadData[2 + i000 * 4];
		uni_flo001_init.array_u8[0] = T2C_RemoteCaliDat001.PayLoadData[3 + i000 * 4];
		AlarmArrayData[i000] = uni_flo001_init.flo_Data;
	}
	if (AlarmArrayData[0] > 60)
	{
		usart_timeout = (uint32_t)AlarmArrayData[0];
	}

	vt_disp_type = FM25L16B_ReadByte(ADDR_DISP_VT_TYPE);
	flag_En_BlankSeal = FM25L16B_ReadByte(ADDR_Enable_BlankSeal);

    // 开机初始化读取，SensorScanParam

	jt808_InitSensorScanParam();
}
/* USER CODE END FunctionPrototypes */

void Task_Usart2_Collector(void const *argument);
void Task_Usart1_Terminal(void const *argument); //终端数据处理任务

void Task_Usart3_LCD_Update(void const *argument);
void Task_Uart4_VoicePlay(void const *argument);
void Task_GetCPU_Usage(void const *argument);


#define TASK_BIT_1	0x01
#define TASK_BIT_2	0x02
#define TASK_BIT_3  0x04

#define TASK_BIT_ALL (TASK_BIT_1|TASK_BIT_2|TASK_BIT_2)
EventGroupHandle_t xCreatedEventGroup=NULL;
static void AppObjCreate (void)
{
    /* 创建事件标志组 */
    xCreatedEventGroup = xEventGroupCreate();
    
    if(xCreatedEventGroup == NULL)
    {
        /* 没有创建成功，用户可以在这里加入创建失败的处理机制 */
            printf("create event failure!\n");
    }
}

/**
  * @brief  FreeRTOS initialization
  * @param  None
  * @retval None
  */
void MX_FREERTOS_Init(void)
{
	/* USER CODE BEGIN Init */

	/* USER CODE END Init */

	/* USER CODE BEGIN RTOS_MUTEX */
	/* add mutexes, ... */
	/* USER CODE END RTOS_MUTEX */

	/* USER CODE BEGIN RTOS_SEMAPHORES */
	/* add semaphores, ... */
	/* USER CODE END RTOS_SEMAPHORES */

	/* USER CODE BEGIN RTOS_TIMERS */
	/* start timers, add new ones, ... */
	/* USER CODE END RTOS_TIMERS */

	/* Create the thread(s) */
	/* definition and creation of Uart_Comm */
	//osThreadDef(Uart_Comm, Task_Usart_GetAllSensorData, osPriorityAboveNormal, 0, 512);
#if DEBUG_FREERTOS_TASK==0
	osThreadDef(Uart2_Comm, Task_Usart2_Collector, osPriorityAboveNormal, 0, 512 * 2); //20200106李伟更改
	Uart2_CommHandle = osThreadCreate(osThread(Uart2_Comm), NULL);

	osThreadDef(Uart_Terminal, Task_Usart1_Terminal, osPriorityNormal, 0, 512 * 2); //终端数据通信任务
	Usart1_TerminalHandle = osThreadCreate(osThread(Uart_Terminal), NULL);
#endif	

#if	USE_RFS_RECORD==1	
	
		osThreadDef(task_record, func_record_queue_main, osPriorityNormal, 0, 512 * 16);
		task_record_Handle = osThreadCreate(osThread(task_record), NULL);
#endif	

	
#if DEBUG_FREERTOS_TASK==0
	/* definition and creation of Data_Process */
	osThreadDef(Data_Process, Task_Usart3_LCD_Update, osPriorityNormal, 0, 512 * 4);
	Data_ProcessHandle = osThreadCreate(osThread(Data_Process), NULL);


	/* USER CODE BEGIN RTOS_THREADS */
	/* add threads, ... */
	//	osThreadDef(VoicePlay_Process, Task_Uart4_VoicePlay, osPriorityNormal, 0, 512*2);
	//  VoicePlay_Handle = osThreadCreate(osThread(VoicePlay_Process), NULL);

	//osPriorityNormal    osPriorityHigh
	osThreadDef(GetCPU_Usage_Process, Task_GetCPU_Usage, osPriorityBelowNormal, 0, 512 * 2);
	Task_GetCPU_Usage_Handle = osThreadCreate(osThread(GetCPU_Usage_Process), NULL);		

#endif
	
	AppObjCreate();
	
	/* USER CODE END RTOS_THREADS */

	/* USER CODE BEGIN RTOS_QUEUES */
	/* add queues, ... */
	/* USER CODE END RTOS_QUEUES */
}
/* USER CODE BEGIN Header_Task_Usart_GetAllSensorData */
uint8_t ReadTime[17];
uint8_t TimeBuf[7]  = {0x20,0x21,0x12,0x29,0x13,0x28,0x55};
/**
  * @brief  Function implementing the Uart_Comm thread.串口通信任务--接收来自终端、采集器的数据
终端为串口1；采集器为串口2；迪文屏为串口3；按键板为串口4

另外定时将零点参数下发给采集器，用于Vt修正
  * @param  argument: Not used 
  * @retval None
  */
int i001 = 0;
/* USER CODE END Header_Task_Usart_GetAllSensorData */
void Task_Usart2_Collector(void const *argument)
{
	/* USER CODE BEGIN Task_Usart2_Collector */
		//ds1302_Init();
	//	//
		//HAL_Delay(50);
		//ds1302_Write_Time(TimeBuf);

	//	ds1302_initV2();
	//	DS1302_timeWrite();//初始化时间-----应该将其放在标定程序中，串口4按键或者串口1终端中
	//

	/* Infinite loop */
	//int i001 = 0;
	tmrForRemoteCali=SPAN_RemoteCali_INTERVAL;
	//	uint8_t keyVal=0;
	while (1)
	{
		i001++;

		//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //复位看门狗sp706
		//continue;
		if (En_XieYouFa_OverSample && (tmrForRemoteCali == 0))
		{ ///针对0x13数据帧特殊处理  解决加油站采样1L左右的油品不破封的问题---开始
			//按照老的格式读取之前的阀门状态----多个阀门状态或运算之后进行铅封业务运算
			ReadCollect_ValveState_64Byte(0x000003, Collector_Get_Valve_OldFormat, 0x0002, 0x0000, 0x0000);
			//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //复位看门狗sp706
			//HAL_Delay(SPAN_ControllerAndCollector_INTERVAL);
			//osDelay(SPAN_ControllerAndCollector_INTERVAL_100);
			xEventGroupSetBits(xCreatedEventGroup, TASK_BIT_1);
			Parse_0x0013_Data();

			Test_get_state(); //

			Break_Seal(); //破封检测  Elect_cover();////电子铅封系统处理

		} ///针对0x13数据帧特殊处理  解决加油站采样1L左右的油品不破封的问题---结束

		///*
		if ((Read_Collect485_Flag) && (tmrForRemoteCali == 0))
		{
			Read_Collect485_Flag = False;
			//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //复位看门狗sp706
			xEventGroupSetBits(xCreatedEventGroup, TASK_BIT_1);
			ReadAllStoreValue();				//读取传感器数据
			xEventGroupSetBits(xCreatedEventGroup, TASK_BIT_1);
			//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //复位看门狗sp706
			//HAL_Delay(20);

			CollectData_Transform_UsefullData();
			
			//if (PlatformCalibrat.Restart_Controller == False)
			//	HAL_GPIO_TogglePin(GPIOC, DWI_Pin);
			
				//		ds1302_Get_Time(ReadTime);
			//			KeySlave485_Send_Data(ReadTime,17);
			//HAL_Delay(20);
		}

		//if(((i00Data%2)==0) && (tmrForRemoteCali==0))//非标定模式
		if (tmrForRemoteCali == 0) //非标定模式 收到0x3901进入标定模式，保持20s 将资源留给标定命令
		{

			//if((i00task_usart3%3)==0)
			{
				Elect_cover(); ////电子铅封系统处理
			}
#if 0
			if (StartUpdate_Screen_Flag == True) //1S更新一次小屏状态
			{
				StartUpdate_Screen_Flag = False;
				Dispaly_CarAndValveState();
			}
#endif
			Test_get_state(); //实时获取阀门状态------------标定数据
		}

		Immediate_Processing_Function(); //来自按键串口或者终端的标定数据处理

		if (flag_Seal_Break == 1)
		{
			//xSemaphoreTake(xSemaphore_uart4, portMAX_DELAY);
			Send_alarm10S(); //破封报警发送
			//xSemaphoreGive(xSemaphore_uart4);
			flag_Seal_Break = 0;
		}

		//*/

		if (i001 >= 10)
		{
			; //MX_UART4_Init();
			i001 = 0;
			//ds1302_Read_Time();//有问题  待调试

			//DS1302_get_all();
		}

		xEventGroupSetBits(xCreatedEventGroup, TASK_BIT_1);
		osDelay(100); //阻塞时间
	}
	/* USER CODE END Task_Usart2_Collector */
}

/* USER CODE BEGIN Header_Task_LCD_Update */
/**
* @brief Function implementing the Data_Process thread.
* @param argument: Not used
在屏幕上显示运行信息
* @retval None
*/
/* USER CODE END Header_Task_LCD_Update */
uint16_t bufText00[256];
uint16_t bufText01Password[256];
char msg000[256] = "罐车安全智能监控系统杭州嘉隆物联网科技有限公司";
//char  Beijing_title[256]="    海底阀-卸油阀-人孔盖-排沉阀-有无油    ";//北京部队试用阀门标题栏

//char  arrValve_title01[256]="   底阀,卸油阀,人孔盖,小孔盖,管道油,底阀余油";//  阀门标题栏

char arrValve_title01[256] = "    海底阀  右卸油阀  左卸油阀  管道油"; //  阀门标题栏

//char  arrValve_title02[256]="海底阀1卸油阀1卸油阀2人孔盖1卸尽否1卸尽否2";//新疆鑫长宇  阀门标题栏
//char  arrValve_title02[256]="   海底阀1卸油阀1人孔盖1小孔盖1卸尽否1 ";//新疆鑫长宇  阀门标题栏
//char  arrValve_title02[256]="   海底阀 卸油阀 人孔盖 小孔盖 管道油 壁挂油 回收口 底阀油 ";//内蒙古项目  阀门标题栏
#if 0
char arrValve_title02[256] = "    海底阀   卸油阀  人孔盖  小孔盖  管道油"; //中岚项目  阀门标题栏
#else
char arrValve_title02[256] = "    液位(m) 实时体积(L) 标准体积(L)";
#endif

uint32_t tick001;
extern uint8_t flag_Sw_DisplaySensorData;
//extern   uint8_t Usart2_ErrorTimes,chkRetCaiJiBan;

/*
人机接口任务---主要是进行数据的业务层运算，刷新信息显示。
*/
void Task_Usart3_LCD_Update(void const *argument)
{
	uint16_t i00task_usart3 = 0; //,i002=0;
	int i001_DataTask, Len000;
	

	UNUSED(i001_DataTask);

	/* USER CODE BEGIN Task_Usart3_LCD_Update */
	ControllerConfig_Init();
	Init_Dwin_Signal();
	osDelay(50);
	Restart_LCD();
	//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //复位看门狗sp706
	osDelay(50);

	WrDwinCmd32(0x0084, 0x5A010000 | 0); //开机logo
	osDelay(500);
	HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //复位看门狗sp706
	//在启动界面上显示版本号
	//bufText01Password[0] = ADDR_DWIN_Text05;
	//WrDwinBuf(ADDR_DWIN_Text05_SP, bufText01Password, 1, 0);

	Len000 = sprintf((char *)bufText01Password, "硬件版本:%s,软件版本:%s;\r\nSN:%s.", Version_hardware, Version_software, product_ID);
	WrDwinBuf(ADDR_DWIN_Text05, bufText01Password, Len000, 1);

	osDelay(1000);//
	//HAL_Delay(300);
	//WrDwinCmd32(0x0084, 0x5A010000 | 0); //开机logo
	HAL_GPIO_TogglePin(GPIOC, DWI_Pin);	 //复位看门狗sp706
	WrDwinCmd16(0x0082, 0x6464);		 //开机屏亮

	Data_From_Server_0x6401_001.res001_u8 = 0x00; //显示服务器数据
	osDelay(300);
	Lcd_Init();
	HAL_GPIO_WritePin(GPIOE, BEEP_Pin, GPIO_PIN_RESET);
	osDelay(1000);						//HAL_Delay(1000);
	HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //复位看门狗sp706
	HAL_GPIO_WritePin(GPIOE, BEEP_Pin, GPIO_PIN_SET);

	//	HAL_GPIO_WritePin(GPIOE, BEEP_Pin, GPIO_PIN_RESET);
	//	HAL_Delay(1000);
	//	HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//复位看门狗sp706
	//	HAL_GPIO_WritePin(GPIOE, BEEP_Pin, GPIO_PIN_SET);

	//李伟更改-----发布状态下，不在屏幕上显示密码  20210609
	if (ShowPassword_JieFeng_En == 1)
	{
		bufText01Password[0] = ADDR_DWIN_Text01; //显示文本命令
		WrDwinBuf(ADDR_DWIN_Text01_SP, bufText01Password, 1, 0);

		bufText01Password[0] = ADDR_DWIN_SensorInfo; //显示模拟量类传感器信息
		WrDwinBuf(ADDR_DWIN_SensorInfo_SP, bufText01Password, 1, 0);

		bufText01Password[0] = ADDR_DWIN_Text02;
		WrDwinBuf(ADDR_DWIN_Text02_SP, bufText01Password, 1, 0);

		bufText01Password[0] = ADDR_DWIN_Text03_sysInfo;
		WrDwinBuf(ADDR_DWIN_Text03_SP, bufText01Password, 1, 0);

		bufText01Password[0] = ADDR_DWIN_Text04;
		WrDwinBuf(ADDR_DWIN_Text04_SP, bufText01Password, 1, 0);

		//显示汉字
		memcpy(bufText01Password, msg000, 64); //
		WrDwinBuf(ADDR_DWIN_Text01, bufText01Password, 80, 1);
		WrDwinBuf(ADDR_DWIN_Text02, bufText01Password, 80, 1);
		WrDwinBuf(ADDR_DWIN_Text03_sysInfo, bufText01Password, 80, 1);
		WrDwinBuf(ADDR_DWIN_Text04, bufText01Password, 80, 1);
	}
	else
	{
#if 0		
		for (i001_DataTask = 0; i001_DataTask < 3; i001_DataTask++)
		{
			bufText01Password[0] = 0xff00; //隐藏文本命令
			WrDwinBuf(ADDR_DWIN_Text01_SP, bufText01Password, 1, 0);
			WrDwinBuf(ADDR_DWIN_Text02_SP, bufText01Password, 1, 0);
			HAL_Delay(200);
			WrDwinBuf(ADDR_DWIN_Text03_SP, bufText01Password, 1, 0);
			WrDwinBuf(ADDR_DWIN_Text04_SP, bufText01Password, 1, 0);

			WrDwinBuf(ADDR_DWIN_SensorInfo_SP, bufText01Password, 1, 0); //隐藏模拟量类传感器信息

//			HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
		}
#endif		
	}

	//系统运行信息隐藏或者显示
	if (flag_Sw_DispSysInfo == 0)
	{
		bufText01Password[0] = 0xff00; //隐藏文本命令
		WrDwinBuf(ADDR_DWIN_Text03_SP, bufText01Password, 1, 0);
		HAL_Delay(10);
	}
	else
	{
		//bufText01Password[0] = ADDR_DWIN_Text03_sysInfo;
		//WrDwinBuf(ADDR_DWIN_Text03_SP, bufText01Password, 1, 0);
	}

	if (DisplaySensorData_En == 0)
	{								   //隐藏模拟量类的传感器显示控件
		bufText01Password[0] = 0xff00; //隐藏文本命令
		WrDwinBuf(ADDR_DWIN_SensorInfo_SP, bufText01Password, 1, 0);
		HAL_Delay(10);
	}
	else
	{ //显示模拟量类的传感器显示控件
		bufText01Password[0] = ADDR_DWIN_SensorInfo;
		WrDwinBuf(ADDR_DWIN_SensorInfo_SP, bufText01Password, 1, 0);
		osDelay(30);
		bufText01Password[0] = ADDR_DWIN_SensorInfo;
		WrDwinBuf(ADDR_DWIN_SensorInfo_SP, bufText01Password, 1, 0);
	}

	//禁止打印命令创鑫微电子
	PrintBuff[0] = 0x1b;
	PrintBuff[1] = 0x64;
	PrintBuff[2] = 0x00;
	KeySlave485_Send_Data((uint8_t *)PrintBuff, 3);
	memset(PrintBuff, 0, sizeof(PrintBuff));

	//济南打印机HOE公司
	PrintBuff[0] = 0x03; //
	PrintBuff[1] = 0xaa;
	KeySlave485_Send_Data((uint8_t *)PrintBuff, 2);

	osDelay(50);
	//禁止打印命令；济南打印机HOE公司
	//	PrintBuff[0]=0x03;//
	//	PrintBuff[1]=0xaa;
	//	KeySlave485_Send_Data((uint8_t *)PrintBuff,2);

	//如果仓数为2   则将2仓的阀门顺序拷贝之1仓，因为有多处使用1仓标题进行显示
	// if((StoreNumber==2)	||  (StoreNumber==3))
	{
	//	memset((char *)arrValve_title01, 0, sizeof(arrValve_title01));
	//	memcpy(arrValve_title01, arrValve_title02, sizeof(arrValve_title02));
	}

	//显示标题栏
	memset(bufTextCang01_IO, ' ', sizeof(bufTextCang01_IO));
	//Len000 = sprintf((char *)bufTextCang01_IO + 16 * 0, "%s", arrValve_title01); //  %02d\r\n
	Len000 = sprintf((char *)bufTextCang01_IO, "%s", arrValve_title02);
	
	memset((char *)bufTextCang01_IO + Len000, 0, sizeof(bufTextCang01_IO) - Len000);
	; //taskENTER_CRITICAL();
	; //
	WrDwinBuf(ADDR_DWIN_Title_IO,&bufTextCang01_IO[0],Len000,1);
	; //taskEXIT_CRITICAL();

	osDelay(350);

	tmrForPrinter = 15000; //启动定时器，15s内只能打印一次

	pT2C_SetupData->Reserved_parameters_4 = 2.0f; //迪文屏显示来自采集器的数据
	//pT2C_SetupData->Reserved_parameters_4=1.0f;//迪文屏默认显示来自平台的数据 而不是采集器的数据

	//56454的车默认p3=3;54021的车默认p3=1;
	pT2C_SetupData->Reserved_parameters_3 = 1.0f; //温度传感器取第1个点的温度
	i00task_usart3=5;
	Full_Oil_allinfo.Car_state_disp=0xff;
	Jump_page_id(Run_mode_key_info.current_page);
	/* Infinite loop */
	while (1)
	{
		i00task_usart3++;

		if (i00task_usart3 > 1000)
		{
			i00task_usart3 = 0;
		}


		//		//if(((i00Data%2)==0) && (tmrForRemoteCali==0))//非标定模式
		//		if(tmrForRemoteCali==0)//非标定模式 收到0x3901进入标定模式，保持20s 将资源留给标定命令
		//		{
		//
		//			if((i00task_usart3%3)==0)
		//			{
		//				Elect_cover();////电子铅封系统处理
		//			}
		//
		//
		//			if(StartUpdate_Screen_Flag ==True)//1S更新一次小屏状态
		//			{
		//				StartUpdate_Screen_Flag =False;
		//				Dispaly_CarAndValveState();
		//			}
		//
		//			Test_get_state();   //实时获取阀门状态------------标定数据
		//		}

		
		

		//Read_REAL_Time();//获取迪文屏时间，刷新至全局变量

		//HAL_Delay(10);
		//Read_REAL_Time();//获取迪文屏时间，刷新至全局变量

		//if(i00Data>=1*2)//给屏幕发送指令，刷新传感器的数值显示
		//ValStateConvertTo91();
		if (StartUpdate_Screen_Flag == True) //1S更新一次小屏状态
		{
			StartUpdate_Screen_Flag = False;
			Dispaly_CarAndValveState();
		}
		if ((i00task_usart3 % 60) == 0)
		{ 
			//偶数的时候显示模拟量类传感器信息--开始
			if ((DisplaySensorData_En) && (flag_Sw_DisplaySensorData == 1))
			{

				DisplaySensorInfo(); //显示运行信息(传感器信息  温度  压力 液位   密度  V20等参数)

				//
				//				switch (CangNum_tskUart3)
				//        {
				//        	case 1:
				//						pT2C_ALL_Sensor_Data_Disp=&T2C_ALL_Sensor_Data01;
				//        		break;
				//        	case 2:
				//						pT2C_ALL_Sensor_Data_Disp=&T2C_ALL_Sensor_Data02;
				//        		break;
				//        	case 3:
				//						pT2C_ALL_Sensor_Data_Disp=&T2C_ALL_Sensor_Data03;
				//        		break;
				//        	case 4:
				//						pT2C_ALL_Sensor_Data_Disp=&T2C_ALL_Sensor_Data04;
				//        		break;
				//
				//        	default:
				//						pT2C_ALL_Sensor_Data_Disp=&T2C_ALL_Sensor_Data01;
				//        		break;
				//        }
			}

		} //偶数的时候显示模拟量类传感器信息--开始

		if ((i00task_usart3 % 20) == 1)
		{
			//指示灯1 表明系统正在运行
			//HAL_GPIO_TogglePin(GPIOE, LED1_Pin);
			 //显示阀门类信息、运行信息--开始

			//			if(((i00Data%10)==5)  && (Usart2_ErrorTimes==0))
			//			{//清除异常标志
			//				WrDwinCmd16(ADDR_DWIN_StateYiChang_HaiDiFa,0x00);//底阀异常
			//				WrDwinCmd16(ADDR_DWIN_StateYiChang_XieYouFa,0x00);//卸油阀异常
			//			}

			tick001 = HAL_GetTick(); //
			//FunDebugCode=DebugFun_Version;//

			DisplayRunInfo(FunDebugCode); //显示运行信息(功能码解码之后信息、功能码信息等)
			//osDelay(50);

			//DisplayValveInfo(); //显示阀门类传感器信息

			//李伟修改  20210419   强制屏幕唤醒  并且跳到相应的图形页面-----开始
			//if(Lcd_sleep_flag ==2)//唤醒休眠
			//if(1==1)
#if  0  			
			if (tmrForKeyPad > 10) //如果有按键操作则强制唤醒休眠
			{
				Lcd_sleep_flag = 3;

				//HAL_Delay(LCD_TimeOfWake);//
			//	osDelay(LCD_TimeOfWake);
				//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				WrDwinCmd16(0x0082, 0x6464);		//亮度调节0x0000~0x6464

				//HAL_Delay(LCD_TimeOfWake);//
			//	osDelay(LCD_TimeOfWake);

				Jump_page_id(Run_mode_key_info.current_page);
				//HAL_Delay(LCD_TimeOfWake);//
			//	osDelay(LCD_TimeOfWake);
				//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}
#endif			
			//李伟修改  20210419   强制屏幕唤醒  并且跳到相应的图形页面-----结束

		} //显示阀门类信息、运行信息--结束
		xEventGroupSetBits(xCreatedEventGroup, TASK_BIT_3);
		osDelay(10);
		//osDelay(100 * 3); //阻塞延时，根据情况调节    20
	}
	/* USER CODE END Task_Usart3_LCD_Update */
}

/* USER CODE BEGIN Header_Task_Usart1_Terminal */
/**
* @brief Function implementing the Data_Process thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_Task_Usart1_Terminal */
uint8_t keyValTsk01 = 0;
void Task_Usart1_Terminal(void const *argument)
{
	/* USER CODE BEGIN Task_Usart1_Terminal */
	int i_task01 = 0;
#if IR_ROM1 == 0x8000000	
	i_task01=sprintf((char*)&USART1_TX_BUF[0],"App01 %s %s\r\n",__DATE__,__TIME__);
#else
	i_task01=sprintf((char*)&USART1_TX_BUF[0],"App02 %s %s\r\n",__DATE__,__TIME__);
#endif	
	//i_task01=sprintf((char*)&USART1_TX_BUF[0],"App01起始地址0x08000000\r\n");
	TerminalSlave485_Send_Data(USART1_TX_BUF,i_task01);	
	osDelay(100);
	i_task01=0;
	
	/* Infinite loop */
	while (1)
	{ //while(1)
	//	if (usart1_rx_flag)
		{
			Data_analysis(); //终端数据--串口1
		}
		i_task01++;

		if (i_task01 > 8000)
		{
			i_task01 = 0;
		}

		//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706

		if (i_task01 % 10 == 0) //调节按键灵敏度   键盘的灵敏度
		{					   //调节按键灵敏度   键盘的灵敏度
			keyValTsk01 = Get_keyvalue();

			if (keyValTsk01 != 0)
			{ //if(keyValTsk01!=0)
				Mode_key_pageID();

				if (FnKey == F2_and_key4)
				{ //强制复位
					FnKey = 0;
					Reboot_System();

				} //强制复位
			}	  //if(keyValTsk01!=0)

		} //调节按键灵敏度   键盘的灵敏度
		xEventGroupSetBits(xCreatedEventGroup, TASK_BIT_2);
		osDelay(10); //阻塞延时，根据情况调节------保证每秒钟可以接收4帧数据，50*Nms休眠时间

		// xy，新透传，41串口透传，模拟F3轮询传感器，构建数据
		if(Pass41SensorScanParam.enable && i_task01 % 100 == 99) 
		{
			jt808_DoInternalSensorScanAndPost();
		}
	} //while(1)
	  /* USER CODE END Task_Usart1_Terminal */
}

#if  USE_TIME_FRAM

void fram_time_read(SDateTime * p_datetime)
{
	FM25L16B_Read_N_Bytes(FRAM_ADDR_TIME_record, (uint8_t *)p_datetime, sizeof(SDateTime));
	return;
}

void ds1302_time_init(SDateTime datetime)
{
	uint8_t buf[32] = {0};
	buf[1] = datetime.year%100 ;		  //年 
	buf[2] = datetime.month;		   		//月 
	buf[3] = datetime.day;		   			//日 
	buf[4] = datetime.hour;		     		//时 
	buf[5] = datetime.min;		     		//分 
	buf[6] = datetime.sec&0x7f; 			//秒，屏蔽秒的第7位，避免超出59
	
	ds1302_Write_Time(buf);
}
void fram_time_write(SDateTime datetime)
{
	datetime.min++;
	
	FM25L16B_Write_N_Bytes(FRAM_ADDR_TIME_record, (uint8_t *)&datetime, sizeof(SDateTime));
	return;
}
#endif
/* USER CODE BEGIN Header_Task_GetCPU_Usage */
/**
* @brief Function implementing the Data_Process thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_Task_GetCPU_Usage */
void Task_GetCPU_Usage(void const *argument)
{
	/* USER CODE BEGIN Task_GetCPU_Usage */
	char hour=0xff;
	char min=0xff;
	int count;
	int i_task01;
	EventBits_t uxBits;
	ds1302_Init();
#if USE_TIME_FRAM	
	fram_time_read(&m_datetime);
	ds1302_time_init(m_datetime);
#endif //======USE_TIME_FRAM=============	
	UNUSED(min);
	
#if 0	
	while(1)
	{
		osDelay(1000); //阻塞延时，根据情况调节
		if(m_datetime.min!=min)
		{
			ds1302_SynTime(&m_datetime);
			min = m_datetime.min;
		}
	};
#endif
	
	//HAL_Delay(100);
	count=0;
	/* Infinite loop */
	while (1)
	{
		//DispRunInfo();//显示运行信息
		cntUsage++;
		osDelay(500); //阻塞延时，根据情况调节
		//2022-9-13, xy, 这里RTC时钟是按每分钟去读取一下RTC芯片校时的，但实在没必要如此频繁，优化成每小时
		if(m_datetime.hour!=hour)
		{
			ds1302_SynTime(&m_datetime);
			hour = m_datetime.hour;
		}

		//add boly 20221019
		if(m_datetime.min!=min)
		{
			
#if USE_TIME_FRAM			
			fram_time_write(m_datetime);
			min = m_datetime.min;
#endif //==============USE_TIME_FRAM====================
			
#if 0			
			m_datetime.day++;
			ds1302_time_init(m_datetime);
#endif			
		}
		//end boly
    //-----------USE_FATFS_RECORD-----------//
		uxBits = xEventGroupWaitBits(xCreatedEventGroup, /* 事件标志组句柄 */
                                     TASK_BIT_ALL,       /* 等待TASK_BIT_ALL被设置 */
                                     pdTRUE,             /* 退出前TASK_BIT_ALL被清除，这里是TASK_BIT_ALL都被设置才表示“退出”*/
                                     pdTRUE,             /* 设置为pdTRUE表示等待TASK_BIT_ALL都被设置*/
                                     500);      /* 等待延迟时间 */
		if((uxBits & TASK_BIT_ALL) == TASK_BIT_ALL)
		{
			count=0;
		}
		else
		{
			//int txlen=sprintf(USART1_TX_BUF,"uxBits=%x count=%d\r\n",uxBits,count);
			//TerminalSlave485_Send_Data(USART1_TX_BUF,txlen);
			++count;
		}
		if(count<40)
		{
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);
			HAL_GPIO_TogglePin(GPIOE, LED1_Pin);
		}
		else
		{
			i_task01=sprintf((char*)&USART1_TX_BUF[0],"system should reboot %x\r\n",uxBits);
			TerminalSlave485_Send_Data(USART1_TX_BUF,i_task01);	
		}
		__nop();
		if(usart_timeout && usart_timeout<usart_timesec)
		{
			Reboot_System();
		}
	}
	/* USER CODE END Task_GetCPU_Usage */
}

/* USER CODE BEGIN Header_Data_Task */
/**
* @brief Function implementing the Data_Process thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_Data_Task */
//void Get_Cpu_Usage_Task(void const * argument)
//{
//  /* USER CODE BEGIN Data_Task */
//
//
//	//HAL_Delay(1000);
//
//  /* Infinite loop */
//  while(1)
//  {
//
//    //DispRunInfo();//显示运行信息
//		osDelay(10);				//阻塞延时，根据情况调节
//
//		cntUsage++;
//
//
//
//  }
//  /* USER CODE END Data_Task */
//}

/* USER CODE BEGIN Header_Data_Task */
/**
* @brief Function implementing the Data_Process thread.
* @param argument: Not used
* @retval None
*/
char SpeakerBuff[64 + 64]; //可以播放24个汉字，48个英文字母
uint16_t crc000, LenToSpk, LenOfMsg, i000_Voice;
/* USER CODE END Header_Data_Task */
#include "Data_deal.h" //CRC16_MODBUS函数
int LenVoi000;

void Task_Uart4_VoicePlay(void const *argument)
{
	/* USER CODE BEGIN Task_Uart4_VoicePlay */

	//HAL_Delay(1000);
	i000_Voice = 1;
	/* Infinite loop */
	while (1)
	{

		//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
		//HAL_Delay(20);
		if (flag_Uart4_Busy == 1)
		{
			continue;
		}

		if (flag_Sw_VoicePlay == 0) //语音播报通过按键关闭
		{
			continue;
		}

		xSemaphoreTake(xSemaphore_uart4, portMAX_DELAY);

		//李伟修改    20210626
		//语音报警

		memset(SpeakerBuff, 0, sizeof(SpeakerBuff));

		SpeakerBuff[0] = 0x03;
		SpeakerBuff[1] = 0x10;
		SpeakerBuff[2] = 0x00;
		SpeakerBuff[3] = 0x33;
		SpeakerBuff[4] = 0x00;
		SpeakerBuff[5] = 0x08;
		SpeakerBuff[6] = 0x11;
		SpeakerBuff[7] = 0x00;
		SpeakerBuff[8] = 0x01;
		//				SpeakerBuff[9]=0x03;
		//				SpeakerBuff[10]=0x03;

#if (VoicePlay_En)

		switch (i000_Voice)
		{
		case 1: //1仓播报数据
			//if(ValState01 & GPIO_PIN_0)//1仓人孔大盖
			LenOfMsg = 0;
			LenVoi000 = 9;

			memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);

			//				LenOfMsg=sprintf(SpeakerBuff+LenVoi000,"%2d仓",i000_Voice);
			//				LenVoi000=LenVoi000+LenOfMsg;//strlen();

			//				Cang01_IO[0]=0x01;
			//				Cang01_IO[1]=0x01;
			//				Cang01_IO[2]=0x01;
			//				Cang01_IO[13]=0x01;

			if (Cang01_IO[0 + 7] == 0x01) //1仓海底阀
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "一仓海底阀未关！");
				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			//if(ValState01 & GPIO_PIN_1)//1仓卸油阀
			//Cang01_IO[1]=0x01;
			if (Cang01_IO[1 + 7] == 0x01) //1仓
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "一仓卸油阀未关！");

				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			//if(ValState01 & GPIO_PIN_2)//1仓人孔大盖
			//Cang01_IO[2]=0x01;
			if (Cang01_IO[2 + 7] == 0x01) //1仓
			{

				LenOfMsg = sprintf(SpeakerBuff + 9, "一仓人孔盖未关！");

				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			//if(ValState01 & GPIO_PIN_3)//1仓排尘阀----索引为13专门表示排沉阀
			if (Cang01_IO[13] == 0x01) //1仓
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "一仓排沉阀未关！");

				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}
			/*
				LenOfMsg=sprintf(SpeakerBuff+LenVoi000,"未关....");
				LenVoi000=LenVoi000+LenOfMsg;//strlen();
	
				//LenOfMsg=sprintf(SpeakerBuff+9,"%2d仓海底阀未关",5);
				LenToSpk=LenVoi000;//9+LenOfMsg-0;
				
				//更新数据长度
				SpeakerBuff[6]=LenToSpk+2;//LenOfMsg+2+0;//加上2字节的crc
				
				__nop();
				crc000=CRC16_MODBUS((unsigned char*)SpeakerBuff,LenToSpk);
				SpeakerBuff[LenToSpk]=crc000 >>8;
				SpeakerBuff[LenToSpk+1]=crc000 & 0x00ff;
				
				//03 10 00 33 00 08 10 00 01 20 35 B2 D6 BA A3 B5 D7 B7 A7 CE B4 B9 D8 A5 08 --5仓海底阀未关

				//03 10 00 33 00 08 11 00 01 D2 BB B2 D6 C8 CB BF D7 B8 C7 CE B4 B9 D8 82 4E 一仓人孔盖未关
				
				//if(ValState01 & 0x0f)
				if(LenVoi000>=23)//至少有一组阀门未关则发送播报语音
				{//任何一个阀门未关闭时才发送数据
						KeySlave485_Send_Data((uint8_t *)SpeakerBuff,LenToSpk+2);
						memset(&SpeakerBuff[9],0,sizeof(SpeakerBuff)-9);
					
				}//任何一个阀门未关闭时才发送数据
			  */

			__nop();

			break;
		case 2: //2仓数据播报
			///////////////

			LenOfMsg = 0;
			LenVoi000 = 9;

			memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);

			//				LenOfMsg=sprintf(SpeakerBuff+LenVoi000,"%2d仓",i000_Voice);
			//				LenVoi000=LenVoi000+LenOfMsg;//strlen();
			//
			//if(ValState02 & GPIO_PIN_0)//2仓
			if (Cang02_IO[0 + 7] == 0x01) //2仓海底阀
			{
				//					LenOfMsg=sprintf(SpeakerBuff+LenVoi000,"海底阀");
				//					LenVoi000=LenVoi000+LenOfMsg;//strlen();

				LenOfMsg = sprintf(SpeakerBuff + 9, "二仓海底阀未关");
				LenVoi000 = 9 + LenOfMsg; //strlen();

				memset(&SpeakerBuff[LenVoi000], 0, sizeof(SpeakerBuff) - LenVoi000);

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			//if(ValState02 & GPIO_PIN_1)//2仓人孔小盖
			if (Cang02_IO[1 + 7] == 0x01) //2仓卸油阀
			{

				//					LenOfMsg=sprintf(SpeakerBuff+LenVoi000,"卸油阀");
				//					LenVoi000=LenVoi000+LenOfMsg;

				LenOfMsg = sprintf(SpeakerBuff + 9, "二仓卸油阀未关。");

				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			//if(ValState02 & GPIO_PIN_2)//2仓人孔大盖
			if (Cang02_IO[2 + 7] == 0x01) //2仓
			{

				LenOfMsg = sprintf(SpeakerBuff + 9, "二仓人孔盖未关.");

				LenVoi000 = 9 + LenOfMsg; //strlen();

				memset(&SpeakerBuff[LenVoi000], 0, sizeof(SpeakerBuff) - LenVoi000);

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706

				/*
					
					LenOfMsg=0;
					LenVoi000=9;
 
					 
//					LenOfMsg=sprintf(SpeakerBuff+0+LenVoi000,"人孔盖,");
//					LenVoi000=LenVoi000+LenOfMsg;
					memset(&SpeakerBuff[9],0,sizeof(SpeakerBuff)-9);
          //LenOfMsg=sprintf(SpeakerBuff+9,"二仓人孔盖未关!!!!");	

					LenOfMsg=sprintf(SpeakerBuff+9,"二仓人孔盖未关");
									
					LenVoi000=9+LenOfMsg;//strlen();
					
					LenToSpk=LenVoi000;//9+LenOfMsg-0;

					SpeakerBuff[6]=LenToSpk+2;//LenOfMsg+2+0;//加上2字节的crc

					__nop();
					crc000=CRC16_MODBUS((unsigned char*)SpeakerBuff,LenToSpk);
					SpeakerBuff[LenToSpk]=crc000 >>8;
					SpeakerBuff[LenToSpk+1]=crc000 & 0x00ff;


					KeySlave485_Send_Data((uint8_t *)SpeakerBuff,LenToSpk+2);
					memset(&SpeakerBuff[9],0,sizeof(SpeakerBuff)-9);
					HAL_Delay(1000);
					HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
					HAL_Delay(1000);
					HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
					*/
			}
			//
			//				if(ValState02 & GPIO_PIN_3)//2仓人孔大盖
			//				{
			//					LenOfMsg=sprintf(SpeakerBuff+9,"%2d仓卸油阀未关",i000_Voice);
			//				}

			if (Cang02_IO[13] == 0x01) //2仓
			{

				//					LenOfMsg=sprintf(SpeakerBuff+0+LenVoi000,"排沉阀");
				//					LenVoi000=LenVoi000+LenOfMsg;

				LenOfMsg = sprintf(SpeakerBuff + 9, "二仓排沉阀未关！");

				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}
			/*
				LenOfMsg=sprintf(SpeakerBuff+LenVoi000,"未关！！！");
				LenVoi000=LenVoi000+LenOfMsg;//strlen();
	
 
				LenToSpk=LenVoi000;//9+LenOfMsg-0;
				
				//更新数据长度
				SpeakerBuff[6]=LenToSpk+2+0;//加上2字节的crc
				
				__nop();
				crc000=CRC16_MODBUS((unsigned char*)SpeakerBuff,LenToSpk);
				SpeakerBuff[LenToSpk]=crc000 >>8;
				SpeakerBuff[LenToSpk+1]=crc000 & 0x00ff;
				
				//03 10 00 33 00 08 10 00 01 20 35 B2 D6 BA A3 B5 D7 B7 A7 CE B4 B9 D8 A5 08 --5仓海底阀未关

				//03 10 00 33 00 08 11 00 01 D2 BB B2 D6 C8 CB BF D7 B8 C7 CE B4 B9 D8 82 4E 一仓人孔盖未关
				
				//if(ValState02 & 0x0f)
				if(LenVoi000>=23)//至少有一组阀门未关则发送播报语音
				{//任何一个阀门未关闭时才发送数据
					KeySlave485_Send_Data((uint8_t *)SpeakerBuff,LenToSpk+2);
					memset(&SpeakerBuff[9],0,sizeof(SpeakerBuff)-9);
				}
				*/

			__nop();

			break;

		case 3:
			///////////////

			LenOfMsg = 0;
			LenVoi000 = 9;

			memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
			if (ValState03 & GPIO_PIN_0) //1仓人孔大盖
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "%2d仓人孔大盖未关", i000_Voice);

				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			if (ValState03 & GPIO_PIN_1) //1仓人孔小盖
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "%2d仓人孔小盖未关", i000_Voice);

				LenVoi000 = 9 + LenOfMsg;	   //strlen();
				LenToSpk = LenVoi000;		   //9+LenOfMsg-0;
				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc
				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
 				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			if (ValState03 & GPIO_PIN_2) //3仓海底阀
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "%2d仓海底阀紧急切断阀未关！", i000_Voice);

				//LenOfMsg=sprintf(SpeakerBuff+9,"3仓海底阀未关！");

				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000; //9+LenOfMsg-0;

				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc

				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			if (ValState03 & GPIO_PIN_3) //1仓人孔大盖
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "%2d仓卸油阀未关！", i000_Voice);

				LenVoi000 = 9 + LenOfMsg;	   //strlen();
				LenToSpk = LenVoi000;		   //9+LenOfMsg-0;
				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc
				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			/*
				LenToSpk=9+LenOfMsg-0;
				
				//更新数据长度
				SpeakerBuff[6]=LenOfMsg+2+0;//加上2字节的crc
				
				__nop();
				crc000=CRC16_MODBUS((unsigned char*)SpeakerBuff,LenToSpk);
				SpeakerBuff[LenToSpk]=crc000 >>8;
				SpeakerBuff[LenToSpk+1]=crc000 & 0x00ff;
				
				//03 10 00 33 00 08 10 00 01 20 35 B2 D6 BA A3 B5 D7 B7 A7 CE B4 B9 D8 A5 08 --5仓海底阀未关

				//03 10 00 33 00 08 11 00 01 D2 BB B2 D6 C8 CB BF D7 B8 C7 CE B4 B9 D8 82 4E 一仓人孔盖未关
			  
				
				
				if(ValState03 & 0x0f)
				{//任何一个阀门未关闭时才发送数据
					KeySlave485_Send_Data((uint8_t *)SpeakerBuff,LenToSpk+2);
				}*/

			__nop();

			break;

		case 4:
			///////////////

			LenOfMsg = 0;
			LenVoi000 = 9;

			memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);

			if (ValState04 & GPIO_PIN_0) //1仓人孔大盖
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "%2d仓人孔盖未关！！", i000_Voice);

				LenVoi000 = 9 + LenOfMsg;	   //strlen();
				LenToSpk = LenVoi000;		   //9+LenOfMsg-0;
				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc
				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			if (ValState04 & GPIO_PIN_1) //1仓人孔小盖
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "%2d仓人孔小盖未关！！", i000_Voice);

				LenVoi000 = 9 + LenOfMsg;	   //strlen();
				LenToSpk = LenVoi000;		   //9+LenOfMsg-0;
				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc
				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			if (ValState04 & GPIO_PIN_2) //4仓
			{

				LenOfMsg = 0;
				LenVoi000 = 9;

				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//LenOfMsg=sprintf(SpeakerBuff+9,"%2d仓海底阀未关",i000_Voice);
				//LenOfMsg=sprintf(SpeakerBuff+9,"四仓海底阀未关  ！");

				LenOfMsg = sprintf(SpeakerBuff + 9, "四仓海底阀未关,,,,");
				LenVoi000 = 9 + LenOfMsg; //strlen();

				LenToSpk = LenVoi000;		   //9+LenOfMsg-0;
				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc
				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			if (ValState04 & GPIO_PIN_3) //1仓人孔大盖
			{
				LenOfMsg = sprintf(SpeakerBuff + 9, "%2d仓卸油阀未关", i000_Voice);

				LenVoi000 = 9 + LenOfMsg;	   //strlen();
				LenToSpk = LenVoi000;		   //9+LenOfMsg-0;
				SpeakerBuff[6] = LenToSpk + 2; //LenOfMsg+2+0;//加上2字节的crc
				__nop();
				crc000 = CRC16_MODBUS((unsigned char *)SpeakerBuff, LenToSpk);
				SpeakerBuff[LenToSpk] = crc000 >> 8;
				SpeakerBuff[LenToSpk + 1] = crc000 & 0x00ff;

				KeySlave485_Send_Data((uint8_t *)SpeakerBuff, LenToSpk + 2);
				memset(&SpeakerBuff[9], 0, sizeof(SpeakerBuff) - 9);
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				//HAL_Delay(1000);
				osDelay(1000);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
			}

			/*
				LenToSpk=9+LenOfMsg-0;
				
				//更新数据长度
				SpeakerBuff[6]=LenOfMsg+2+0;//加上2字节的crc
				
				__nop();
				crc000=CRC16_MODBUS((unsigned char*)SpeakerBuff,LenToSpk);
				SpeakerBuff[LenToSpk]=crc000 >>8;
				SpeakerBuff[LenToSpk+1]=crc000 & 0x00ff;
				
				//03 10 00 33 00 08 10 00 01 20 35 B2 D6 BA A3 B5 D7 B7 A7 CE B4 B9 D8 A5 08 --5仓海底阀未关

				//03 10 00 33 00 08 11 00 01 D2 BB B2 D6 C8 CB BF D7 B8 C7 CE B4 B9 D8 82 4E 一仓人孔盖未关
				
				if(ValState03 & 0x0f)
				{//任何一个阀门未关闭时才发送数据
					KeySlave485_Send_Data((uint8_t *)SpeakerBuff,LenToSpk+2);
				}*/

			__nop();

			break;

		default:
			break;
		}

		i000_Voice++;
		//if(i000_Voice>4)//
		if (i000_Voice > StoreNumber) //
		{
			i000_Voice = 1;
		}
#endif

		xSemaphoreGive(xSemaphore_uart4);

		osDelay(3 * 1000); //阻塞延时，根据情况调节
	}
	/* USER CODE END Task_Uart4_VoicePlay */
}

/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */

/*
显示运行信息(功能码信息、车牌号，版本号等)
*/
int Len_AnHuiKaiLe;
uint32_t ValveNum000;						 //j001,
float KaiLeTemp = 16, KaiLePressture = 98.1; //安徽开乐演示用
int Len001RunInfo_disp=-1;
void DisplayRunInfo(uint32_t FunDebugCode000)
{
	int Len000RunInfo, Len001RunInfo;
	int i000;

	FRAM_cnt++;

	if (FRAM_cnt > 60)
	{
		FRAM_cnt = 0;
		//提高寿命 每分钟写入一次
		FM25L16B_WriteByte(ADDR_TotalRunTime + 0, totalRunTimeCnt >> 24);
		FM25L16B_WriteByte(ADDR_TotalRunTime + 1, totalRunTimeCnt >> 16);
		FM25L16B_WriteByte(ADDR_TotalRunTime + 2, totalRunTimeCnt >> 8);
		FM25L16B_WriteByte(ADDR_TotalRunTime + 3, totalRunTimeCnt & 0xff);
	}

	if (FunDebugCode000 > 80000)
	{ //按键功能码>90000 ----开始   if(FunDebugCode>90000)

		//memset(bufText01Password,0,sizeof(bufText01Password));
		switch (FunDebugCode000)
		{
			//					case	DebugFun_LCD_Version:
			//
			//						memset((char*)bufText01Password+0,0,sizeof(bufText01Password));
			//						Len000=sprintf((char*)bufText01Password+0,"VersionOf_LCD=");
			//						FM25L16B_Read_N_Bytes(ADDR_VersionOf_LCD,(uint8_t *)bufText01Password+Len000,32);
			//						Len001=sprintf((char*)bufText01Password+Len000+32,".code=%5d.\r\n",FunDebugCode);
			//					  Len000=Len001+Len000+32;
			//
			//						WrDwinBuf(ADDR_DWIN_Text03_sysInfo,bufText01Password,Len000,1);//显示LCD版本号码

			//
			//						break;

			//					case	DebugFun_VersionOf_Software:
			//						memset((char*)bufText01Password+0,0,sizeof(bufText01Password));
			//						Len000=sprintf((char*)bufText01Password+0,"VersionOf_Software=");
			//						FM25L16B_Read_N_Bytes(ADDR_VersionOf_Software,(uint8_t *)bufText01Password+Len000,32);
			//						Len001=sprintf((char*)bufText01Password+Len000+32,".code=%5d.\r\n",FunDebugCode);
			//					  Len000=Len001+Len000;
			//
			//
			//	          WrDwinBuf(ADDR_DWIN_Text03_sysInfo,bufText01Password,Len000,1);// s
			//
			//
			//						break;
		case DebugFun_LCD_SleepTime:
			memset((char *)bufText01Password + 0, 0, sizeof(bufText01Password));
			Len000RunInfo = sprintf((char *)bufText01Password + 0, "LCD Sleep Time=");
			FM25L16B_Read_N_Bytes(ADDR_SleepTime_ScreenDwin, (uint8_t *)bufText01Password + Len000RunInfo, 32);
			Len001RunInfo = sprintf((char *)bufText01Password + Len000RunInfo + 32, ".code=%5d.\r\n", FunDebugCode);
			Len001RunInfo = Len001RunInfo + Len000RunInfo;
			break;

		case DebugFun_DS1302Time:
			break;
		case DebugFun_CarLicensePlate:

			memset((char *)bufText01Password + 0, 0, sizeof(bufText01Password));
			Len000RunInfo = sprintf((char *)bufText01Password + 0, "Che Pai Hao Ma=");
			FM25L16B_Read_N_Bytes(ADDR_CarPlate_Number, (uint8_t *)bufText01Password + Len000RunInfo, 16);
			Len000RunInfo = sprintf((char *)bufText01Password + Len000RunInfo + 16, ".code=%5d.\r\n", FunDebugCode);
			WrDwinBuf(ADDR_DWIN_Text03_sysInfo, bufText01Password, Len000RunInfo, 1); //重启之前显示车牌号

			break;

		case DebugFun_Sw_VoicePlay: //切换语音播报功能
			//FM25L16B_Read_N_Bytes(ADDR_CarPlate_Number,(uint8_t *)bufText01Password+0,16);

			if (flag_Sw_VoicePlay)
			{
				flag_Sw_VoicePlay = 0;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "语音播报被关闭.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;
			}
			else
			{
				flag_Sw_VoicePlay = 1;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "语音播报被打开.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;
			}
			FunDebugCode = 0; //

			break;

		case DebugFun_Sw_ValveRaw: //切换阀门的原始数据或者汉字数据
			//FM25L16B_Read_N_Bytes(ADDR_CarPlate_Number,(uint8_t *)bufText01Password+0,16);

			if (flag_ShowValveRaw)
			{
				flag_ShowValveRaw = 0;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "将显示阀门的解码数据.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;

				memset(bufTextCang01_IO, ' ', sizeof(bufTextCang01_IO)); //清除原有的较长的信息
				WrDwinBuf(ADDR_DWIN_Cang01_IO, &bufTextCang01_IO[0], 124, 1);
				HAL_Delay(50); //
				WrDwinBuf(ADDR_DWIN_Cang02_IO, &bufTextCang01_IO[0], 124, 1);
			}
			else
			{
				flag_ShowValveRaw = 1;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "将显示阀门原始数字数据.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;
			}
			FunDebugCode = 0; //

			break;

		case DebugFun_Sw_DisplaySensorData:

			if (flag_Sw_DisplaySensorData)
			{
				flag_Sw_DisplaySensorData = 0;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "将不显示模拟量传感器数据.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;
			}
			else
			{
				flag_Sw_DisplaySensorData = 1;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "将显示模拟量传感器数据.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;
			}
			FunDebugCode = 0; //

			break;

		case DebugFun_Refresh_Title_IO: //强制刷新一次阀门名称显示

			Len001RunInfo = sprintf((char *)bufText01Password + 16, "强制刷新一次阀门名称显示.code=%5d.\r\n", FunDebugCode);
			Len001RunInfo = 16 + Len001RunInfo;

			memset(bufTextCang01_IO, ' ', sizeof(bufTextCang01_IO));
			//Len000=sprintf((char*)bufTextCang01_IO+16*0,"    海底阀-卸油阀-人孔盖-小孔盖-有无油    ");//  %02d\r\n
			Len000RunInfo = sprintf((char *)bufTextCang01_IO + 16 * 0, "%s", arrValve_title01); //  %02d\r\n
			memset((char *)bufTextCang01_IO + Len000RunInfo, 0, sizeof(bufTextCang01_IO) - Len000RunInfo);
			//taskENTER_CRITICAL();
			; //						WrDwinBuf(ADDR_DWIN_Title_IO,&bufTextCang01_IO[0],Len000RunInfo,1);
			//taskEXIT_CRITICAL();

			FunDebugCode = 0; //

			//
			//
			//						memset(bufTextCang01_IO,' ',sizeof(bufTextCang01_IO));
			//						Len000RunInfo=sprintf((char*)bufTextCang01_IO+16*0,"%s",arrValve_title01);//  %02d\r\n
			//						memset((char*)bufTextCang01_IO+Len000RunInfo,0,sizeof(bufTextCang01_IO)-Len000RunInfo);
			//						WrDwinBuf(ADDR_DWIN_Title_IO,&bufTextCang01_IO[0],Len000RunInfo,1);

			break;

		case DebugFun_Sw_DispSysInfo: //切换是否显示系统运行信息

			if (flag_Sw_DispSysInfo)
			{
				flag_Sw_DispSysInfo = 0;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "将不显示系统运行信息.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;
			}
			else
			{
				flag_Sw_DispSysInfo = 1;
				Len001RunInfo = sprintf((char *)bufText01Password + 16, "将显示系统运行信息.code=%5d.\r\n", FunDebugCode);
				Len001RunInfo = 16 + Len001RunInfo;
			}

			//系统运行信息隐藏或者显示
			if (flag_Sw_DispSysInfo == 0)
			{
				bufText01Password[0] = 0xff00; //隐藏文本命令
				WrDwinBuf(ADDR_DWIN_Text03_SP, bufText01Password, 1, 0);
				HAL_Delay(10);
			}
			else
			{
				bufText01Password[0] = ADDR_DWIN_Text03_sysInfo;
				WrDwinBuf(ADDR_DWIN_Text03_SP, bufText01Password, 1, 0);
			}

			FunDebugCode = 0; //

			break;
		case DebugFun_Set_BlankSeal_Enable:
			flag_En_BlankSeal=1;
			FunDebugCode=0;
			break;
		case DebugFun_Set_BlankSeal_Disable:
			flag_En_BlankSeal=0;
			FunDebugCode=0;
			break;

#if KeyPad_Set_SealState_En
		/////////////////////////////强制注入电子铅封的状态----开始
		case DebugFun_Set_Cang_NUM01_Seal: //强制施封----同时显示施封破封

			Full_Oil_allinfo.Break_sealing_Id = 0xff; //
			Full_Oil_allinfo.Auto_sealedOK_ID = 0xff;
			FunDebugCode = 0; //Full_Oil_allinfo.Break_sealing_Id

			break;
		case DebugFun_Set_Cang_NUM02_Seal: //强制施封

			Full_Oil_allinfo.Break_sealing_Id = 0x00; //
			Full_Oil_allinfo.Auto_sealedOK_ID = 0xff;
			FunDebugCode = 0; //Full_Oil_allinfo.Break_sealing_Id

			break;

		case DebugFun_Set_Cang_NUM01_Broken: //强制破封

			Full_Oil_allinfo.Break_sealing_Id = 0xff; //
			Full_Oil_allinfo.Auto_sealedOK_ID = 0x00;
			FunDebugCode = 0; //Full_Oil_allinfo.Break_sealing_Id

			break;

		case DebugFun_Set_Cang_NUM01_JieFeng: //强制解封

			Full_Oil_allinfo.Break_sealing_Id = 0x00; //
			Full_Oil_allinfo.Auto_sealedOK_ID = 0x00;
			FunDebugCode = 0; //Full_Oil_allinfo.Break_sealing_Id

			break;
#endif
			/////////////////////////////强制注入电子铅封的状态----结束

		case DebugFun_Set_Cang_NUM01: //手动设定为N仓N阀门
		case DebugFun_Set_Cang_NUM02:
		case DebugFun_Set_Cang_NUM03:
		case DebugFun_Set_Cang_NUM04:
		case DebugFun_Set_Cang_NUM05:
		case DebugFun_Set_Cang_NUM06:
		case DebugFun_Set_Cang_NUM07:
		case DebugFun_Set_Cang_NUM08:

			//						Config_info_all.All_number =01;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =01;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =01;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =01;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =01;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//
			//
			//						break;
			//
			//
			//					case	DebugFun_Set_Cang_NUM02: //手动设定为2仓2阀门

			//						Config_info_all.All_number =02;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =02;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =02;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =02;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =02;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//
			//
			//						break;
			//
			//					case	DebugFun_Set_Cang_NUM03: //手动设定为3仓3阀门

			//						Config_info_all.All_number =03;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =03;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =03;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =03;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =03;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//
			//
			//						break;

			//					case	DebugFun_Set_Cang_NUM04: //手动设定为4仓4阀门

			//						Config_info_all.All_number =04;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =04;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =04;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =04;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =04;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//
			//
			//						break;

			//					case	DebugFun_Set_Cang_NUM05: //手动设定为5仓5阀门

			//						Config_info_all.All_number =05;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =05;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =05;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =05;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =05;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//
			//
			//						break;

			//					case	DebugFun_Set_Cang_NUM06: //手动设定为6仓6阀门

			//						Config_info_all.All_number =06;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =06;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =06;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =06;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =06;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//
			//
			//						break;

			//					case	DebugFun_Set_Cang_NUM07: //手动设定为7仓7阀门

			//						Config_info_all.All_number =07;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =07;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =07;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =07;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =07;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//
			//
			//						break;

			//					case	DebugFun_Set_Cang_NUM08: //手动设定为8仓8阀门

			//						Config_info_all.All_number =8;// UART4_RX_BUF[4];
			//						StoreNumber = Config_info_all.All_number;
			//						FM25L16B_WriteByte(ADDR_StoreNumber,StoreNumber);
			//
			//						Config_info_all.ManHole_Big_info =8;// UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_Big_info,Config_info_all.ManHole_Big_info);
			//
			//						Config_info_all.ManHole_small_info =8;// UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			//						FM25L16B_WriteByte(ADDR_ManHole_small_info,Config_info_all.ManHole_small_info);
			//
			//
			//						Config_info_all.Dump_info =8;// UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			//						FM25L16B_WriteByte(ADDR_Dump_info,Config_info_all.Dump_info);
			//
			//						Config_info_all.HaiDiFa_info =8;// UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			//						FM25L16B_WriteByte(ADDR_Foot_info,Config_info_all.HaiDiFa_info);
			//
			//						all_Store = StoreNumber;
			//						Go_homepage();//回到首页
			//						FunDebugCode=0;//

			ValveNum000 = FunDebugCode - 98100;

			if (ValveNum000 > 8)
			{
				ValveNum000 = 8;
			}

			if (ValveNum000 == 0)
			{
				ValveNum000 = 2;
			}

			Config_info_all.All_number = (uint8_t)ValveNum000; // UART4_RX_BUF[4];
			StoreNumber = Config_info_all.All_number;
			FM25L16B_WriteByte(ADDR_StoreNumber, StoreNumber);

			Config_info_all.ManHole_Big_info = (uint8_t)ValveNum000; // UART4_RX_BUF[5];//人孔盖信息（大盖）bit7标定大盖有没有 1没有 0有
			FM25L16B_WriteByte(ADDR_ManHole_Big_info, Config_info_all.ManHole_Big_info);

			Config_info_all.ManHole_small_info = (uint8_t)ValveNum000; // UART4_RX_BUF[6];//小盖单独标定，bit7标定大盖有没有 1没有 0有
			FM25L16B_WriteByte(ADDR_ManHole_small_info, Config_info_all.ManHole_small_info);

			Config_info_all.Dump_info = (uint8_t)ValveNum000; // UART4_RX_BUF[7];//卸油阀标定bit7=0常规一仓一个，bit7=1特殊一仓两个
			FM25L16B_WriteByte(ADDR_Dump_info, Config_info_all.Dump_info);

			Config_info_all.HaiDiFa_info = (uint8_t)ValveNum000; // UART4_RX_BUF[8];//底阀标定bit7=0气阀，bit7=1特殊485（日后可能会改）
			FM25L16B_WriteByte(ADDR_Foot_info, Config_info_all.HaiDiFa_info);

			all_Store = StoreNumber;
			Go_homepage(); //回到首页

			//						memset(bufTextCang01_IO,' ',sizeof(bufTextCang01_IO));
			//						Len000RunInfo=sprintf((char*)bufTextCang01_IO+16*0,"%s",arrValve_title01);//  %02d\r\n
			//						memset((char*)bufTextCang01_IO+Len000RunInfo,0,sizeof(bufTextCang01_IO)-Len000RunInfo);
			//						WrDwinBuf(ADDR_DWIN_Title_IO,&bufTextCang01_IO[0],Len000RunInfo,1);

			FunDebugCode = 0; //

			break;
		case DebugFun__Restart_ContBoard00: //复位  //立即重启
			Reboot_System();
			break;

		case DebugFun__Restart_ContBoard01: //复位   //可以取消的重启
											//FM25L16B_Read_N_Bytes(ADDR_CarPlate_Number,(uint8_t *)bufText01Password+0,16);
											//						memset(bufText01Password,0,sizeof(bufText01Password));
											//						sprintf((char*)bufText01Password+16*0,"系统即将重启...F1键取消重启.code=%5d.\r\n",FunDebugCode);
											//						WrDwinBuf(ADDR_DWIN_Text03_sysInfo,bufText01Password,44,1);//重启之前显示信息
			i000 = 0;
			flag_exitReset = 0;
			while (i000 < 100)  //10s取消重启时间
			{
				i000++;
				osDelay(100);
				HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706

				//查询按键终止
				if (flag_exitReset == 1)
				{
					memset(bufText01Password, 0, sizeof(bufText01Password));
					Len000RunInfo = sprintf((char *)bufText01Password + 16 * 0, "重启取消.code=%5d.\r\n", FunDebugCode);
					WrDwinBuf(ADDR_DWIN_Text03_sysInfo, bufText01Password, Len000RunInfo, 1); //重启之前显示信息

					break;
				}
				else
				{
					memset(bufText01Password, 0, sizeof(bufText01Password));
					Len000RunInfo = sprintf((char *)bufText01Password + 16 * 0, "系统即将重启...F1键取消重启.code=%5d.%5d.\r\n", FunDebugCode, 10 - i000 / 10);
					WrDwinBuf(ADDR_DWIN_Text03_sysInfo, bufText01Password, Len000RunInfo, 1); //重启之前显示信息
																							  //return;
				}
			}

			if (flag_exitReset == 1)
			{ //终止复位
				FunDebugCode = 0;
				break;
			}

			Reboot_System();

			break;

		case DebugFun_Clear_Valve_Info: //
			//强制清除各仓的显示信息，避免乱码无法消除----因为正常只有39字符，原始数字较长，所以后边有残余
			memset((char *)bufText01Password + 0, 0, sizeof(bufText01Password));
			Len000RunInfo = sprintf((char *)bufText01Password + 0, "手动清除各仓显示阀门信息=%s", product_ID);
			//						FM25L16B_Read_N_Bytes(ADDR_CarPlate_Number,(uint8_t *)bufText01Password+0,16);
			//
			Len001RunInfo = sprintf((char *)bufText01Password + Len000RunInfo, "product_ID=%s.code=%5d.\r\n", product_ID, FunDebugCode);
			Len001RunInfo = Len001RunInfo + Len001RunInfo;

			memset(bufTextCang01_IO, ' ', sizeof(bufTextCang01_IO));
			WrDwinBuf(ADDR_DWIN_Cang01_IO, &bufTextCang01_IO[0], 124, 1);
			WrDwinBuf(ADDR_DWIN_Cang02_IO, &bufTextCang01_IO[0], 124, 1);

			break;

			//					case	DebugFun_Show_product_ID://显示ID编号
			//						memset((char*)bufText01Password+0,0,sizeof(bufText01Password));
			//						Len000=sprintf((char*)bufText01Password+0,"product_ID=%s",product_ID);
			//
			//						Len001=sprintf((char*)bufText01Password+Len000,"product_ID=%s.code=%5d.\r\n",product_ID,FunDebugCode);
			//						Len001=Len001+Len001;
			//
			//						break;

			//					case	DebugFun_Show_Terminal://显示来自终端的命令
			//
			//
			//						break;

			//					case	DebugFun_DS1302Time://显示ds1302时间信息
			//						memset(bufText01Password,0,sizeof(bufText01Password));
			//						DS1302_timeRead();
			//						Len001=sprintf((char*)bufText01Password,"系统运行中.tick=%08X,%08d.code=%5d.DS1302=%02X%02X%02X;%02X%02X%02X%02X%02X.\r\n",tick001,tick001,FunDebugCode,
			//							time_buf_reg[0],time_buf_reg[1],time_buf_reg[2],time_buf_reg[3],time_buf_reg[4],time_buf_reg[5],time_buf_reg[6],time_buf_reg[7]);
			//
			////						DS1302_get_all();
			////						sprintf((char*)bufText01Password,"系统运行中.tick=%08X,%08d.code=%5d.DS1302=%02X%02X%02X;%02X%02X%02X%02X%02X.\r\n",tick001,tick001,FunDebugCode,
			////						tableDS1302[0],tableDS1302[1],tableDS1302[2],tableDS1302[3],tableDS1302[4],tableDS1302[5],tableDS1302[6],tableDS1302[0]);

			//
			//						break;

		default:
			//FM25L16B_Read_N_Bytes(ADDR_VersionOf_LCD,(uint8_t *)bufText01Password+0,32);

			Len001RunInfo = sprintf((char *)bufText01Password, "系统运行中.tick=%08X,%08d.未识别code=%5d.\r\n", tick001, tick001, FunDebugCode);
			memset((char *)bufText01Password + Len001RunInfo, 0, sizeof(bufText01Password) - Len001RunInfo);
			break;
		}

		; //FunDebugCode=DebugFun_Show_Terminal;
	}	  //按键功能码>90000 ----结束   if(FunDebugCode>90000)
	else
	{ //功能码范围在00--90000之间--开始
		memset(bufText01Password, ' ', sizeof(bufText01Password));
		//sprintf((char*)bufText01Password,"系统运行中.tick=%08X,%08d.\r\n",tick001,tick001);
		if (FunDebugCode000 == 0)
		{
			Len001RunInfo = 0;//sprintf((char *)bufText01Password, "系统运行中.tick=%08X,%08u.默认配置code=%5d.CPU=%d.\r\n", tick001, totalRunTimeCnt, FunDebugCode000, cntUsage); //tick001/1000  cntUsage  chkRetCaiJiBan  Usart2_ErrorTimes
																																											   //cntUsage+=10;
#if (En_AnHuiKaiLe == 1)

			Len_AnHuiKaiLe = sprintf((char *)bufText01Password + Len001RunInfo, "温度:%4.2f ℃,压力:%4.2f kPa.\r\n", KaiLeTemp + (tick001 % 20) * 0.0001, KaiLePressture + (tick001 % 20) * 0.00001);
			Len001RunInfo = Len001RunInfo + Len_AnHuiKaiLe;

#endif

			if (Collect485.Collect_CommError == True)
			{ //采集器掉线故障
				Len_AnHuiKaiLe = sprintf((char *)bufText01Password + Len001RunInfo, "采集器断线:%06d.\r\n", Usart2_ErrorTimes);
				Len001RunInfo = Len001RunInfo + Len_AnHuiKaiLe;
			}

			if (cntUsage > 0xefffffff)
			{
				cntUsage = 0;
			}
			memset((char *)bufText01Password + Len001RunInfo, 0, sizeof(bufText01Password) - Len001RunInfo);
		}

		else
		{ //1--90000之间的功能码--开始
			Len001RunInfo = sprintf((char *)bufText01Password, "系统运行中.tick=%08X,%08d.未定义code=%5d.CPU=%d.\r\n", tick001, tick001 / 1000, FunDebugCode000, cntUsage);
			memset((char *)bufText01Password + Len001RunInfo, 0, sizeof(bufText01Password) - Len001RunInfo);

		} //1--90000之间的功能码--结束

	} //功能码范围在0--90000之间----结束

	//taskENTER_CRITICAL();
	if(Len001RunInfo==0)
		Len001RunInfo=1;
	if((Len001RunInfo!=Len001RunInfo_disp) || (Len001RunInfo_disp!=1))
	{
		WrDwinBuf(ADDR_DWIN_Text03_sysInfo, bufText01Password, Len001RunInfo, 1); //显示功能码以及对应的功能解析
		Len001RunInfo_disp=Len001RunInfo;
	}
	//taskEXIT_CRITICAL();

	totalRunTimeCnt++;
	__nop();
}

void DisplayValveInfo(void)
{
	//int i000;
	int Len000Valve, Len002, Len003;

	UNUSED(Len000Valve);
	
	if (DebugFun__Restart_ContBoard01 != FunDebugCode) //只要不是重启命令就定时刷新屏幕信息
	{												   //显示阀门开关信息--开始

		//WrDwinBuf(ADDR_DWIN_Text04,&bufText01Password[0],44,1);
#if 0
		if (FRAM_cnt % 5 == 0) //显示标题栏
		{					   ////显示标题栏

			///*

			//显示标题栏
			memset(bufTextCang01_IO, ' ', sizeof(bufTextCang01_IO));
			//Len000Valve=sprintf((char*)bufTextCang01_IO+16*0,"%s",arrValve_title01);//  %02d\r\n
			Len000Valve = sprintf((char *)bufTextCang01_IO + 16 * 0, "海底阀  卸油阀  人孔盖  小孔盖  管道油"); //  %02d\r\n
			memset((char *)bufTextCang01_IO + Len000Valve, 0, sizeof(bufTextCang01_IO) - Len000Valve);
			//sprintf((char*)bufTextCang01_IO+16*0,"仓%d:--测试关-----关-----关-----关-----关---%d",StoreNumber,FRAM_cn);//
			taskENTER_CRITICAL();
			; //WrDwinBuf(ADDR_DWIN_Title_IO,&bufTextCang01_IO[0],Len000Valve,1);
			taskEXIT_CRITICAL();

			//
			//							taskENTER_CRITICAL();
			//							//WrDwinBuf(ADDR_DWIN_Cang01_IO,&bufTextCang01_IO[0],Len002,1);
			//							memset(bufTextCang01_IO,' ',sizeof(bufTextCang01_IO));
			//							Len000Valve=sprintf((char*)bufTextCang01_IO+16*0,"海底阀  卸油阀  人孔盖  小孔盖  管道油");//  %02d\r\n
			//							memset((char*)bufTextCang01_IO+Len000Valve,0,sizeof(bufTextCang01_IO)-Len000Valve);
			//							//sprintf((char*)bufTextCang01_IO+16*0,"仓%d:--测试关-----关-----关-----关-----关---%d",StoreNumber,FRAM_cn);//

			//							;//
			//							WrDwinBuf(ADDR_DWIN_Title_IO,&bufTextCang01_IO[0],Len000Valve,1);

			//							taskEXIT_CRITICAL();

			__nop();

			//*/

		} ////显示标题栏
#endif
		////第1--2仓阀门状态显示--开始
		if (FRAM_cnt % 2 == 0)
		{	//第1--2仓阀门状态显示--开始
			//					if((ShowCang02_IO_EN==0) || (StoreNumber==1))
			//					{//如果禁止仓2显示  或者只有一个仓位则隐藏仓2的信息显示  //隐藏第二仓信息
			//
			//						bufText01Password[0]=0xff00;//隐藏文本命令
			//						WrDwinBuf(ADDR_DWIN_Cang02_IO_SP,bufText01Password,1,0);
			//						WrDwinBuf(ADDR_DWIN_Cang03_IO_SP,bufText01Password,1,0);
			//						WrDwinBuf(ADDR_DWIN_Cang04_IO_SP,bufText01Password,1,0);
			//
			//					}
			//					else

			//显示第1仓信息
			if(memcmp(ValStateArr_0x20_Cang01,Cang01_IO,64))
			{
				memset(bufTextCang01_IO, ' ', sizeof(bufTextCang01_IO));
				Len002 = formatStr(bufTextCang01_IO, Cang01_IO, 1);
				memset(bufTextCang01_IO + Len002, ' ', sizeof(bufTextCang01_IO) - Len002);
				WrDwinBuf(ADDR_DWIN_Cang01_IO, &bufTextCang01_IO[0], Len002, 1);
				memcpy(ValStateArr_0x20_Cang01,Cang01_IO,64);
			}
			

			// HAL_Delay(50);

			//if(FRAM_cn%5==2)
			if (StoreNumber >= 2)
			{
				if (memcmp(ValStateArr_0x20_Cang02, Cang02_IO, 64))
				{
					Len003 = formatStr(bufTextCang02_IO, Cang02_IO, 2);
					memset(bufTextCang02_IO + Len003, ' ', sizeof(bufTextCang02_IO) - Len003);

					// taskENTER_CRITICAL();
					WrDwinBuf(ADDR_DWIN_Cang02_IO, &bufTextCang02_IO[0], Len003 + 0, 1); // 40
					memcpy(ValStateArr_0x20_Cang02,Cang02_IO,64);
				}

				// taskEXIT_CRITICAL();

				// HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
				// HAL_Delay(50);
			}

		} ////第1--2仓阀门状态显示--结束

		if (StoreNumber >= 3)
		{ //如果存在3仓

			if (FRAM_cnt % 2 == 1)
			{ ////第3--4仓阀门状态显示--开始

				if (3 <= StoreNumber)
				{
					if (memcmp(ValStateArr_0x20_Cang03, Cang03_IO, 64))
					{
						Len003 = formatStr(bufTextCang03_IO, Cang03_IO, 3);
						memset(bufTextCang03_IO + Len003, ' ', sizeof(bufTextCang03_IO) - Len003);
						// taskENTER_CRITICAL();
						WrDwinBuf(ADDR_DWIN_Cang03_IO, &bufTextCang03_IO[0], Len003, 1);
						memcpy(ValStateArr_0x20_Cang03,Cang03_IO,64);
						// taskEXIT_CRITICAL();
						// HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
						// HAL_Delay(50);
					}
				}
				//if(FRAM_cn%5==4)

				if (4 == StoreNumber)
				{ // if(4==StoreNumber)
					if (memcmp(ValStateArr_0x20_Cang04, Cang04_IO, 64))
					{
						Len003 = formatStr(bufTextCang04_IO, Cang04_IO, 4);
						memset(bufTextCang04_IO + Len003, ' ', sizeof(bufTextCang04_IO) - Len003);
						// taskENTER_CRITICAL();
						WrDwinBuf(ADDR_DWIN_Cang04_IO, &bufTextCang04_IO[0], Len003, 1);
						memcpy(ValStateArr_0x20_Cang04,Cang04_IO,64);
						// taskEXIT_CRITICAL();
						// HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
					}
					// HAL_Delay(50);
				}										// if(4==StoreNumber)
			}											////第3--4仓阀门状态显示--结束
		}												//如果存在3仓
	} ////显示阀门开关信息--结束
}

//格式化模拟量类传感器信息
int formatStrSensor(uint16_t *bufTextCang01_IO000, float *flo_data, uint8_t cangNum)
{
	//int j001,Len001;//Len002

	sprintf((char *)bufTextCang01_IO000, "T=%4.2f;", *flo_data); //Stor[0].Temperature

	//	if(Usart2_ErrorTimes>=Max_Usart2_ErrorTime)//485总线没有数据传输，默认从机有问题，6S
	//	{
	//		Collect485.Collect_CommError=True;
	//		WrDwinCmd16(ADDR_DWIN_StateYiChang_HaiDiFa,0xff);//底阀异常
	//		WrDwinCmd16(ADDR_DWIN_StateYiChang_XieYouFa,0xff);//卸油阀异常
	//
	//	}

	__nop();

	return 0;
}

#define IO_NUM_Of_Cang01 4		//1仓开关数量
#define IO_NUM_Of_Cang02 6		//2仓开关数量
int j001_Cang01, Len001_Cang01; //Len002
int formatStrCang01(uint16_t *bufTextCang01_IO000, uint8_t *Cang01_IO000, uint8_t cangNum)
{

	//sprintf((char*)bufTextCang01_IO+16*0,"仓1:非-开-关-非-非-非-非-非-非-非");//  %02d\r\n
	__nop();
	//Len001=sprintf((char*)bufTextCang01_IO000+16*0,"仓%d:--关-----关-----关-----关-----关---",cangNum);//  %02d\r\n

	/*for(j001=0;j001<5;j001++)
						 {
							 
							 if(j001<4)
								 {//前边4个位开关状态，第五个位有油无油
								 switch (Cang01_IO[j001+7])
								 {
									case 0x00:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"  关   ");
										break;
									case 0x01:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"  开   ");
										break;
									case 0x03:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"  异常 ");
										break;
									
									default:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"  异常 ");
										break;
								 }							 
							 
							 }//前边4个字节为开关状态，第4个为有油无油
							else
							{//显示有油无油
								 switch (Cang01_IO[j001+7])
								 {
									case 0x00:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"无油   ");
										break;
									case 0x01:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"有油   ");
										break;
									case 0x03:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"  异常 ");
										break;
									
									default:
										sprintf((char*)bufTextCang01_IO+4+j001*7,"  异常 ");
										break;
								 }								 
							 
							 }//显示有油无油

							 
							 
							 
						 }*/

	if (DebugFun_Disp_Valve_Info_Bit == FunDebugCode) //直接显示阀门的原始数据----兼容之前的老板本协议，0xA1为帧标志
	{												  //直接显示阀门的原始数据
													  //sprintf((char*)bufTextCang01_IO000+0+0*3,"仓%02d",cangNum);

		sprintf((char *)bufTextCang01_IO000 + 0 + 0 * 3, "全部");
		for (j001_Cang01 = 0; j001_Cang01 < 16; j001_Cang01++)
		{
			//sprintf((char*)bufTextCang01_IO000+4+j001*3,"%02X ",Array_Of_IO_0xA1[j001+5]);
			sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 3, "%02X ", Array_Of_IO_0xA1[j001_Cang01 + 5]);
		}

		Len001_Cang01 = j001_Cang01 * 2 + 4;

		return Len001_Cang01;

	} //直接显示阀门的原始数据----兼容之前的老板本协议，0xA1为帧标志

	//flag_ShowValveRaw=1;
	if (flag_ShowValveRaw == 1) //直接显示阀门的原始数据----64字节长度的新协议
	{							//直接显示阀门的原始数据

		sprintf((char *)bufTextCang01_IO000 + 0 + 0 * 3, "仓%d:", cangNum);
		for (j001_Cang01 = 0; j001_Cang01 < 20; j001_Cang01++)
		{	//直接显示阀门的原始数据
			//sprintf((char*)bufTextCang01_IO000+4+j001*3,"%02X ",Cang01_IO000[j001+18]);
			sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 3, "%02X ", *(Cang01_IO000 + j001_Cang01 + 18));
		}

		Len001_Cang01 = j001_Cang01 * 3 + 4;

	} //直接显示阀门的原始数据----64字节长度的新协议
	else
	{ //解析阀门的开关状态--开始
		Len001_Cang01 = sprintf((char *)bufTextCang01_IO000 + 16 * 0, "仓%d:", cangNum);
		for (j001_Cang01 = 0; j001_Cang01 < IO_NUM_Of_Cang01; j001_Cang01++)
		{ //显示第一仓5个阀门的状态--开始

			if (j001_Cang01 < 4)
			{ //前边3个字节代表开关状态：海底阀，卸油阀，人孔大盖，第五个为有油无油（00=无油，01=有油）
				switch (*(Cang01_IO000 + j001_Cang01 + 18))
				{
				case 0x00:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  关   ");
					break;
				case 0x01:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  开   ");
					break;
				case 0x03:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  异常 ");
					break;

				default:
					//sprintf((char*)bufTextCang01_IO000+4+j001*7,"  未知 ");
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  关   ");
					break;
				}

			} //前边3个字节为开关状态
			/*
										else if(j001==3)//迪文屏上的排沉阀
										{
											switch (Cang01_IO[13])//索引为13的位置为第1个排尘阀
											{
												case 0x00:
													sprintf((char*)bufTextCang01_IO+4+j001*7,"  关   ");
													break;
												case 0x01:
													sprintf((char*)bufTextCang01_IO+4+j001*7,"  开   ");
													break;
												case 0x03:
													sprintf((char*)bufTextCang01_IO+4+j001*7,"  异常 ");
													break;

												default:
													sprintf((char*)bufTextCang01_IO+4+j001*7,"  异常 ");
													break;
											}	
										
										}
										*/
			else if (j001_Cang01 == 4) //卸油阀的光电传感器输出，表示管道余油
			{						   //显示有油无油
				switch (*(Cang01_IO000 + j001_Cang01 + 18))
				{
				case 0x00:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "无油   ");
					break;
				case 0x01:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "有油   ");
					break;
				case 0x03:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  异常 ");
					break;

				default:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  异常 ");
					break;
				}

			}						   //显示有油无油
			else if (j001_Cang01 == 5) //海底阀的浮球探测--表示底阀存在余油
			{						   //海底阀的浮球探测--表示底阀存在余油
				switch (*(Cang01_IO000 + j001_Cang01 + 18))
				{
				case 0x00:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "无油   ");
					break;
				case 0x01:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "有油   ");
					break;
				case 0x03:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  异常 ");
					break;

				default:
					sprintf((char *)bufTextCang01_IO000 + 4 + j001_Cang01 * 7, "  异常 ");
					break;
				}

			} //海底阀的浮球探测--表示底阀存在余油

			Len001_Cang01 = 4 + j001_Cang01 * 7;

		} //显示第一仓5个阀门的状态--结束
	}	  //解析阀门的开光状态--结束

	//memset(bufTextCang01_IO+40,0,sizeof(bufTextCang01_IO)-40);

	return Len001_Cang01;
}

//阀门信息格式化解码
int formatStr(uint16_t *bufTextCang02_IO000, uint8_t *Cang02_IO000, uint8_t cangNum)
{
	int j001, Len001;
	uint8_t sensorValue;
	//sprintf((char*)bufTextCang02_IO+16*0,"仓2:异-开-关-开-关-开-关-开-关-开  %02d\r\n",FRAM_cn);
	__nop();

	/*Len001=sprintf((char*)bufTextCang02_IO000+16*0,"仓%u:异-开-关-开-关-开-关-开-关-开",cangNum);//  %02d\r\n
						 for(j001=0;j001<5;j001++)
						 {
							 switch (Cang02_IO[j001+7])
							 {
								case 0x00:
									sprintf((char*)bufTextCang02_IO+4+j001*7,"  关   ");
									break;
								case 0x01:
									sprintf((char*)bufTextCang02_IO+4+j001*7,"  开   ");
									break;
								case 0x03:
									sprintf((char*)bufTextCang02_IO+4+j001*7,"  异常 ");
									break;
								
								default:
									sprintf((char*)bufTextCang02_IO+4+j001*7,"  异常 ");
									break;
							 }
						 }*/

	if (flag_ShowValveRaw == 1) //直接显示阀门的原-始数据
	{							//直接显示阀门的原始数据

		Len001 = sprintf((char *)bufTextCang02_IO000 + 16 * 0, "仓%u:", cangNum);

		for (j001 = 0; j001 < 20; j001++)
		{
			//sprintf((char*)bufTextCang02_IO000+4+j001*3,"%02X ",Cang02_IO000[j001+18]);

			sprintf((char *)bufTextCang02_IO000 + 4 + j001 * 3, "%02X ", *(Cang02_IO000 + j001 + 18));
		}

		Len001 = 4 + j001 * 3;

	} //直接显示阀门的原始数据
	else
	{ //解析阀门的开关状态，转换为汉字--开始

		Len001 = sprintf((char *)bufTextCang02_IO000 + 16 * 0, "仓%u:", cangNum);

		for (j001 = 0; j001 < IO_NUM_Of_Cang01; j001++)
		{ //解析5个阀门的状态,--开始
#if  1
			switch(j001)
			{
				case 0:
				case 1:
					sensorValue=*(Cang02_IO000 + j001 + 18); //底阀 左卸油阀
					break;
				case 2:
					sensorValue=*(Cang02_IO000 + 11 + 18);  //右卸油阀
					break;
				case 3:
					sensorValue=*(Cang02_IO000 + 4 + 18); //管道油
					break;
				default:
					break;
			}
#else			
			sensorValue=*(Cang02_IO000 + j001 + 18);
#endif			
			if (j001 < (IO_NUM_Of_Cang01-1))
			{										 //前边4个字节代表开关状态：海底阀，卸油阀，人孔大盖，人孔小盖，第1个为有油无油（00=无油，01=有油）
				switch (sensorValue) //Cang02_IO000[j001+18]
				{
				case 0x00:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, "  关    ");
					break;
				case 0x01:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, "  开    ");
					break;
				case 0x03:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, "  异常  ");
					break;

				default:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, "  异常  ");
					break;
				}

			} //前边4个字节代表开关状态：海底阀，卸油阀，人孔大盖，人孔小盖，第1个为有油无油（00=无油，01=有油）
			/*
										else if(j001==3)//迪文屏上的排尘阀
										{
											switch (Cang02_IO[13])//索引为13的位置为第1个排尘阀
											{
												case 0x00:
													sprintf((char*)bufTextCang02_IO+4+j001*7,"  关   ");
													break;
												case 0x01:
													sprintf((char*)bufTextCang02_IO+4+j001*7,"  开   ");
													break;
												case 0x03:
													sprintf((char*)bufTextCang02_IO+4+j001*7,"  异常 ");
													break;

												default:
												sprintf((char*)bufTextCang02_IO+4+j001*7,"  异常 ");
												break;
											}	
										
										}*/
			else
			{										 //显示有油无油
				switch (sensorValue) //(Cang02_IO000[j001+18])
				{
				case 0x00:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, "无油   ");
					break;
				case 0x01:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, "有油   ");
					break;
				case 0x03:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, " 异常 ");
					break;

				default:
					Len001 += sprintf((char *)bufTextCang02_IO000 + Len001, " 异常 ");
					break;
				}

			} //显示有油无油

			//Len001 = 4 + j001 * 7;
		} //解析5个阀门的状态,--开始

	} //解析阀门的开关状态，转换为汉字--开始

	__nop();

	return Len001;
}

/*
显示模拟量类的传感器信息------温度 液位   压力  Vt V20等参数
*/
void DisplaySensorInfo(void)
{
	//	float f000;
	int i;
	int Len002, Len003;
	static int CangNum_tskUart3;
	float Ht_t[8];

	UNUSED(Ht_t);
	UNUSED(Len002);
	//pT2C_SetupData->Reserved_parameters_4=1.0;

	CangNum_tskUart3++;

	if (CangNum_tskUart3 > StoreNumber)
	{
		CangNum_tskUart3 = 1; //
	}

	if (CangNum_tskUart3 == 1)
	{
		pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data01;
	}

	if (CangNum_tskUart3 == 2)
	{
		pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data02;
	}

	if (CangNum_tskUart3 == 3)
	{
		pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data03;
	}

	if (CangNum_tskUart3 == 4)
	{
		pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data04;
	}

	Vt_Local_Disp = pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[5];

	Ht_t[0] = T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[0];
	Ht_t[1] = T2C_ALL_Sensor_Data02.MoniLiang_Data_Every_Cang[0];
	Ht_t[2] = T2C_ALL_Sensor_Data03.MoniLiang_Data_Every_Cang[0];
	Ht_t[3] = T2C_ALL_Sensor_Data04.MoniLiang_Data_Every_Cang[0];
	if(vt_disp_type==0)
	{
		Vt_Local[0] = T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[5];
		Vt_Local[1] = T2C_ALL_Sensor_Data02.MoniLiang_Data_Every_Cang[5];
		Vt_Local[2] = T2C_ALL_Sensor_Data03.MoniLiang_Data_Every_Cang[5];
		Vt_Local[3] = T2C_ALL_Sensor_Data04.MoniLiang_Data_Every_Cang[5];

		Tempe_For_V20[0] = T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[3];
		Tempe_For_V20[1] = T2C_ALL_Sensor_Data02.MoniLiang_Data_Every_Cang[3];
		Tempe_For_V20[2] = T2C_ALL_Sensor_Data03.MoniLiang_Data_Every_Cang[3];
		Tempe_For_V20[3] = T2C_ALL_Sensor_Data04.MoniLiang_Data_Every_Cang[3];

		V20_Local[0] = Vt_Local[0] * (1 + (20 - Tempe_For_V20[0]) * ExpansionRatio[0]);
		V20_Local[1] = Vt_Local[1] * (1 + (20 - Tempe_For_V20[1]) * ExpansionRatio[1]);
		V20_Local[2] = Vt_Local[2] * (1 + (20 - Tempe_For_V20[2]) * ExpansionRatio[2]);
		V20_Local[3] = Vt_Local[3] * (1 + (20 - Tempe_For_V20[3]) * ExpansionRatio[3]);
	}
	else
	{
		for(i=0;i<4;++i)
		{
			Vt_Local[i] = T2C_SetupData[i].Capacity_Vt;
			V20_Local[i] = T2C_SetupData[i].Capacity_V20;
		}
	}
	

	Len003=0;
#if 0	
	memset(bufTextSensorInfo,0,256);
	for(i=0;i<StoreNumber;++i)
	{
		switch (i)
		{
			case 0:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data01;
				Len003 += sprintf((char *)bufTextSensorInfo+Len003, "一");
				break;
			case 1:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data02;
				Len003 += sprintf((char *)bufTextSensorInfo+Len003, "二");
				break;
			case 2:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data03;
				Len003 += sprintf((char *)bufTextSensorInfo+Len003, "三");
				break;
			case 3:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data04;
				Len003 += sprintf((char *)bufTextSensorInfo+Len003, "四");
				break;
			default:
				break;
			}
		Len003 += sprintf((char *)bufTextSensorInfo+Len003, "仓: V20 % 8.1f     ",
					 V20_Local[i]);	
		if(i==1 || i==3)
		{
			Len003 += sprintf((char *)bufTextSensorInfo+Len003, "\r\n");		
		}
	}
	WrDwinBuf(ADDR_DWIN_SensorInfo, &bufTextSensorInfo[0], Len003, 1);
	return;

	if (Auto_sealedOK_ID_bak != Full_Oil_allinfo.Auto_sealedOK_ID)
	{
		for (i = 0; i < 4; ++i)
		{
			if ((Auto_sealedOK_ID_bak & (1<<i)) != (Full_Oil_allinfo.Auto_sealedOK_ID & (1<<i)))
			{
				if (Auto_sealedOK_ID_bak & (1<<i))
				{
					V20_Seal[i] = V20_Local[i];
					Vt_Seal[i] = Vt_Local[i];
					Ht_Seal[i] = Ht_t[i];
				}
				else
				{
					V20_Break[i] = V20_Local[i];
					Vt_Break[i] = Vt_Local[i];
					Ht_Break[i] = Ht_t[i];	
				}
			}
		}
		Auto_sealedOK_ID_bak=Full_Oil_allinfo.Auto_sealedOK_ID;
	}
#endif
	switch (CangNum_tskUart3)
	{
	case 1:
		V20_Local_Disp = V20_Local[0];
		Vt_Local_Disp = Vt_Local[0];
		break;
	case 2:
		V20_Local_Disp = V20_Local[1];
		Vt_Local_Disp = Vt_Local[1];
		break;
	case 3:
		V20_Local_Disp = V20_Local[2];
		Vt_Local_Disp = Vt_Local[2];
		break;
	case 4:
		V20_Local_Disp = V20_Local[3];
		Vt_Local_Disp = Vt_Local[3];
		break;
	default:
		V20_Local_Disp = V20_Local[0];
		Vt_Local_Disp = Vt_Local[0];
		break;
	}

	//taskENTER_CRITICAL();
	//显示模拟量类传感器信息----开始
	memset(bufTextSensorInfo, ' ', sizeof(bufTextSensorInfo));
	//						Stor[0].Temperature=123.34;
	//						Len002=formatStrSensor(bufTextSensorInfo,&Stor[0].Temperature,1);
	//						memset(bufTextSensorInfo+Len002,' ',sizeof(bufTextSensorInfo)-Len002);
	//Len003=sprintf((char*)bufTextSensorInfo+Len002,"仓%d:--模拟量传感器信息-----关---%d",StoreNumber,Len002);//  %02d\r\n
	//
	//						Len003=sprintf((char*)bufTextSensorInfo+Len002,"仓数：%d,Vt01:%5.2f;--模拟量传感器信息-----关---%d",
	//									StoreNumber,Vt_Local,Len002);//  %02d\r\n
	/*	Len003=sprintf((char*)bufTextSensorInfo+Len002,"仓数：%d;液位:%5.4f;%5.4f;Vt01:%5.2f;--模拟量传感器信息-----关---%d",
									StoreNumber,
									T2C_MoniLiang_Data_Cang1to4.MoniLiang_DataOfCang_1to4[0],
									T2C_MoniLiang_Data_Cang1to4.MoniLiang_DataOfCang_1to4[11],	
									Vt_Local,Len002);//  %02d\r\n 
	
*/
//	Len002 = 0;
	//Len003=sprintf((char*)bufTextSensorInfo+Len002,"仓号：%d;h:%5.4f;T:%5.4f;T1,%5.4f;T2:%5.4f;T3:%5.4f;Vt:%5.4f;V20:%5.2f;--模拟量-----关---%d",
	//									StoreNumber,
	//									T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[0],
	//									T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[1],
	//									T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[2],
	//									T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[3],
	//									T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[4],
	//									T2C_ALL_Sensor_Data01.MoniLiang_Data_Every_Cang[5],
	//									Vt_Local,Len002);//  %02d\r\n

	//Len003=sprintf((char*)bufTextSensorInfo+Len002,"仓号：%d;h:%5.4f;T:%5.4f;T1,%5.4f;T2:%5.4f;T3:%5.4f;Vt:%5.4f;V20:%5.2f;长度:%d",
	//									CangNum_tskUart3,
	//									pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[0],
	//									pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[1],
	//									pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[2],
	//									pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[3],
	//									pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[4],
	//									pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[5],
	//									Vt_Local_Disp,Len002);//  %02d\r\n

	; //V20_Local_Disp+=10000.1301*CangNum_tskUart3;
	if(Config_info_all.Config_fun_id&0xC0)
	{
		Len003 = sprintf((char *)bufTextSensorInfo, "仓%d:",CangNum_tskUart3);	
	}
#if 0	
	if(Config_info_all.Config_fun_id&0x80) //液位
	{
		Len003 += sprintf((char *)bufTextSensorInfo + Len003, "h:%5.4f;Vt:%5.2f L;V20:%5.2f L\r\n",
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[0], //液位Pre:%5.2f
					 Vt_Local_Disp, //采集板查表计算的Vt
					 V20_Local_Disp);
	}
	if(Config_info_all.Config_fun_id&0x40) //压力
	{
		Len003 += sprintf((char *)bufTextSensorInfo + Len003, "Pressure:%5.4f\r\n",
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[6]);
	}
#else
	if(Config_info_all.Config_fun_id&0x80) //液位
	{
		Len003 += sprintf((char *)bufTextSensorInfo + Len003, " %5.4f    %5.2f      %5.2f",
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[0], //液位Pre:%5.2f
					 Vt_Local_Disp, //采集板查表计算的Vt
					 V20_Local_Disp);
	}
	WrDwinBuf(0x1A00+0x100*CangNum_tskUart3, &bufTextSensorInfo[0],Len003, 1);
	return;
#endif	
#if 0	
	Len003 = sprintf((char *)bufTextSensorInfo + Len002, "仓号：%d;h:%5.4f;Ta:%5.2f;T1,%5.2f ℃;T2:%5.2f;T3:%5.2f;\r\nVt:%5.2f L;V20:%5.2f L;\r\n",
					 CangNum_tskUart3,
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[0], //液位Pre:%5.2f
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[1], //平均温度
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[2], //温度1
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[3], //温度2
					 pT2C_ALL_Sensor_Data_Disp->MoniLiang_Data_Every_Cang[4], //温度3
					 Vt_Local_Disp, //采集板查表计算的Vt
					 V20_Local_Disp);										  //  %02d\r\n ,V20_Local_Disp
#endif
#if 0	
	if (FunDebugCode == 0)
	{
		//		//整车参数
		//	Len002=sprintf((char*)bufTextSensorInfo+Len003,"Qx:%3.2f;Qy:%3.2f;Qz,%3.2f;电量:%3.2f;\r\n",
		//
		//									pT2C_ALL_Sensor_WholeCar->tiltXYZ[0], //倾角
		//									pT2C_ALL_Sensor_WholeCar->tiltXYZ[1], //
		//									pT2C_ALL_Sensor_WholeCar->tiltXYZ[2], //
		//									pT2C_ALL_Sensor_WholeCar->BeiDianDianLiang //电量
		//									);//  %02d\r\n

		//整车参数
		Len002 = sprintf((char *)bufTextSensorInfo + Len003, "Qx:%3.2f ;Qy:%3.2f;\r\n",

						 pT2C_ALL_Sensor_WholeCar->tiltXYZ[0],	//倾角
						 pT2C_ALL_Sensor_WholeCar->tiltXYZ[1]); //  %02d\r\n
	}
	else
	{
		//						memset((char*)bufText01Password+0,0,sizeof(bufText01Password));
		//						Len000=sprintf((char*)bufText01Password+0,"膨胀系数=");
		//						//FM25L16B_Read_N_Bytes(ADDR_OiLType_Data,(uint8_t *)bufText01Password+Len000,32);
		//					  Len002=sprintf((char*)bufText01Password+Len000,"%6.5f,%6.5f,%6.5f,%6.5f",
		//							ExpansionRatio[0],ExpansionRatio[1],ExpansionRatio[2],ExpansionRatio[3]);

		switch (FunDebugCode)
		{
			case DebugFun_SW_ExpansionRatio: //显示膨胀系数
			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "膨胀系数s1:%6.5f;s2:%6.5f;s3,%6.5f;s4,%6.5f;\r\n",
							 ExpansionRatio[0], ExpansionRatio[1], ExpansionRatio[2], ExpansionRatio[3]); //

			break;

		case DebugFun_SW_ExtAddr_ControllBoard: //显示扩展地址
			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "控制板扩展地址:%08X;\r\n",
							 addr_ext_controllBoard); //
			break;
		case DebugFun_SW_ValveState_PoFeng0x13: //显示破封时的阀门状态
			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "破封阀门状态0x13:%02X%02X;%02X%02X;%02X%02X;%02X%02X;\r\n",
							 ValStateArr_PoFeng_0x13[5], ValStateArr_PoFeng_0x13[6], ValStateArr_PoFeng_0x13[7], ValStateArr_PoFeng_0x13[8],
							 ValStateArr_PoFeng_0x13[9], ValStateArr_PoFeng_0x13[10], ValStateArr_PoFeng_0x13[11], ValStateArr_PoFeng_0x13[12]); //
			break;

		case DebugFun_SW_ValveState_PoFeng0x20: //显示破封时的阀门状态
			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "破封阀门状态0x20:%02X%02X;%02X%02X;%02X%02X;%02X%02X;\r\n",
							 ValStateArr_PoFeng_0x20[18 + 0], ValStateArr_PoFeng_0x20[18 + 1], ValStateArr_PoFeng_0x20[18 + 2], ValStateArr_PoFeng_0x20[18 + 3],
							 ValStateArr_PoFeng_0x20[18 + 4], ValStateArr_PoFeng_0x20[18 + 5], ValStateArr_PoFeng_0x20[18 + 6], ValStateArr_PoFeng_0x20[18 + 7]); //
			break;

		case DebugFun_SW_ExtAddr_IO_OnOff_Group: //显示扩展地址
			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "U32阀门开关:%08X;%08X;%08X;%08X;\r\n",
							 IO_OnOff_State01, IO_OnOff_State02, IO_OnOff_State03, IO_OnOff_State04); //
			break;
		case DebugFun_Set_Enable_ReSeal: //允许重复施封
			//FunDebugCode = 0;
			Config_info_all.Config_fun_id |= 0x08; //UART4_RX_BUF[2];//功能配置ID
			FM25L16B_WriteByte(ADDR_Config_fun_id, Config_info_all.Config_fun_id);

			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "允许重复施封:%08X;%08X;%08X;%08X;%02X\r\n",
							 IO_OnOff_State01, IO_OnOff_State02, IO_OnOff_State03, IO_OnOff_State04, Config_info_all.Config_fun_id); //

			break;

		case DebugFun_Set_Disable_ReSeal: //禁止重复施封

			//FunDebugCode = 0;
			Config_info_all.Config_fun_id &= (~0x08); //功能配置ID
			FM25L16B_WriteByte(ADDR_Config_fun_id, Config_info_all.Config_fun_id);

			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "禁止重复施封!%08X;%08X;%08X;%08X;%02X;\r\n",
							 IO_OnOff_State01, IO_OnOff_State02, IO_OnOff_State03, IO_OnOff_State04,
							 Config_info_all.Config_fun_id); //

			break;

		case DebugFun_SW_ExtAddr_IO_Exception_Group: //显示扩展地址
			Len002 = sprintf((char *)bufTextSensorInfo + Len003, "U32阀门异常:%08X;%08X;%08X;%08X;%02X;\r\n",
							 IO_Exception_State01, IO_Exception_State02, IO_Exception_State03, IO_Exception_State04,
							 Config_info_all.Config_fun_id); //

			break;

			default:
			//				Len002=sprintf((char*)bufTextSensorInfo+Len003,"膨胀系数s1:%6.5f;s2:%6.5f;s3,%6.5f;s4,%6.5f;\r\n",
			//									ExpansionRatio[0],ExpansionRatio[1],ExpansionRatio[2],ExpansionRatio[3]);//
			__NOP();
			break;
		}
	}

	//显示来自平台的数据
	if (data_Src_To_Disp != 0)
	{
	}

	
	if(Run_mode_key_info.current_page==Run_mode_key_info.Liquid_id)
	{
		memset(bufTextSensorInfo,0,256);
		Len003 = sprintf((char *)bufTextSensorInfo, "         体积Vt(L)   液位ht(m)    体积V20(L)\r\n");
		WrDwinBuf(ADDR_DWIN_SensorInfoAll, &bufTextSensorInfo[0],Len003, 1);
		for(i=0;i<StoreNumber;++i)
		{
			Len003=0;
			memset(bufTextSensorInfo,0,256);
			switch (i)
			{

			case 0:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data01;
				Len003 = sprintf((char *)bufTextSensorInfo, "一");
				break;
			case 1:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data02;
				Len003 = sprintf((char *)bufTextSensorInfo, "二");
				break;
			case 2:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data03;
				Len003 = sprintf((char *)bufTextSensorInfo, "三");
				break;
			case 3:
				pT2C_ALL_Sensor_Data_Disp = &T2C_ALL_Sensor_Data04;
				Len003 = sprintf((char *)bufTextSensorInfo, "四");
				break;
			default:
				break;
			}
#if 0			
			Len003 += sprintf((char *)bufTextSensorInfo+Len003, "仓装油: 体积Vt:% 7.1f L;液位ht:%1.4f m;体积V20:% 7.1f L;\r\n",
					 Vt_Seal[i], //采集板查表计算的Vt
					 Ht_Seal[i], //液位Pre:%5.2f
					 V20_Seal[i]);	
			Len003 += sprintf((char *)bufTextSensorInfo+Len003, "    卸油: 体积Vt:% 7.1f L;液位ht:%1.4f m;体积V20:% 7.1f L;\r\n",
					 Vt_Break[i], //采集板查表计算的Vt
					 Ht_Break[i], //液位Pre:%5.2f
					 V20_Break[i]);	
#else
		Len003 += sprintf((char *)bufTextSensorInfo+Len003, "仓装油: % 8.1f \t% 7.4f \t% 8.1f\r\n",
					 Vt_Seal[i], //采集板查表计算的Vt
					 Ht_Seal[i], //液位Pre:%5.2f
					 V20_Seal[i]);	
		Len003 += sprintf((char *)bufTextSensorInfo+Len003, "    卸油: % 8.1f \t% 7.4f \t% 8.1f\r\n",
					 Vt_Break[i], //采集板查表计算的Vt
					 Ht_Break[i], //液位Pre:%5.2f
					 V20_Break[i]);
#endif					 
			WrDwinBuf(ADDR_DWIN_SensorInfoAll+(i+1)*0x100, &bufTextSensorInfo[0],Len003, 1);
		}
		memset(bufTextSensorInfo,0,256);
		Len002 = sprintf((char *)bufTextSensorInfo, "倾角 x轴:%3.2f ; y轴:%3.2f;\r\n",
						 pT2C_ALL_Sensor_WholeCar->tiltXYZ[0],	//倾角
						 pT2C_ALL_Sensor_WholeCar->tiltXYZ[1]); //  %02d\r\n
		WrDwinBuf(ADDR_DWIN_SensorInfoAll+(i+1)*0x100, &bufTextSensorInfo[0],Len002, 1);
	}
	else
	{
		WrDwinBuf(ADDR_DWIN_SensorInfo, &bufTextSensorInfo[0], Len002 + Len003, 1);
	}
	//taskEXIT_CRITICAL();

	//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
	__nop();
	//显示模拟量类传感器信息----结束

	/*
				//李伟修改  20210222

			    if((fabs(pT2C_SetupData->Reserved_parameters_4-2.0f)<0.2f  ) || (pT2C_SetupData->Reserved_parameters_4<0.2f) \
						  || (tmrForTemp_ManualInput>5))  //强制使用采集器的数据
         	{//Reserved_parameters_4==2.0 或者=0 也使用采集器传来的温度
						
						
						//是否采用强制手工输入的温度
						if(tmrForTemp_ManualInput>5)
						{
						    uni_temper001.flo_Data=uni_temper001.flo_Data;
						}
						else
						{
								uni_temper001.flo_Data=Stor[0].Temperature;
							
							
							//李伟修改  20210428  根据平台下发的命令的p3参数决定取哪一个温度作为体积修正的 参考
							if(fabs(pT2C_SetupData->Reserved_parameters_3-1.0f)<0.2f)
							{
							
								uni_temper001.flo_Data=Stor[0].Temperature;//默认取第一个温度传感器的数据
							}
							
							if(fabs(pT2C_SetupData->Reserved_parameters_3-2.0f)<0.2f)
							{
							
								uni_temper001.flo_Data=Stor[1].Temperature;//取第2个温度传感器的数据
							}
							
							if(fabs(pT2C_SetupData->Reserved_parameters_3-3.0f)<0.2f)
							{
							
								uni_temper001.flo_Data=Stor[2].Temperature;//取第2个温度传感器的数据
							}
							
						
						}
					
						
						
						
					uni_LiqLev001.flo_Data=Stor[0].yewei_flo[0];
					uni_QingJiao001.flo_Data=Stor[0].QingJiaoFlo;
					uni_QingJiao002.flo_Data=Stor[1].QingJiaoFlo;						
					uni_TankVol_Realtime001.flo_Data=Stor[0].Volume;
 				
									
					Vt_Local=uni_TankVol_Realtime001.flo_Data;//实时容积   采集器计算的

					//李伟修改   20200209根据会议讨论结论进行修改
//           
//					#ifdef	SCL_Factor_diesel   //0808车   雷达液位计
//					//V20计算  默认为柴油
//						V20_Local=Vt_Local*(1+SCL_Factor_diesel*0.01f*(20.00001f-uni_temper001.flo_Data));
//					#else

//						V20_Local=Vt_Local*(1+SCL_Factor_petrol*0.01f*(20.00001f-uni_temper001.flo_Data));
//					#endif
//					
//					 
					
					V20_Local=Vt_Local*(1+SCL_Factor_diesel*0.01f*(20.00001f-uni_temper001.flo_Data));


					//换算的20度容积显示
					uni_TankVol_Tempe20_002.flo_Data=V20_Local;
					
					__nop();
				}
				else  // if()  
				{//Reserved_parameters_4==1.0  使用平台上下发的数据
					uni_temper001.flo_Data=pT2C_SetupData->temperature;//temperature; 
					uni_LiqLev001.flo_Data=pT2C_SetupData->liquid_level;//liquid_level;
					uni_GasPressure001.flo_Data=pT2C_SetupData->pressure;
					uni_QingJiao001.flo_Data=pT2C_SetupData->inclination_angle_x;					
					//uni_QingJiao002.flo_Data=pT2C_SetupData->inclination_angle_y;	
					uni_QingJiao002.flo_Data=Stor[1].QingJiao;					
					uni_TankVol_Realtime001.flo_Data=pT2C_SetupData->Capacity_Vt;	
					uni_TankVol_Tempe20_001.flo_Data=pT2C_SetupData->Capacity_V20;//换算的20度容积显示
								
					
					__nop();
					//uni_QingJiao002.flo_Data=pT2C_SetupData->Capacity_V20;
					
					//uni_temper001.flo_Data=pT2C_SetupData->temperature;
					__nop();
					
				}
				
				*/

	/*
				//目前一共8种状态：迪文屏手工输入温度，平台输入温度，平台输入密度
				//该状态为：迪文屏不输入温度=0；平台输入温度=0，平台输入密度=1
				//Reserved_parameters_4==3.0  使用平台下发的数据罐容数据，并且显示密度数据
				//因Reserved_parameters_4==1,2已经使用。所以定为3
//				if(((pT2C_SetupData->Reserved_parameters_4>2.5f) && (pT2C_SetupData->Reserved_parameters_4<3.5f)) \
//					  ||  ((pT2C_SetupData->Reserved_parameters_4>1.5f) && (pT2C_SetupData->Reserved_parameters_4<2.5f)))
				//下发温度或者下发密度均会显示平台下发数据 p4=1,3
//				if(((pT2C_SetupData->Reserved_parameters_4>2.5f) && (pT2C_SetupData->Reserved_parameters_4<3.5f)) \
//					  ||  ((pT2C_SetupData->Reserved_parameters_4>0.5f) && (pT2C_SetupData->Reserved_parameters_4<1.5f)))
//				
				if((fabs(pT2C_SetupData->Reserved_parameters_4-1.0f)<0.2f) || \
					(fabs(pT2C_SetupData->Reserved_parameters_4-3.0f)<0.2f))
				{
					uni_TankVol_Realtime001.flo_Data=pT2C_SetupData->Capacity_Vt;	
					uni_TankVol_Tempe20_001.flo_Data=pT2C_SetupData->Capacity_V20;//换算的20度容积显示
				}
				
				
		 
						
			//uni_temper001.flo_Data=uni_temper001.flo_Data-10;
			//温度显示
			sd000=uni_temper001.farray[3]<<24 | uni_temper001.farray[2]<<16 |uni_temper001.farray[1]<<8 | uni_temper001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Tempe01,sd000);

      //HAL_Delay(10);//osDelay(10);	
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
		 	
 
			//压力显示
			sd000=uni_GasPressure001.farray[3]<<24 | uni_GasPressure001.farray[2]<<16 |uni_GasPressure001.farray[1]<<8 | uni_GasPressure001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Pressure01,sd000);
			
			//海底阀状态刷新
			//WrDwinCmd32(0x1006,!HaiDiFa001);
			//WrDwinCmd32(0x1006,i002++);
			//WrDwinCmd16(0x1006,i002++);

			
			//液位显示
			//uni_LiqLev001.flo_Data=uni_LiqLev001.flo_Data+i000;
			sd000=uni_LiqLev001.farray[3]<<24 | uni_LiqLev001.farray[2]<<16 |uni_LiqLev001.farray[1]<<8 | uni_LiqLev001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Yewei01_Cang01,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			//uni_LiqLev001.flo_Data=55.66;
			sd000=uni_LiqLev002.farray[3]<<24 | uni_LiqLev002.farray[2]<<16 |uni_LiqLev002.farray[1]<<8 | uni_LiqLev002.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Yewei01_Cang02,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			sd000=uni_LiqLev003.farray[3]<<24 | uni_LiqLev003.farray[2]<<16 |uni_LiqLev003.farray[1]<<8 | uni_LiqLev003.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Yewei01_Cang03,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			sd000=uni_LiqLev004.farray[3]<<24 | uni_LiqLev004.farray[2]<<16 |uni_LiqLev004.farray[1]<<8 | uni_LiqLev004.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Yewei01_Cang04,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
	 
			
			//角度显示  倾角显示
			//uni_QingJiao001.flo_Data=uni_QingJiao001.flo_Data+i000;
			//以下调试用
			//if(dbgArray[0]==1)
			if(0)	
			{
						
				f000=f000+1;
				uni_QingJiao002.flo_Data=f000;
				uni_QingJiao001.flo_Data=f000*(float)0.89;
				
				uni_TankVol_Realtime001.flo_Data=(float)69999.89+f000;//调试用//实时容积显示
				
			
			}
			
//			
			if((uni_QingJiao001.flo_Data>10)  || ((uni_QingJiao001.flo_Data-360)<-10))
			{
			
			   ;//uni_QingJiao001.flo_Data=0.32;
			}
			
			
			if((uni_QingJiao002.flo_Data>10)  || ((uni_QingJiao002.flo_Data-360)<-10))
			{
			
			   ;//uni_QingJiao002.flo_Data=-0.2;
			}
			//uni_QingJiao001.flo_Data=2.34;
			
			
			sd000=uni_QingJiao001.farray[3]<<24 | uni_QingJiao001.farray[2]<<16 |uni_QingJiao001.farray[1]<<8 | uni_QingJiao001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Qingjiao01,sd000);//0x204c为迪文屏液晶屏的倾角1的地址
			
						
			sd000=uni_QingJiao002.farray[3]<<24 | uni_QingJiao002.farray[2]<<16 |uni_QingJiao002.farray[1]<<8 | uni_QingJiao002.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Qingjiao02,sd000);//0x207c为迪文屏液晶屏的倾角2的地址
			
			//HAL_Delay(10);//osDelay(10);
			
						
			//重量显示
			sd000=uni_OilWeight001.farray[3]<<24 | uni_OilWeight001.farray[2]<<16 |uni_OilWeight001.farray[1]<<8 | uni_OilWeight001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Zhongliang,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			//uni_TempRealtime001.flo_Data+=0.35;
			//实时温度用户输入显示  温度显示
			sd000=uni_TempRealtime001.farray[3]<<24 | uni_TempRealtime001.farray[2]<<16 |uni_TempRealtime001.farray[1]<<8 | uni_TempRealtime001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_TempeManualInput,sd000);
			
 
			//if(DWIN_Display_Source==0x00)//显示控制器计算的数据
			//按键输入温度的xx分钟之内，强制取本地的计算进行显示
			 if(  (fabs(pT2C_SetupData->Reserved_parameters_4-2.0f)<0.2f   ) || (pT2C_SetupData->Reserved_parameters_4<0.2f) \
						  || (tmrForTemp_ManualInput>5))  //强制使用采集器的数据
			{
  
						//换算的20度容积显示
						uni_TankVol_Tempe20_002.flo_Data=V20_Local;
						sd000=uni_TankVol_Tempe20_002.farray[3]<<24 | uni_TankVol_Tempe20_002.farray[2]<<16 |uni_TankVol_Tempe20_002.farray[1]<<8 | uni_TankVol_Tempe20_002.farray[0]; 
						WrDwinCmd32(ADDR_DWIN_V20_Cang01,sd000);
			}
			else
			{//显示来自平台下发的数据
			
					//实时容积显示
					//uni_TankVol_Realtime001.flo_Data=10007;
					uni_TankVol_Realtime001.flo_Data=pT2C_SetupData->Capacity_Vt;
 
					
					//换算的20度容积显示
					uni_TankVol_Tempe20_001.flo_Data=pT2C_SetupData->Capacity_V20;
					sd000=uni_TankVol_Tempe20_001.farray[3]<<24 | uni_TankVol_Tempe20_001.farray[2]<<16 |uni_TankVol_Tempe20_001.farray[1]<<8 | uni_TankVol_Tempe20_001.farray[0]; 
					WrDwinCmd32(ADDR_DWIN_V20_Cang01,sd000);
				  
				
			
			}
			 
			
			//HAL_Delay(10);//osDelay(10);
			sd000=uni_TankVol_Realtime001.farray[3]<<24 | uni_TankVol_Realtime001.farray[2]<<16 |uni_TankVol_Realtime001.farray[1]<<8 | uni_TankVol_Realtime001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Vt_Cang01,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			
			sd000=uni_TankVol_Realtime001.farray[3]<<24 | uni_TankVol_Realtime001.farray[2]<<16 |uni_TankVol_Realtime001.farray[1]<<8 | uni_TankVol_Realtime001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Vt_Cang02,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			sd000=uni_TankVol_Realtime001.farray[3]<<24 | uni_TankVol_Realtime001.farray[2]<<16 |uni_TankVol_Realtime001.farray[1]<<8 | uni_TankVol_Realtime001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Vt_Cang03,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			sd000=uni_TankVol_Realtime001.farray[3]<<24 | uni_TankVol_Realtime001.farray[2]<<16 |uni_TankVol_Realtime001.farray[1]<<8 | uni_TankVol_Realtime001.farray[0]; 
			WrDwinCmd32(ADDR_DWIN_Vt_Cang04,sd000);
			HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			 
			
			
			
			//HAL_Delay(10);//osDelay(10);
			
			//强制编译此段代码而非不进行编译
			if(TriTempSensorOn)
				{   //在装油界面显示所有的温度传感器数值
				  uni_temper002.flo_Data=ArrOfTempeSensor_Flo[0];//Stor[0].Temperature;
					sd000=uni_temper002.farray[3]<<24 | uni_temper002.farray[2]<<16 |uni_temper002.farray[1]<<8 | uni_temper002.farray[0]; 
					WrDwinCmd32(ADDR_DWIN_Tempe01_Cang01,sd000);
				
					uni_temper003.flo_Data=ArrOfTempeSensor_Flo[1];//Stor[1].Temperature;
					sd000=uni_temper003.farray[3]<<24 | uni_temper003.farray[2]<<16 |uni_temper003.farray[1]<<8 | uni_temper003.farray[0]; 
					WrDwinCmd32(ADDR_DWIN_Tempe02_Cang01,sd000);
				
					uni_temper004.flo_Data=ArrOfTempeSensor_Flo[2];//Stor[2].Temperature;
					sd000=uni_temper004.farray[3]<<24 | uni_temper004.farray[2]<<16 |uni_temper004.farray[1]<<8 | uni_temper004.farray[0]; 
					WrDwinCmd32(ADDR_DWIN_Tempe03_Cang01,sd000);
				
					HAL_GPIO_TogglePin(GPIOC, DWI_Pin);//看门狗sp706
			
			}
				
			
			
			
			
  
			//在屏幕上显示密度数据密度参数
			uni_OilDensity001.flo_Data=pT2C_SetupData->density;
			
			
			//uni_OilDensity001.flo_Data=-2.0f;//测试用
			
			srand(xTaskGetTickCount());    //gSystickMsecCount这个值是在Systick中断中计数的变量

			
			
			//测试程序  测试密度显示
			#if(1==0)
				srand(xTaskGetTickCount());    //gSystickMsecCount这个值是在Systick中断中计数的变量
				
				
				pT2C_SetupData->density+=1000;//;
				pT2C_SetupData->density+=(rand() % 10000)*0.0001f;
				
				if(pT2C_SetupData->density>9000)
				{
					pT2C_SetupData->density=10;
				}
				//uni_OilDensity001.flo_Data=899.3457;//pT2C_SetupData->density;
				
			#endif
			//密度数据显示  密度参数  
			//uni_OilDensity001.flo_Data=pT2C_SetupData->Reserved_parameters_4;//1.0f;//0.7239f;
			//uni_OilDensity001.flo_Data=0.8185;//for test 
			
			
			//sd000=uni_OilDensity001.farray[3]<<24 | uni_OilDensity001.farray[2]<<16 |uni_OilDensity001.farray[1]<<8 | uni_OilDensity001.farray[0]; 
			__nop();
			sd000=uni_OilDensity001.u32Dat;
			__nop();
			//sd000=uni_OilDensity001.u32Dat;
			__nop();
			WrDwinCmd32(ADDR_DWIN_Density_Cang01,sd000);//密度显示   密度数据显示
			
			
			
			*/
	//HAL_GPIO_TogglePin(GPIOC, DWI_Pin); //看门狗sp706
#endif
}

/* USER CODE END Application */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
