Commit 945e4ca0 authored by 李冠华's avatar 李冠华

feat:增加上电KL15、30、13.5V电25s,断总电5s和断13.5V电5s的功能

parent 894c4295
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
[Subproject] [Subproject]
:sourceDir=..\..\source\Appliciation :sourceDir=..\..\source\Appliciation
Power_Controls.c
Power_Controls.h
api_RS485.c api_RS485.c
api_RS485.h api_RS485.h
R485_Communication_Matrix.c R485_Communication_Matrix.c
......
...@@ -59,7 +59,7 @@ uint8_t KEYBUFFER [ 4 ]; ...@@ -59,7 +59,7 @@ uint8_t KEYBUFFER [ 4 ];
uint32_t CAN_Msg_Tx_Enable; uint32_t CAN_Msg_Tx_Enable;
uint32_t MENU_CHECK_STEP; uint32_t MENU_CHECK_STEP = 10U;
uint32_t Global_Session = 0; uint32_t Global_Session = 0;
uint32_t loc_Step; uint32_t loc_Step;
...@@ -85,7 +85,7 @@ void MENU_CHECK_STEP_SUB(void) ...@@ -85,7 +85,7 @@ void MENU_CHECK_STEP_SUB(void)
void MENU_CHECK_Init(void) void MENU_CHECK_Init(void)
{ {
MENU_CHECK_STEP = 0; MENU_CHECK_STEP = 10U;
} }
......
...@@ -4489,7 +4489,7 @@ void Display_Send_Vspead(uint8_t menu) ...@@ -4489,7 +4489,7 @@ void Display_Send_Vspead(uint8_t menu)
break; break;
default: default:
MENU_CHECK_STEP = 0; MENU_CHECK_STEP = 10u;
break; break;
} }
if(menu != 12) if(menu != 12)
......
...@@ -18,7 +18,7 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) ...@@ -18,7 +18,7 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent)
Display_TFT_Clear( ); Display_TFT_Clear( );
} }
MENU_CHECK_STEP_ADD( ); // MENU_CHECK_STEP_ADD( );
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
...@@ -64,7 +64,7 @@ void Key_Operation_SW4(Key_Event_en_t enKeyEvent) ...@@ -64,7 +64,7 @@ void Key_Operation_SW4(Key_Event_en_t enKeyEvent)
// Display_Sub( ); // Display_Sub( );
// Display_TFT_Clear( ); // Display_TFT_Clear( );
// } // }
MENU_CHECK_STEP_SUB(); // MENU_CHECK_STEP_SUB();
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
...@@ -192,7 +192,7 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent) ...@@ -192,7 +192,7 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent)
{ {
if(Get_Display_Type( ) == 2) if(Get_Display_Type( ) == 2)
{ {
MENU_CHECK_STEP_SUB( ); // MENU_CHECK_STEP_SUB( );
} }
} }
else else
...@@ -221,7 +221,7 @@ void Key_Operation_SW1(Key_Event_en_t enKeyEvent) ...@@ -221,7 +221,7 @@ void Key_Operation_SW1(Key_Event_en_t enKeyEvent)
{ {
if(Get_Display_Type( ) == 2) if(Get_Display_Type( ) == 2)
{ {
MENU_CHECK_STEP_ADD( ); // MENU_CHECK_STEP_ADD( );
} }
} }
else else
......
#include "Power_Controls.h"
uint16_t PowerCountNum = 0U;
uint8_t KL1530ON = 0U;
uint8_t ControlsStatus = DUAN_DIAN_STATE;
void Power_Control_Count(void)
{
if (PowerCountNum <= 250U)
{
KL1530ON = 1U;
PowerCountNum ++;
}
else if ((PowerCountNum > 250U) && (PowerCountNum < 300U))
{
KL1530ON = 0U;
PowerCountNum ++;
}
else
{
KL1530ON = 0U;
PowerCountNum = 0U;
}
}
void Power_KL15_KL30_Controls(void)
{
if(ControlsStatus == 1U)
{
if (KL1530ON == 1U)
{
LINE_OUT_NEG_01 = 1U;
LINE_OUT_NEG_02 = 1U;
LINE_OUT_NEG_03 = 1U;
LINE_OUT_NEG_04 = 1U;
}
else
{
LINE_OUT_NEG_01 = 0U;
LINE_OUT_NEG_02 = 0U;
LINE_OUT_NEG_03 = 0U;
LINE_OUT_NEG_04 = 0U;
}
}
else
{
if (KL1530ON == 1U)
{
LINE_OUT_NEG_01 = 1U;
}
else
{
LINE_OUT_NEG_01 = 0U;
}
}
}
#ifndef POWER_CONTROLS_H__
#define POWER_CONTROLS_H__
#include "RTE_GPIO.h"
#include "Key.h"
#include "Display_Info.h"
#include "Check_Ctrl.h"
#include "Barcode_Scanner.h"
#include "Task.h"
#define DUAN_DIAN_STATE 0 /*0--只控制13.5V电,1--控制所有电*/
extern void Power_Control_Count(void);
extern void Power_KL15_KL30_Controls(void);
#endif
...@@ -583,7 +583,7 @@ uint32_t R485_Send_0x41(void) ...@@ -583,7 +583,7 @@ uint32_t R485_Send_0x41(void)
R485_ID41h.Sig.RotorLocked = 0; R485_ID41h.Sig.RotorLocked = 0;
break; break;
case 10: case 10:
R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x300; //速度 = (X * 0.512 * 3.14 * 1.05) / 30 88km R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x0; //速度 = (X * 0.512 * 3.14 * 1.05) / 30 88km
R485_ID41h.Sig.TotalBatterySOC = 0xC6; //电量 R485_ID41h.Sig.TotalBatterySOC = 0xC6; //电量
R485_ID41h.Sig.VehicleStatus = 0x3; //整车状态 R485_ID41h.Sig.VehicleStatus = 0x3; //整车状态
R485_ID41h.Sig.SpeedGear = 0; //挡位 R485_ID41h.Sig.SpeedGear = 0; //挡位
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
// #define LINE_OUT_POS_09 GPIO_OUT_PORT08_PIN08 // #define LINE_OUT_POS_09 GPIO_OUT_PORT08_PIN08
// #define LINE_OUT_POS_10 GPIO_OUT_PORT00_PIN07 // #define LINE_OUT_POS_10 GPIO_OUT_PORT00_PIN07
#define LINE_OUT_NEG_01 GPIO_OUT_PORT09_PIN06 //12V #define LINE_OUT_NEG_01 GPIO_OUT_PORT09_PIN06 //12V----13.5电
#define LINE_OUT_NEG_02 GPIO_OUT_PORT09_PIN05 //BAT #define LINE_OUT_NEG_02 GPIO_OUT_PORT09_PIN05 //BAT
#define LINE_OUT_NEG_03 GPIO_OUT_PORT09_PIN04 //BAT~ #define LINE_OUT_NEG_03 GPIO_OUT_PORT09_PIN04 //BAT~
#define LINE_OUT_NEG_04 GPIO_OUT_PORT09_PIN03 //ACC1 #define LINE_OUT_NEG_04 GPIO_OUT_PORT09_PIN03 //ACC1
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "string.h" #include "string.h"
#include "api_RS485.h" #include "api_RS485.h"
#include "R485_Communication_Matrix.h" #include "R485_Communication_Matrix.h"
#include "Power_Controls.h"
/******************************************************************************* /*******************************************************************************
* * * *
* ϵͳ��������ģʽ(SYS_MODE_OFF / SYS_MODE_ON / SYS_MODE_STANDBY )�����б� * * ϵͳ��������ģʽ(SYS_MODE_OFF / SYS_MODE_ON / SYS_MODE_STANDBY )�����б� *
...@@ -105,7 +106,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void) ...@@ -105,7 +106,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
{ {
if(zhenduanflag == 0) if(zhenduanflag == 0)
{ {
R485_Send_Line_0x47(MENU_CHECK_STEP); // R485_Send_Line_0x47(MENU_CHECK_STEP);
RS485_User_Tx_Data(); RS485_User_Tx_Data();
comparestart = 0; comparestart = 0;
} }
...@@ -205,7 +206,7 @@ void Sys_Run_Mode_50ms_Tasks_Group(void) ...@@ -205,7 +206,7 @@ void Sys_Run_Mode_50ms_Tasks_Group(void)
timerms++; timerms++;
} }
Power_KL15_KL30_Controls();
// if ( timer_100ms >= 500 ) // if ( timer_100ms >= 500 )
// { // {
...@@ -278,7 +279,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void) ...@@ -278,7 +279,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
} }
else else
{ {
MENU_CHECK_STEP_ADD( ); // MENU_CHECK_STEP_ADD( );
AutoTime = 0; AutoTime = 0;
} }
...@@ -344,6 +345,7 @@ void Sys_Exact_50us_Tasks(void) ...@@ -344,6 +345,7 @@ void Sys_Exact_50us_Tasks(void)
{ {
GenDelay_Tick( ); GenDelay_Tick( );
DoCAN_Timer_Update(50u); DoCAN_Timer_Update(50u);
} }
/*============================================================================*/ /*============================================================================*/
...@@ -358,6 +360,7 @@ void Sys_Exact_50us_Tasks(void) ...@@ -358,6 +360,7 @@ void Sys_Exact_50us_Tasks(void)
void Sys_Exact_100ms_Tasks(void) void Sys_Exact_100ms_Tasks(void)
{ {
// CHECK_IPK_COUNT( ); // CHECK_IPK_COUNT( );
Power_Control_Count();
} }
/*============================================================================*/ /*============================================================================*/
void Sys_Enter_Sleep_Mode(void) void Sys_Enter_Sleep_Mode(void)
......
...@@ -505,7 +505,7 @@ void RS485_User_Tx_Data(void) ...@@ -505,7 +505,7 @@ void RS485_User_Tx_Data(void)
} }
void backsend(void) void backsend(void)
{ {
if(RS485_send_time>=20) if(RS485_send_time>=2)
{ {
RS485_send_time = 0; RS485_send_time = 0;
RS485_TX_finish = 0; RS485_TX_finish = 0;
......
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