|
@@ -368,6 +368,7 @@ void bikelight_voBikeLightInit(BIKELEDCHECK_STR *LedPoit)
|
|
|
/***************************************************************
|
|
|
Function: bikelight_voBikeLightCoef;
|
|
|
Description: 滤波时间/阈值电压设定参数更新 ,参数输入端
|
|
|
+ uwBike_LedMode:
|
|
|
0x01:模式1,连接尾灯,开灯时低亮,刹车时高亮
|
|
|
0x02:模式2,连接尾灯,开灯时高亮,刹车时闪烁
|
|
|
0x03:模式3,连接刹车灯,刹车时高亮
|
|
@@ -376,6 +377,11 @@ void bikelight_voBikeLightInit(BIKELEDCHECK_STR *LedPoit)
|
|
|
0x06:模式6,连接蜂鸣器,超速报警
|
|
|
0x07:模式7,开机低亮,刹车高亮
|
|
|
0x08:模式8,仅开灯高亮,关灯灭
|
|
|
+
|
|
|
+ uwBike_LedFun 模式功能选择
|
|
|
+ 0-PWM电池电压有保护,
|
|
|
+ 1-前后灯分别控PWM6/12V无保护,
|
|
|
+ 2-DCDC输出
|
|
|
Call by:初始化,接收数据更新
|
|
|
Input Variables: N/A
|
|
|
Output/Return Variables: N/A
|
|
@@ -388,9 +394,11 @@ void bikelight_voBikeLightCoef(UWORD volt)
|
|
|
//前灯
|
|
|
BikeLedCheck_F.uwBike_LedVolt =volt & 0x0f;
|
|
|
BikeLedCheck_F.uwBike_LedMode=8; //前灯模式
|
|
|
+ BikeLedCheck_F.uwBike_LedFun=1;
|
|
|
//尾灯
|
|
|
BikeLedCheck_B.uwBike_LedMode = (volt & 0xf000)>>12;//尾灯模式
|
|
|
BikeLedCheck_B.uwBike_LedVolt =(volt & 0x0f00)>>8;
|
|
|
+ BikeLedCheck_B.uwBike_LedFun=1;
|
|
|
|
|
|
|
|
|
//左灯模式
|
|
@@ -437,17 +445,23 @@ if( power_stPowStateOut.blPowerStartupFlg ==FALSE)
|
|
|
|
|
|
}
|
|
|
else
|
|
|
+{
|
|
|
+if(( BikeLedCheck_F.uwBike_LedFun==1) ||(BikeLedCheck_B.uwBike_LedFun==1)||(BikeLedCheck_L.uwBike_LedFun==1)||(BikeLedCheck_R.uwBike_LedFun==1))
|
|
|
+{
|
|
|
+ IO_LED_6or12V_EN_H();
|
|
|
+}
|
|
|
+else
|
|
|
{
|
|
|
ledfunctions[BikeLedCheck_DC.uwBike_LedMode](&BikeLedCheck_DC);
|
|
|
- if( BikeLedCheck_B.blBike_LedSta==TRUE) //尾灯控制
|
|
|
- {
|
|
|
- IO_LED_6or12V_EN_H();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- IO_LED_6or12V_EN_L();
|
|
|
- }
|
|
|
-
|
|
|
+ if( BikeLedCheck_DC.blBike_LedSta==TRUE) //尾灯控制
|
|
|
+ {
|
|
|
+ IO_LED_6or12V_EN_H();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ IO_LED_6or12V_EN_L();
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
//-----------尾灯处理--------
|
|
@@ -527,9 +541,10 @@ else
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-#if(DCDC_12S6V_SEL_EN!=1)
|
|
|
+//#if(DCDC_12S6V_SEL_EN!=1)
|
|
|
+ if( BikeLedCheck_F.uwBike_LedFun!=1)
|
|
|
DL_COMP_setDACCode0(COMP_FLEDCHECK_INST, 0x4f);
|
|
|
-#endif
|
|
|
+//#endif
|
|
|
}
|
|
|
|
|
|
BikeLedCheck_F.uwBike_keyLedLowSta=1;
|
|
@@ -639,8 +654,12 @@ else
|
|
|
|
|
|
#endif
|
|
|
|
|
|
- //--------------LED电路检测----------
|
|
|
+
|
|
|
+
|
|
|
+//--------------LED电路检测----------
|
|
|
//-------F_LED
|
|
|
+ if( BikeLedCheck_F.uwBike_LedFun!=1)
|
|
|
+ {
|
|
|
if((BikeLedCheck_F.blBike_LedCurErr==TRUE )&&(BikeLedCheck_F.blBike_LedSta == TRUE)) //过流标志,前灯恢复检测
|
|
|
{
|
|
|
BikeLedCheck_F.uwBike_LedOffErrCnt++;
|
|
@@ -657,8 +676,11 @@ else
|
|
|
{
|
|
|
BikeLedCheck_F.uwBike_LedOffErrCnt=0;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
//------B_LED
|
|
|
+ if( BikeLedCheck_B.uwBike_LedFun!=1)
|
|
|
+ {
|
|
|
if((BikeLedCheck_B.blBike_LedCurErr==TRUE)&&(BikeLedCheck_B.blBike_LedSta == TRUE)) //后灯恢复检测
|
|
|
{
|
|
|
|
|
@@ -676,9 +698,11 @@ else
|
|
|
{
|
|
|
BikeLedCheck_B.uwBike_LedOffErrCnt=0;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
//------R_LED
|
|
|
-
|
|
|
+ if( BikeLedCheck_R.uwBike_LedFun!=1)
|
|
|
+ {
|
|
|
if((BikeLedCheck_R.blBike_LedCurErr==TRUE )&&(BikeLedCheck_R.blBike_LedSta == TRUE)) //过流标志,前灯恢复检测
|
|
|
{
|
|
|
BikeLedCheck_R.uwBike_LedOffErrCnt++;
|
|
@@ -695,8 +719,11 @@ else
|
|
|
{
|
|
|
BikeLedCheck_R.uwBike_LedOffErrCnt=0;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
//------L_LED
|
|
|
+ if( BikeLedCheck_L.uwBike_LedFun!=1)
|
|
|
+ {
|
|
|
if((BikeLedCheck_L.blBike_LedCurErr==TRUE )&&(BikeLedCheck_L.blBike_LedSta == TRUE)) //过流标志,前灯恢复检测
|
|
|
{
|
|
|
BikeLedCheck_L.uwBike_LedOffErrCnt++;
|
|
@@ -713,6 +740,7 @@ else
|
|
|
{
|
|
|
BikeLedCheck_L.uwBike_LedOffErrCnt=0;
|
|
|
}
|
|
|
+ }
|
|
|
//------
|
|
|
|
|
|
}
|
|
@@ -737,6 +765,8 @@ if(switchAction!=0)
|
|
|
else
|
|
|
{
|
|
|
p->uwBikeLight_PWM=LIGHTBLR_FIRSTPWM;//
|
|
|
+ if(p->uwBike_LedFun ==1 )
|
|
|
+ p->uwBikeLight_PWM=LIGHT_FIRSTPWM;// 4us
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -751,6 +781,10 @@ if(switchAction!=0)
|
|
|
{
|
|
|
p->uwBikeLight_PWM=0;
|
|
|
}
|
|
|
+ if(p->uwBike_LedFun ==1 ) //去掉保护
|
|
|
+ {
|
|
|
+ p->uwBikeLight_PWM = LIGHTBLR_NoProPWM;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
// else if(p->uwBike_OpenPreTime>=1000)
|
|
@@ -758,7 +792,7 @@ if(switchAction!=0)
|
|
|
// p->uwBikeLight_PWM=0;//
|
|
|
// p->uwBike_OpenLedEn=1;
|
|
|
// }
|
|
|
- if((p->uwBike_OpenPreTime>2) && (p->uwBikeLight_PWM!=0))// ||(p->uwBike_LedCheckLowTime>=2)
|
|
|
+ if((p->uwBike_OpenPreTime>2) && ((p->uwBikeLight_PWM!=0)||(p->uwBike_LedFun ==1 )))// ||(p->uwBike_LedCheckLowTime>=2)
|
|
|
{
|
|
|
p->blBike_LedCurErr=FALSE;
|
|
|
p->uwBike_OpenLedEn=1;
|