Commit 2ac46ae9 authored by 梁百峰's avatar 梁百峰

feat:优化静态电流检测

parent d966adf5
......@@ -16,6 +16,7 @@ uint32_t Display_Menu_Type;
uint32_t Page_Refresh = 1;
uint32_t PageNum_history = 0xff;
uint16_t Fuel_Res;
uint32_t loc_Current_0 = 0;
//const uint16_t BackLightDigitNum09PosX[] = {30*9, 30*8, 30*7, 30*6, 30*5, 30*4, 30*3, 30*2, 30*1, 30*0};
const unsigned char gImage_titlex0_y0[]={/*Byte Size322*/
80U,32U,
......@@ -3527,16 +3528,16 @@ void HW_Voltage_Check(uint32_t cmd)
}
const uint16_t CurrentDigitNum09PosX[] = {200,180,170};
#define Sampling_NUM 15
#define Sampling_NUM 2000
uint32_t dianliu;
static uint32_t loc_ret1 = 0;
void HW_Static_Current_Check(uint32_t cmd)
{
uint8_t p [ 20 ];
uint32_t loc_Current_0 = 0;
uint32_t loc_Current_1 = 0;
static uint32_t loc_Timer = 0;
static uint32_t loc_ret = 0;
if ( cmd == 0u )
{
......@@ -3548,13 +3549,42 @@ void HW_Static_Current_Check(uint32_t cmd)
TFT_LCD_Draw_Bmp(3, 60, ( uint8_t * )gImage_Dyy_words_5X6_Y137);
TFT_LCD_Draw_Bmp(210, 60, ( uint8_t * )gImage_Dyy_words_18X210_Y139);
//电流 *0.25 *100 = 电压
loc_Current_0 = ADC_Read_Signal(ADC_CH_KL15_VOLTAGE);//静态电流:电压/25
// loc_Current_0 = ADC_Read_Signal(ADC_CH_KL15_VOLTAGE);//静态电流:电压/25
dianliu = loc_Current_0;
// loc_ret += loc_Current_0;
// loc_Timer++;
// if ( loc_Timer >= Sampling_NUM )
// {
// loc_Timer = 0;
// loc_ret /= Sampling_NUM;
// // loc_ret *= 1000;//单位0.001毫伏
// // loc_ret /= 100;//转化为电流,单位0.001毫安
// loc_ret /= 10;//单位0.1毫安
if(loc_ret1 != 0)
{
TFT_LCD_Draw_Bmp(190, 60, ( uint8_t * )gImage_Number_15_white_PiontX0_Y0);
GUI_General_Digit_Display(loc_ret1, Num_15, 3, 0, CurrentDigitNum09PosX, 60);
loc_ret1 = 0;
}
// loc_ret = 0;
// }
}
}
void Get_static_Current(void)
{
static uint32_t loc_Timer = 0;
static uint32_t loc_ret = 0;
if(MENU_CHECK_STEP == 13)
{
loc_Current_0 = ADC_Read_Signal(ADC_CH_KL15_VOLTAGE);
loc_ret += loc_Current_0;
loc_Timer++;
if ( loc_Timer >= Sampling_NUM )
{
loc_Timer = 0;
......@@ -3563,14 +3593,10 @@ void HW_Static_Current_Check(uint32_t cmd)
// loc_ret *= 1000;//单位0.001毫伏
// loc_ret /= 100;//转化为电流,单位0.001毫安
loc_ret /= 10;//单位0.1毫安
TFT_LCD_Draw_Bmp(190, 60, ( uint8_t * )gImage_Number_15_white_PiontX0_Y0);
GUI_General_Digit_Display(loc_ret, Num_15, 3, 0, CurrentDigitNum09PosX, 60);
loc_ret = 0;
loc_ret1 = loc_ret;
}
}
}
const uint16_t testNum[] = {200,190,180};
void Check_PWM(void)
......@@ -3717,81 +3743,6 @@ void Display_Version_Info(uint32_t ON_OFF)
uint8_t mbuff [4] = {1,0,1,0xff};
General_Number_Disp(mbuff, 160, 290);
// if ( display_Check01 != 7 )
// {
// if ( SW_Version [ 0 ] != 255 )
// {
// SW_Version__Display();
// display_Check01++;
// }
// else
// {
// display_Check01 = 0U;
// }
// }
// if ( display_Check02 != 7 )
// {
// if ( HW_Version [ 0 ] != 255 )
// {
// HW_Version__Display();
// display_Check02++;
// }
// else
// {
// display_Check02 = 0U;
// }
// }
// if ( display_Check03 != 7 )
// {
// if ( Part_Version [ 0 ] != 255 )
// {
// Part_Version__Display();
// display_Check03++;
// }
// else
// {
// display_Check03 = 0U;
// }
// }
//if ( display_Check04 != 7 )
//{
// if ( Made_Date [ 0 ] != 255 )
// {
// Made_Date__Display();
// display_Check04++;
// }
// else
// {
// display_Check04 = 0U;
// }
//}
// if ( display_Check05 != 7 )
// {
// if ( SUPPLIER [ 0 ] != 255 )
// {
// SUPPLIER__Display();
// display_Check05++;
// }
// else
// {
// display_Check05 = 0U;
// }
// }
// HW_Voltage_Check(1);
// Voltage_UDS [0] = 1;
// Voltage_UDS [1] = 2;
// Voltage_UDS [2] = 3;
// Voltage_UDS [3] = 4;
// Voltage_UDS [4] = 5;
// Voltage_UDS [5] = 6;
// Voltage_UDS [6] = 7;
// Voltage_UDS [7] = 8;
// Voltage_UDS__Display();
// //FUEL_UDS__Display(1);
// Check_PWM();
}
......
......@@ -93,6 +93,8 @@ extern const uint8_t *Num_30[];
extern const uint8_t * Letter_Num_11[];
extern uint32_t loc_Current_0;
extern void Get_static_Current(void);
extern const uint8_t *Num_15[];
#define PCodeText_Space_size 2//故障文字 英文空格的像素数
#endif
......@@ -101,11 +101,11 @@ void RTE_GPIO_Init(void)
gpio_temp.enGPIODir = GPIO_DIR_IN;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);
queren = 0;
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1;
queren = 0;
#if(0)
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_0;
......
......@@ -74,8 +74,8 @@ void Sys_Startup_Init(void)
GPIO_SET_KEPP( );
RTE_ADC_Init( );
COM_CAN_Init( );
Can_Init( );
// COM_CAN_Init( );
// Can_Init( );
enable_interrupt( );
Sys_Tick_Timer_Start( );
TFT_LCD_Startup( );
......@@ -104,6 +104,8 @@ void Sys_Startup_Init(void)
loc_config.pfnUARTErrHandleCallBack = 0;
loc_config.pfnUARTReadMsgCallBack = UART_Put1;
UART_Init(UART_RLIN31, &loc_config);
Auto_ONOFF = 1;
AutoFlag = 1;
}
/***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment