Commit 5cccc6b1 authored by 高士达's avatar 高士达

Merge branch 'gaoshida' into 'dev'

Gaoshida

See merge request !7
parents ef86c91d 829e80c3
......@@ -18,6 +18,7 @@
#include "Services_Mileage_User.h"
#include "U2_app_Service.h"
#include "System_Monitor.h"
#include "Services_Mileage.h"
#include "Flash_synchronizer.h"
......@@ -373,7 +374,7 @@ SEND_FAULT_END:
CopyData[6] = temp32>>8;
CopyData[7] = temp32&0xff;
}
extern uint8_t ModfyODORemainTimes;
/* extern uint8_t ModfyODORemainTimes; */
void Can_Set_Buff_522(uint8_t CopyData[])
{
uint32_t temp32 = 0;
......@@ -400,7 +401,7 @@ void Can_Set_Buff_522(uint8_t CopyData[])
CopyData[3] <<= 4;
CopyData[3] |= (temp32%10);
CopyData[4] |= ModfyODORemainTimes&0x0f;
/* CopyData[4] |= ModfyODORemainTimes&0x0f; */
temp16 = Common_Get_Disp_V_Speed();
if(temp16>1990) temp16=1990;
temp16 /= 10;
......
......@@ -4,7 +4,7 @@
#include "tim4.h"
#include "MCU_Core_Protocol.h"
#include "CAN_Communication_Matrix.h"
#include "SEG_LCD.h"
//static uint16_t VehSpeedBuf[3];
//static uint8_t VehSpeedCount;
......
#include "Services_Mileage_User.h"
#include "Common_Interface.h"
#include "eepromManage.h"
#include "Menus.h"
#include "CAN_Communication_Matrix.h"
#include "wdt.h"
uint32_t TotalODOTemp = 0;
uint16_t ODORemainder = 0;
Mileage_t g_WriteMileage __attribute__ ((aligned (4)));
Mileage_t g_ReadMileage __attribute__ ((aligned (4)));
uint8_t SaveODOValid = 0;
uint16_t odoVaild = 0;
uint8_t ModfyODORemainTimes = 0;
uint16_t ModfyODOTimeDelay_ms = 0;
#define EEPROM_BLOCK_00 0 //用来储存总计清零次数
#define EEPROM_BLOCK_01 16
#define EEPROM_BLOCK_02 32
#define EEPROM_BLOCK_03 48
#define EEPROM_BLOCK_04 64
#define EEPROM_BLOCK_05 80
void Mileage_Delay_ms(uint32_t u32Ms)
{
uint32_t i, Counter;
for(Counter = 0; Counter < u32Ms; Counter++) {
for(i = 0; i < 44; i++) {
__NOP();
__NOP();
__NOP();
}
WDT_Restart();
}
}
void CalcODOKL30Init(void)
{
odoVaild = eeprom_ReadODO(&g_ReadMileage);
if(g_ReadMileage.Odo>= g_WriteMileage.Odo)
{
g_WriteMileage.Odo = g_ReadMileage.Odo;
}
if(g_ReadMileage.Trip>= g_WriteMileage.Trip)
{
g_WriteMileage.Trip = g_ReadMileage.Trip;
}
if(g_ReadMileage.Trip1>= g_WriteMileage.Trip1)
{
g_WriteMileage.Trip1 = g_ReadMileage.Trip1;
}
eeprom_ReadRecord(EEPROM_BLOCK_00,(uint8_t*)&ModfyODORemainTimes,1);
if(ModfyODORemainTimes == 0xff){
ModfyODORemainTimes = 3;
}
}
void CalcODOKL15Init(void)
{
SaveODOValid = 1;
}
void CalcODOIgnOffInit(void)
{
SaveODOValid = 1;
}
//=======================================
//+++++++50ms任务调度+++++++++++++++++
//
//根据车速计算里程数
//=======================================
void CalcODO_50ms_Services(void)
{
uint32_t mVspeed=0;
if(Common_Get_IG_Sts() == COMMON_POWER_OFF){
return;
}
mVspeed = Common_Get_Act_V_Speed();
if(mVspeed > 3600){
mVspeed = 3600;
}
TotalODOTemp += (mVspeed * 25) / 18; //50ms cycle
/*取余数*/
ODORemainder += (mVspeed * 25) % 18;
if(ODORemainder >= 18 )
{
ODORemainder -= 18;
TotalODOTemp ++;
}
if (TotalODOTemp > 10000)
{
TotalODOTemp -= 10000;
g_WriteMileage.Odo += 10;
if ((g_WriteMileage.Odo % 100) == 0)
{
SaveODOValid = 1;
}
g_WriteMileage.Trip += 10;
g_WriteMileage.Trip1 += 10;
if(Get_Unit_Setting() == Metric){
if (g_WriteMileage.Trip > 999999) { //999km999m
g_WriteMileage.Trip = 0;
}
if (g_WriteMileage.Trip1 > 999999) { //999km999m
g_WriteMileage.Trip1 = 0;
}
}
if(Get_Unit_Setting() == Imperial){
if (g_WriteMileage.Trip > 1609343) { //999mile999
g_WriteMileage.Trip = 0;
}
if (g_WriteMileage.Trip1 > 1609343) { //999mile999
g_WriteMileage.Trip1 = 0;
}
}
if (g_WriteMileage.Odo > 1609343999) { //999999mile
g_WriteMileage.Odo = 1609343999;
}
}
}
void CalcODO_100ms_Services(void)
{
uint8_t PwSts = 0;
uint32_t temp32 = 0;
static uint8_t clearEnFlag = 0;
static uint8_t TripClearCommandBak = 0;
if(odoVaild == 0)
{
/* qitiancun 防止上电读取失败 */
odoVaild = eeprom_ReadODO(&g_ReadMileage);
if(g_ReadMileage.Odo >= g_WriteMileage.Odo)
{
g_WriteMileage.Odo = g_ReadMileage.Odo;
}
if(g_ReadMileage.Trip>= g_WriteMileage.Trip)
{
g_WriteMileage.Trip = g_ReadMileage.Trip;
}
if(g_ReadMileage.Trip1>= g_WriteMileage.Trip1)
{
g_WriteMileage.Trip1 = g_ReadMileage.Trip1;
}
}
if (SaveODOValid) {
SaveODOValid = 0;
if(Common_Get_IG_Sts() == COMMON_POWER_ON) {
PwSts = 1;
}
else {
PwSts = 0;
}
eeprom_WriteODO( &g_WriteMileage , distance_100m , PwSts);
}
//厂家清大计,
//200km ODO以内,可以清除总里程,ODO可以改大,不能改小。
//两者共享次数为3次,仪表两次里程操作响应间隔时间为10s。触发后连发3次。
if(ModfyODOTimeDelay_ms >= 100){
ModfyODOTimeDelay_ms -= 100;
}
else{
if(ModfyODORemainTimes){
//0x01= 清零总里程(小于200km)
if((Get_ID_55C_Sig_ModifyODOSts() == 1) && (g_WriteMileage.Odo) && (g_WriteMileage.Odo < 200000)){
ModfyODOTimeDelay_ms = 10000;
g_WriteMileage.Odo = 0u;
g_WriteMileage.Trip = 0;
g_WriteMileage.Trip1 = 0;
TotalODOTemp = 0;
ModfyODORemainTimes--;
eeprom_ClearOdoSection();
Mileage_Delay_ms(40);
eeprom_WriteRecord(EEPROM_BLOCK_00,(uint8_t*)&ModfyODORemainTimes,1);
}
//0x02= 设置总里程(只能改大,改小不响应)
temp32 = Get_ID_55C_Sig_ModifyODOValue();
temp32 *= 100;
if((Get_ID_55C_Sig_ModifyODOSts() == 2) && (g_WriteMileage.Odo < temp32)){
ModfyODOTimeDelay_ms = 10000;
g_WriteMileage.Trip = 0;
g_WriteMileage.Trip1 = 0;
TotalODOTemp = 0;
ModfyODORemainTimes--;
for(uint32_t i=0; i<20; i++){
if(temp32 > i*100){
g_WriteMileage.Odo = temp32-((19-i)*100);
}
else{
g_WriteMileage.Odo = 0;
}
eeprom_WriteODO( &g_WriteMileage , distance_100m , 1);
Mileage_Delay_ms(20);
}
eeprom_WriteRecord(EEPROM_BLOCK_00,(uint8_t*)&ModfyODORemainTimes,1);
}
}
}
//TBOX控制清小计
temp32 = Get_ID_55C_Sig_ClearTrip();
//一定要判断数据发生变化再清一次,避免频繁写EEPROM
if((temp32 == 0) || (temp32 != TripClearCommandBak)){
clearEnFlag = 1;
}
if(clearEnFlag){
if(temp32 == 0x01){ //清零TRIPA
Data_Clear_Trip ( EM_TRIP_A );
clearEnFlag = 0;
}
else if(temp32 == 0x02){ //清零TRIPB
Data_Clear_Trip ( EM_TRIP_B );
clearEnFlag = 0;
}
else if(temp32 == 0x03){ //全部清零
Data_Clear_Trip ( EM_TRIP_A );
Data_Clear_Trip ( EM_TRIP_B );
clearEnFlag = 0;
}
}
TripClearCommandBak = temp32;
}
uint32_t Data_Read_Trip(DataTripEnum_t TripN)
{
uint32_t temp32 = 0;
if(TripN == EM_TRIP_A){
temp32 = g_WriteMileage.Trip;
}
else if(TripN == EM_TRIP_B){
temp32 = g_WriteMileage.Trip1;
}
return temp32;
}
uint32_t Data_ODO_Read ( void )
{
return g_WriteMileage.Odo;
}
void Data_Clear_Trip ( DataTripEnum_t TripN )
{
if(TripN == EM_TRIP_A){
g_WriteMileage.Trip = 0u;
g_WriteMileage.IsTripClear = 1;
}
else if(TripN == EM_TRIP_B){
g_WriteMileage.Trip1 = 0u;
g_WriteMileage.IsTrip1Clear = 1;
}
SaveODOValid = 1;
}
void Data_Mileage_Clear(void)
{
/*产线 清大计和flash校验使用*/
g_WriteMileage.Odo = 0u;
g_WriteMileage.Trip = 0;
g_WriteMileage.Trip1 = 0;
TotalODOTemp = 0;
ModfyODORemainTimes = 3;
eeprom_ClearOdoSection();
Mileage_Delay_ms(40);
eeprom_WriteRecord(EEPROM_BLOCK_00,(uint8_t*)&ModfyODORemainTimes,1);
}
#ifndef __SERVICE_MILEAGE_USER_H__
#define __SERVICE_MILEAGE_USER_H__
#include "common.h"
typedef unsigned char ee_uint8_t;
typedef unsigned short ee_uint16_t;
typedef unsigned int ee_uint32_t;
typedef enum
{
EM_TRIP_A,
EM_TRIP_B,
EM_TRIP_MAX,
} DataTripEnum_t;
void CalcODO_50ms_Services(void);
void CalcODO_100ms_Services(void);
void CalcODOKL30Init(void);
void CalcODOKL15Init(void);
void CalcODOIgnOffInit(void);
uint32_t Data_ODO_Read ( void );
uint32_t Data_Read_Trip(DataTripEnum_t TripN);
void Data_Clear_Trip ( DataTripEnum_t TripN );
void Data_Mileage_Clear(void);
#endif
#ifndef GUI_LCD_DIS_H
#define GUI_LCD_DIS_H
#endif
\ No newline at end of file
#ifndef _GUI_SEG_DIS_H_
#define _GUI_SEG_DIS_H_
#include "BU98R10.h"
#endif
#ifndef _GAUGES_H_
#define _GAUGES_H_
#include "SEG_LCD.h"
#include "Common_Interface.h"
/******************************************************************************
......
......@@ -9,7 +9,7 @@
#include "Data_Gear.h"
#include "Menus.h"
#include "BGLInterface.h"
#include "SEG_LCD.h"
#include "System_Monitor.h"
#include "Gauges.h"
#include "CoolantTemp.h"
......@@ -17,6 +17,7 @@
#include "CAN_Communication_Matrix.h"
#include "CAN_User.h"
#include "Flash_synchronizer.h"
#include "Services_Mileage.h"
uint8_t PackageCnt;
......@@ -328,139 +329,7 @@ static uint16_t SpeedStandTime = 0u;
// 100ms
void Drive_Info_Display_Update_Service(void)
{
//rtc_counter_value_t RtcTime;
int16_t temp16 = 0;
uint64_t totaldisp = 0;
uint32_t faultcodedisp = 0;
uint32_t vehicle = 0;
uint8_t SpeedStand = 0;
static uint16_t Checktime = 0;
//里程\车速
if(Get_Disp_Mileage_Mode() == Mileage_Mode_Total)
{
totaldisp = Data_ODO_Read();
totaldisp /= 100;
}
else if(Get_Disp_Mileage_Mode() == Mileage_Mode_TripA)
{
totaldisp = Data_Read_Trip(EM_TRIP_A);
totaldisp /= 100;
}
else if(Get_Disp_Mileage_Mode() == Mileage_Mode_TripB)
{
totaldisp = Data_Read_Trip(EM_TRIP_B);
totaldisp /= 100;
}
vehicle = Common_Get_Disp_V_Speed();
if(Get_Unit_Setting() == Imperial)
{
totaldisp = (totaldisp * 6213)/10000;
vehicle = (vehicle * 621)/1000;
}
else
{
if((Get_Disp_Mileage_Mode() == Mileage_Mode_TripA) && (totaldisp > 9999))
{
Data_Clear_Trip ( EM_TRIP_A );
}
else if((Get_Disp_Mileage_Mode() == Mileage_Mode_TripB) && (totaldisp > 9999))
{
Data_Clear_Trip ( EM_TRIP_B );
}
}
if (Get_Disp_Mileage_Mode() == Mileage_Mode_FaultCode)
{
if (GetDtcAmnt() == 0)
{
Checktime = 0;
DtcDispNum = 0;
faultcodedisp = 0;
}
else
{
if(Common_GetIgnOnTime() < IGON_SelfcheckingTimer)
{
Checktime = 0;
DtcDispNum = 0;
}
Checktime++;
faultcodedisp = GetDtcDispNum(DtcDispNum)>>16;
if (Checktime > 50)
{
Checktime = 0;
if ((DtcDispNum + 1) < GetDtcAmnt())
DtcDispNum ++;
else
DtcDispNum = 0;
}
}
}
else
{
Checktime = 0;
DtcDispNum = 0;
}
if (Common_Get_Disp_E_Speed() == 0)
{
if (SpeedStandTime < 10)
SpeedStandTime++;
}
else
{
SpeedStandTime = 0;
}
if (SpeedStandTime >= 10)
SpeedStand = 1;
else
SpeedStand = 0;
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
if (Common_GetIgnOnTime() >= IGON_SelfcheckingTimer)
{
if (get_SEG_Check_Contrl() == 0)
{
// 档位显示
SEG_LCD_Gear_Display(1, get_ID_ISG_Power(), CAN_MSG_Status(ID_ISG_Count));
// 车速显示
SEG_LCD_Vehicle_Speed_Num_Display(1, Get_Unit_Setting(), vehicle / 10); // 1:mph default:km/h
// 转速显示
SEG_LCD_Engine_Speed_Seg_Display(1, Common_Get_Disp_E_Speed(), SpeedStand);
// 累计里程显示
if (BatteryErrFlg)
{
SEG_LCD_BatteryErr_Display(1, Common_GetIgnOnTime());
}
else
{
if (Get_Disp_Mileage_Mode() == Mileage_Mode_FaultCode)
{
SEG_LCD_FaultCode_Display(1, faultcodedisp);
}
else
{
SEG_LCD_ODO_Trip_Display(1, Get_Disp_Mileage_Mode(), Get_Unit_Setting(), totaldisp); // mode/unit/batt/totaldisp
}
}
// 水温显示
SEG_Coolant_Temp_Display(1, Get_CoolantTemp_Disp_Byte());
// 燃油显示
SEG_Fuel_Level_Display(1, Get_Fuel_Disp_Byte());
// 蓄电池电压
SEG_LCD_Battery_Voltage_Display(1, get_Delay_ECU_Battery_Voltage(), CAN_MSG_Status(ID_ECU_Battery_Count));
}
}
}
}
static uint32_t Animat_GEAR = 0u;
......@@ -473,142 +342,7 @@ static uint32_t Animat_Battery = 0u;
//10ms
void Selfcheck_Display_Update_Service(void)
{
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
if (Common_GetIgnOnTime() < IGON_SelfcheckingTimer)
{
// 100ms
if (Common_GetIgnOnTime() < 1600)
{
// 档位自检
SEG_LCD_Gear_Display(1, 0, 0);
Animat_GEAR = Common_GetIgnOnTime() / 10;
// 车速自检
SEG_LCD_Vehicle_Speed_Num_Display(1, 0, Animat_Vspeed * 10 / 75); // 1:mph default:km/h
Animat_Vspeed = Common_GetIgnOnTime();
// 转速自检12000
SEG_LCD_Engine_Speed_Seg_Selftest(Animat_Espeed * 8);
Animat_Espeed = Common_GetIgnOnTime();
// 里程自检
if ((Get_Disp_Mileage_Mode() != Mileage_Mode_TempErr) && ((!Get_ID_113_Tbatt()) || (get_ID_ISG_BATT() > 10)))
{
SEG_LCD_ODO_Trip_FaultCode_Selftest(Animat_ODO / 15);
Animat_ODO = Common_GetIgnOnTime() / 10;
}
else
{
SEG_LCD_BatteryErr_Display(1, Common_GetIgnOnTime());
BatteryErrFlg = 1;
}
// Animat_ODO+=10;
// 水温自检
SEG_Coolant_Temp_Display(1, Animat_Temp / 30);
Animat_Temp = Common_GetIgnOnTime() / 10;
// 燃油自检
SEG_Fuel_Level_Display(1, Animat_Fuel / 30);
Animat_Fuel = Common_GetIgnOnTime() / 10;
// 蓄电池电压自检
SEG_LCD_Battery_Voltage_Selftest(Animat_Battery / 15);
Animat_Battery = Common_GetIgnOnTime() / 10;
}
else
{
// 档位自检
SEG_LCD_Gear_Display(1, 0, 0);
if (Animat_GEAR)
Animat_GEAR = IGON_SelfcheckingTimer - Common_GetIgnOnTime();
// 车速自检
SEG_LCD_Vehicle_Speed_Num_Display(1, 0, Animat_Vspeed * 10 / 75); // 1:mph default:km/h
if (Animat_Vspeed)
Animat_Vspeed = IGON_SelfcheckingTimer - Common_GetIgnOnTime();
// 转速自检12000
SEG_LCD_Engine_Speed_Seg_Selftest(Animat_Espeed * 8);
if (Animat_Espeed)
Animat_Espeed = IGON_SelfcheckingTimer - Common_GetIgnOnTime();
// 里程自检
if ((Get_Disp_Mileage_Mode() != Mileage_Mode_TempErr) && ((!Get_ID_113_Tbatt()) || (get_ID_ISG_BATT() > 10)))
{
SEG_LCD_ODO_Trip_FaultCode_Selftest(Animat_ODO / 150);
}
else
{
SEG_LCD_BatteryErr_Display(1, Common_GetIgnOnTime());
BatteryErrFlg = 1;
}
if (Animat_ODO)
Animat_ODO = IGON_SelfcheckingTimer - Common_GetIgnOnTime();
// 水温自检
SEG_Coolant_Temp_Display(1, Animat_Temp / 300);
if (Animat_Temp)
Animat_Temp = IGON_SelfcheckingTimer - Common_GetIgnOnTime();
// 燃油自检
SEG_Fuel_Level_Display(1, Animat_Fuel / 300);
if (Animat_Fuel)
Animat_Fuel = IGON_SelfcheckingTimer - Common_GetIgnOnTime();
// 蓄电池电压自检
SEG_LCD_Battery_Voltage_Selftest(Animat_Battery / 150);
if (Animat_Battery)
Animat_Battery = IGON_SelfcheckingTimer - Common_GetIgnOnTime();
}
}
else
{
// 20221117 TYW大计清零后,循环显示断码检测
if (get_SEG_Check_Contrl())
{
if (SEG_Check_ContrlTime > 300)
{
SEG_Check_ContrlTime = 0;
Animat_GEAR = 0u;
Animat_Vspeed = 0u;
Animat_Espeed = 0u;
Animat_ODO = 0u;
Animat_Temp = 0u;
Animat_Fuel = 0u;
Animat_Battery = 0u;
}
else
{
SEG_Check_ContrlTime++;
}
// 档位自检
SEG_LCD_Gear_Selftest(Animat_GEAR / 30);
Animat_GEAR += 1;
// 车速自检
SEG_LCD_Vehicle_Speed_Num_Selftest(Animat_Vspeed / 30);
Animat_Vspeed += 1;
// 转速自检12000
SEG_LCD_Engine_Speed_Seg_Selftest(Animat_Espeed * 40);
Animat_Espeed += 1;
// 里程自检
SEG_LCD_ODO_Trip_FaultCode_Selftest(Animat_ODO / 30);
Animat_ODO += 1;
// 水温自检
SEG_Coolant_Temp_Display(1, Animat_Temp / 50);
Animat_Temp += 1;
// 燃油自检
SEG_Fuel_Level_Display(1, Animat_Fuel / 50);
Animat_Fuel += 1;
// 蓄电池电压自检
SEG_LCD_Battery_Voltage_Selftest(Animat_Battery / 30);
Animat_Battery += 1;
}
}
}
else
{
Animat_GEAR = 0u;
Animat_Vspeed = 0u;
Animat_Espeed = 0u;
Animat_ODO = 0u;
Animat_Temp = 0u;
Animat_Fuel = 0u;
Animat_Battery = 0u;
}
}
void Get_ID_02_Data(uint8_t** buffer, uint8_t* length)
......
......@@ -8,7 +8,7 @@
#include "CalcFrequency.h"
#include "CAN_Communication_Matrix.h"
#include "Flash_synchronizer.h"
#include "Services_Mileage.h"
uint8_t MenuByte6 = 0;
uint8_t MenuByte7 = 0;
uint8_t MenuByte8 = 0;
......
/**
* @file Services_Mileage.c
* @brief 里程服务函数
* @details 里程服务函数,包括大计、小计
* @author myliu
* @date 2022.05.10
* @version V1.0
* @copyright myiu
*/
#ifndef SERVICE_MILEAGE_H
#define SERVICE_MILEAGE_H
/*
Platform_32Bit
Platform_16Bit
*/
#ifdef Platform_16Bit
#define Millib_uint8_t unsigned char
#define Millib_uint16_t unsigned int
#define Millib_uint32_t unsigned long
#else
#define Millib_uint8_t unsigned char
#define Millib_uint16_t unsigned short
#define Millib_uint32_t unsigned int
#define Millib_uint64_t unsigned long long
#endif
#ifndef Millib_NULL
#define Millib_NULL (void *)0u
#endif /* NULL */
/**@enum 小计里程枚举
* @brief 用来区分每个小计里程数
*/
typedef enum
{
EM_TRIP_A,
EM_TRIP_B,
EM_TRIP_C,
EM_TRIP_D,
EM_TRIP_MAX,
} DataTripEnum_t;
/**@enum EEPROM存储块枚举类型
* @brief 用来区分EEPORM存储区域
*/
typedef enum
{
EM_MILEAGE_BLOCK = 0u, /**< 累计里程 */
EM_ODO_BLOCK, /**< 总计里程 */
EM_TRIP_BLOCK, /**< 小计里程 */
EM_Maintenance_BLOCK, /**< 保养里程 */
EM_ODOSYNC_CNT_BLOCK, /**< 里程备份次数 */
EM_ENGODO_BLOCK, /**< 发动机总里程 */
} Data_EEPROM_Enum_t;
typedef void (*EEPromWrite)(Data_EEPROM_Enum_t BlockID, Millib_uint32_t u32Data[], Millib_uint16_t u16Len);
typedef Millib_uint8_t (*GetRunValid)(void);
typedef struct
{
Millib_uint8_t (*Get_Sys_IG_Sts)(void); /**< 获取系统电源状态,请务必填写函数名或NULL */
Millib_uint8_t (*Get_Act_V_Speed_Valid)(void); /**< 实际车速有效位,请务必填写函数名或NULL */
Millib_uint16_t (*Get_Act_V_Speed)(void); /**< 实际车速,请务必填写函数名或NULL */
Millib_uint16_t (*Get_TireSize)(void); /**< 轮胎系数,请务必填写函数名或NULL */
EEPromWrite EEPromWrite_Cbk; /**< 写EEPROM回调函数,请务必填写函数名或NULL */
} Mileage_Func_t;
typedef struct
{
Millib_uint32_t Mileage; /**< KL30初始化时,从EEPROM读取的数据 */
} Mileage_Init_t;
typedef struct
{
Millib_uint32_t Stamp; /**< 在Mileage上记录的里程戳 */
Millib_uint32_t Offset; /**< 里程偏移量,暂不使用,预留 */
Millib_uint32_t MaxValue; /**< 最大的总计里程,单位100m */
} ODO_Init_t;
typedef struct
{
Millib_uint32_t EngODO; /**< 在Mileage上记录的里程戳 */
Millib_uint32_t MaxValue; /**< 最大的总计里程,单位100m */
} EngODO_Init_t;
typedef struct
{
Millib_uint32_t Stamp; /**< 在Mileage上记录的里程戳 */
Millib_uint32_t MaxValue; /**< 最大的小计里程,单位100m */
Millib_uint8_t IsRestart; /**< 小计里程达到最大值后,是否自动从0开始,重新累计小计里程 */
} Trip_Init_t;
#define Data_MEM_Block_Mileage ((Millib_uint8_t)12u)
#define Data_MEM_Block_ODO ((Millib_uint8_t)16u)
#define Data_MEM_Block_EngODO ((Millib_uint8_t)8u)
#define Data_MEM_Block_Trip ((Millib_uint8_t)16u)
/*
total size =Data_MEM_Block_Trip*EM_TRIP_MAX
*/
/**
* @brief 里程服务初始化,KL30调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Mileage,此内存需在休眠唤醒后不丢失
* @param[in] pInitData 从EEPROM读取上次下电前累计的里程
* @param[in] pFunc 底层发送回调函数, 详见Mileage_Func_t
*
* @warning 此函数必须后于EEPROM初始化,因为要读取EEPROM数据,否则每次都是从0开始
*
* @since 1.0.0
*/
void Data_Mileage_KL30_Init(Millib_uint8_t *pMemSpace,
Mileage_Init_t *pInitData, Mileage_Func_t *pFunc);
/**
* @brief 里程服务初始化,唤醒时调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Mileage,此内存需在休眠唤醒后不丢失
* @param[in] pFunc 底层发送回调函数, 详见Mileage_Func_t
*
* @since 1.0.0
*/
void Data_Mileage_Wakeup_Init(Millib_uint8_t *pMemSpace, Mileage_Func_t *pFunc);
/**
* @brief 里程累计服务,在100ms中断调用
*
* @since 1.0.0
*/
void Data_Mileage_ISR(void);
/**
* @brief 里程读取
* @return 当前累计里程数,单位100m
* @warning 此数据非总计里程,总计里程属于此里程数的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_Mileage_Read(void);
/**
* @brief 里程读取
* @return 当前累计里程数,单位mm
* @warning 此数据非总计里程,总计里程属于此里程数的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_Mileage_Readmm(void);
/**
* @brief 写里程
* @param[in] NewMileage 新里程数,单位100m
* @return 成功 - 1 失败 - 0
* @warning 调用此函数前,需要调用Data_Mileage_Clear函数
*
* @since 1.0.0
*/
Millib_uint8_t Data_Mileage_Write(Millib_uint32_t NewMileage);
/**
* @brief 清里程,出厂时使用
* @warning 此函数包含功能:清Mileage,清ODO以及清trip,调用此函数后,需要复位后,里程才会继续走动
*
* @since 1.0.0
*/
void Data_Mileage_Clear(void);
/**
* @brief 清里程,出厂时使用
* @warning 此函数包含功能:清Mileage,清ODO以及清Trip,调用此函数,不影响里程的走动
*
* @since 1.0.0
*/
void Data_Mileage_Clear_GoOn(void);
/**
* @brief 将累计的里程存入EEPROM, 10ms任务中调用
*
* @since 1.0.0
*/
void Data_Mileage_Write_EEPROM(void);
/**
* @brief 获取里程库软件版本号
* @return 版本号 1.01
* @since 1.0.0
*/
Millib_uint8_t *Get_Data_Mileage_Version(void);
/**
* @brief 总计里程初始化,KL30调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_ODO,此内存需在休眠唤醒后不丢失
* @param[in] pInitData 详见ODO_Init_t
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_KL30_Init之后调用
*
* @since 1.0.0
*/
void Data_ODO_KL30_Init(Millib_uint8_t *pMemSpace, ODO_Init_t *pInitData, EEPromWrite Func);
/**
* @brief 总计里程初始化,唤醒调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_ODO,此内存需在休眠唤醒后不丢失
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_Wakeup_Init之后调用
*
* @since 1.0.0
*/
void Data_ODO_Wakeup_Init(Millib_uint8_t *pMemSpace, EEPromWrite Func);
/**
* @brief 总计里程计算服务,为了其他服务获取总计里程无0.1m的偏差,需要此服务函数
*
* @warning 在100ms任务重调用
*
* @since 1.0.0
*/
void Data_ODO_Processing(void);
/**
* @brief 总计里程读取
* @return 当前总计里程数,单位100m
* @warning 此数据为上次Data_ODO_Clear后,到调用此函数为止,累计的Mileage,属于Mileage的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_ODO_Read(void);
/**
* @brief 清总计里程,车厂使用
* @warning 此函数只是将总计里程的里程戳标记为当前的Mileage,不属于完全清除,如出厂请调用Data_Mileage_Clear
*
* @since 1.0.0
*/
void Data_ODO_Clear(void);
/**
* @brief 总计里程偏移量读取
* @return 当前偏移量,单位100m
* @warning 里程备份时使用
*
* @since 1.0.0
*/
Millib_uint32_t Data_Offset_Read(void);
/**
* @brief 总计里程偏移量修改
* @return 当前偏移量,单位100m
* @warning 里程备份时使用
*
* @since 1.0.0
*/
void Data_ODO_Modify(Millib_uint32_t Offset);
/**
* @brief 发动机总计里程初始化,KL30调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_EngODO,此内存需在休眠唤醒后不丢失
* @param[in] pInitData 详见EngODO_Init_t
* @param[in] pFunc1 累计发动机总里程的条件
* @param[in] pFunc2 写EEPROM回调函数
*
* @warning 在Data_Mileage_KL30_Init之后调用
*
* @since 1.0.0
*/
void Data_EngODO_KL30_Init(Millib_uint8_t *pMemSpace, EngODO_Init_t *pInitData, GetRunValid pFunc1, EEPromWrite pFunc2);
/**
* @brief 发动机总计里程初始化,唤醒调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_EngODO,此内存需在休眠唤醒后不丢失
* @param[in] pFunc1 累计发动机总里程的条件
* @param[in] pFunc2 写EEPROM回调函数
*
* @warning 在Data_Mileage_Wakeup_Init之后调用
*
* @since 1.0.0
*/
void Data_EngODO_Wakeup_Init(Millib_uint8_t *pMemSpace, GetRunValid pFunc1, EEPromWrite pFunc2);
/**
* @brief 发动机总计里程计算服务,为了其他服务获取总计里程无0.1m的偏差,需要此服务函数
*
* @warning 在100ms任务重调用
*
* @since 1.0.0
*/
void Data_EngODO_Processing(void);
/**
* @brief 发动机总计里程读取
* @return 当前总计里程数,单位100m
* @warning 此数据为上次Data_ODO_Clear后,到调用此函数为止,累计的Mileage,属于Mileage的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_EngODO_Read(void);
/**
* @brief 发动机总计里程写
* @return 当前发动机总计里程数,单位100m
* @warning 此数据为上次Data_EngODO_Clear后,累计的Mileage
*
* @since 1.0.0
*/
void Data_EngODO_Write(Millib_uint32_t newEngODO);
/**
* @brief 清发动机总计里程,车厂使用
* @warning 此函数只是将发送机总计里程清除,如需工厂清除,需要调用Data_Mileage_Clear
*
* @since 1.0.0
*/
void Data_EngODO_Clear(void);
/**
* @brief 小计里程初始化,KL30调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Trip*EM_TRIP_MAX,此内存需在休眠唤醒后不丢失
* @param[in] pInitData Trip_Init_t
* @param[in] TotalTrip 小计总数,(例如:1个小计, 2个小计,3个小计)
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_KL30_Init之后调用
*
* @since 1.0.0
*/
void Data_Trip_KL30_Init(Millib_uint8_t *pMemSpace, Trip_Init_t *pInitData, Millib_uint8_t TotalTrip, EEPromWrite pFunc);
/**
* @brief 小计里程初始化,唤醒调用,必须调用,否则造成空指针
* @param[in] pMemSpace 内存空间,需要的空间大小至少大于Data_MEM_Block_Trip*EM_TRIP_MAX,此内存需在休眠唤醒后不丢失
* @param[in] TotalTrip 小计总数,(例如:1个小计, 2个小计,3个小计)
* @param[in] Func 写EEPROM回调函数
*
* @warning 在Data_Mileage_Wakeup_Init之后调用
*
* @since 1.0.0
*/
void Data_Trip_Wakeup_Init(Millib_uint8_t *pMemSpace, Millib_uint8_t TotalTrip, EEPromWrite pFunc);
/**
* @brief 小计里程计算服务,为了其他服务获取小计里程无0.1m的偏差,需要此服务函数
*
* @warning 在100ms任务重调用
*
* @since 1.0.0
*/
void Data_Trip_Processing(void);
/**
* @brief 清小计里程
* @param[in] TripN DataTripEnum_t
* @warning 此函数只是将小计里程的里程戳标记为当前的Mileage,不属于完全清除,如出厂请调用Data_Mileage_Clear
*
* @since 1.0.0
*/
void Data_Clear_Trip(DataTripEnum_t TripN);
/**
* @brief 清小计里程
* @warning 此函数只是将小计里程的里程戳标记为当前的Mileage,不属于完全清除,如出厂请调用Data_Mileage_Clear
*
* @since 1.0.0
*/
void Data_Clear_Trip_All(void);
/**
* @brief 小计里程读取
* @param[in] TripN DataTripEnum_t
* @return 当前小计里程数,单位100m
* @warning 此数据为上次Data_ODO_Clear后,到调用此函数为止,累计的Mileage,属于Mileage的一部分
*
* @since 1.0.0
*/
Millib_uint32_t Data_Read_Trip(DataTripEnum_t TripN);
#endif
#include "Services_Mileage_User.h"
#include "Services_Mileage.h"
#include "eepromManage.h"
#include <string.h>
#include "Common_Interface.h"
#include "Services_Mileage.h"
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;
static uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data [], uint16_t u16Len);
static void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data [], uint16_t u16Len);
#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
uint32_t Milleage_InitFlag = 0U;
uint32_t RiskStop_Flag = 0u;
uint8_t ChangAn_ODOClear_Sts;
uint8_t ChangAn_ODOClear_Timer;
uint8_t ChangAn_ODOClear;
/******************************************************************************
Function:Data_ODO_KL30Init
Description:
Input:
Output:
******************************************************************************/
void Data_User_Mileage_KL30Init(void)
{
uint32_t TempBuf [ 8 ] = {0};
Mileage_Init_t MileInit = {0};
Mileage_Func_t Func = {0};
ODO_Init_t ODOInit = {0};
EngODO_Init_t EngODOInit = {0};
Trip_Init_t TripInit [ 4 ] = {0};
Milleage_InitFlag = 0U;
//�������ݴ�EEPROM�ж�ȡ
( void )Data_User_EEPROM_Read(EM_MILEAGE_BLOCK, TempBuf, 1);
if ( TempBuf [ 0 ] == 0xFFFFFFFF )
{
MileInit.Mileage = 0u;
}
else
{
MileInit.Mileage = TempBuf [ 0 ];
}
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts;
Func.Get_Act_V_Speed_Valid = Common_Get_Act_V_Speed_Valid;
Func.Get_Act_V_Speed = Common_Get_Act_V_Speed;
Func.Get_TireSize = ( void *)0;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write; //��ʱδ����
Data_Mileage_KL30_Init(DataMilleageBuf, &MileInit, &Func);
( void )Data_User_EEPROM_Read(EM_ODO_BLOCK, TempBuf + 1, 2);
if ( TempBuf [ 1 ] == 0xFFFFFFFF )
{
ODOInit.Stamp = 0;
}
else
{
ODOInit.Stamp = TempBuf [ 1 ];
}
if ( TempBuf [ 1 ] == 0xFFFFFFFF )
{
ODOInit.Offset = 0;
}
else
{
ODOInit.Offset = TempBuf [ 2 ];
}
ODOInit.MaxValue = 9999999;
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
( void )Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 4);
TripInit [ EM_TRIP_A ].Stamp = 0xFFFFFFFFu;
TripInit [ EM_TRIP_A ].MaxValue = 99999;
TripInit [ EM_TRIP_A ].IsRestart = 1u;
TripInit [ EM_TRIP_B ].Stamp = 0xFFFFFFFFu;
TripInit [ EM_TRIP_B ].MaxValue = 99999;
TripInit [ EM_TRIP_B ].IsRestart = 1u;
TripInit [ EM_TRIP_C ].Stamp = 0xFFFFFFFFu;
TripInit [ EM_TRIP_C ].MaxValue = 99999;
TripInit [ EM_TRIP_C ].IsRestart = 1u;
TripInit [ EM_TRIP_D ].Stamp = 0xFFFFFFFFu;
TripInit [ EM_TRIP_D ].MaxValue = 99999;
TripInit [ EM_TRIP_D ].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Milleage_InitFlag = 0X5AA53AA3UL;
RiskStop_Flag = 0;
ChangAn_ODOClear_Sts = 0xAA;
ChangAn_ODOClear_Timer = 0;
}
void Data_User_Mileage_WakeupInit(void)
{
Mileage_Func_t Func = {0};
Milleage_InitFlag = 0U;
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts;
Func.Get_Act_V_Speed_Valid = Common_Get_Act_V_Speed_Valid;
Func.Get_Act_V_Speed = Common_Get_Act_V_Speed;
Func.Get_TireSize = ( void *)0;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write; //��ʱδ����
Data_Mileage_Wakeup_Init(DataMilleageBuf, &Func);
Data_ODO_Wakeup_Init(DataODOBuf, Func.EEPromWrite_Cbk);
Data_Trip_Wakeup_Init(DataTripBuf, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Milleage_InitFlag = 0X5AA53AA3UL;
RiskStop_Flag = 0;
}
uint32_t Get_MileageInit_Status(void)
{
return Milleage_InitFlag;
}
static uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data [], uint16_t u16Len)
{
switch ( u16BlockID )
{
case EM_MILEAGE_BLOCK:
odo_readState = eeprom_ReadODO(&g_ReadMileage);
u32Data [ 0 ] = g_ReadMileage.Odo;
// g_EngineRunMileage = g_ReadMileage.Trip;
// eeprom_ReadRecord(EEPROM_BLOCK_00, ( uint8_t * )u32Data, u16Len * 4);
break;
case EM_ODO_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_01, ( uint8_t * )u32Data, u16Len * 4);
break;
case EM_TRIP_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_03, ( uint8_t * )u32Data, u16Len * 4);
break;
default:
break;
}
return 0;
}
static void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data [], uint16_t u16Len)
{
uint8_t i = 0u;
switch ( BlockID )
{
case EM_MILEAGE_BLOCK:
if ( u32Data [ 0 ] == 0 )
{
eeprom_ClearOdoSection( );
}
else
{
g_WriteMileage.Odo = u32Data [ 0 ];
// g_WriteMileage.Trip = 0;
g_WriteMileage.IsTripClear = 0;
// g_WriteMileage.Trip = g_EngineRunMileage;
odo_writeState = WRITE_FAIL;
if(g_WriteMileage.Odo % 10 == 0)
{
while(odo_writeState != WRITE_COMPLETE)
{
odo_writeState = eeprom_WriteODO(&g_WriteMileage, distance_100m, 1);
i++;
if(i > 10)
{
break;
}
}
}
}
// eeprom_WriteRecord(EEPROM_BLOCK_00, ( uint8_t * )u32Data, u16Len * 4);
break;
case EM_ODO_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_01, ( uint8_t * )u32Data, u16Len * 4);
break;
case EM_TRIP_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_03, ( uint8_t * )u32Data, u16Len * 4);
break;
default:
break;
}
}
void Services_Mileage_Callback(void)
{
Data_Mileage_ISR( );
}
#ifndef __SERVICE_ODO_USER_H__
#define __SERVICE_ODO_USER_H__
#include "common.h"
//#define ONLY_CLEAR_ODO_MIL 0x01u /*仅根据距离信息进行ODO清除*/
//#define ONLY_CLEAR_ODO_NUM 0x01u /*仅根据次数信息进行ODO清除*/
#define CLEAR_ODO_NUM_MIL 0x01u /*以距离信息以及次数信息进行ODO清除*/
#define ODO_CLEAR_NUM 5u /*清除次数上限值 */
#define ODO_CLEAR_MIL 50000u /*清除距离上限值 单位0.1KM*/
extern uint8_t ODO_Clear_Num_Value;
void Data_User_Mileage_KL30Init(void);
void Data_User_Mileage_WakeupInit(void);
void Services_Mileage_Callback(void);
uint32_t Get_MileageInit_Status(void);
#endif
......@@ -25,12 +25,12 @@
#include "U2_uds_includes.h"
#include "CAN_User.h"
#include "BU98R10.h"
#include "SEG_LCD.h"
#include "can.h"
#include "RTE_ADC.h"
#include "IS31FL3236.h"
#include "AW93015.h"
#include "Services_Mileage.h"
uint16_t g_sleepDelay = 0;
......@@ -44,11 +44,14 @@ void Power_KL30_Init ( void )
Fuel_KL30_Init();
CoolantTemp_KL30_Init();
// eeprom_StoreInfo_Init( );
// CalcODOKL30Init();
Data_Gear_KL30_Init();
//APP_CAN_Init();
//SEG_LCD_Init();
BU98R10_Init();
MenuKL30Init();
Data_User_Mileage_KL30Init();
}
......@@ -61,9 +64,11 @@ void Power_Sleep_Init(void)
Capture_Stop(39);
Capture_Stop(40);
Analog_Signal_Conv_Stop();
SEG_LCD_Shutdown();
IS31_Shutdown();
BU98R10_Shutdown();
GPIO_Init(GPIO_SLEEP_MODE );
INTC_DisableIRQ(LVI_IRQn );
INTC_DisableIRQ(INTP0_IRQn );
......@@ -200,9 +205,10 @@ void Power_Wakeup_Init ( void )
IS31_OFF_Wakeup();
IS31FL3236_Update();
Init93015_IIC();//4034
BU98R10_Init();
APP_CAN_Init();
IS31FL3236_Init();
Data_User_Mileage_WakeupInit();
}
......@@ -210,13 +216,6 @@ void Power_Wakeup_Init ( void )
void Power_IG_OFF_Init(void)
{
SEG_LCD_Vehicle_Speed_Num_Display(0, 0, 0);
SEG_LCD_Engine_Speed_Seg_Display(0, 0, 0);
SEG_LCD_ODO_Trip_Display(0, 0, 0, 0);
SEG_Fuel_Level_Display(0, 0);
SEG_LCD_Battery_Voltage_Display(0, 0 ,0);
SEG_LCD_Gear_Display(0, 0, 0);
SEG_Coolant_Temp_Display(0, 0);
Line_In_KL15_OFF_Init();
Common_Set_IG_Sts(COMMON_POWER_OFF);
......@@ -246,16 +245,15 @@ void Power_IG_ON_Init(void)
uart2_User_KL15_Init();
CalcFreq_KL15_Init();
APP_CAN_Init();
CalcODOKL15Init();
Common_Set_IG_Sts(COMMON_POWER_ON);
// UART2_Init(115200);
SEG_LCD_Init();
//IS31FL3236_Init();
Init93015_IIC(); // 4034
DtcFaultInit();
/*----------------------------------------*/
BatteryVoltageDelayInit();
Set_SEG_Check_Contrl(0);
}
void Power_IG_OVP_Init(void)
{
......
......@@ -4,7 +4,7 @@
#include "Common_Interface.h"
#include "Line_in.h"
#include "CAN_User.h"
#include "SEG_LCD.h"
#include "CoolantTemp.h"
#include "gpio.h"
#include "Fuel.h"
......@@ -35,700 +35,20 @@ void Telltales_Init(void)
const LED_Attribute_st LED_Attribute[LED_Max] =
{
/* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */
{ m_LED_RIGHT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_RIGHT_Judgement , LED_RIGHT_Execution },//右转向
{ m_LED_LEFT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_LEFT_Judgement , LED_LEFT_Execution },//左转向
{ m_LED_HI_BEAM , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_HI_BEAM_Judgement , LED_HI_BEAM_Execution },//远光灯
{ m_LED_MIL , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_MIL_Judgement , LED_MIL_Execution },//发动机报警灯
{ m_LED_ABS , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_ABS_Judgement , LED_ABS_Execution },//ABS_低有效
{ m_LED_TSC , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_TSC_Judgement , LED_TSC_Execution },//TSC
{ m_LED_AutoStarStop , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_AutoStarStop_Judgement , LED_AutoStarStop_Execution },//自动启停
{ m_LED_Batterylow , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_Batterylow_Judgement , LED_Batterylow_Execution },//蓄电池电压报警
{ m_LED_Auto_HI_BEAM , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_Auto_HI_BEAM_Judgement , LED_Auto_HI_BEAM_Execution },//自动远光灯(预留)
{ m_LED_Shore , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_Shore_Judgement , LED_Shore_Execution },//边撑状态
{ m_LED_ENGINE_OIL_LOW , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_ENGINE_OIL_LOW_Judgement , LED_ENGINE_OIL_LOW_Execution },//机油压力报警灯(预留)
{ m_LED_TPMS , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_TPMS_Judgement , LED_TPMS_Execution },//胎压功能(预留)
{ m_LED_READY , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_READY_Judgement , LED_READY_Execution },//READY
{ m_LED_Fuel , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_Fuel_Judgement , LED_Fuel_Execution },//燃油
{ m_LED_Temp , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, LED_Temp_Judgement , LED_Temp_Execution },//水温
{ m_LED_RIGHT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//右转向
{ m_LED_LEFT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//左转向
{ m_LED_HI_BEAM , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//远光灯
{ m_LED_MIL , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//发动机报警灯
{ m_LED_ABS , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//ABS_低有效
{ m_LED_TSC , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//TSC
{ m_LED_AutoStarStop , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//自动启停
{ m_LED_Batterylow , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//蓄电池电压报警
{ m_LED_Auto_HI_BEAM , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//自动远光灯(预留)
{ m_LED_Shore , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//边撑状态
{ m_LED_ENGINE_OIL_LOW , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//机油压力报警灯(预留)
{ m_LED_TPMS , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//胎压功能(预留)
{ m_LED_READY , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//READY
{ m_LED_Fuel , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//燃油
{ m_LED_Temp , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//水温
};
/******************************************************************************
右转向灯
信号接口:硬线
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_RIGHT_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_RightTurn);
if (Get_LIne_Sta == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_RIGHT_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_RightTurn(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_Right, 1);
}
else
{
SEG_LCD_RightTurn(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_Right, 0);
}
}
/******************************************************************************
左转向灯
信号接口:硬线
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_LEFT_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_LeftTurn);
if (Get_LIne_Sta == LINE_IN_LOGIC_VALID)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_LEFT_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_LeftTurn(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_Left, 1);
}
else
{
SEG_LCD_LeftTurn(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_Left, 0);
}
}
/******************************************************************************
远光灯
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_HI_BEAM_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_HighBeam);
if (Get_LIne_Sta == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_HI_BEAM_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_HighBeam(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_HighBeam, 1);
}
else
{
SEG_LCD_HighBeam(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_HighBeam, 0);
}
}
/******************************************************************************
发动机故障报警灯
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_MIL_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_OBD);
if (Get_LIne_Sta == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_MIL_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_OBD(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_OBD, 1);
}
else
{
SEG_LCD_OBD(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_OBD, 0);
}
}
/******************************************************************************
ABS故障报警灯
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_ABS_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_ABS);
if (Get_LIne_Sta == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_ABS_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_ABS(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_ABS, 1);
}
else
{
SEG_LCD_ABS(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_ABS, 0);
}
}
/******************************************************************************
TSC故障报警灯
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_TSC_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_CANdate = 0u;
uint8_t Get_CANdate1 = 0u;
uint8_t Get_CANdate2 = 0u;
uint8_t Get_CANdate3 = 0u;
static uint8_t gu8_flashCnt = 0;
static uint16_t gu16_last_TCS_workMode = 0x00;
static uint16_t gu16_last_result = 0u;
Get_CANdate = Get_ID_125_Sig_TCS_SysState();
Get_CANdate1 = Get_ID_125_Sig_TCS_WorkMode();
Get_CANdate2 = Get_ID_125_Sig_TCS_WarningLamp();
Get_CANdate3 = (CAN_SIG_NORMAL == CAN_MSG_Status(ID_TCS_Count)) ? 1 : 0;
if (Common_GetIgnOnTime() > 3200)
{
/*
if ((Get_CANdate3 == 1) && (Get_CANdate1 == 0) && Get_TCS_Status())
{
if ((Get_CANdate == 0u) || (Get_CANdate2 == 1))
{
Set_TCS_WorkModeFlshTime(120);
if (Get_CANdate == 0) // TCS_SysState_Init
{
u8Result = 1u;
}
else if (Get_CANdate2 == 1) // TCS_WarningLamp_Open
{
if (FLASH_SYNC_1Hz)
{
u8Result = 1;
}
else
{
u8Result = 0;
}
}
}
else
{
if (Get_TCS_WorkModeFlash() == 1) // Six_Flash
{
if (FLASH_SYNC_1Hz)
{
u8Result = 1;
}
else
{
u8Result = 0;
}
}
}
}
else
{
Set_TCS_WorkModeFlshTime(0);
u8Result = 0u;
}
*/
if ( Get_TCS_Status() == 0 )
{
gu8_flashCnt = 0;
gu16_last_TCS_workMode = 0x01;
return u8Result = 0u;
} /* */
if ( CAN_SIG_LOST == CAN_MSG_Status( ID_TCS_Count ) )
{
gu8_flashCnt = 0;
gu16_last_TCS_workMode = 0x01;
return u8Result = 0u;
} /* */
//tmpTCS_workMode = Get_ID_125_Sig_TCS_WorkMode();
if ( 0x01 == Get_CANdate1 )
{
gu8_flashCnt = 0;
gu16_last_TCS_workMode = Get_CANdate1;
return u8Result = 0u;
} /* */
//tmpTCS_SysState = Get_ID_125_Sig_TCS_SysState();
if ( 0x00 == Get_CANdate )
{
gu8_flashCnt = 0;
gu16_last_TCS_workMode = Get_CANdate1;
return u8Result = 1u;
}
//tmpTCS_WarningLamp = Get_ID_125_Sig_TCS_WarningLamp();
if ( 0x01 == Get_CANdate2 )
{
/* 1. */
if ( FLASH_SYNC_1Hz )
{ u8Result = 1u; }
else
{ u8Result = 0u; }
gu8_flashCnt = 0;
gu16_last_TCS_workMode = 0;
}
else
{
if ( 0x01 == gu16_last_TCS_workMode ) //上一次的工作模式为1,表示上一次灯关闭;当前工作模式为0,灯闪烁
{
if ( FLASH_SYNC_1Hz )
{ u8Result = 1u; }
else
{ u8Result = 0u; }
if ( gu16_last_result != u8Result )
{
gu8_flashCnt++;
gu16_last_result = u8Result;
if ( gu8_flashCnt > 12 )
{
gu16_last_TCS_workMode = Get_CANdate1;
u8Result = 1u;
}
}
}
else
{
u8Result = 1u;
gu16_last_result = u8Result;
gu8_flashCnt = 0;
}
}
}
return u8Result;
}
void LED_TSC_Execution(uint16_t led_status)
{
if ((led_status == 1u) && (Get_TCS_Status()))
{
SEG_LCD_TSC(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_TLight, 1);
}
else
{
SEG_LCD_TSC(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_TLight, 0);
}
}
/******************************************************************************
自动启停故障报警灯
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_AutoStarStop_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_AutoStarStop);
if (Get_LIne_Sta == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_AutoStarStop_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_AutoStarStop(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_AutoStartStop, 1);
}
else
{
SEG_LCD_AutoStarStop(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_AutoStartStop, 0);
}
}
/******************************************************************************
蓄电池电压报警
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_Batterylow_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_CANdate = 0u;
u8Result = Get_LED_ECU_Battery_VoltageFlag();
Get_CANdate = (CAN_SIG_NORMAL == CAN_MSG_Status(ID_ECU_Battery_Count)) ? 1 : 0;
if ((u8Result == 1u) && (Get_CANdate == 1))
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_Batterylow_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_Batterylow(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_Battery, 1);
}
else
{
SEG_LCD_Batterylow(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_Battery, 0);
}
}
/******************************************************************************
自动远光灯(预留)
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_Auto_HI_BEAM_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_CANdate = 0u;
// Get_CANdate = get_240_MILLampSts();
//Get_CANdate = get_113_MILLampSts();
if (Get_CANdate == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_Auto_HI_BEAM_Execution(uint16_t led_status)
{
//if (led_status == 1u)
if (0)
{
SEG_LCD_HI_BEAM(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_ALight, 1);
}
else
{
SEG_LCD_HI_BEAM(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_ALight, 0);
}
}
/******************************************************************************
边撑状态
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_Shore_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_CANdate = 0u;
Get_CANdate = Get_ID_111_Sig_ISG_SideStand();
if (Get_CANdate == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_Shore_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_Shore(SEG_LCD_LIGHT);
PORT_SetBit(TLight_OUT);
}
else
{
SEG_LCD_Shore(SEG_LCD_OFF);
PORT_ClrBit(TLight_OUT);
}
}
/******************************************************************************
机油压力低报警灯
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_ENGINE_OIL_LOW_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
// Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_OilPressure);
if (Get_LIne_Sta == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_ENGINE_OIL_LOW_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_OilPressure(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_OilPressure, 1);
}
else
{
SEG_LCD_OilPressure(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_OilPressure, 0);
}
}
/******************************************************************************
胎压功能(预留)
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_TPMS_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_LIne_Sta = 0u;
// Get_LIne_Sta = (uint8_t)Line_In_Get_Status(LINE_IN_OilPressure);
if (Get_LIne_Sta == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_TPMS_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_TirePressure(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_TirePressure, 1);
}
else
{
SEG_LCD_TirePressure(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_TirePressure, 0);
}
}
/******************************************************************************
READY
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_READY_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_CANdate = 0u;
Get_CANdate = Get_ID_111_ISG_Ready();
if (Get_CANdate == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_READY_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_READY(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_READY, 1);
}
else
{
SEG_LCD_READY(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_READY, 0);
}
}
/******************************************************************************
燃油
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_Fuel_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_Fueldate = 0u;
Get_Fueldate = Get_CurFuelSetp();
if (Get_Fuel_Sensor_State() == FuelSensorNormal)
{
if (Get_Fueldate == 0u)
{
if(FLASH_SYNC_1Hz)
u8Result = 1;
else
u8Result = 0;
}
else if (Get_Fueldate == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 2u;
}
}
else
{
u8Result = 2u;
}
return u8Result;
}
extern uint8_t CurFuelSetp;
void LED_Fuel_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_Fuel(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_Fuel_W, 0);
App_Telltales_Ctrl(LED_Fuel_Y, 1);
}
else if (led_status == 2u)
{
SEG_LCD_Fuel(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_Fuel_W, 1);
App_Telltales_Ctrl(LED_Fuel_Y, 0);
}
else
{
SEG_LCD_Fuel(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_Fuel_W, 0);
App_Telltales_Ctrl(LED_Fuel_Y, 0);
}
}
/******************************************************************************
水温
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint16_t LED_Temp_Judgement(void)
{
uint16_t u8Result = 0u;
uint8_t Get_CANdate = 0u;
Get_CANdate = Get_CoolantTemp_Alarm();
if (Get_CANdate == 0u)
{
u8Result = 2u;
}
else if (Get_CANdate == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_Temp_Execution(uint16_t led_status)
{
if (led_status == 1u)
{
SEG_LCD_Temp(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_Temp_W, 0);
App_Telltales_Ctrl(LED_Temp_R, 1);
}
else if (led_status == 2u)
{
SEG_LCD_Temp(SEG_LCD_LIGHT);
App_Telltales_Ctrl(LED_Temp_W, 1);
App_Telltales_Ctrl(LED_Temp_R, 0);
}
else
{
SEG_LCD_Temp(SEG_LCD_OFF);
App_Telltales_Ctrl(LED_Temp_W, 0);
App_Telltales_Ctrl(LED_Temp_R, 0);
}
}
......@@ -25,36 +25,6 @@ typedef enum
} LED_Idx_t;
uint16_t LED_RIGHT_Judgement(void);
void LED_RIGHT_Execution(uint16_t led_status);
uint16_t LED_LEFT_Judgement(void);
void LED_LEFT_Execution(uint16_t led_status);
uint16_t LED_HI_BEAM_Judgement(void);
void LED_HI_BEAM_Execution(uint16_t led_status);
uint16_t LED_MIL_Judgement(void);
void LED_MIL_Execution(uint16_t led_status);
uint16_t LED_ABS_Judgement(void);
void LED_ABS_Execution(uint16_t led_status);
uint16_t LED_TSC_Judgement(void);
void LED_TSC_Execution(uint16_t led_status);
uint16_t LED_AutoStarStop_Judgement(void);
void LED_AutoStarStop_Execution(uint16_t led_status);
uint16_t LED_Batterylow_Judgement(void);
void LED_Batterylow_Execution(uint16_t led_status);
uint16_t LED_Auto_HI_BEAM_Judgement(void);
void LED_Auto_HI_BEAM_Execution(uint16_t led_status);
uint16_t LED_Shore_Judgement(void);
void LED_Shore_Execution(uint16_t led_status);
uint16_t LED_ENGINE_OIL_LOW_Judgement(void);
void LED_ENGINE_OIL_LOW_Execution(uint16_t led_status);
uint16_t LED_TPMS_Judgement(void);
void LED_TPMS_Execution(uint16_t led_status);
uint16_t LED_READY_Judgement(void);
void LED_READY_Execution(uint16_t led_status);
uint16_t LED_Fuel_Judgement(void);
void LED_Fuel_Execution(uint16_t led_status);
uint16_t LED_Temp_Judgement(void);
void LED_Temp_Execution(uint16_t led_status);
......
#ifndef _SEG_LCD_H_
#define _SEG_LCD_H_
#include "BU98R10.H"
/******************************************************************************
段码状态
******************************************************************************/
#define SEG_LCD_LIGHT 7
#define SEG_LCD_GRAY 1
#define SEG_LCD_GRAY_2 2
#define SEG_LCD_OFF 0
#define SEG_LCD_ON 255
/******************************************************************************
显示模式
******************************************************************************/
#define GUI_DISP_MODE_NORMAL 0x00 //正常
#define GUI_DISP_MODE_WARNING 0x01 //报警
#define GUI_DISP_MODE_NEGATIVE 0x01 //负数
#define GUI_DISP_MODE_BLANK 0x02 //空白
#define GUI_DISP_MODE_INVALID 0x03 //无效
/******************************************************************************
段码液晶显示数据备份结构
******************************************************************************/
typedef struct
{
uint8_t Brightness;
uint8_t Window;
uint8_t SetMode;
uint8_t VSpeedSeg;
uint8_t ESpeedSeg;
uint16_t VSpeed;
uint16_t ESpeed;
uint16_t Voltage;
uint8_t VolCANset;
uint8_t Gear;
uint8_t TempSeg;
uint8_t FuelSeg;
uint8_t ODOMode;
uint32_t ODOMileage;
uint8_t ODOUnit;
uint32_t ODOFaultCode;
}SEGLCDBackupStruct;
/******************************************************************************
图标状态寄存器SEGLCDIconxxxStatus位定义
================================================================
Bit 7 | SEG_LCD_ICON_FORCE | 强制显示标志
-------+-------------------------+------------------------------
Bit 6 | Rsvd. | 保留
-------+-------------------------+------------------------------
Bit 5 | Rsvd. | 保留
-------+-------------------------+------------------------------
Bit 4 | Rsvd. | 保留
-------+-------------------------+------------------------------
Bit 3 | Rsvd. | 保留
-------+-------------------------+------------------------------
Bit 2 | Rsvd. | 保留
-------+-------------------------+------------------------------
Bit 1 | SEG_LCD_ICON_FORCE_STAT | 强制显示状态 1-强制点亮 0-强制熄灭
-------+-------------------------+------------------------------
Bit 0 | SEG_LCD_ICON_STAT | 显示状态 1-点亮 0-熄灭
================================================================
******************************************************************************/
#define SEG_LCD_ICON_FORCE ((uint8_t)0x80)
#define SEG_LCD_ICON_FORCE_STAT ((uint8_t)0x02)
#define SEG_LCD_ICON_STAT ((uint8_t)0x01)
#define Clr_Bit(p, b) (p) &= (~(1u << (b)))
#define Set_Bit(p, b) (p) |= (1u << (b))
#define Bit_Is_Set(p, b) ((p) &(1u << (b)))
#define Bit_Is_Clr(p, b) (!((p) & (1u << (b))))
/******************************************************************************
Icon开关状态
******************************************************************************/
typedef enum
{
SEG_LCD_ICON_OFF = 0, //熄灭图标
SEG_LCD_ICON_ON, //点亮图标
SEG_LCD_ICON_FORCE_OFF, //强制熄灭图标,通过 SEG_LCD_ICON_OFF / SEG_LCD_ICON_ON 状态不能控制图标熄灭或点亮
SEG_LCD_ICON_FORCE_ON, //强制点亮图标,通过 SEG_LCD_ICON_OFF / SEG_LCD_ICON_ON 状态不能控制图标熄灭或点亮
SEG_LCD_ICON_FREE, //取消对图标的强制熄灭或点亮,将图标交由 SEG_LCD_ICON_OFF / SEG_LCD_ICON_ON 状态控制
}SEGLCDIconStatusEnum;
/**********************************************************************************
全局变量
***********************************************************************************/
extern SEGLCDBackupStruct SEGLCDBackup;
/******************************************************************************
函数声明
******************************************************************************/
void SEG_LCD_Init(void);
void SEG_LCD_Shutdown(void);
void SEG_LCD_Gear_Display(uint8_t m_Flag, uint8_t SegNum, uint8_t CanStand);
void SEG_LCD_Gear_Selftest(uint8_t Gear);
void SEG_LCD_Vehicle_Speed_Num_Display(uint8_t m_Flag, uint8_t SetMode, uint16_t Vspeed); //1:mph default:km/h
void SEG_LCD_Vehicle_Speed_Num_Selftest(uint16_t Vspeed);
void SEG_LCD_Engine_Speed_Seg_Display(uint8_t m_Flag, uint16_t SegNum, uint8_t SpeedStand);
void SEG_LCD_Engine_Speed_Seg_Selftest(uint16_t SegNum);
void SEG_LCD_ODO_Trip_Display(uint8_t m_Flag, uint8_t Mode, uint8_t Unit, uint32_t Mileage);
void SEG_LCD_FaultCode_Display(uint8_t m_Flag, uint32_t FaultCodeDisp);
void SEG_LCD_ODO_Trip_FaultCode_Selftest(uint8_t Mileage);
void SEG_LCD_BatteryErr_Display(uint8_t m_Flag, uint32_t ModeTime);
void SEG_Coolant_Temp_Display(uint8_t m_Flag, uint8_t Seg);
void SEG_Fuel_Level_Display(uint8_t m_Flag, uint8_t Seg);
void SEG_LCD_Battery_Voltage_Display(uint8_t m_Flag, uint8_t Voltage ,uint16_t VolCANset);
void SEG_LCD_Battery_Voltage_Selftest(uint8_t Voltage);
//Light
void SEG_LCD_OilPressure(uint8_t state);
void SEG_LCD_TirePressure(uint8_t state);
void SEG_LCD_READY(uint8_t state);
void SEG_LCD_ABS(uint8_t state);
void SEG_LCD_TSC(uint8_t state);
void SEG_LCD_AutoStarStop(uint8_t state);
void SEG_LCD_Batterylow(uint8_t state);
void SEG_LCD_HI_BEAM(uint8_t state);
void SEG_LCD_Shore(uint8_t state);
void SEG_LCD_OBD(uint8_t state);
void SEG_LCD_HighBeam(uint8_t state);
void SEG_LCD_LeftTurn(uint8_t state);
void SEG_LCD_RightTurn(uint8_t state);
void SEG_LCD_Fuel(uint8_t state);
void SEG_LCD_Temp(uint8_t state);
void Engine_Speed_Update(void);
#endif
#include "BU98R10.h"
#include "SEG_LCD.h"
#include "IS31FL3236.h"
/* 端口寄存器基地址 */
......
#include "SEG_LCD.h"
#include "Flash_synchronizer.h"
#include "Data_Gear.h"
#include "MCU_Core_Protocol.h"
#include "Common_Interface.h"
#include "BU98R10.h"
#include "app_Telltales.h"
#include "string.h"
SEGLCDBackupStruct SEGLCDBackup;
uint8_t DispText[6];
/*0, 1, 2, 3, 4, 5, 6, 7, 8, 9 */
const uint8_t SEG_DISPLAY_NUMBER0[] = {0x3Fu, 0x06u, 0x5Bu, 0x4Fu, 0x66u, 0x6Du, 0x7Du, 0x07u, 0x7Fu, 0x6Fu};
const uint8_t SEG_UNDISPLAY_NUMBER0[] = {0x00u, 0x06u, 0x5Bu, 0x4Fu, 0x66u, 0x6Du, 0x7Du, 0x07u, 0x7Fu, 0x6Fu};
/*0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F */
const uint8_t SEG_HEX_DISPLAY_NUMBER0[] = {0x3Fu, 0x06u, 0x5Bu, 0x4Fu, 0x66u, 0x6Du, 0x7Du, 0x07u, 0x7Fu, 0x6Fu, 0x77u, 0x7Cu, 0x39u, 0x5Eu, 0x79u, 0x71u};
void SEG_LCD_Init(void)
{
SEG_LCD_Vehicle_Speed_Num_Display(0, 0, 0);
SEG_LCD_Engine_Speed_Seg_Display(0, 0, 0);
SEG_LCD_ODO_Trip_Display(0, 0, 0, 0);
SEG_Fuel_Level_Display(0, 0);
SEG_LCD_Battery_Voltage_Display(0, 0 ,0);
SEG_Coolant_Temp_Display(0, 0);
SEG_LCD_Gear_Display(0, 0, 0);
BU98R10_Init();
}
void SEG_LCD_Shutdown(void)
{
BU98R10_Shutdown();
App_Telltales_AllOFF();
SEGLCDBackup.Brightness = 0x00;
SEGLCDBackup.Window = 0x00;
}
void Conv_Single_DECHEX(uint8_t *m_NUM, uint32_t FaultCodeDisp)
{
uint8_t temp8 = 0;
uint8_t cont = 0;
memset(m_NUM, 0, 4);
if (FaultCodeDisp < 16)
{
m_NUM[0] = FaultCodeDisp;
}
while (FaultCodeDisp >= 16)
{
temp8 = (FaultCodeDisp % 16);
m_NUM[cont] = temp8;
cont++;
FaultCodeDisp /= 16;
if (FaultCodeDisp < 16)
m_NUM[cont] = FaultCodeDisp;
}
}
/******************************************************************************
��������SEG_LCD_Gear_Display
�� ��: ��λ����ʾ
�� ��:
����ֵ��
******************************************************************************/
void SEG_LCD_Gear_Display(uint8_t m_Flag, uint8_t SegNum, uint8_t CanStand)
{
uint8_t Num;
uint8_t m8;
static uint8_t Gear;
if (m_Flag == 1)
{
PORT_SetBit(LightModeCtrl); //背光 ON
if (CanStand == CAN_SIG_NORMAL)
{
Gear = SegNum;
}
if (SEGLCDBackup.Gear != Gear)
{
SEGLCDBackup.Gear = Gear;
BU98R10_1_SEG46 = SEG_LCD_LIGHT; // Mode
BU98R10_1_SEG47 = SEG_LCD_LIGHT; // P
if (Gear >= 2)
{
BU98R10_1_SEG54 = SEG_LCD_OFF;
BU98R10_1_SEG53 = SEG_LCD_OFF;
BU98R10_1_SEG52 = SEG_LCD_OFF;
BU98R10_1_SEG51 = SEG_LCD_OFF;
BU98R10_1_SEG50 = SEG_LCD_OFF;
BU98R10_1_SEG48 = SEG_LCD_OFF;
BU98R10_1_SEG49 = SEG_LCD_LIGHT;
}
else
{
/*个位*/
Num = Gear % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_1_SEG54 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG54 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_1_SEG53 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG53 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_1_SEG52 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG52 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_1_SEG51 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG51 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_1_SEG50 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG50 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_1_SEG48 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG48 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_1_SEG49 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG49 = SEG_LCD_OFF;
}
}
}
}
else
{
PORT_ClrBit(LightModeCtrl); //背光OFF
BU98R10_1_SEG46 = SEG_LCD_OFF; // Mode
BU98R10_1_SEG47 = SEG_LCD_OFF; // P
BU98R10_1_SEG54 = SEG_LCD_OFF;
BU98R10_1_SEG53 = SEG_LCD_OFF;
BU98R10_1_SEG52 = SEG_LCD_OFF;
BU98R10_1_SEG51 = SEG_LCD_OFF;
BU98R10_1_SEG50 = SEG_LCD_OFF;
BU98R10_1_SEG48 = SEG_LCD_OFF;
BU98R10_1_SEG49 = SEG_LCD_OFF;
SEGLCDBackup.Gear = 0xff;
}
}
void SEG_LCD_Gear_Selftest(uint8_t Gear)
{
uint8_t Num;
uint8_t m8;
PORT_SetBit(LightModeCtrl); //背光 ON
if (SEGLCDBackup.Gear != Gear)
{
SEGLCDBackup.Gear = Gear;
BU98R10_1_SEG46 = SEG_LCD_LIGHT; // Mode
BU98R10_1_SEG47 = SEG_LCD_LIGHT; // P
/*个位*/
Gear = Gear > 9 ? 9 : Gear;
Num = Gear % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_1_SEG54 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG54 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_1_SEG53 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG53 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_1_SEG52 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG52 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_1_SEG51 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG51 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_1_SEG50 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG50 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_1_SEG48 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG48 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_1_SEG49 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG49 = SEG_LCD_OFF;
}
}
}
/******************************************************************************
��������SEG_LCD_Vehicle_Speed_Num_Display
�� ��: ���복����ʾ
�� ��:
����ֵ��
******************************************************************************/
void SEG_LCD_Vehicle_Speed_Num_Display(uint8_t m_Flag, uint8_t SetMode ,uint16_t Vspeed)
{
uint8_t Num;
uint8_t m8;
if (m_Flag == 1)
{
if ((SEGLCDBackup.VSpeed != Vspeed) || (SEGLCDBackup.SetMode != SetMode))
{
SEGLCDBackup.VSpeed = Vspeed;
SEGLCDBackup.SetMode = SetMode;
if(SetMode == 1)
{
BU98R10_1_SEG64 = SEG_LCD_LIGHT; //mph
BU98R10_1_SEG63 = SEG_LCD_OFF;
}
else
{
BU98R10_1_SEG63 = SEG_LCD_LIGHT; //km/h
BU98R10_1_SEG64 = SEG_LCD_OFF;
}
/*百位*/
Num = Vspeed / 100u;
if (Num >= 1u)
{
BU98R10_0_SEG51 = SEG_LCD_LIGHT;
PORT_SetBit(LightVehHundredsCtrl);
}
else
{
BU98R10_0_SEG51 = SEG_LCD_OFF;
PORT_ClrBit(LightVehHundredsCtrl);
}
/*十位*/
Num = (Vspeed / 10u) % 10u;
if (Vspeed >= 10u)
{
PORT_SetBit(LightVehTensCtrl);
}
else
{
PORT_ClrBit(LightVehTensCtrl);
}
if (Vspeed >= 100u)
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
else
{
m8 = SEG_UNDISPLAY_NUMBER0[Num];
}
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG43 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG43 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG42 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG42 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG41 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG41 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG34 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG34 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG48 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG48 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG46 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG46 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG47 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG47 = SEG_LCD_OFF;
}
/*个位*/
Num = Vspeed % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_1_SEG62 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG62 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_1_SEG61 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG61 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_1_SEG59 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG59 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_1_SEG58 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG58 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_1_SEG57 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG57 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_1_SEG56 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG56 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_1_SEG60 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG60 = SEG_LCD_OFF;
}
}
}
else
{
BU98R10_1_SEG64 = SEG_LCD_OFF; // mph
BU98R10_1_SEG63 = SEG_LCD_OFF; // km/h
BU98R10_0_SEG51 = SEG_LCD_OFF;
BU98R10_0_SEG43 = SEG_LCD_OFF;
BU98R10_0_SEG42 = SEG_LCD_OFF;
BU98R10_0_SEG41 = SEG_LCD_OFF;
BU98R10_0_SEG34 = SEG_LCD_OFF;
BU98R10_0_SEG48 = SEG_LCD_OFF;
BU98R10_0_SEG46 = SEG_LCD_OFF;
BU98R10_0_SEG47 = SEG_LCD_OFF;
BU98R10_1_SEG62 = SEG_LCD_OFF;
BU98R10_1_SEG61 = SEG_LCD_OFF;
BU98R10_1_SEG59 = SEG_LCD_OFF;
BU98R10_1_SEG58 = SEG_LCD_OFF;
BU98R10_1_SEG57 = SEG_LCD_OFF;
BU98R10_1_SEG56 = SEG_LCD_OFF;
BU98R10_1_SEG60 = SEG_LCD_OFF;
SEGLCDBackup.VSpeed = 0xFFFF;
SEGLCDBackup.SetMode = 0xFF;
}
}
void SEG_LCD_Vehicle_Speed_Num_Selftest(uint16_t Vspeed)
{
uint8_t Num;
uint8_t m8;
if (SEGLCDBackup.VSpeed != Vspeed)
{
SEGLCDBackup.VSpeed = Vspeed;
SEGLCDBackup.SetMode = 0xFF;;
BU98R10_1_SEG63 = SEG_LCD_LIGHT; //km/h
BU98R10_1_SEG64 = SEG_LCD_LIGHT;
Vspeed = Vspeed > 9 ? 9 : Vspeed;
/*百位*/
if (Vspeed)
{
BU98R10_0_SEG51 = SEG_LCD_LIGHT;
PORT_SetBit(LightVehHundredsCtrl);
}
else
{
BU98R10_0_SEG51 = SEG_LCD_OFF;
PORT_ClrBit(LightVehHundredsCtrl);
}
/*十位*/
PORT_SetBit(LightVehTensCtrl);
Num = Vspeed % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG43 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG43 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG42 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG42 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG41 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG41 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG34 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG34 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG48 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG48 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG46 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG46 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG47 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG47 = SEG_LCD_OFF;
}
/*个位*/
Num = Vspeed % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_1_SEG62 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG62 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_1_SEG61 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG61 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_1_SEG59 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG59 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_1_SEG58 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG58 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_1_SEG57 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG57 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_1_SEG56 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG56 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_1_SEG60 = SEG_LCD_LIGHT;
}
else
{
BU98R10_1_SEG60 = SEG_LCD_OFF;
}
}
}
/******************************************************************************
��������SEG_LCD_Engine_Speed_Seg_Display
�� ��: ת�ٵ�SEG��ʾ
�� ��:
����ֵ��
******************************************************************************/
uint16_t DispSegNum = 0 ;
uint8_t OldSpeedStand = 0 ;
void SEG_LCD_Engine_Speed_Seg_Display(uint8_t m_Flag, uint16_t SegNum, uint8_t SpeedStand)
{
static uint8_t time = 0;
if (m_Flag == 1)
{
SegNum = (SegNum + SegNum / 20) / 500;
if (SegNum > 24)
SegNum = 24;
if (SpeedStand == 1)
{
OldSpeedStand = 5;
}
if (DispSegNum > SegNum)
{
if (time >= 2)
{
time = 0;
DispSegNum--;
}
}
if (DispSegNum < SegNum)
{
DispSegNum++;
if (OldSpeedStand)
{
OldSpeedStand--;
DispSegNum = SegNum;
}
}
time++;
BU98R10_0_SEG130 = SEG_LCD_OFF; //Mark
BU98R10_1_SEG70 = SEG_LCD_OFF; //Mark
BU98R10_1_SEG31 = SEG_LCD_OFF; //Mark
BU98R10_0_SEG101 = SEG_LCD_LIGHT; //Touch1
BU98R10_1_SEG55 = SEG_LCD_LIGHT; //Touch1
BU98R10_0_SEG37 = SEG_LCD_LIGHT; //X1000r/min
BU98R10_0_SEG96 = SEG_LCD_LIGHT;
BU98R10_0_SEG91 = SEG_LCD_LIGHT;
BU98R10_0_SEG86 = SEG_LCD_LIGHT;
BU98R10_0_SEG81 = SEG_LCD_LIGHT;
BU98R10_0_SEG76 = SEG_LCD_LIGHT;
BU98R10_0_SEG72 = SEG_LCD_LIGHT;
BU98R10_0_SEG71 = SEG_LCD_LIGHT;
BU98R10_0_SEG70 = SEG_LCD_LIGHT;
BU98R10_0_SEG69 = SEG_LCD_LIGHT;
BU98R10_0_SEG63 = SEG_LCD_LIGHT;
BU98R10_0_SEG58 = SEG_LCD_LIGHT;
BU98R10_0_SEG53 = SEG_LCD_LIGHT;
BU98R10_0_SEG49 = SEG_LCD_LIGHT;
BU98R10_0_SEG44 = SEG_LCD_LIGHT;
BU98R10_0_SEG38 = SEG_LCD_LIGHT;
BU98R10_0_SEG36 = SEG_LCD_LIGHT;
BU98R10_0_SEG32 = SEG_LCD_LIGHT;
BU98R10_0_SEG31 = SEG_LCD_LIGHT;
BU98R10_0_SEG16 = SEG_LCD_LIGHT;
BU98R10_0_SEG17 = SEG_LCD_LIGHT;
BU98R10_0_SEG18 = SEG_LCD_LIGHT;
BU98R10_0_SEG21 = SEG_LCD_LIGHT;
BU98R10_0_SEG23 = SEG_LCD_LIGHT;
BU98R10_0_SEG25 = SEG_LCD_LIGHT;
BU98R10_0_SEG26 = SEG_LCD_LIGHT;
if (SEGLCDBackup.ESpeedSeg != DispSegNum)
{
SEGLCDBackup.ESpeedSeg = DispSegNum;
BU98R10_0_SEG100 = SEG_LCD_GRAY_2;
BU98R10_0_SEG95 = SEG_LCD_GRAY_2;
BU98R10_0_SEG90 = SEG_LCD_GRAY_2;
BU98R10_0_SEG85 = SEG_LCD_GRAY_2;
BU98R10_0_SEG80 = SEG_LCD_GRAY_2;
BU98R10_0_SEG75 = SEG_LCD_GRAY_2;
BU98R10_0_SEG74 = SEG_LCD_GRAY_2;
BU98R10_0_SEG73 = SEG_LCD_GRAY_2;
BU98R10_0_SEG68 = SEG_LCD_GRAY_2;
BU98R10_0_SEG64 = SEG_LCD_GRAY_2;
BU98R10_0_SEG59 = SEG_LCD_GRAY_2;
BU98R10_0_SEG54 = SEG_LCD_GRAY_2;
BU98R10_0_SEG50 = SEG_LCD_GRAY_2;
BU98R10_0_SEG45 = SEG_LCD_GRAY_2;
BU98R10_0_SEG40 = SEG_LCD_GRAY_2;
BU98R10_0_SEG39 = SEG_LCD_GRAY_2;
BU98R10_0_SEG35 = SEG_LCD_GRAY_2;
BU98R10_0_SEG33 = SEG_LCD_GRAY_2;
BU98R10_0_SEG30 = SEG_LCD_GRAY_2;
BU98R10_0_SEG29 = SEG_LCD_GRAY_2;
BU98R10_0_SEG19 = SEG_LCD_GRAY_2;
BU98R10_0_SEG20 = SEG_LCD_GRAY_2;
BU98R10_0_SEG22 = SEG_LCD_GRAY_2;
BU98R10_0_SEG24 = SEG_LCD_GRAY_2;
BU98R10_0_SEG27 = SEG_LCD_GRAY_2;
BU98R10_0_SEG28 = SEG_LCD_GRAY_2;
switch (DispSegNum)
{
case 24 : BU98R10_0_SEG27 = SEG_LCD_LIGHT;
case 23 : BU98R10_0_SEG24 = SEG_LCD_LIGHT;
case 22 : BU98R10_0_SEG22 = SEG_LCD_LIGHT;
case 21 : BU98R10_0_SEG20 = SEG_LCD_LIGHT;
case 20 : BU98R10_0_SEG19 = SEG_LCD_LIGHT;
case 19 : BU98R10_0_SEG29 = SEG_LCD_LIGHT;
case 18 : BU98R10_0_SEG30 = SEG_LCD_LIGHT;
case 17 : BU98R10_0_SEG33 = SEG_LCD_LIGHT;
case 16 : BU98R10_0_SEG35 = SEG_LCD_LIGHT;
case 15 : BU98R10_0_SEG39 = SEG_LCD_LIGHT;
case 14 : BU98R10_0_SEG40 = SEG_LCD_LIGHT;
case 13 : BU98R10_0_SEG45 = SEG_LCD_LIGHT;
case 12 : BU98R10_0_SEG50 = SEG_LCD_LIGHT;
case 11 : BU98R10_0_SEG54 = SEG_LCD_LIGHT;
case 10 : BU98R10_0_SEG59 = SEG_LCD_LIGHT;
case 9 : BU98R10_0_SEG64 = SEG_LCD_LIGHT;
case 8 : BU98R10_0_SEG68 = SEG_LCD_LIGHT;
case 7 : BU98R10_0_SEG73 = SEG_LCD_LIGHT;
case 6 : BU98R10_0_SEG74 = SEG_LCD_LIGHT;
case 5 : BU98R10_0_SEG75 = SEG_LCD_LIGHT;
case 4 : BU98R10_0_SEG80 = SEG_LCD_LIGHT;
case 3 : BU98R10_0_SEG85 = SEG_LCD_LIGHT;
case 2 : BU98R10_0_SEG90 = SEG_LCD_LIGHT;
case 1 : BU98R10_0_SEG95 = SEG_LCD_LIGHT;
default : break;
}
}
}
else
{
BU98R10_0_SEG130 = SEG_LCD_OFF; //Mark
BU98R10_1_SEG70 = SEG_LCD_OFF; //Mark
BU98R10_1_SEG31 = SEG_LCD_OFF; //Mark
BU98R10_0_SEG101 = SEG_LCD_OFF; //Touch1
BU98R10_1_SEG55 = SEG_LCD_OFF; //Touch1
BU98R10_0_SEG37 = SEG_LCD_OFF; //X1000r/min
BU98R10_0_SEG96 = SEG_LCD_OFF;
BU98R10_0_SEG91 = SEG_LCD_OFF;
BU98R10_0_SEG86 = SEG_LCD_OFF;
BU98R10_0_SEG81 = SEG_LCD_OFF;
BU98R10_0_SEG76 = SEG_LCD_OFF;
BU98R10_0_SEG72 = SEG_LCD_OFF;
BU98R10_0_SEG71 = SEG_LCD_OFF;
BU98R10_0_SEG70 = SEG_LCD_OFF;
BU98R10_0_SEG69 = SEG_LCD_OFF;
BU98R10_0_SEG63 = SEG_LCD_OFF;
BU98R10_0_SEG58 = SEG_LCD_OFF;
BU98R10_0_SEG53 = SEG_LCD_OFF;
BU98R10_0_SEG49 = SEG_LCD_OFF;
BU98R10_0_SEG44 = SEG_LCD_OFF;
BU98R10_0_SEG38 = SEG_LCD_OFF;
BU98R10_0_SEG36 = SEG_LCD_OFF;
BU98R10_0_SEG32 = SEG_LCD_OFF;
BU98R10_0_SEG31 = SEG_LCD_OFF;
BU98R10_0_SEG16 = SEG_LCD_OFF;
BU98R10_0_SEG17 = SEG_LCD_OFF;
BU98R10_0_SEG18 = SEG_LCD_OFF;
BU98R10_0_SEG21 = SEG_LCD_OFF;
BU98R10_0_SEG23 = SEG_LCD_OFF;
BU98R10_0_SEG25 = SEG_LCD_OFF;
BU98R10_0_SEG26 = SEG_LCD_OFF;
BU98R10_0_SEG100 = SEG_LCD_GRAY_2;
BU98R10_0_SEG95 = SEG_LCD_GRAY_2;
BU98R10_0_SEG90 = SEG_LCD_GRAY_2;
BU98R10_0_SEG85 = SEG_LCD_GRAY_2;
BU98R10_0_SEG80 = SEG_LCD_GRAY_2;
BU98R10_0_SEG75 = SEG_LCD_GRAY_2;
BU98R10_0_SEG74 = SEG_LCD_GRAY_2;
BU98R10_0_SEG73 = SEG_LCD_GRAY_2;
BU98R10_0_SEG68 = SEG_LCD_GRAY_2;
BU98R10_0_SEG64 = SEG_LCD_GRAY_2;
BU98R10_0_SEG59 = SEG_LCD_GRAY_2;
BU98R10_0_SEG54 = SEG_LCD_GRAY_2;
BU98R10_0_SEG50 = SEG_LCD_GRAY_2;
BU98R10_0_SEG45 = SEG_LCD_GRAY_2;
BU98R10_0_SEG40 = SEG_LCD_GRAY_2;
BU98R10_0_SEG39 = SEG_LCD_GRAY_2;
BU98R10_0_SEG35 = SEG_LCD_GRAY_2;
BU98R10_0_SEG33 = SEG_LCD_GRAY_2;
BU98R10_0_SEG30 = SEG_LCD_GRAY_2;
BU98R10_0_SEG29 = SEG_LCD_GRAY_2;
BU98R10_0_SEG19 = SEG_LCD_GRAY_2;
BU98R10_0_SEG20 = SEG_LCD_GRAY_2;
BU98R10_0_SEG22 = SEG_LCD_GRAY_2;
BU98R10_0_SEG24 = SEG_LCD_GRAY_2;
BU98R10_0_SEG27 = SEG_LCD_GRAY_2;
BU98R10_0_SEG28 = SEG_LCD_GRAY_2;
SEGLCDBackup.ESpeedSeg = 0xff;
}
}
void SEG_LCD_Engine_Speed_Seg_Selftest(uint16_t SegNum)
{
SegNum = (SegNum+SegNum/20)/500;
if (SegNum > 24)
SegNum = 24;
BU98R10_0_SEG130 = SEG_LCD_OFF; //Mark
BU98R10_1_SEG70 = SEG_LCD_OFF; //Mark
BU98R10_1_SEG31 = SEG_LCD_OFF; //Mark
BU98R10_0_SEG101 = SEG_LCD_LIGHT; //Touch1
BU98R10_1_SEG55 = SEG_LCD_LIGHT; //Touch1
BU98R10_0_SEG37 = SEG_LCD_LIGHT; //X1000r/min
BU98R10_0_SEG96 = SEG_LCD_LIGHT;
BU98R10_0_SEG91 = SEG_LCD_LIGHT;
BU98R10_0_SEG86 = SEG_LCD_LIGHT;
BU98R10_0_SEG81 = SEG_LCD_LIGHT;
BU98R10_0_SEG76 = SEG_LCD_LIGHT;
BU98R10_0_SEG72 = SEG_LCD_LIGHT;
BU98R10_0_SEG71 = SEG_LCD_LIGHT;
BU98R10_0_SEG70 = SEG_LCD_LIGHT;
BU98R10_0_SEG69 = SEG_LCD_LIGHT;
BU98R10_0_SEG63 = SEG_LCD_LIGHT;
BU98R10_0_SEG58 = SEG_LCD_LIGHT;
BU98R10_0_SEG53 = SEG_LCD_LIGHT;
BU98R10_0_SEG49 = SEG_LCD_LIGHT;
BU98R10_0_SEG44 = SEG_LCD_LIGHT;
BU98R10_0_SEG38 = SEG_LCD_LIGHT;
BU98R10_0_SEG36 = SEG_LCD_LIGHT;
BU98R10_0_SEG32 = SEG_LCD_LIGHT;
BU98R10_0_SEG31 = SEG_LCD_LIGHT;
BU98R10_0_SEG16 = SEG_LCD_LIGHT;
BU98R10_0_SEG17 = SEG_LCD_LIGHT;
BU98R10_0_SEG18 = SEG_LCD_LIGHT;
BU98R10_0_SEG21 = SEG_LCD_LIGHT;
BU98R10_0_SEG23 = SEG_LCD_LIGHT;
BU98R10_0_SEG25 = SEG_LCD_LIGHT;
BU98R10_0_SEG26 = SEG_LCD_LIGHT;
if (SEGLCDBackup.ESpeedSeg != SegNum)
{
SEGLCDBackup.ESpeedSeg = SegNum;
BU98R10_0_SEG100 = SEG_LCD_GRAY_2;
BU98R10_0_SEG95 = SEG_LCD_GRAY_2;
BU98R10_0_SEG90 = SEG_LCD_GRAY_2;
BU98R10_0_SEG85 = SEG_LCD_GRAY_2;
BU98R10_0_SEG80 = SEG_LCD_GRAY_2;
BU98R10_0_SEG75 = SEG_LCD_GRAY_2;
BU98R10_0_SEG74 = SEG_LCD_GRAY_2;
BU98R10_0_SEG73 = SEG_LCD_GRAY_2;
BU98R10_0_SEG68 = SEG_LCD_GRAY_2;
BU98R10_0_SEG64 = SEG_LCD_GRAY_2;
BU98R10_0_SEG59 = SEG_LCD_GRAY_2;
BU98R10_0_SEG54 = SEG_LCD_GRAY_2;
BU98R10_0_SEG50 = SEG_LCD_GRAY_2;
BU98R10_0_SEG45 = SEG_LCD_GRAY_2;
BU98R10_0_SEG40 = SEG_LCD_GRAY_2;
BU98R10_0_SEG39 = SEG_LCD_GRAY_2;
BU98R10_0_SEG35 = SEG_LCD_GRAY_2;
BU98R10_0_SEG33 = SEG_LCD_GRAY_2;
BU98R10_0_SEG30 = SEG_LCD_GRAY_2;
BU98R10_0_SEG29 = SEG_LCD_GRAY_2;
BU98R10_0_SEG19 = SEG_LCD_GRAY_2;
BU98R10_0_SEG20 = SEG_LCD_GRAY_2;
BU98R10_0_SEG22 = SEG_LCD_GRAY_2;
BU98R10_0_SEG24 = SEG_LCD_GRAY_2;
BU98R10_0_SEG27 = SEG_LCD_GRAY_2;
BU98R10_0_SEG28 = SEG_LCD_GRAY_2;
switch (SegNum)
{
case 24 : BU98R10_0_SEG27 = SEG_LCD_LIGHT;
case 23 : BU98R10_0_SEG24 = SEG_LCD_LIGHT;
case 22 : BU98R10_0_SEG22 = SEG_LCD_LIGHT;
case 21 : BU98R10_0_SEG20 = SEG_LCD_LIGHT;
case 20 : BU98R10_0_SEG19 = SEG_LCD_LIGHT;
case 19 : BU98R10_0_SEG29 = SEG_LCD_LIGHT;
case 18 : BU98R10_0_SEG30 = SEG_LCD_LIGHT;
case 17 : BU98R10_0_SEG33 = SEG_LCD_LIGHT;
case 16 : BU98R10_0_SEG35 = SEG_LCD_LIGHT;
case 15 : BU98R10_0_SEG39 = SEG_LCD_LIGHT;
case 14 : BU98R10_0_SEG40 = SEG_LCD_LIGHT;
case 13 : BU98R10_0_SEG45 = SEG_LCD_LIGHT;
case 12 : BU98R10_0_SEG50 = SEG_LCD_LIGHT;
case 11 : BU98R10_0_SEG54 = SEG_LCD_LIGHT;
case 10 : BU98R10_0_SEG59 = SEG_LCD_LIGHT;
case 9 : BU98R10_0_SEG64 = SEG_LCD_LIGHT;
case 8 : BU98R10_0_SEG68 = SEG_LCD_LIGHT;
case 7 : BU98R10_0_SEG73 = SEG_LCD_LIGHT;
case 6 : BU98R10_0_SEG74 = SEG_LCD_LIGHT;
case 5 : BU98R10_0_SEG75 = SEG_LCD_LIGHT;
case 4 : BU98R10_0_SEG80 = SEG_LCD_LIGHT;
case 3 : BU98R10_0_SEG85 = SEG_LCD_LIGHT;
case 2 : BU98R10_0_SEG90 = SEG_LCD_LIGHT;
case 1 : BU98R10_0_SEG95 = SEG_LCD_LIGHT;
default : break;
}
}
}
/******************************************************************************
�������SSEG_LCD_ODO_Trip_Display
�� ��: ODO_Trip������ʾ
�� ��: Mode0:TOTAL ,Mode1:Trip 1 ,Mode2:Trip 2 ,Mode3:FaultCode, Unit0:km ,Unit1:miles
����ֵ��
******************************************************************************/
void SEG_LCD_ODO_Trip_Display(uint8_t m_Flag, uint8_t Mode ,uint8_t Unit, uint32_t Mileage)
{
uint32_t m_NUM;
uint32_t Num;
uint8_t m8;
if (m_Flag == 1u)
{
if ((SEGLCDBackup.ODOMode != Mode) || (SEGLCDBackup.ODOUnit != Unit) || (SEGLCDBackup.ODOMileage != Mileage))
{
SEGLCDBackup.ODOMode = Mode;
SEGLCDBackup.ODOUnit = Unit;
SEGLCDBackup.ODOMileage = Mileage;
m_NUM = Mileage;// /10倍;
if(Unit == 1)
{
BU98R10_0_SEG168 = SEG_LCD_OFF; //miles
BU98R10_0_SEG169 = SEG_LCD_LIGHT;
BU98R10_0_SEG170 = SEG_LCD_LIGHT;
}
else if(Unit == 0)
{
BU98R10_0_SEG168 = SEG_LCD_LIGHT; //Km
BU98R10_0_SEG169 = SEG_LCD_LIGHT;
BU98R10_0_SEG170 = SEG_LCD_OFF;
}
if (Mode == 0)
{
m_NUM = m_NUM > 999999 ? 999999 : m_NUM;
m_NUM /= 10;
BU98R10_0_SEG164 = SEG_LCD_OFF; //Point
BU98R10_0_SEG146 = SEG_LCD_OFF; //TOTAL
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_LIGHT;
}
else if (Mode == 1)
{
BU98R10_0_SEG164 = SEG_LCD_LIGHT; //point
BU98R10_0_SEG146 = SEG_LCD_LIGHT; //TRIPA
BU98R10_0_SEG147 = SEG_LCD_LIGHT;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_OFF;
}
else if (Mode == 2)
{
BU98R10_0_SEG164 = SEG_LCD_LIGHT; //point
BU98R10_0_SEG146 = SEG_LCD_LIGHT; //TRIPB
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_LIGHT;
BU98R10_0_SEG149 = SEG_LCD_OFF;
}
/*十万位*/
Num = (m_NUM / 100000u);
m8 = SEG_UNDISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG143 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG143 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG142 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG142 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG152 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG152 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG151 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG151 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG145 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG145 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG144 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG144 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG141 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG141 = SEG_LCD_OFF;
}
/*万位*/
Num = (m_NUM / 10000u) % 10u;
if (m_NUM > 99999)
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
else
{
m8 = SEG_UNDISPLAY_NUMBER0[Num];
}
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG138 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG138 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG137 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG137 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG136 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG136 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG154 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG154 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG153 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG153 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG139 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG139 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG140 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG140 = SEG_LCD_OFF;
}
/*千位*/
Num = (m_NUM / 1000u) % 10u;
if (m_NUM > 9999)
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
else
{
m8 = SEG_UNDISPLAY_NUMBER0[Num];
}
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG128 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG128 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG127 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG127 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG157 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG157 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG156 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG156 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG155 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG155 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG135 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG135 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG114 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG114 = SEG_LCD_OFF;
}
/*百位*/
Num = (m_NUM / 100u) % 10u;
if (m_NUM > 999)
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
else
{
m8 = SEG_UNDISPLAY_NUMBER0[Num];
}
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG111 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG111 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG110 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG110 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG160 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG160 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG159 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG159 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG158 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG158 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG112 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG112 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG113 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG113 = SEG_LCD_OFF;
}
/*十位*/
Num = (m_NUM / 10u) % 10u;
if ((Mode == 1) || (Mode == 2))
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
else
{
if (m_NUM > 99)
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
else
{
m8 = SEG_UNDISPLAY_NUMBER0[Num];
}
}
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG108 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG108 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG107 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG107 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG163 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG163 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG162 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG162 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG161 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG161 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG109 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG109 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG106 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG106 = SEG_LCD_OFF;
}
/*个位*/
Num = m_NUM % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG104 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG104 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG103 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG103 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG167 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG167 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG166 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG166 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG165 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG165 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG105 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG105 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG102 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG102 = SEG_LCD_OFF;
}
}
}
else
{
BU98R10_0_SEG168 = SEG_LCD_OFF; //Km
BU98R10_0_SEG169 = SEG_LCD_OFF;
BU98R10_0_SEG170 = SEG_LCD_OFF;
BU98R10_0_SEG164 = SEG_LCD_OFF; //Point
BU98R10_0_SEG146 = SEG_LCD_OFF; //TOTAL
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_OFF;
BU98R10_0_SEG143 = SEG_LCD_OFF;
BU98R10_0_SEG142 = SEG_LCD_OFF;
BU98R10_0_SEG152 = SEG_LCD_OFF;
BU98R10_0_SEG151 = SEG_LCD_OFF;
BU98R10_0_SEG145 = SEG_LCD_OFF;
BU98R10_0_SEG144 = SEG_LCD_OFF;
BU98R10_0_SEG141 = SEG_LCD_OFF;
BU98R10_0_SEG138 = SEG_LCD_OFF;
BU98R10_0_SEG137 = SEG_LCD_OFF;
BU98R10_0_SEG136 = SEG_LCD_OFF;
BU98R10_0_SEG154 = SEG_LCD_OFF;
BU98R10_0_SEG153 = SEG_LCD_OFF;
BU98R10_0_SEG139 = SEG_LCD_OFF;
BU98R10_0_SEG140 = SEG_LCD_OFF;
BU98R10_0_SEG128 = SEG_LCD_OFF;
BU98R10_0_SEG127 = SEG_LCD_OFF;
BU98R10_0_SEG157 = SEG_LCD_OFF;
BU98R10_0_SEG156 = SEG_LCD_OFF;
BU98R10_0_SEG155 = SEG_LCD_OFF;
BU98R10_0_SEG135 = SEG_LCD_OFF;
BU98R10_0_SEG114 = SEG_LCD_OFF;
BU98R10_0_SEG111 = SEG_LCD_OFF;
BU98R10_0_SEG110 = SEG_LCD_OFF;
BU98R10_0_SEG160 = SEG_LCD_OFF;
BU98R10_0_SEG159 = SEG_LCD_OFF;
BU98R10_0_SEG158 = SEG_LCD_OFF;
BU98R10_0_SEG112 = SEG_LCD_OFF;
BU98R10_0_SEG113 = SEG_LCD_OFF;
BU98R10_0_SEG108 = SEG_LCD_OFF;
BU98R10_0_SEG107 = SEG_LCD_OFF;
BU98R10_0_SEG163 = SEG_LCD_OFF;
BU98R10_0_SEG162 = SEG_LCD_OFF;
BU98R10_0_SEG161 = SEG_LCD_OFF;
BU98R10_0_SEG109 = SEG_LCD_OFF;
BU98R10_0_SEG106 = SEG_LCD_OFF;
BU98R10_0_SEG104 = SEG_LCD_OFF;
BU98R10_0_SEG103 = SEG_LCD_OFF;
BU98R10_0_SEG167 = SEG_LCD_OFF;
BU98R10_0_SEG166 = SEG_LCD_OFF;
BU98R10_0_SEG165 = SEG_LCD_OFF;
BU98R10_0_SEG105 = SEG_LCD_OFF;
BU98R10_0_SEG102 = SEG_LCD_OFF;
SEGLCDBackup.ODOMode = 0xFF;
SEGLCDBackup.ODOMileage = 0xFF;
SEGLCDBackup.ODOUnit = 0xFF;
}
SEGLCDBackup.ODOFaultCode = 0xFF;
}
void SEG_LCD_FaultCode_Display(uint8_t m_Flag, uint32_t FaultCodeDisp)
{
uint8_t m_NUM[4];
uint32_t Num;
uint8_t m8;
if (m_Flag == 1u)
{
BU98R10_0_SEG168 = SEG_LCD_OFF;
BU98R10_0_SEG169 = SEG_LCD_OFF;
BU98R10_0_SEG170 = SEG_LCD_OFF;
BU98R10_0_SEG164 = SEG_LCD_OFF; //point
BU98R10_0_SEG146 = SEG_LCD_OFF;
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_OFF;
BU98R10_0_SEG143 = SEG_LCD_OFF;
BU98R10_0_SEG142 = SEG_LCD_OFF;
BU98R10_0_SEG152 = SEG_LCD_OFF;
BU98R10_0_SEG151 = SEG_LCD_OFF;
BU98R10_0_SEG145 = SEG_LCD_OFF;
BU98R10_0_SEG144 = SEG_LCD_OFF;
BU98R10_0_SEG141 = SEG_LCD_OFF;
BU98R10_0_SEG138 = SEG_LCD_LIGHT; //P
BU98R10_0_SEG137 = SEG_LCD_LIGHT;
BU98R10_0_SEG136 = SEG_LCD_OFF;
BU98R10_0_SEG154 = SEG_LCD_OFF;
BU98R10_0_SEG153 = SEG_LCD_LIGHT;
BU98R10_0_SEG139 = SEG_LCD_LIGHT;
BU98R10_0_SEG140 = SEG_LCD_LIGHT;
if (SEGLCDBackup.ODOFaultCode != FaultCodeDisp)
{
SEGLCDBackup.ODOFaultCode = FaultCodeDisp;
Conv_Single_DECHEX(m_NUM, FaultCodeDisp);
/*千位*/
Num = m_NUM[3];
m8 = SEG_HEX_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG128 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG128 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG127 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG127 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG157 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG157 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG156 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG156 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG155 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG155 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG135 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG135 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG114 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG114 = SEG_LCD_OFF;
}
/*百位*/
Num = m_NUM[2];
m8 = SEG_HEX_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG111 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG111 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG110 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG110 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG160 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG160 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG159 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG159 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG158 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG158 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG112 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG112 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG113 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG113 = SEG_LCD_OFF;
}
/*十位*/
Num = m_NUM[1];
m8 = SEG_HEX_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG108 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG108 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG107 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG107 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG163 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG163 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG162 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG162 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG161 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG161 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG109 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG109 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG106 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG106 = SEG_LCD_OFF;
}
/*个位*/
Num = m_NUM[0];
m8 = SEG_HEX_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG104 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG104 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG103 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG103 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG167 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG167 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG166 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG166 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG165 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG165 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG105 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG105 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG102 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG102 = SEG_LCD_OFF;
}
}
}
else
{
BU98R10_0_SEG168 = SEG_LCD_OFF; //Km
BU98R10_0_SEG169 = SEG_LCD_OFF;
BU98R10_0_SEG170 = SEG_LCD_OFF;
BU98R10_0_SEG164 = SEG_LCD_OFF; //Point
BU98R10_0_SEG146 = SEG_LCD_OFF; //TOTAL
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_OFF;
BU98R10_0_SEG143 = SEG_LCD_OFF;
BU98R10_0_SEG142 = SEG_LCD_OFF;
BU98R10_0_SEG152 = SEG_LCD_OFF;
BU98R10_0_SEG151 = SEG_LCD_OFF;
BU98R10_0_SEG145 = SEG_LCD_OFF;
BU98R10_0_SEG144 = SEG_LCD_OFF;
BU98R10_0_SEG141 = SEG_LCD_OFF;
BU98R10_0_SEG138 = SEG_LCD_OFF;
BU98R10_0_SEG137 = SEG_LCD_OFF;
BU98R10_0_SEG136 = SEG_LCD_OFF;
BU98R10_0_SEG154 = SEG_LCD_OFF;
BU98R10_0_SEG153 = SEG_LCD_OFF;
BU98R10_0_SEG139 = SEG_LCD_OFF;
BU98R10_0_SEG140 = SEG_LCD_OFF;
BU98R10_0_SEG128 = SEG_LCD_OFF;
BU98R10_0_SEG127 = SEG_LCD_OFF;
BU98R10_0_SEG157 = SEG_LCD_OFF;
BU98R10_0_SEG156 = SEG_LCD_OFF;
BU98R10_0_SEG155 = SEG_LCD_OFF;
BU98R10_0_SEG135 = SEG_LCD_OFF;
BU98R10_0_SEG114 = SEG_LCD_OFF;
BU98R10_0_SEG111 = SEG_LCD_OFF;
BU98R10_0_SEG110 = SEG_LCD_OFF;
BU98R10_0_SEG160 = SEG_LCD_OFF;
BU98R10_0_SEG159 = SEG_LCD_OFF;
BU98R10_0_SEG158 = SEG_LCD_OFF;
BU98R10_0_SEG112 = SEG_LCD_OFF;
BU98R10_0_SEG113 = SEG_LCD_OFF;
BU98R10_0_SEG108 = SEG_LCD_OFF;
BU98R10_0_SEG107 = SEG_LCD_OFF;
BU98R10_0_SEG163 = SEG_LCD_OFF;
BU98R10_0_SEG162 = SEG_LCD_OFF;
BU98R10_0_SEG161 = SEG_LCD_OFF;
BU98R10_0_SEG109 = SEG_LCD_OFF;
BU98R10_0_SEG106 = SEG_LCD_OFF;
BU98R10_0_SEG104 = SEG_LCD_OFF;
BU98R10_0_SEG103 = SEG_LCD_OFF;
BU98R10_0_SEG167 = SEG_LCD_OFF;
BU98R10_0_SEG166 = SEG_LCD_OFF;
BU98R10_0_SEG165 = SEG_LCD_OFF;
BU98R10_0_SEG105 = SEG_LCD_OFF;
BU98R10_0_SEG102 = SEG_LCD_OFF;
SEGLCDBackup.ODOFaultCode = 0xFF;
}
SEGLCDBackup.ODOMode = 0xFF;
SEGLCDBackup.ODOMileage = 0xFF;
SEGLCDBackup.ODOUnit = 0xFF;
}
void SEG_LCD_ODO_Trip_FaultCode_Selftest(uint8_t Mileage)
{
uint32_t m_NUM;
uint32_t Num;
uint8_t m8;
if (SEGLCDBackup.ODOMileage != Mileage)
{
SEGLCDBackup.ODOMode = 0xFF;
SEGLCDBackup.ODOUnit = 0xFF;
SEGLCDBackup.ODOMileage = Mileage;
Mileage = Mileage > 9 ? 9 : Mileage;
m_NUM = Mileage % 10;// /10倍;
BU98R10_0_SEG168 = SEG_LCD_LIGHT;
BU98R10_0_SEG169 = SEG_LCD_LIGHT;
BU98R10_0_SEG170 = SEG_LCD_LIGHT;
BU98R10_0_SEG164 = SEG_LCD_OFF; //point
BU98R10_0_SEG146 = SEG_LCD_LIGHT;
BU98R10_0_SEG147 = SEG_LCD_LIGHT;
BU98R10_0_SEG148 = SEG_LCD_LIGHT;
BU98R10_0_SEG149 = SEG_LCD_LIGHT;
/*十万位*/
Num = m_NUM % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG143 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG143 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG142 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG142 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG152 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG152 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG151 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG151 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG145 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG145 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG144 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG144 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG141 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG141 = SEG_LCD_OFF;
}
/*万位*/
Num = m_NUM % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG138 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG138 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG137 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG137 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG136 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG136 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG154 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG154 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG153 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG153 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG139 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG139 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG140 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG140 = SEG_LCD_OFF;
}
/*千位*/
Num = m_NUM % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG128 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG128 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG127 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG127 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG157 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG157 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG156 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG156 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG155 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG155 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG135 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG135 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG114 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG114 = SEG_LCD_OFF;
}
/*百位*/
Num = m_NUM % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG111 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG111 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG110 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG110 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG160 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG160 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG159 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG159 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG158 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG158 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG112 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG112 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG113 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG113 = SEG_LCD_OFF;
}
/*十位*/
Num = m_NUM % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG108 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG108 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG107 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG107 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG163 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG163 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG162 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG162 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG161 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG161 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG109 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG109 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG106 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG106 = SEG_LCD_OFF;
}
/*个位*/
Num = m_NUM % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG104 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG104 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG103 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG103 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG167 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG167 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG166 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG166 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG165 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG165 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG105 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG105 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG102 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG102 = SEG_LCD_OFF;
}
}
}
extern uint8_t BatteryErrFlg;
void SEG_LCD_BatteryErr_Display(uint8_t m_Flag, uint32_t ModeTime)
{
uint8_t Mode;
if (m_Flag == 1u)
{
if (ModeTime < 5000u)
{
Mode = 1;
}
else if((ModeTime >= 5000u) && (ModeTime < 6000u))
{
Mode = 0;
}
else if((ModeTime >= 6000) && (ModeTime < 11000))
{
Mode = 1;
}
else
{
Mode = 0;
BatteryErrFlg = 0;
}
if (SEGLCDBackup.ODOMode != Mode)
{
SEGLCDBackup.ODOMode = Mode;
if (Mode == 1)
{
BU98R10_0_SEG168 = SEG_LCD_OFF; //Km
BU98R10_0_SEG169 = SEG_LCD_OFF;
BU98R10_0_SEG170 = SEG_LCD_OFF;
BU98R10_0_SEG164 = SEG_LCD_OFF; //Point
BU98R10_0_SEG146 = SEG_LCD_OFF; //TOTAL
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_OFF;
BU98R10_0_SEG143 = SEG_LCD_OFF;
BU98R10_0_SEG142 = SEG_LCD_OFF;
BU98R10_0_SEG152 = SEG_LCD_OFF;
BU98R10_0_SEG151 = SEG_LCD_OFF;
BU98R10_0_SEG145 = SEG_LCD_OFF;
BU98R10_0_SEG144 = SEG_LCD_OFF;
BU98R10_0_SEG141 = SEG_LCD_OFF;
BU98R10_0_SEG138 = SEG_LCD_OFF;
BU98R10_0_SEG137 = SEG_LCD_OFF;
BU98R10_0_SEG136 = SEG_LCD_OFF;
BU98R10_0_SEG154 = SEG_LCD_OFF;
BU98R10_0_SEG153 = SEG_LCD_OFF;
BU98R10_0_SEG139 = SEG_LCD_OFF;
BU98R10_0_SEG140 = SEG_LCD_OFF;
BU98R10_0_SEG128 = SEG_LCD_LIGHT;
BU98R10_0_SEG127 = SEG_LCD_LIGHT;
BU98R10_0_SEG157 = SEG_LCD_LIGHT;
BU98R10_0_SEG156 = SEG_LCD_OFF;
BU98R10_0_SEG155 = SEG_LCD_LIGHT;
BU98R10_0_SEG135 = SEG_LCD_LIGHT;
BU98R10_0_SEG114 = SEG_LCD_LIGHT;
BU98R10_0_SEG111 = SEG_LCD_OFF;
BU98R10_0_SEG110 = SEG_LCD_LIGHT;
BU98R10_0_SEG160 = SEG_LCD_LIGHT;
BU98R10_0_SEG159 = SEG_LCD_OFF;
BU98R10_0_SEG158 = SEG_LCD_OFF;
BU98R10_0_SEG112 = SEG_LCD_OFF;
BU98R10_0_SEG113 = SEG_LCD_OFF;
BU98R10_0_SEG108 = SEG_LCD_LIGHT;
BU98R10_0_SEG107 = SEG_LCD_LIGHT;
BU98R10_0_SEG163 = SEG_LCD_LIGHT;
BU98R10_0_SEG162 = SEG_LCD_LIGHT;
BU98R10_0_SEG161 = SEG_LCD_LIGHT;
BU98R10_0_SEG109 = SEG_LCD_LIGHT;
BU98R10_0_SEG106 = SEG_LCD_OFF;
BU98R10_0_SEG104 = SEG_LCD_LIGHT;
BU98R10_0_SEG103 = SEG_LCD_OFF;
BU98R10_0_SEG167 = SEG_LCD_OFF;
BU98R10_0_SEG166 = SEG_LCD_LIGHT;
BU98R10_0_SEG165 = SEG_LCD_LIGHT;
BU98R10_0_SEG105 = SEG_LCD_LIGHT;
BU98R10_0_SEG102 = SEG_LCD_OFF;
}
else
{
BU98R10_0_SEG168 = SEG_LCD_OFF; //Km
BU98R10_0_SEG169 = SEG_LCD_OFF;
BU98R10_0_SEG170 = SEG_LCD_OFF;
BU98R10_0_SEG164 = SEG_LCD_OFF; //Point
BU98R10_0_SEG146 = SEG_LCD_OFF; //TOTAL
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_OFF;
BU98R10_0_SEG143 = SEG_LCD_OFF;
BU98R10_0_SEG142 = SEG_LCD_OFF;
BU98R10_0_SEG152 = SEG_LCD_OFF;
BU98R10_0_SEG151 = SEG_LCD_OFF;
BU98R10_0_SEG145 = SEG_LCD_OFF;
BU98R10_0_SEG144 = SEG_LCD_OFF;
BU98R10_0_SEG141 = SEG_LCD_OFF;
BU98R10_0_SEG138 = SEG_LCD_OFF;
BU98R10_0_SEG137 = SEG_LCD_OFF;
BU98R10_0_SEG136 = SEG_LCD_OFF;
BU98R10_0_SEG154 = SEG_LCD_OFF;
BU98R10_0_SEG153 = SEG_LCD_OFF;
BU98R10_0_SEG139 = SEG_LCD_OFF;
BU98R10_0_SEG140 = SEG_LCD_OFF;
BU98R10_0_SEG128 = SEG_LCD_OFF;
BU98R10_0_SEG127 = SEG_LCD_OFF;
BU98R10_0_SEG157 = SEG_LCD_OFF;
BU98R10_0_SEG156 = SEG_LCD_OFF;
BU98R10_0_SEG155 = SEG_LCD_OFF;
BU98R10_0_SEG135 = SEG_LCD_OFF;
BU98R10_0_SEG114 = SEG_LCD_OFF;
BU98R10_0_SEG111 = SEG_LCD_OFF;
BU98R10_0_SEG110 = SEG_LCD_OFF;
BU98R10_0_SEG160 = SEG_LCD_OFF;
BU98R10_0_SEG159 = SEG_LCD_OFF;
BU98R10_0_SEG158 = SEG_LCD_OFF;
BU98R10_0_SEG112 = SEG_LCD_OFF;
BU98R10_0_SEG113 = SEG_LCD_OFF;
BU98R10_0_SEG108 = SEG_LCD_OFF;
BU98R10_0_SEG107 = SEG_LCD_OFF;
BU98R10_0_SEG163 = SEG_LCD_OFF;
BU98R10_0_SEG162 = SEG_LCD_OFF;
BU98R10_0_SEG161 = SEG_LCD_OFF;
BU98R10_0_SEG109 = SEG_LCD_OFF;
BU98R10_0_SEG106 = SEG_LCD_OFF;
BU98R10_0_SEG104 = SEG_LCD_OFF;
BU98R10_0_SEG103 = SEG_LCD_OFF;
BU98R10_0_SEG167 = SEG_LCD_OFF;
BU98R10_0_SEG166 = SEG_LCD_OFF;
BU98R10_0_SEG165 = SEG_LCD_OFF;
BU98R10_0_SEG105 = SEG_LCD_OFF;
BU98R10_0_SEG102 = SEG_LCD_OFF;
}
SEGLCDBackup.ODOMileage = 0xFF;
SEGLCDBackup.ODOUnit = 0xFF;
}
}
else
{
BU98R10_0_SEG168 = SEG_LCD_OFF; //Km
BU98R10_0_SEG169 = SEG_LCD_OFF;
BU98R10_0_SEG170 = SEG_LCD_OFF;
BU98R10_0_SEG164 = SEG_LCD_OFF; //Point
BU98R10_0_SEG146 = SEG_LCD_OFF; //TOTAL
BU98R10_0_SEG147 = SEG_LCD_OFF;
BU98R10_0_SEG148 = SEG_LCD_OFF;
BU98R10_0_SEG149 = SEG_LCD_OFF;
BU98R10_0_SEG143 = SEG_LCD_OFF;
BU98R10_0_SEG142 = SEG_LCD_OFF;
BU98R10_0_SEG152 = SEG_LCD_OFF;
BU98R10_0_SEG151 = SEG_LCD_OFF;
BU98R10_0_SEG145 = SEG_LCD_OFF;
BU98R10_0_SEG144 = SEG_LCD_OFF;
BU98R10_0_SEG141 = SEG_LCD_OFF;
BU98R10_0_SEG138 = SEG_LCD_OFF;
BU98R10_0_SEG137 = SEG_LCD_OFF;
BU98R10_0_SEG136 = SEG_LCD_OFF;
BU98R10_0_SEG154 = SEG_LCD_OFF;
BU98R10_0_SEG153 = SEG_LCD_OFF;
BU98R10_0_SEG139 = SEG_LCD_OFF;
BU98R10_0_SEG140 = SEG_LCD_OFF;
BU98R10_0_SEG128 = SEG_LCD_OFF;
BU98R10_0_SEG127 = SEG_LCD_OFF;
BU98R10_0_SEG157 = SEG_LCD_OFF;
BU98R10_0_SEG156 = SEG_LCD_OFF;
BU98R10_0_SEG155 = SEG_LCD_OFF;
BU98R10_0_SEG135 = SEG_LCD_OFF;
BU98R10_0_SEG114 = SEG_LCD_OFF;
BU98R10_0_SEG111 = SEG_LCD_OFF;
BU98R10_0_SEG110 = SEG_LCD_OFF;
BU98R10_0_SEG160 = SEG_LCD_OFF;
BU98R10_0_SEG159 = SEG_LCD_OFF;
BU98R10_0_SEG158 = SEG_LCD_OFF;
BU98R10_0_SEG112 = SEG_LCD_OFF;
BU98R10_0_SEG113 = SEG_LCD_OFF;
BU98R10_0_SEG108 = SEG_LCD_OFF;
BU98R10_0_SEG107 = SEG_LCD_OFF;
BU98R10_0_SEG163 = SEG_LCD_OFF;
BU98R10_0_SEG162 = SEG_LCD_OFF;
BU98R10_0_SEG161 = SEG_LCD_OFF;
BU98R10_0_SEG109 = SEG_LCD_OFF;
BU98R10_0_SEG106 = SEG_LCD_OFF;
BU98R10_0_SEG104 = SEG_LCD_OFF;
BU98R10_0_SEG103 = SEG_LCD_OFF;
BU98R10_0_SEG167 = SEG_LCD_OFF;
BU98R10_0_SEG166 = SEG_LCD_OFF;
BU98R10_0_SEG165 = SEG_LCD_OFF;
BU98R10_0_SEG105 = SEG_LCD_OFF;
BU98R10_0_SEG102 = SEG_LCD_OFF;
SEGLCDBackup.ODOMode = 0xFF;
SEGLCDBackup.ODOMileage = 0xFF;
SEGLCDBackup.ODOUnit = 0xFF;
}
}
/******************************************************************************
��������SEG_Coolant_Temp_Display
�� ��: ˮ�¶���ʾ
�� ��:
����ֵ��
******************************************************************************/
void SEG_Coolant_Temp_Display(uint8_t m_Flag, uint8_t Seg)
{
if (m_Flag == 1)
{
if (SEGLCDBackup.TempSeg != Seg)
{
SEGLCDBackup.TempSeg = Seg;
BU98R10_1_SEG45 = SEG_LCD_LIGHT; //C
BU98R10_1_SEG38 = SEG_LCD_LIGHT; //H
BU98R10_1_SEG44 = SEG_LCD_LIGHT;
BU98R10_1_SEG42 = SEG_LCD_LIGHT;
BU98R10_1_SEG33 = SEG_LCD_LIGHT;
BU98R10_1_SEG34 = SEG_LCD_LIGHT;
BU98R10_1_SEG36 = SEG_LCD_LIGHT;
BU98R10_1_SEG43 = SEG_LCD_GRAY_2; //SEG5
BU98R10_1_SEG41 = SEG_LCD_GRAY_2;
BU98R10_1_SEG40 = SEG_LCD_GRAY_2;
BU98R10_1_SEG35 = SEG_LCD_GRAY_2;
BU98R10_1_SEG37 = SEG_LCD_GRAY_2;
switch(Seg)
{
case 9: BU98R10_1_SEG41 = SEG_LCD_LIGHT; //ShortCircuit
BU98R10_1_SEG40 = SEG_LCD_LIGHT;
BU98R10_1_SEG35 = SEG_LCD_LIGHT;
break;
case 8 : BU98R10_1_SEG43 = SEG_LCD_LIGHT; //OpenCircuit
BU98R10_1_SEG37 = SEG_LCD_LIGHT;
break;
case 7 : BU98R10_1_SEG43 = SEG_LCD_LIGHT; //Not_Connect
BU98R10_1_SEG41 = SEG_LCD_LIGHT;
BU98R10_1_SEG40 = SEG_LCD_LIGHT;
break;
case 6 : BU98R10_1_SEG35 = SEG_LCD_LIGHT; //Not_Connect
BU98R10_1_SEG37 = SEG_LCD_LIGHT;
break;
case 5 : BU98R10_1_SEG37 = SEG_LCD_LIGHT; //SEG5
case 4 : BU98R10_1_SEG35 = SEG_LCD_LIGHT;
case 3 : BU98R10_1_SEG40 = SEG_LCD_LIGHT;
case 2 : BU98R10_1_SEG41 = SEG_LCD_LIGHT;
case 1 : BU98R10_1_SEG43 = SEG_LCD_LIGHT;
case 0 : break;
default : break;
}
}
}
else
{
BU98R10_1_SEG45 = SEG_LCD_OFF; //C
BU98R10_1_SEG38 = SEG_LCD_OFF; //H
BU98R10_1_SEG44 = SEG_LCD_OFF;
BU98R10_1_SEG42 = SEG_LCD_OFF;
BU98R10_1_SEG33 = SEG_LCD_OFF;
BU98R10_1_SEG34 = SEG_LCD_OFF;
BU98R10_1_SEG36 = SEG_LCD_OFF;
BU98R10_1_SEG43 = SEG_LCD_GRAY_2; //SEG5
BU98R10_1_SEG41 = SEG_LCD_GRAY_2;
BU98R10_1_SEG40 = SEG_LCD_GRAY_2;
BU98R10_1_SEG35 = SEG_LCD_GRAY_2;
BU98R10_1_SEG37 = SEG_LCD_GRAY_2;
SEGLCDBackup.TempSeg = 0xff;
}
}
/******************************************************************************
��������SEG_Fuel_Level_Display
�� ��: ȼ�Ͷ���ʾ
�� ��:
����ֵ��
******************************************************************************/
void SEG_Fuel_Level_Display(uint8_t m_Flag, uint8_t Seg)
{
if (m_Flag == 1)
{
if (SEGLCDBackup.FuelSeg != Seg)
{
SEGLCDBackup.FuelSeg = Seg;
BU98R10_0_SEG126 = SEG_LCD_LIGHT; //E
BU98R10_0_SEG115 = SEG_LCD_LIGHT; //F
BU98R10_0_SEG124 = SEG_LCD_LIGHT;
BU98R10_0_SEG122 = SEG_LCD_LIGHT;
BU98R10_0_SEG120 = SEG_LCD_LIGHT;
BU98R10_0_SEG118 = SEG_LCD_LIGHT;
BU98R10_0_SEG116 = SEG_LCD_LIGHT;
BU98R10_0_SEG125 = SEG_LCD_GRAY_2; //SEG5
BU98R10_0_SEG123 = SEG_LCD_GRAY_2;
BU98R10_0_SEG121 = SEG_LCD_GRAY_2;
BU98R10_0_SEG119 = SEG_LCD_GRAY_2;
BU98R10_0_SEG117 = SEG_LCD_GRAY_2;
switch(Seg)
{
case 7: BU98R10_0_SEG123 = SEG_LCD_LIGHT; //ShortCircuit
BU98R10_0_SEG121 = SEG_LCD_LIGHT;
BU98R10_0_SEG119 = SEG_LCD_LIGHT;
break;
case 6 : BU98R10_0_SEG125 = SEG_LCD_LIGHT; //OpenCircuit
BU98R10_0_SEG117 = SEG_LCD_LIGHT;
break;
case 5 : BU98R10_0_SEG117 = SEG_LCD_LIGHT; //SEG5
case 4 : BU98R10_0_SEG119 = SEG_LCD_LIGHT;
case 3 : BU98R10_0_SEG121 = SEG_LCD_LIGHT;
case 2 : BU98R10_0_SEG123 = SEG_LCD_LIGHT;
case 1 : BU98R10_0_SEG125 = SEG_LCD_LIGHT;
case 0 : break;
default : break;
}
}
}
else
{
BU98R10_0_SEG126 = SEG_LCD_OFF; //E
BU98R10_0_SEG115 = SEG_LCD_OFF; //F
BU98R10_0_SEG124 = SEG_LCD_OFF;
BU98R10_0_SEG122 = SEG_LCD_OFF;
BU98R10_0_SEG120 = SEG_LCD_OFF;
BU98R10_0_SEG118 = SEG_LCD_OFF;
BU98R10_0_SEG116 = SEG_LCD_OFF;
BU98R10_0_SEG125 = SEG_LCD_GRAY_2; //SEG5
BU98R10_0_SEG123 = SEG_LCD_GRAY_2;
BU98R10_0_SEG121 = SEG_LCD_GRAY_2;
BU98R10_0_SEG119 = SEG_LCD_GRAY_2;
BU98R10_0_SEG117 = SEG_LCD_GRAY_2;
SEGLCDBackup.FuelSeg = 0xff;
}
}
/******************************************************************************
��������SEG_LCD_Battery_Voltage_Display
�� ��: ���복����ʾ
�� ��:
����ֵ��
******************************************************************************/
void SEG_LCD_Battery_Voltage_Display(uint8_t m_Flag, uint8_t Voltage ,uint16_t VolCANset)
{
uint8_t Num;
uint8_t m8;
if (m_Flag == 1)
{
PORT_SetBit(LightBATTCtrl); //背光 ON
if ((SEGLCDBackup.Voltage != Voltage) || (SEGLCDBackup.VolCANset != VolCANset))
{
SEGLCDBackup.Voltage = Voltage;
SEGLCDBackup.VolCANset = VolCANset;
BU98R10_0_SEG61 = SEG_LCD_LIGHT; //BATT
BU98R10_0_SEG52 = SEG_LCD_LIGHT; //V
BU98R10_0_SEG94 = SEG_LCD_LIGHT; //.
if(VolCANset == CAN_SIG_LOST)
{
BU98R10_0_SEG79 = SEG_LCD_OFF;
BU98R10_0_SEG78 = SEG_LCD_OFF;
BU98R10_0_SEG88 = SEG_LCD_OFF;
BU98R10_0_SEG87 = SEG_LCD_OFF;
BU98R10_0_SEG84 = SEG_LCD_OFF;
BU98R10_0_SEG82 = SEG_LCD_OFF;
BU98R10_0_SEG83 = SEG_LCD_LIGHT;
BU98R10_0_SEG67 = SEG_LCD_OFF;
BU98R10_0_SEG66 = SEG_LCD_OFF;
BU98R10_0_SEG93 = SEG_LCD_OFF;
BU98R10_0_SEG92 = SEG_LCD_OFF;
BU98R10_0_SEG89 = SEG_LCD_OFF;
BU98R10_0_SEG77 = SEG_LCD_OFF;
BU98R10_0_SEG65 = SEG_LCD_LIGHT;
BU98R10_0_SEG57 = SEG_LCD_OFF;
BU98R10_0_SEG56 = SEG_LCD_OFF;
BU98R10_0_SEG99 = SEG_LCD_OFF;
BU98R10_0_SEG98 = SEG_LCD_OFF;
BU98R10_0_SEG97 = SEG_LCD_OFF;
BU98R10_0_SEG60 = SEG_LCD_OFF;
BU98R10_0_SEG55 = SEG_LCD_LIGHT;
}
else
{
/*百位*/
Num = (Voltage / 100u) % 10u;
if (Voltage >= 1000u)
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
else
{
m8 = SEG_UNDISPLAY_NUMBER0[Num];
}
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG79 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG79 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG78 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG78 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG88 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG88 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG87 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG87 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG84 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG84 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG82 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG82 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG83 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG83 = SEG_LCD_OFF;
}
/*十位*/
Num = (Voltage / 10u) % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG67 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG67 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG66 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG66 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG93 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG93 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG92 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG92 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG89 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG89 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG77 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG77 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG65 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG65 = SEG_LCD_OFF;
}
/*个位*/
Num = Voltage % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG57 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG57 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG56 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG56 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG99 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG99 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG98 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG98 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG97 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG97 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG60 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG60 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG55 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG55 = SEG_LCD_OFF;
}
}
}
}
else
{
PORT_ClrBit(LightBATTCtrl); //背光OFF
BU98R10_0_SEG61 = SEG_LCD_OFF; //BATT
BU98R10_0_SEG52 = SEG_LCD_OFF; //V
BU98R10_0_SEG94 = SEG_LCD_OFF; //.
BU98R10_0_SEG79 = SEG_LCD_OFF;
BU98R10_0_SEG78 = SEG_LCD_OFF;
BU98R10_0_SEG88 = SEG_LCD_OFF;
BU98R10_0_SEG87 = SEG_LCD_OFF;
BU98R10_0_SEG84 = SEG_LCD_OFF;
BU98R10_0_SEG82 = SEG_LCD_OFF;
BU98R10_0_SEG83 = SEG_LCD_OFF;
BU98R10_0_SEG67 = SEG_LCD_OFF;
BU98R10_0_SEG66 = SEG_LCD_OFF;
BU98R10_0_SEG93 = SEG_LCD_OFF;
BU98R10_0_SEG92 = SEG_LCD_OFF;
BU98R10_0_SEG89 = SEG_LCD_OFF;
BU98R10_0_SEG77 = SEG_LCD_OFF;
BU98R10_0_SEG65 = SEG_LCD_OFF;
BU98R10_0_SEG57 = SEG_LCD_OFF;
BU98R10_0_SEG56 = SEG_LCD_OFF;
BU98R10_0_SEG99 = SEG_LCD_OFF;
BU98R10_0_SEG98 = SEG_LCD_OFF;
BU98R10_0_SEG97 = SEG_LCD_OFF;
BU98R10_0_SEG60 = SEG_LCD_OFF;
BU98R10_0_SEG55 = SEG_LCD_OFF;
SEGLCDBackup.Voltage = 0xFFFF;
SEGLCDBackup.VolCANset = 0xFF;
}
}
void SEG_LCD_Battery_Voltage_Selftest(uint8_t Voltage)
{
uint8_t Num;
uint8_t m8;
PORT_SetBit(LightBATTCtrl); //背光 ON
if (SEGLCDBackup.Voltage != Voltage)
{
SEGLCDBackup.Voltage = Voltage;
SEGLCDBackup.VolCANset = 0xFF;
BU98R10_0_SEG61 = SEG_LCD_LIGHT; //BATT
BU98R10_0_SEG52 = SEG_LCD_LIGHT; //V
BU98R10_0_SEG94 = SEG_LCD_LIGHT; //.
Voltage = Voltage > 9 ? 9 : Voltage;
/*百位*/
Num = Voltage % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG79 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG79 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG78 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG78 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG88 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG88 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG87 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG87 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG84 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG84 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG82 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG82 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG83 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG83 = SEG_LCD_OFF;
}
/*十位*/
Num = Voltage % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG67 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG67 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG66 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG66 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG93 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG93 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG92 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG92 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG89 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG89 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG77 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG77 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG65 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG65 = SEG_LCD_OFF;
}
/*个位*/
Num = Voltage % 10u;
m8 = SEG_DISPLAY_NUMBER0[Num];
if (Bit_Is_Set(m8, 0))
{
BU98R10_0_SEG57 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG57 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 1))
{
BU98R10_0_SEG56 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG56 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 2))
{
BU98R10_0_SEG99 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG99 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 3))
{
BU98R10_0_SEG98 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG98 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 4))
{
BU98R10_0_SEG97 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG97 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 5))
{
BU98R10_0_SEG60 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG60 = SEG_LCD_OFF;
}
if (Bit_Is_Set(m8, 6))
{
BU98R10_0_SEG55 = SEG_LCD_LIGHT;
}
else
{
BU98R10_0_SEG55 = SEG_LCD_OFF;
}
}
}
void SEG_LCD_OilPressure(uint8_t state)
{
BU98R10_1_SEG32 = state;
}
void SEG_LCD_TirePressure(uint8_t state)
{
BU98R10_0_SEG150 = state;
}
void SEG_LCD_READY(uint8_t state)
{
BU98R10_1_SEG65 = state;
}
void SEG_LCD_ABS(uint8_t state)
{
BU98R10_0_SEG133 = state;
}
void SEG_LCD_TSC(uint8_t state)
{
BU98R10_1_SEG67 = state;
}
void SEG_LCD_AutoStarStop(uint8_t state)
{
BU98R10_1_SEG71 = state;
}
void SEG_LCD_Batterylow(uint8_t state)
{
BU98R10_1_SEG66 = state;
}
void SEG_LCD_HI_BEAM(uint8_t state)
{
BU98R10_1_SEG68 = state;
}
void SEG_LCD_Shore(uint8_t state)
{
BU98R10_0_SEG62 = state;
}
void SEG_LCD_OBD(uint8_t state)
{
BU98R10_0_SEG132 = state;
}
void SEG_LCD_HighBeam(uint8_t state)
{
BU98R10_0_SEG129 = state;
}
void SEG_LCD_LeftTurn(uint8_t state)
{
BU98R10_0_SEG131 = state;
}
void SEG_LCD_RightTurn(uint8_t state)
{
BU98R10_1_SEG69 = state;
}
void SEG_LCD_Fuel(uint8_t state)
{
BU98R10_0_SEG134 = state;
}
void SEG_LCD_Temp(uint8_t state)
{
BU98R10_1_SEG39 = state;
}
......@@ -23,12 +23,11 @@
#include "clk.h"
#include "rtc.h"
#include "can.h"
#include "SEG_LCD.h"
#include "eeManager_Interface.h"
#include "Services_Mileage_User.h"
#include "IS31_IIC_Master.h"
#include "IS31FL3236.h"
#include "Services_Mileage.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
......@@ -101,13 +100,6 @@ void Sys_Startup_Init(void)
Simulated_IIC_2_Init();
IS31FL3236_Init();
SEG_LCD_Init();
SEG_LCD_Vehicle_Speed_Num_Display(0, 0, 0);
SEG_LCD_Engine_Speed_Seg_Display(0, 0, 0);
SEG_LCD_ODO_Trip_Display(0, 0, 0, 0);
SEG_Fuel_Level_Display(0, 0);
SEG_LCD_Battery_Voltage_Display(0, 0 ,0);
SEG_LCD_Gear_Display(0, 0, 0);
Sys_Tick_Timer_Start();
......@@ -124,7 +116,7 @@ void Sys_Startup_Init(void)
Power_Management_Init(0u);
bsp_CAN_Init();
eeprom_StoreInfo_Init( ); //20221028
CalcODOKL30Init();
}
......
......@@ -46,7 +46,8 @@
#include "IS31FL3236.h"
#include "IS31_IIC_Master.h"
#include "app_Telltales.h"
#include "Services_Mileage.h"
#include "Gui_Seg_Dis.h"
/*******************************************************************************
* *
......@@ -55,7 +56,7 @@
*******************************************************************************/
/*==============================================================================
伪实时任?
伪实时任?
------------------------------------------------------------------------------*/
void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
......@@ -127,14 +128,14 @@ void Sys_Run_Mode_10ms_Tasks(void)
// Telltales_Left_Right_Management_Service();
// Key_Service();
// //CAN_BUSOFF_Recover();
// /*车?处?*/
// /*车�?�处�?*/
// SetGaugesPara(VehGauges, VehSpeedAmplification(Cal_Veh_Val()));
// /*转?处?*/
// /*转�?�处�?*/
// Common_Set_Act_E_Speed(Get_ID_CF00400_Sig_EngineSpeed() / 8);
// SetGaugesPara(RevGauges, RevSpeedManage(Common_Get_Act_E_Speed()));
// /*表头调度函数 added by yutian*/
// UserGaugeSchedule();/*在主循环中调?*/
// UserGaugeSchedule();/*在主循环中调?*/
// /*end*/
// Sound_Play_Service();
// CD4051B_ReadSignal_Serviece();
......@@ -148,7 +149,7 @@ void Sys_Run_Mode_10ms_Tasks(void)
//if(Common_Get_IG_Sts() == COMMON_POWER_ON)
Data_Mileage_Write_EEPROM();
}
/*============================================================================*/
......@@ -169,14 +170,14 @@ void Sys_Run_Mode_20ms_Tasks(void)
{
if((Common_GetIgnOnTime() >= IGON_SelfcheckingTimer)&&(get_SEG_Check_Contrl() == 0))
{
//转?显?
//转�?�显�?
SEG_LCD_Engine_Speed_Seg_Display( Common_Get_Disp_E_Speed());
}
}*/
BU98R10_Update_Request();
//转?表头走?
//转�?�表头走�?
//Gauges_Management_Service();
Diag_Req_Send(20);
IS31FL3236_Update();
......@@ -203,7 +204,7 @@ void Sys_Run_Mode_50ms_Tasks(void)
Flash_Sync_Signal_Generation_Service();
if(get_SEG_Check_Contrl() == 0) CalcODO_50ms_Services();//20221117 TYW大计清零后,循环显示断码?? 停止大计/小计里程
// Data_Time_Calibration();
// Data_Service_Gear_Processing();
......@@ -252,7 +253,7 @@ void Sys_Run_Mode_100ms_Tasks_Group1(void)
void Sys_Run_Mode_100ms_Tasks_Group2(void)
{
/*车转速服务函?*/
/*车转速服务函?*/
CalcFreqData(100u);
/*燃油计算*/
......@@ -266,23 +267,50 @@ void Sys_Run_Mode_100ms_Tasks_Group3(void)
CoolantTemp_Cal_Sevice(100u);
}
uint8_t GSDTEST = 0;
uint32_t MileageArray[4] = {0};
void Sys_Run_Mode_100ms_Tasks_Group4(void)
{
uint8_t i = 0;
if(GSDTEST == 1)
{
Data_Mileage_Clear_GoOn();
for(i = 0;i<90;i++)
{
BU98R10Chip0DDRAM.Byte[i] = 0X77;
BU98R10Chip1DDRAM.Byte[i] = 0X77;
}
}
else
{
for(i = 0;i<90;i++)
{
BU98R10Chip0DDRAM.Byte[i] = 0;
BU98R10Chip1DDRAM.Byte[i] = 0;
}
}
MileageArray[0] = Data_ODO_Read();
MileageArray[1] = Data_Read_Trip(EM_TRIP_A);
MileageArray[2] = Data_Mileage_Readmm();
MileageArray[3] = eeprom_getWriteState();
/*获取RTC时间*/
RTC_Service();
Data_ODO_Processing();
/*大计小计计算*/
CalcODO_100ms_Services();
Services_Mileage_Callback();
}
void Sys_Run_Mode_100ms_Tasks_Group5(void)
{
/*挡位??*/
/*挡位�?�?*/
//Data_Service_Gear_Processing();
}
......@@ -305,7 +333,7 @@ void Sys_Run_Mode_100ms_Tasks_Group7(void)
//CAN_Check_Liandian();
ReqSilentTimer100mSService();
/*MIL灯超时计?*/
/*MIL灯超时计?*/
Can_User_Time_Service(100);
}
......@@ -321,12 +349,12 @@ void Sys_Run_Mode_100ms_Tasks_Group8(void)
}
void Sys_Run_Mode_100ms_Tasks_Group9(void)
{
/*?测断码屏数据是否异常*/
/*?测断码屏数据是否异常*/
//if(Common_GetIgnOnTime() > 1000)
//checkSegTftState();
/* 临时测试程序 ?? */
/* 临时测试程序 �?�? */
// tempodo = Data_ODO_Read( );
// tempTripA = Data_Read_Trip(EM_TRIP_A);
// tempTripB = Data_Read_Trip(EM_TRIP_B);
......@@ -380,13 +408,13 @@ void Sys_Run_Mode_100ms_Tasks_Group10(void)
// else
// {
// Conmmon_Set_MotorModeStaFlag(4u);
// /*转?电机目标步赋??*/
// /*转�?�电机目标步赋�??*/
// if (bsp_GetMotorState(0) == Normal)
// {
// MeterPostion[0].destPosition = GetGaugesCurrentPos(RevGauges);
// }
// /*车?电机目标步赋??*/
// /*车�?�电机目标步赋�??*/
// if (bsp_GetMotorState(1) == Normal)
// {
// MeterPostion[1].destPosition = GetGaugesCurrentPos(VehGauges);
......@@ -400,20 +428,20 @@ void Sys_Run_Mode_100ms_Tasks_Group10(void)
// //BL_Management_service();
// Popups_Management_Service();
// Popup_Scheduling_Service();
// /*综合油?信?*/
// /*综合油�?�信�?*/
// Data_FuelCounsComprehensive();
// /*小计油?信?*/
// /*小计油�?�信�?*/
// Data_FuelCounsumpTrip();
// /*本次油?信?*/
// /*本次油�?�信�?*/
// Data_FuelCounsumpThisTime();
// /*加油后行车信?*/
// /*加油后行车信?*/
// Data_Info_Last_Refueling();
// /*当前油??*/
// /*当前油??*/
// Fuel_CurrentFuelEco_Data();
// /*综合油??*/
// /*综合油??*/
// Fuel_ComprehensiveFuelEco_Data();
// /*综合气??*/
// /*综合气??*/
// Gas_ComprehensiveGasEco_Data();
// /*机油压力*/
// Oil_EngineOilPressure_Data();
......@@ -436,11 +464,11 @@ void Sys_Sleep_Mode_Tasks(void)
/*******************************************************************************
* *
* 精确?50us计时任务列表 *
* 精确?50us计时任务列表 *
* *
*******************************************************************************/
/*==============================================================================
精确?50us计时任务 禁止添加修改列表中的任务
精确?50us计时任务 禁止添加修改列表中的任务
------------------------------------------------------------------------------*/
void Sys_Exact_50us_Tasks(void)
{
......@@ -450,11 +478,11 @@ void Sys_Exact_50us_Tasks(void)
/*******************************************************************************
* *
* 精确?100ms计时任务列表 *
* 精确?100ms计时任务列表 *
* *
*******************************************************************************/
/*==============================================================================
精确?100ms计时任务 禁止添加修改列表中的任务
精确?100ms计时任务 禁止添加修改列表中的任务
------------------------------------------------------------------------------*/
void Sys_Exact_100ms_Tasks(void)
{
......
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