Commit 48b29153 authored by 张明扬's avatar 张明扬 🇨🇳
parents 8c121712 6d71a1a2
......@@ -849,24 +849,34 @@
<FilePath>..\..\..\..\Source\Component\LED_Driver\LED_Driver_V1.3.lib</FilePath>
</File>
<File>
<FileName>Maintenance.c</FileName>
<FileName>System_Monitor.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\Maintenance\Maintenance.c</FilePath>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.c</FilePath>
</File>
<File>
<FileName>Maintenance.h</FileName>
<FileName>System_Monitor.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Maintenance\Maintenance.h</FilePath>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.h</FilePath>
</File>
<File>
<FileName>System_Monitor.c</FileName>
<FileName>Service_Interval.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.c</FilePath>
<FilePath>..\..\..\..\Source\Component\Service_Interval\Service_Interval.c</FilePath>
</File>
<File>
<FileName>System_Monitor.h</FileName>
<FileName>Service_Interval.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.h</FilePath>
<FilePath>..\..\..\..\Source\Component\Service_Interval\Service_Interval.h</FilePath>
</File>
<File>
<FileName>Service_Interval_User.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\Service_Interval\Service_Interval_User.c</FilePath>
</File>
<File>
<FileName>Service_Interval_User.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Service_Interval\Service_Interval_User.h</FilePath>
</File>
</Files>
</Group>
......
......@@ -36,8 +36,9 @@ SET CPU_CLOCK=0x00B71B00
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\powermanag_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\system_monitor_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\telltales_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\maintenance.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\system_monitor.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\service_interval.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\service_interval_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\rte_tick_timer_bat32a239.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\rte_wdt_bat32a239.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\rte_gpio_bat32a239.__i"
......
#include "BlueTooth.h"
#include "UDS_ISO14229_Services.h"
BlueTooth_t BlueTooth;
uint8_t UUIDData[32] = {"tywtywtywtywtywtywtywtywtywtyw03"};
extern Ser2EDFlashData Ser2EDataForDFlash;
void BlueTooth_KL30_KL15_Wakeup_Init(void)
{
BlueTooth.BLE_St = BLUE_STATE_Starting;
......@@ -11,8 +12,8 @@ void BlueTooth_KL30_KL15_Wakeup_Init(void)
}
void Send_UUID_To_Esp32(void)
{
Protocol_Send(MCU_ESP32_0x03, UUIDData, 32);
//Protocol_Send(MCU_ESP32_0x03, Ser2EDataForDFlash.DID_F184, 32);
//Protocol_Send(MCU_ESP32_0x03, UUIDData, 32);
Protocol_Send(MCU_ESP32_0x03, Ser2EDataForDFlash.DID_F184, 32);
}
......
......@@ -9,9 +9,9 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] =
{
{0x220ul, 50ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_220, (void *)0},
{0x6EEul, 100ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EE, (void *)0},
{0x6EFul, 100ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EF, (void *)0},
{0x450ul, 100ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450, (void *)0},
{0x6EEul, 100ul * 1000ul, 8ul * 1000ul, 0u, MSG_STD, 2u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EE, (void *)0},
{0x6EFul, 100ul * 1000ul, 9ul * 1000ul, 0u, MSG_STD, 3u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EF, (void *)0},
{0x450ul, 100ul * 1000ul, 10ul * 1000ul, 0u, MSG_STD, 4u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450, (void *)0},
#if (IC_Current == TY200_080000b_ty)
{0x580ul, 8ul * 1000ul, 0ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_580, (void *)0},
#endif
......@@ -36,7 +36,7 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
1000ul,
0x341ul,
(( void * )0),
(( void * )0),
(Can_341_Receive),
(( void * )0),
},
{
......
......@@ -2,7 +2,14 @@
#include "Components.h"
#include "Application.h"
uint16_t CAN_TX_Count = 0;
uint16_t AliveCountTimer = 0;
extern uint8_t Tpms_TX_Flag;
void CAN_TX_Count_Init(void)
{
CAN_TX_Count = 0;
AliveCountTimer = 0;
}
void Can_Set_Buff_220(canlib_uint8_t CopyData[])
{
CANMsg220Union *p220;
......@@ -17,6 +24,17 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
}
p220 -> Sig.TCS_TX = Get_Dis_Tcs_Val();
p220 -> Sig.AliveCounter = AliveCountTimer;
p220 -> Sig.CheckSum = (Get_Dis_Tcs_Val() == 1) ? 8 : 0;
}
if(AliveCountTimer < 7)
{
AliveCountTimer++;
}
else
{
AliveCountTimer = 0;
}
}
......@@ -25,7 +43,7 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
CANMsg6EEUnion *p6EE;
uint8_t i = 0;
uint16_t Vspeed_tx = 0;
uint32_t ODO_tx = Data_ODO_Read() / 10;
uint32_t ODO_tx = Data_ODO_Read();
Vspeed_tx = Get_DispVechileSpeed_TX()/10;
p6EE = (CANMsg6EEUnion *)CopyData;
......@@ -106,8 +124,8 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
p450 -> Sig.Front_Pressure_TX_H = (Get_Front_TPMS_TX() >> 8) & 0xFF;
p450 -> Sig.Front_Pressure_TX_L = Get_Front_TPMS_TX() & 0xFF;
p450 -> Sig.Front_Pressure_TX_H = ((Get_Front_TPMS_TX() + 146) >> 8) & 0xFF;
p450 -> Sig.Front_Pressure_TX_L = (Get_Front_TPMS_TX() + 146) & 0xFF;
}
if(MenuData.TPMS_Rear_Learn == 0)
{
......@@ -116,13 +134,14 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
p450 -> Sig.Rear_Pressure_TX_H = (Get_Rear_TPMS_TX() >> 8) & 0xFF;
p450 -> Sig.Rear_Pressure_TX_L = Get_Rear_TPMS_TX() & 0xFF;
p450 -> Sig.Rear_Pressure_TX_H = ((Get_Rear_TPMS_TX() + 146) >> 8) & 0xFF;
p450 -> Sig.Rear_Pressure_TX_L = (Get_Rear_TPMS_TX() + 146) & 0xFF;
}
}
}
void Can_Set_Buff_580(canlib_uint8_t CopyData[])
{
CANMsg580Union *p580;
......@@ -138,6 +157,11 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
if(Get_Tpms_TX_Flag() == 1)
{
if(++CAN_TX_Count > 3)
{
Tpms_TX_Flag = 0;
CAN_TX_Count = 0;
}
p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x31;
p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x01;
p580 -> Sig.TPMS_LEARN_CND_BYTE2 = 0x59;
......@@ -146,6 +170,11 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
}
else if(Get_Tpms_TX_Flag() == 2)
{
if(++CAN_TX_Count > 3)
{
Tpms_TX_Flag = 0;
CAN_TX_Count = 0;
}
p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x31;
p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x01;
p580 -> Sig.TPMS_LEARN_CND_BYTE2 = 0x59;
......@@ -154,11 +183,12 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
}
else
{
p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x0;
p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x0;
p580 -> Sig.TPMS_LEARN_CND_BYTE2 = 0x0;
p580 -> Sig.TPMS_LEARN_CND_BYTE3 = 0x0;
p580 -> Sig.TPMS_LEARN_CND_BYTE4 = 0x02;
CAN_TX_Count = 0;
//p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x0;
//p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x0;
//p580 -> Sig.TPMS_LEARN_CND_BYTE2 = 0x0;
//p580 -> Sig.TPMS_LEARN_CND_BYTE3 = 0x0;
//p580 -> Sig.TPMS_LEARN_CND_BYTE4 = 0x02;
}
}
......
......@@ -17,7 +17,11 @@ typedef union
uint32_t Res2: 8;
uint32_t Res3: 16;
uint32_t Res4: 32;
uint32_t Res4: 16;
uint32_t Res5: 8;
uint32_t CheckSum: 5;
uint32_t AliveCounter: 3;
} Sig;
} CANMsg220Union;
......
......@@ -307,17 +307,18 @@ uint8_t Get_Busoff_Status(void)
{
return get_can_busoff(CAN_CH_0);
}
extern uint8_t Can_341_Flg;
uint8_t COM_APP_Process(st_CAN_Msg *Msg)
{
Can_Write((st_CAN_Msg *)Msg);
return 0;
}
// Can_Write((st_CAN_Msg *)Msg);
// return 0;
// }
void Can_Write(st_CAN_Msg *Msg)
{
// void Can_Write(st_CAN_Msg *Msg)
// {
uint32_t i = 0;
CanTxRxMsg CAN_SendMsg;
uint8_t CAN_result = 0;
CAN_SendMsg.Id = Msg->MsgID; /* ID */
CAN_SendMsg.DLC = Msg->MsgDLC; /* Len */
......@@ -333,23 +334,33 @@ void Can_Write(st_CAN_Msg *Msg)
switch (CAN_SendMsg.Id)
{
case 0x6EE:
CAN_Transmit(CAN0MSG08, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG08, &CAN_SendMsg);
break;
case 0x6EF:
CAN_Transmit(CAN0MSG12, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG12, &CAN_SendMsg);
break;
case 0x450:
CAN_Transmit(CAN0MSG13, &CAN_SendMsg);
if(Can_341_Flg == 1 || Common_GetIgnOnTime() > 2000)
{
CAN_result = CAN_Transmit(CAN0MSG13, &CAN_SendMsg);
}
break;
case 0x220:
CAN_Transmit(CAN0MSG10, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG10, &CAN_SendMsg);
break;
#if (IC_Current == TY200_080000b_ty)
case 0x580:
CAN_Transmit(CAN0MSG14, &CAN_SendMsg);
if(Get_Tpms_TX_Flag() == 1 || Get_Tpms_TX_Flag() == 2)
{
CAN_result = CAN_Transmit(CAN0MSG14, &CAN_SendMsg);
}
break;
#endif
default:
break;
}
return (!CAN_result);
}
......@@ -4,6 +4,7 @@
_TPMS_Display TPMS;
uint32_t LearnTime_Count = 0;
uint32_t LearnTime_Count1 = 0;
uint8_t Can_341_Flg = 0;
void Data_TPMS_KL30_Init ( void )
{
uint8_t TPMS_L[2] = {0,0};
......@@ -27,6 +28,8 @@ void Data_TPMS_KL30_Init ( void )
TPMS.TPMS_LOST = 0;
LearnTime_Count = 6001;
LearnTime_Count1 = 6001;
Can_341_Flg = 0;
}
void Data_TPMS_KL15_WAKE_UP_Init ( void )
{
......@@ -44,6 +47,13 @@ void Data_TPMS_KL15_WAKE_UP_Init ( void )
TPMS.TPMS_LOST = 0;
LearnTime_Count = 6001;
LearnTime_Count1 = 6001;
Can_341_Flg = 0;
}
void Can_341_Receive(void)
{
Can_341_Flg = 1;
}
void Data_TPMS_Processing_Service ( void )
......@@ -68,44 +78,45 @@ void Data_TPMS_Processing_Service ( void )
if(TPMS.TPMS_Front_Learn == 0x0)
{
//if(LearnTime_Count <= 6000)
//{
// LearnTime_Count++;
if(LearnTime_Count <= 6000)
{
LearnTime_Count++;
TPMS.TPMS_Front_Learn = Unstudied;
//LearnTime_Count = 0;
}
else
{
if(TPMS.TPMS_Front_Timeclean == 1)
{
LearnTime_Count = 0;
//}
//else
//{
// if(TPMS.TPMS_Front_Timeclean == 1)
// {
// LearnTime_Count = 0;
// }
// TPMS.TPMS_Front_Timeclean = 0;
// if ((MenuData.TPMS_Front_Learn != 0x2) && (MenuData.TPMS_Front_Learn != 0x3) )
// {
// if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST)
// {
// TPMS.TPMS_Front_Learn = LearningFailure;
// }
// else
// {
// TPMS.TPMS_Front_Learn = MenuData.TPMS_Front_Learn;
// }
//
// }
// else
// {
// TPMS.TPMS_Front_Learn = MenuData.TPMS_Front_Learn;
// }
//}
}
TPMS.TPMS_Front_Timeclean = 0;
if ((MenuData.TPMS_Front_Learn != 0x2) && (MenuData.TPMS_Front_Learn != 0x3) )
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST)
{
TPMS.TPMS_Front_Learn = LearningFailure;
}
else
{
TPMS.TPMS_Front_Learn = MenuData.TPMS_Front_Learn;
}
}
else
{
TPMS.TPMS_Front_Learn = MenuData.TPMS_Front_Learn;
}
}
}
else if(TPMS.TPMS_Front_Learn == 0x1)
{
//if(TPMS.TPMS_Front_Timeclean == 0)
//{
// LearnTime_Count = 0;
//}
//TPMS.TPMS_Front_Timeclean = 1;
if(TPMS.TPMS_Front_Timeclean == 0)
{
LearnTime_Count = 0;
}
TPMS.TPMS_Front_Timeclean = 1;
if(LearnTime_Count <= 6000)
{
LearnTime_Count++;
......@@ -135,11 +146,12 @@ void Data_TPMS_Processing_Service ( void )
LearnTime_Count = 0;
if((Get_CAN_CH0_ID_373_Sig_Front_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Front_id() != 0xFFFFFFFF))
{
TPMS.TPMS_Front_Learn = LearningCompletion;
TPMS.TPMS_Front_ID_Value = 1;
//TPMS.TPMS_Front_Learn = LearningCompletion;
}
else
{
;
TPMS.TPMS_Front_ID_Value = 0;
}
}
......@@ -156,34 +168,34 @@ void Data_TPMS_Processing_Service ( void )
if(TPMS.TPMS_Rear_Learn == 0x0)
{
//if(LearnTime_Count1 <= 6000)
//{
if(LearnTime_Count1 <= 6000)
{
LearnTime_Count1 = 0;
TPMS.TPMS_Rear_Learn = Unstudied;
//}
//else
//{
// if(TPMS.TPMS_Rear_Timeclean == 1)
// {
// LearnTime_Count1 = 0;
// }
// TPMS.TPMS_Rear_Timeclean = 0;
// if ((MenuData.TPMS_Rear_Learn != 0x2) && (MenuData.TPMS_Rear_Learn != 0x3) )
// {
// if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST)
// {
// TPMS.TPMS_Rear_Learn = LearningFailure;
// }
// else
// {
// TPMS.TPMS_Rear_Learn = MenuData.TPMS_Rear_Learn;
// }
// }
// else
// {
// TPMS.TPMS_Rear_Learn = MenuData.TPMS_Rear_Learn;
// }
//}
}
else
{
if(TPMS.TPMS_Rear_Timeclean == 1)
{
LearnTime_Count1 = 0;
}
TPMS.TPMS_Rear_Timeclean = 0;
if ((MenuData.TPMS_Rear_Learn != 0x2) && (MenuData.TPMS_Rear_Learn != 0x3) )
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST)
{
TPMS.TPMS_Rear_Learn = LearningFailure;
}
else
{
TPMS.TPMS_Rear_Learn = MenuData.TPMS_Rear_Learn;
}
}
else
{
TPMS.TPMS_Rear_Learn = MenuData.TPMS_Rear_Learn;
}
}
}
else if(TPMS.TPMS_Rear_Learn == 0x1)
{
......@@ -221,11 +233,12 @@ void Data_TPMS_Processing_Service ( void )
LearnTime_Count1 = 0;
if((Get_CAN_CH0_ID_373_Sig_Rear_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Rear_id() != 0xFFFFFFFF))
{
TPMS.TPMS_Rear_Learn = LearningCompletion;
TPMS.TPMS_Rear_ID_Value = 1;
//TPMS.TPMS_Rear_Learn = LearningCompletion;
}
else
{
;
TPMS.TPMS_Rear_ID_Value = 0;
}
}
......@@ -260,7 +273,14 @@ void Data_TPMS_Processing_Service ( void )
{
MenuData.TPMS_Rear_Learn = TPMS.TPMS_Rear_Learn;
}
if((TPMS.TPMS_Front_Learn == 0x2) || (TPMS.TPMS_Front_Learn == 0x3) || (TPMS.TPMS_Rear_Learn == 0x2) || (TPMS.TPMS_Rear_Learn == 0x3))
if(((TPMS.TPMS_Front_Learn == 0x2) || (TPMS.TPMS_Front_Learn == 0x3)) && (TPMS.TPMS_Front_Learn != MenuData.TPMS_Front_Learn))
{
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
}
if( ((TPMS.TPMS_Rear_Learn == 0x2) || (TPMS.TPMS_Rear_Learn == 0x3)) && (TPMS.TPMS_Rear_Learn != MenuData.TPMS_Rear_Learn))
{
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
......@@ -454,6 +474,15 @@ uint8_t Get_Rear_TPMS_Sig_Vaild (void)
{
return TPMS.Rear_TPMS_Valid;
}
uint8_t Get_Front_TPMS_ID_Vaild (void)
{
return TPMS.TPMS_Front_ID_Value;
}
uint8_t Get_Rear_TPMS_ID_Vaild (void)
{
return TPMS.TPMS_Rear_ID_Value;
}
//10倍
uint16_t Get_Front_TPMS_Sig_Value (void)
{
......
......@@ -19,6 +19,9 @@ typedef struct __attribute__((aligned(4)))
uint8_t TPMS_Front_Timeclean;
uint8_t TPMS_Rear_Timeclean;
uint8_t TPMS_Front_ID_Value;
uint8_t TPMS_Rear_ID_Value;
}_TPMS_Display;
typedef enum
{
......@@ -33,6 +36,8 @@ uint32_t Data_Bar_To_Psi (uint32_t bar);
uint8_t Get_Led_TPMS_Waring (void);
uint8_t Get_Front_TPMS_Sig_Vaild (void);
uint8_t Get_Rear_TPMS_Sig_Vaild (void);
uint8_t Get_Front_TPMS_ID_Vaild (void);
uint8_t Get_Rear_TPMS_ID_Vaild (void);
uint16_t Get_Front_TPMS_Sig_Value (void);
uint16_t Get_Rear_TPMS_Sig_Value (void);
uint16_t Get_Rear_TPMS_TX (void);
......@@ -41,4 +46,6 @@ void Data_TPMS_KL15_WAKE_UP_Init ( void );
uint8_t Get_Front_FirstLearn_Flag (void);
uint8_t Get_Rear_FirstLearn_Flag (void);
uint8_t Get_TPMS_CAN_LOST (void);
void Can_341_Receive(void);
#endif
......@@ -74,7 +74,7 @@ void Gauge_Service(void)
Check_SEG_Display();
for(k = 0; k < LampCh0_MAX; k ++)
{
if (k == 24)
if (k == 24 || k == 21 || k == 13 || k == 26)
{
k ++;
}
......
......@@ -677,7 +677,7 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
break;
}
}
if ((m_Flag && BlueTooth.BLE_St) || (Common_GetIgnOnTime() < 3000))
if ((m_Flag && BlueTooth.BLE_St) || (Common_GetIgnOnTime() < 3000) || ClearODO_Flag == 1)
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_17_Length2, LED_ON);
......@@ -1090,8 +1090,8 @@ void SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
IC2_SEG102 = IC_SEG_GREY;
IC2_SEG101 = IC_SEG_GREY;
IC2_SEG108 = IC_SEG_GREY;
IC2_SEG100 = IC_SEG_GREY;
IC2_SEG108 = IC_SEG_OFF;
IC2_SEG100 = IC_SEG_OFF;
}
}
else
......@@ -1106,8 +1106,8 @@ void SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
}
else
{
IC2_SEG108 = IC_SEG_GREY;
IC2_SEG100 = IC_SEG_GREY;
IC2_SEG108 = IC_SEG_OFF;
IC2_SEG100 = IC_SEG_OFF;
}
}
else
......@@ -1364,8 +1364,8 @@ void SEG_SET_CoolantDial(uint8_t m_Flag, uint8_t m_SEG, uint16_t m_Num, uint8_t
}
else
{
IC1_SEG110 = IC_SEG_GREY;
IC1_SEG103 = IC_SEG_GREY;
IC1_SEG110 = IC_SEG_OFF;
IC1_SEG103 = IC_SEG_OFF;
}
}
else
......@@ -2130,14 +2130,14 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
IC2_SEG109 = IC_SEG_OFF;
IC2_SEG110 = IC_SEG_ON;
if(Get_TPMS_CAN_LOST() == 0)
if((Get_TPMS_CAN_LOST() == 0))
{
IC2_SEG138 = IC_SEG_ON;
IC2_SEG118 = IC_SEG_ON;
}
else
{
if ((Get_Current_PageType() == Page_Front_Tpms) || (Get_Front_FirstLearn_Flag() == 1) || (Get_Front_FirstLearn_Flag() == 3))
if ((Get_Current_PageType() == Page_Front_Tpms) || (Get_Front_FirstLearn_Flag() == 1) )
{
if (FLASH_SYNC_1Hz)
{
......@@ -2153,7 +2153,7 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
IC2_SEG138 = IC_SEG_ON;
}
if ((Get_Current_PageType() == Page_Rear_Tpms) || (Get_Rear_FirstLearn_Flag() == 1) || (Get_Rear_FirstLearn_Flag() == 3))
if ((Get_Current_PageType() == Page_Rear_Tpms) || (Get_Rear_FirstLearn_Flag() == 1))
{
if (FLASH_SYNC_1Hz)
{
......@@ -2180,7 +2180,7 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
IC2_SEG138 = IC_SEG_OFF;
}
}
if(Get_TPMS_CAN_LOST() == 0)
if(Get_TPMS_CAN_LOST() == 0 )
{
if (Get_Current_PageType() == Page_Front_Tpms)
{
......@@ -2250,9 +2250,23 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
IC2_SEG116 = IC_SEG_OFF;
}
else
{
if(Get_Front_TPMS_ID_Vaild() == 1)
{
SEG_SET_FRONT_TPMS_NUM(Get_Front_FirstLearn_Flag(), m_NUM1, m_valid1);
}
else
{
SEG_SET_FRONT_TPMS_NUM(LearningFailure, m_NUM1, m_valid1);
}
if(Get_Rear_TPMS_ID_Vaild() == 1)
{
SEG_SET_Rear_TPMS_NUM(Get_Rear_FirstLearn_Flag(), m_NUM2, m_valid2);
}
else
{
SEG_SET_Rear_TPMS_NUM(LearningFailure, m_NUM2, m_valid2);
}
}
......@@ -2260,7 +2274,7 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
}
else
{
IC2_SEG109 = IC_SEG_ON;
IC2_SEG109 = IC_SEG_OFF;
IC2_SEG110 = IC_SEG_ON;
IC2_SEG118 = IC_SEG_ON;
IC2_SEG138 = IC_SEG_ON;
......@@ -2706,29 +2720,13 @@ void SEG_SET_FRONT_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM1, uint8_t m_valid1
}
else if (learnflag == 3)
{
if (FLASH_SYNC_1Hz)
{
IC2_SEG140 = IC_SEG_ON;
IC2_SEG133 = IC_SEG_ON;
IC2_SEG143 = IC_SEG_ON;
IC2_SEG141 = IC_SEG_ON;
IC2_SEG139 = IC_SEG_ON;
IC2_SEG146 = IC_SEG_ON;
IC2_SEG145 = IC_SEG_OFF;
IC2_SEG144 = IC_SEG_ON;
//if (FLASH_SYNC_1Hz)
//{
IC2_SEG138 = IC_SEG_ON;
IC2_SEG135 = IC_SEG_ON;
IC2_SEG134 = IC_SEG_ON;
IC2_SEG132 = IC_SEG_ON;
IC2_SEG131 = IC_SEG_ON;
IC2_SEG137 = IC_SEG_OFF;
IC2_SEG136 = IC_SEG_ON;
}
else
{
IC2_SEG140 = IC_SEG_OFF;
IC2_SEG133 = IC_SEG_OFF;
IC2_SEG140 = IC_SEG_ON;
IC2_SEG133 = IC_SEG_ON;
IC2_SEG143 = IC_SEG_OFF;
IC2_SEG141 = IC_SEG_OFF;
......@@ -2743,7 +2741,29 @@ void SEG_SET_FRONT_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM1, uint8_t m_valid1
IC2_SEG131 = IC_SEG_OFF;
IC2_SEG137 = IC_SEG_OFF;
IC2_SEG136 = IC_SEG_OFF;
}
//}
//else
//{
// IC2_SEG138 = IC_SEG_OFF;
//
// IC2_SEG140 = IC_SEG_OFF;
// IC2_SEG133 = IC_SEG_OFF;
//
// IC2_SEG143 = IC_SEG_OFF;
// IC2_SEG141 = IC_SEG_OFF;
// IC2_SEG139 = IC_SEG_OFF;
// IC2_SEG146 = IC_SEG_OFF;
// IC2_SEG145 = IC_SEG_OFF;
// IC2_SEG144 = IC_SEG_OFF;
//
// IC2_SEG135 = IC_SEG_OFF;
// IC2_SEG134 = IC_SEG_OFF;
// IC2_SEG132 = IC_SEG_OFF;
// IC2_SEG131 = IC_SEG_OFF;
// IC2_SEG137 = IC_SEG_OFF;
// IC2_SEG136 = IC_SEG_OFF;
//}
}
else
{
......@@ -3156,29 +3176,17 @@ void SEG_SET_Rear_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM2, uint8_t m_valid2)
}
else if (learnflag == 3)
{
if (FLASH_SYNC_1Hz)
{
//IC2_SEG118 = IC_SEG_ON;
//IC2_SEG120 = IC_SEG_ON;
//IC2_SEG113 = IC_SEG_ON;
//if (FLASH_SYNC_1Hz)
//{
IC2_SEG120 = IC_SEG_ON;
IC2_SEG113 = IC_SEG_ON;
IC2_SEG123 = IC_SEG_ON;
IC2_SEG121 = IC_SEG_ON;
IC2_SEG119 = IC_SEG_ON;
IC2_SEG126 = IC_SEG_ON;
IC2_SEG125 = IC_SEG_OFF;
IC2_SEG124 = IC_SEG_ON;
IC2_SEG118 = IC_SEG_ON;
IC2_SEG115 = IC_SEG_ON;
IC2_SEG114 = IC_SEG_ON;
IC2_SEG112 = IC_SEG_ON;
IC2_SEG111 = IC_SEG_ON;
IC2_SEG117 = IC_SEG_OFF;
IC2_SEG116 = IC_SEG_ON;
}
else
{
IC2_SEG120 = IC_SEG_OFF;
IC2_SEG113 = IC_SEG_OFF;
IC2_SEG123 = IC_SEG_OFF;
IC2_SEG121 = IC_SEG_OFF;
......@@ -3193,7 +3201,29 @@ void SEG_SET_Rear_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM2, uint8_t m_valid2)
IC2_SEG111 = IC_SEG_OFF;
IC2_SEG117 = IC_SEG_OFF;
IC2_SEG116 = IC_SEG_OFF;
}
//}
//else
//{
// IC2_SEG120 = IC_SEG_OFF;
// IC2_SEG113 = IC_SEG_OFF;
//
// IC2_SEG118 = IC_SEG_OFF;
//
// IC2_SEG123 = IC_SEG_OFF;
// IC2_SEG121 = IC_SEG_OFF;
// IC2_SEG119 = IC_SEG_OFF;
// IC2_SEG126 = IC_SEG_OFF;
// IC2_SEG125 = IC_SEG_OFF;
// IC2_SEG124 = IC_SEG_OFF;
//
// IC2_SEG115 = IC_SEG_OFF;
// IC2_SEG114 = IC_SEG_OFF;
// IC2_SEG112 = IC_SEG_OFF;
// IC2_SEG111 = IC_SEG_OFF;
// IC2_SEG117 = IC_SEG_OFF;
// IC2_SEG116 = IC_SEG_OFF;
//}
}
else
{
......
......@@ -31,7 +31,8 @@
#include "TrmerM\TrmerM.h"
#include "RTC\RTE_RTC.h"
#include "AD\RTE_AD.h"
#include "Maintenance\Maintenance.h"
#include "Service_Interval\Service_Interval.h"
#include "Service_Interval\Service_Interval_User.h"
......
......@@ -484,8 +484,8 @@ void MenuData_TCS_Init(void)
uint8_t ClearODO_Flag = 0;
void TYW_RESET_ODO(void)
{
uint8_t Clear_EE[1] = {0xff};
uint32_t EE_Count = 0U;
uint8_t Clear_EE[4] = {0xff, 0xff, 0xff, 0xff};
uint8_t Clear_EE_8[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
if(SYS_OPR_STAT_IGN_ON)
{
if(ClearODO_Flag < 1)
......@@ -494,10 +494,17 @@ void TYW_RESET_ODO(void)
{
ClearODO_Flag = 1;
Data_Mileage_Clear();
for(EE_Count = 0 ; EE_Count < 255; EE_Count++)
{
eeprom_WriteRecord(EE_Count, ( uint8_t * )&Clear_EE, 1);
}
Service_Interval_First_Reset( ); /*保养*/
eeprom_WriteRecord(EEPROM_BLOCK_00, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_01, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_02, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_03, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_04, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_05, ( uint8_t * )&Clear_EE_8, 8);
eeprom_WriteRecord(EEPROM_BLOCK_06, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_07, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_08, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_09, ( uint8_t * )&Clear_EE, 4);
}
}
}
......@@ -506,9 +513,16 @@ void TYW_RESET_ODO(void)
void Maintain_Reset_Service(void)
{
if((Get_Data_Maintenace_Interval_Processing() == 0) && (PageMenu != Page_Trip) && (PageMenu != Page_TCS) && (PageType == Page_Menu))
if((Get_SERVICE_WARNING_ForCan() == 1) && (PageMenu != Page_Trip) && (PageMenu != Page_TCS) && (PageType == Page_Menu))
{
Data_Maintenance_Interval_Reset();
if(Get_Interval_SetKm() == 5000)//0.1
{
Service_Interval_Second_Reset();
}
else
{
Service_Interval_SetKm(2000);
}
}
}
......
#include "Maintenance.h"
/*** 保养里程 ***/
uint32_t DataServiceInterval = 0xFFFFu;
uint32_t NVM_User_Settings_Service; /***********临时接口*********/
/******************************************************************************
Data_Maintenance_Interval_Set
功 能: 写入保养
参 数: 无
返回值:无
******************************************************************************/
void Data_Maintenance_Interval_Set(uint32_t u32Data)
{
uint32_t u32Data1[1u] = {0};
u32Data1[0u] = u32Data;
Data_User_EEPROM_Write(EM_Maintenance_BLOCK, u32Data1, 1u);
}
/******************************************************************************
Data_Maintenance_Interval_Set_Flag
功 能: 写入保养标志
参 数: 无
返回值:无
******************************************************************************/
void Data_Maintenance_Interval_Set_Flag(uint32_t u32Data)
{
uint32_t u32Data1[1u] = {0};
u32Data1[0u] = u32Data;
Data_User_EEPROM_Write(EM_Maintenance_Firstflg, u32Data1, 1u);
}
/******************************************************************************
函数名:Data_Service_Interval_Processing
功 能: 剩余保养里程处理
参 数: 无
返回值:无
******************************************************************************/
uint32_t Get_Data_Maintenace_Interval_Processing(void)
{
uint32_t MileageDev = 0;
uint32_t Servicekm = 0;
uint32_t ODO_Data = 0;
ODO_Data = Data_ODO_Read() / 10;
if (ODO_Data >= NVM_User_Settings_Service)
{
Servicekm = 0u;
}
else
{
MileageDev = NVM_User_Settings_Service - ODO_Data;
Servicekm = MileageDev;
}
if (Servicekm >= 2000u)
{
Servicekm = 2000u;
}
DataServiceInterval = Servicekm;
return DataServiceInterval;
}
/******************************************************************************
函数名:Data_Service_Interval_Reset
功 能: 重置保养里程
参 数: 无
返回值:无
******************************************************************************/
void Data_Maintenance_Interval_Reset(void)
{
uint32_t ODO_Data = 0;
uint32_t u32Data[1u] = {0};
uint32_t Maintenance_Firstflg[1u] = {0};
ODO_Data = Data_ODO_Read() / 10u;
Data_User_EEPROM_Read(EM_Maintenance_Firstflg, Maintenance_Firstflg, 1u);
if (Maintenance_Firstflg[0u] == 0xFFFFFFFF)
{
NVM_User_Settings_Service = ODO_Data + 1000;
u32Data[0u] = NVM_User_Settings_Service;
Data_User_EEPROM_Write(EM_Maintenance_BLOCK, u32Data, 1u);
Maintenance_Firstflg[0u] = 1;
Data_User_EEPROM_Write(EM_Maintenance_Firstflg, Maintenance_Firstflg, 1u);
}
else if (Maintenance_Firstflg[0u] == 1)
{
NVM_User_Settings_Service = ODO_Data + 2000;
u32Data[0u] = NVM_User_Settings_Service;
Data_User_EEPROM_Write(EM_Maintenance_BLOCK, u32Data, 1u);
}
}
#ifndef MAINTENANCE_H
#define MAINTENANCE_H
#include "Components.h"
#include "Application.h"
extern uint32_t NVM_User_Settings_Service;
/******获取剩余保养里程*******/
uint32_t Get_Data_Maintenace_Interval_Processing(void);//用来判断
/********重置保养里程*********/
void Data_Maintenance_Interval_Reset(void);//用按键重置
extern void Data_Maintenance_Interval_Set(uint32_t u32Data);
void Data_Maintenance_Interval_Set_Flag(uint32_t u32Data);
#endif
#include "Components.h"
__align(4)
uint8_t DataMilleageBuf[Data_MEM_Block_Mileage];
uint8_t DataMilleageBuf[Data_MEM_Block_Mileage];
uint8_t DataODOBuf[Data_MEM_Block_ODO];
uint8_t DataTripBuf[Data_MEM_Block_Trip * EM_TRIP_MAX];
Mileage_t g_WriteMileage;
Mileage_t g_ReadMileage;
uint8_t odo_writeState;
uint8_t odo_readState;
extern uint32_t NVM_User_Settings_Service;
#define EEPROM_BLOCK_00 0x00
#define EEPROM_BLOCK_01 0x16
#define EEPROM_BLOCK_02 0x32
#define EEPROM_BLOCK_03 0x48
#define EEPROM_BLOCK_04 0x64
#define EEPROM_BLOCK_05 0x80
#define EEPROM_BLOCK_06 0x90
#define EEPROM_BLOCK_07 0xA0
#define EEPROM_BLOCK_08 0xB0
#define EEPROM_BLOCK_09 0xC0
uint32_t Milleage_InitFlag = 0U;
/******************************************************************************
Function:Data_ODO_KL30Init
Description:
......@@ -106,14 +89,6 @@ void Data_User_Mileage_KL30Init(void)
TripInit[EM_TRIP_D].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Data_User_EEPROM_Read(EM_Maintenance_BLOCK, TempBuf, 1u);
NVM_User_Settings_Service = TempBuf[0u];
if (TempBuf[0u] == 0xFFFFFFFF)
{
NVM_User_Settings_Service = 500;
Data_User_EEPROM_Write(EM_Maintenance_BLOCK, &NVM_User_Settings_Service, 1u);
}
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
if (TempBuf[0u] == 0xFFFFFFFF)
{
......@@ -176,13 +151,13 @@ uint32_t Get_MileageInit_Status(void)
eeprom_ReadRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_Maintenance_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
break;
// case EM_Maintenance_BLOCK:
// eeprom_ReadRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_Maintenance_Firstflg:
eeprom_ReadRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
break;
// case EM_Maintenance_Firstflg:
// eeprom_ReadRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_MenuData_Tcs_Val:
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
break;
......@@ -225,13 +200,13 @@ uint32_t Get_MileageInit_Status(void)
eeprom_WriteRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_Maintenance_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
break;
// case EM_Maintenance_BLOCK:
// eeprom_WriteRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_Maintenance_Firstflg:
eeprom_WriteRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
break;
// case EM_Maintenance_Firstflg:
// eeprom_WriteRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_MenuData_Tcs_Val:
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 1);
break;
......
#ifndef __SERVICE_ODO_USER_H__
#define __SERVICE_ODO_USER_H__
//#define ONLY_CLEAR_ODO_MIL 0x01u /*仅根据距离信息进行ODO清除*/
//#define ONLY_CLEAR_ODO_NUM 0x01u /*仅根据次数信息进行ODO清除*/
#define CLEAR_ODO_NUM_MIL 0x01u /*以距离信息以及次数信息进行ODO清除*/
......@@ -8,6 +10,17 @@
#define ODO_CLEAR_NUM 5u /*清除次数上限值 */
#define ODO_CLEAR_MIL 50000u /*清除距离上限值 单位0.1KM*/
#define EEPROM_BLOCK_00 0x00
#define EEPROM_BLOCK_01 0x20
#define EEPROM_BLOCK_02 0x40
#define EEPROM_BLOCK_03 0x60
#define EEPROM_BLOCK_04 0x80
#define EEPROM_BLOCK_05 0xC0
#define EEPROM_BLOCK_06 0xE0
#define EEPROM_BLOCK_07 0x100
#define EEPROM_BLOCK_08 0x120
#define EEPROM_BLOCK_09 0x140
extern uint8_t ODO_Clear_Num_Value;
void Data_User_Mileage_KL30Init(void);
......
......@@ -78,7 +78,7 @@ static void Power_KL30_Init(void)
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
Service_Interval_User_KL30Init();
Telltales_Init();
Telltales_UserInit();
MenuData_Unit_Init();
......@@ -93,6 +93,8 @@ static void Power_KL30_Init(void)
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
FaultCode_Init();
CAN_TX_Count_Init();
}
extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void)
......@@ -138,6 +140,8 @@ static void Power_Wakeup_Init(void)
Data_TPMS_KL15_WAKE_UP_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
FaultCode_Init();
Service_Interval_User_WakeupInit();
CAN_TX_Count_Init();
}
static void Power_LVP_Init(void)
......@@ -172,6 +176,8 @@ static void Power_IG_ON_Init(void)
DFlash_init();
Data_Read_DiagPara();
FaultCode_Init();
CAN_TX_Count_Init();
}
static void Power_Sleep_Init(void)
......@@ -241,6 +247,7 @@ static Power_Status_em Power_Stay_OFF(void)
return u8PowerSts;
}
extern uint16_t AliveCountTimer;
static Power_Status_em Power_Stay_Protect(void)
{
Power_Status_em u8PowerSts;
......@@ -253,6 +260,7 @@ static Power_Status_em Power_Stay_Protect(void)
BU98R10_Shutdown( );
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Disable);
AliveCountTimer = 0;
}
u8PowerSts = EM_IGN_OFF_Init;
/* 电溝模弝正常 */
......
This diff is collapsed.
#ifndef SERVICE_INTERVAL_H
#define SERVICE_INTERVAL_H
/*
Platform_32Bit
Platform_16Bit
*/
#ifdef Platform_16Bit
#define Intlib_uint8_t unsigned char
#define Intlib_uint16_t unsigned int
#define Intlib_uint32_t unsigned long
#else
#define Intlib_uint8_t unsigned char
#define Intlib_uint16_t unsigned short
#define Intlib_uint32_t unsigned int
#define Intlib_uint64_t unsigned long long
#endif
#ifndef Intlib_NULL
#define Intlib_NULL ( void * )0u
#endif /* NULL */
#define Int_PowerON 1u /**< 电源状态 KL15 ON */
#define Int_PowerOFF 0u /**< 电源状态 KL15 ON */
typedef Intlib_uint8_t (*Int_PowerSts)(void);
typedef Intlib_uint32_t (*Int_ReadODO)(void);
typedef void (*Int_EEPromWrite)(Intlib_uint32_t u32Data [], Intlib_uint16_t u16Len);
typedef void (*Int_EEPromRead)(Intlib_uint32_t u32Data [], Intlib_uint16_t u16Len);
typedef struct
{
Int_PowerSts PowerSts_Cbk; /**< 获取系统电源状态回调 */
Int_ReadODO ReadODO_Cbk; /**< 获取当前总计里程回调 */
Int_EEPromWrite EEPromWrite_Cbk; /**< 写EEPROM回调函数 */
Int_EEPromRead EEPromRead_Cbk; /**< 从EEPROM读取保养相关数据回调 */
} Maintain_Func_t;
typedef struct
{
Intlib_uint32_t IntervalDayEnable; /**< 保养天数功能使能,0:无此功能 1:使能 */
Intlib_uint32_t IntervalKm; /**< 系统设定的保养里程间隔,单位km,这里特指首次保养的里程间隔,如不区分首次,则为默认值 */
Intlib_uint32_t IntervalDay; /**< 系统设定的保养天数间隔,单位天,这里特指首次保养的天数间隔,如不区分首次,则为默认值 */
} Maintain_Init_t;
#define Data_MEM_Block_Maintain (( Intlib_uint8_t )32u) /**< 此功能库,需要的内存空间大小,此为最小值 */
void Service_Interval_KL30_Init(Intlib_uint8_t *pMemSpace, Maintain_Init_t *pInitData, Maintain_Func_t *pFunc);
void Service_Interval_Wakeup_Init(Intlib_uint8_t *pMemSpace, Maintain_Func_t *pFunc);
void Service_Interval_Processing(void);
void Service_Interval_TimerISR(void);
void Service_Interval_TimerSleepFix(Intlib_uint32_t FixTimer);
void Service_Interval_SetKm(Intlib_uint32_t IntervalKm);
void Service_Interval_SetDay(Intlib_uint32_t IntervalDay);
Intlib_uint32_t Service_Interval_GetMil100m(void);
Intlib_uint32_t Service_Interval_GetDay(void);
Intlib_uint32_t Get_Interval_SetKm(void);
#endif
#include "Service_Interval.h"
#include "Service_Interval_User.h"
uint8_t __attribute__((aligned(4))) DataMaintainBuf [ Data_MEM_Block_Maintain ];
static void Service_Interval_Write_EEProm(uint32_t u32Data [], uint16_t u16Len);
static void Service_Interval_Read_EEProm(uint32_t u32Data [], uint16_t u16Len);
void Service_Interval_User_KL30Init(void)
{
Maintain_Init_t InitData;
Maintain_Func_t Func;
InitData.IntervalDayEnable = 0;
//默认值
InitData.IntervalDay = 90;
InitData.IntervalKm = 500;
//回调函数
Func.PowerSts_Cbk = Common_Get_IG_Sts;
Func.ReadODO_Cbk = Data_ODO_Read;
Func.EEPromWrite_Cbk = Service_Interval_Write_EEProm;
Func.EEPromRead_Cbk = Service_Interval_Read_EEProm;
Service_Interval_KL30_Init(DataMaintainBuf, &InitData, &Func);
}
void Service_Interval_User_WakeupInit(void)
{
Maintain_Func_t Func;
//回调函数
Func.PowerSts_Cbk = Common_Get_IG_Sts;
Func.ReadODO_Cbk = Data_ODO_Read;
Func.EEPromWrite_Cbk = Service_Interval_Write_EEProm;
Func.EEPromRead_Cbk = Service_Interval_Read_EEProm;
Service_Interval_Wakeup_Init(DataMaintainBuf, &Func);
}
void Service_Interval_First_Reset(void)
{
Service_Interval_SetKm(500); // 500km
}
void Service_Interval_Second_Reset(void)
{
Service_Interval_SetKm(1000); // 1000km
}
static void Service_Interval_Write_EEProm(uint32_t u32Data [], uint16_t u16Len)
{
ee_uint16_t tmpWritestatus = 0;
ee_uint16_t Cnt = 0;
tmpWritestatus = eeprom_WriteRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
while(tmpWritestatus == WRITING)
{
tmpWritestatus = eeprom_WriteRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
Cnt++;
if(Cnt >= 1000)
{
break;
}
}
}
static void Service_Interval_Read_EEProm(uint32_t u32Data [], uint16_t u16Len)
{
ee_uint16_t tmpReadstatus = 0;
ee_uint16_t Cnt = 0;
tmpReadstatus = eeprom_ReadRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
while(tmpReadstatus == READING)
{
tmpReadstatus = eeprom_ReadRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
Cnt++;
if(Cnt >= 1000)
{
break;
}
}
}
uint32_t g_ServiceMil100m = 0;
uint8_t Get_SERVICE_WARNING_ForCan(void)
{
uint8_t Res;
uint32_t m_Condition_1;
m_Condition_1 = Service_Interval_GetMil100m();
g_ServiceMil100m = Service_Interval_GetMil100m();
if (m_Condition_1 <= 0u)
{
Res = 1u; /*87606-4*/
}
else
{
Res = 0u; /*87606-5*/
}
return Res;
}
#ifndef SERVICE_INTERVAL_USER_H
#define SERVICE_INTERVAL_USER_H
#include "Components.h"
void Service_Interval_User_KL30Init(void);
void Service_Interval_User_WakeupInit(void);
void Service_Interval_First_Reset(void);
void Service_Interval_Second_Reset(void);
void Service_Interval_WriteKm(uint32_t IntervalKm);
uint8_t Get_SERVICE_WARNING_ForCan(void);
#endif
......@@ -286,14 +286,18 @@ static void LED_Fuel_Execution(Tellib_uint16_t led_status)
static Tellib_uint16_t LED_Coolant_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if(GET_DataCollantTempWarnflg() == 2)
if(ClearODO_Flag == 1)
{
LED_STATE = 2;
LED_STATE = 1;
}
else if (GET_DataCollantTempWarnflg() == 1)
{
LED_STATE = 3;
}
else if(GET_DataCollantTempWarnflg() == 2)
{
LED_STATE = 2;
}
else
{
LED_STATE = 4;
......@@ -492,7 +496,7 @@ static void LED_Auto_Start_Execution(Tellib_uint16_t led_status)
static Tellib_uint16_t LED_Maintain_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if(Get_Data_Maintenace_Interval_Processing() == 0)
if(Get_SERVICE_WARNING_ForCan() == 1)
{
LED_STATE = 1;
}
......@@ -621,7 +625,11 @@ static void LED_Lateral_Strut_Execution(Tellib_uint16_t led_status)
static Tellib_uint16_t LED_Tire_Pressure_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if((Get_Front_FirstLearn_Flag() == 2) || (Get_Rear_FirstLearn_Flag() == 2))
if(ClearODO_Flag == 1)
{
LED_STATE = 1;
}
else if((Get_Front_FirstLearn_Flag() == 2) || (Get_Rear_FirstLearn_Flag() == 2))
{
if(Get_Led_TPMS_Waring() == 1)
{
......
......@@ -725,7 +725,7 @@ uint8_t CAN_Transmit(CANMSG_Type *CANxMSGy, CanTxRxMsg* TxMessage)
CANxMSGy->CMCTRL = CAN_MCTRL_CLR_RDY;
/* Wait the operate complete */
while (((CANxMSGy->CMCTRL & CAN_MCTRL_RDY_MASK) != 0x00) && (timeout != 0))
//while (((CANxMSGy->CMCTRL & CAN_MCTRL_RDY_MASK) != 0x00) && (timeout != 0))
{
timeout--;
}
......
......@@ -18,7 +18,7 @@ void Sys_Pseudo_Real_Time_Tasks(void)
void Sys_2ms_Tasks(void)
{
Common_Input_Para();
Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
//Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
Sys_Status_Update_Service();
Analog_Signal_Conv_Service();
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,2u);
......@@ -79,7 +79,7 @@ void Sys_50ms_Tasks(void)
}
uint8_t u8LEDDriverCheckCount = 0U;
uint16_t ljs_voltage = 0;
//uint16_t ljs_voltage = 0;
void Sys_100ms_Tasks(void)
{
if((PageType != Page_Time_Hour)&&(PageType != Page_Time_Minute))
......@@ -88,6 +88,7 @@ void Sys_100ms_Tasks(void)
counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours);
counter_val.time.RTC_Minutes = RTC_Bcd2ToByte(counter_val.time.RTC_Minutes);
}
Service_Interval_Processing();
Fuel_Cal_Sevice(100u);
BackLight_Process();
Services_Mileage_Callback();
......@@ -95,7 +96,7 @@ void Sys_100ms_Tasks(void)
S3_ServerCNTT();
//ECU_FaultCode_Processing_Service();
Send_UUID_To_Esp32();
ljs_voltage = ADC_Conv_Single_Channel(ADC_CH_KL15_VOLTAGE);
//ljs_voltage = ADC_Conv_Single_Channel(ADC_CH_KL15_VOLTAGE);
if (u8LEDDriverCheckCount >= 10U)
{
u8LEDDriverCheckCount = 0U;
......@@ -120,6 +121,7 @@ void Sys_100ms_Tasks(void)
void Sys_Exact_50us_Tasks(void)
{
static uint32_t task_1ms = 0u;
Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 50u);
DoCAN_Timer_Update(50u);
GenDelay_Tick();
task_1ms++;
......
......@@ -312,12 +312,12 @@
#define UnknownPartID 8 // Unknown Part ID
#define SWV 0x100 // 0x100 = 1.00 software version 软件版本号
#define HWV 0x100 // 0x100 = 1.00 hardware version 硬件版本号
#define HWV 0x101 // 0x100 = 1.00 hardware version 硬件版本号
#define BTV 0x100 // 0x100 = 1.00 bootloader version boot程序版本号
#define INTLV 0x106 // 0x100 = 1.00 internal version 内部版本号
#define INTLV 0x108 // 0x100 = 1.00 internal version 内部版本号
#define PROG_Y 0x24 // 0x24 = 2024年, program year
#define PROG_M 0x07 // 0x03 = 3月, program month
#define PROG_D 0x02 // 0x19 = 19日, program day
#define PROG_D 0x18 // 0x19 = 19日, program day
/******************************************************************************
Bootloader Variable
......
This diff is collapsed.
This diff is collapsed.
......@@ -10,5 +10,8 @@
"31 01 02 03",
"31 01 02 03",
"22 F1 F1",
"22 F1 F1"
"22 F1 F1",
"22 F1 84",
"2E F1 84 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11",
"22 F1 84"
]
\ No newline at end of file
#new Option
#Tue Jul 02 09:52:52 CST 2024
#Thu Jul 18 09:36:34 CST 2024
IsSort=true
MergeFlashIsCompression=false
ChangeAppFilePath=
......@@ -7,13 +7,13 @@ MergeCanXLSPath=
RH850_D1M1AGPIOJSONpath=
DBFFilePath=
MergeCrcTtpe=21
MergeBootFilePath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\Boot_Release\\TY200.080000b(ty)\\TY_TY200.080000b(ty)_Boot_B1.01_240620.hex
MergeBootFilePath=D\:\\git\\tianying_ty100\\Firmware\\utility\\Boot_Release\\TY200.080000b(ty)\\TY_TY200.080000b(ty)_Boot_B1.01_240620.hex
IsMergeChangeAddress=false
MergeFlashOutPutFilePath=
GPIOOutPutPath=
MergeCanDBCPath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\Can_BDF\\tianying.dbc
MergeCanDBCPath=
IsFilling=true
RxID=789
RxID=7E8
MergeAudioInPutPath=
MergeAudioIndex=3
IsFastSend=true
......@@ -23,23 +23,23 @@ UDS_22_2E_DID_FilePath=
SoftwareVersion=0
MsgSTmin=0
MergeLineInOutPutPath=
Leave2ID=1
PHYID=781
Leave2ID=9
PHYID=7E0
BaudRate=500K
AppUpdateFilePath=
FUNID=7DF
IsMergeCreateBin=false
IsOverWrite=false
DllFilePath=
DllFilePath=D\:\\git\\tianying_ty100\\Firmware\\utility\\\u8BCA\u65AD\u5DE5\u5177\\\u89E3\u9501\u6587\u4EF6\\TY100 x64.dll
MergeAudioOutPutPath=
MergeCanOutPutPath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\Can_BDF
MergeCanOutPutPath=
ChangeOutPutFilePath=
MergeTelltalesOutPutPath=
TTFExtractTXTpath=
JieFaRH850GPIOJSONpath=
MergeFlashIsMandatory=false
UpdateProcess=\u6BD4\u4E9A\u8FEA
Driver=Kvaser
Driver=PCAN
MergeFlashImageFormat=
RH850_F1KMGPIOJSONpath=
DriverFilePath=
......@@ -56,12 +56,12 @@ IsHexDisplay=true
MergeLineInXLSPath=
MergeFlashInPutFilePath=
MergeFlashIsInternal=false
MergeOutPutFilePath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\\u7A0B\u5E8F\u91CA\u653E\\20240702
MergeAppFilePath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\\u7A0B\u5E8F\u91CA\u653E\\20240702\\TianYing.hex
MergeOutPutFilePath=D\:\\git\\tianying_ty100\\Firmware\\utility\\\u7A0B\u5E8F\u91CA\u653E\\20240718\\TY_TY200.080000b_ty_BAT32G139GK64FB_BootApp_S1.08_240718
MergeAppFilePath=D\:\\git\\tianying_ty100\\Firmware\\utility\\\u7A0B\u5E8F\u91CA\u653E\\20240718\\TianYing.hex
MergeTelltalesXLSPath=
FillingByte=-86
ImageVersion=0
XHYGPIOJSONpath=
Leave1ID=1
Leave1ID=9
TTFExtractOUTpath=
MergeAudioPWMMax=2000
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