Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
VC66_7C
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISUZU
VC66_7C
Commits
d759f4a3
Commit
d759f4a3
authored
Jul 12, 2023
by
hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整背光NTC逻辑
parent
d19aa359
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
89 deletions
+163
-89
BGLInterface.c
source/Application/APP/BackLight/BGLInterface.c
+28
-5
BGLInterface.h
source/Application/APP/BackLight/BGLInterface.h
+5
-46
BackGroundLight.c
source/Application/APP/BackLight/BackGroundLight.c
+60
-36
BackgroundLight.h
source/Application/APP/BackLight/BackgroundLight.h
+70
-2
No files found.
source/Application/APP/BackLight/BGLInterface.c
View file @
d759f4a3
...
...
@@ -132,10 +132,10 @@ void BackLightSchedu(uint8_t BGLPowerSt, uint8_t WakeFlag)
BLStatePara
.
BL_User_Lvl_Total
=
BL_LV_TOTAL
;
BLStatePara
.
BL_User_NTC_AD_MAX
=
NTC_AD_MAX
;
BLStatePara
.
BL_User_effect
=
testBL
;
if
(
BLStatePara
.
BL_User_
Lvl
<
BL_LV_TOTAL
)
if
(
BLStatePara
.
BL_User_
TFTLvl
<
BL_LV_TOTAL
&&
BLStatePara
.
BL_User_DIALLvl
<
BL_LV_TOTAL
&&
BLStatePara
.
BL_User_RGBLvl
<
BL_LV_TOTAL
)
{
BL_Tmp_PARA
.
BL_User_TFTDuty
=
BackLightValue_TFT_Default
[
BLStatePara
.
BL_User_Type
][
BLStatePara
.
BL_User_Lvl
];
BL_Tmp_PARA
.
BL_User_GaugesDuty
=
BackLightValue_DIAL_Default
[
BLStatePara
.
BL_User_Type
][
BLStatePara
.
BL_User_Lvl
];
BL_Tmp_PARA
.
BL_User_TFTDuty
=
BackLightValue_TFT_Default
[
BLStatePara
.
BL_User_Type
][
BLStatePara
.
BL_User_
TFT
Lvl
];
BL_Tmp_PARA
.
BL_User_GaugesDuty
=
BackLightValue_DIAL_Default
[
BLStatePara
.
BL_User_Type
][
BLStatePara
.
BL_User_
TFT
Lvl
];
// BL_Tmp_PARA.BL_User_RDuty = BackLightValue_R_Default[BLStatePara.BL_User_Theme][BLStatePara.BL_User_Type][BLStatePara.BL_User_Lvl];
// BL_Tmp_PARA.BL_User_GDuty = BackLightValue_G_Default[BLStatePara.BL_User_Theme][BLStatePara.BL_User_Type][BLStatePara.BL_User_Lvl];
// BL_Tmp_PARA.BL_User_BDuty = BackLightValue_B_Default[BLStatePara.BL_User_Theme][BLStatePara.BL_User_Type][BLStatePara.BL_User_Lvl];
...
...
@@ -194,7 +194,7 @@ void GetBGLLvl(uint8_t BGLLvl, uint8_t FunPositionLight)
{
tmpLvl
=
BGLLvl
;
}
BLStatePara
.
BL_User_Lvl
=
tmpLvl
;
BLStatePara
.
BL_User_
TFT
Lvl
=
tmpLvl
;
}
/**@brief Get Ground Light Little Light function
* @author TYW
...
...
@@ -290,4 +290,27 @@ void SetGDebugPara(uint16_t TestBDuty)
{
DebugBDuty
=
TestBDuty
;
}
#endif
\ No newline at end of file
#endif
/**@brief Ground Light Task function
* @author TYW
* @param[in]
* @since 1.0.0.0
*/
uint8_t
BackLightTestWakeFlag
=
3
;
uint8_t
BLlv
=
10
;
uint8_t
BGLType
=
0
;
void
BGTask
(
void
)
{
uint8_t
TmpPopupMsg
;
uint8_t
positionLight
;
uint8_t
realLight
;
GetBGLTheme
(
0u
);
GetBGLType
(
BGLType
);
GetBGLLvl
(
BLlv
,
0
);
GetBGLNTCVol
(
0u
);
BackLightSchedu
(
1
,
BackLightTestWakeFlag
);
}
source/Application/APP/BackLight/BGLInterface.h
View file @
d759f4a3
...
...
@@ -11,15 +11,7 @@
#define NTC_AD_MAX 4096u
/*有小灯背光降到当前显示等级的百分比*/
#define POSITION_LIGHT_PERCENT 50u
enum
{
BGL_IGN_OFF
,
BGL_IGN_ON
,
};
enum
{
BGL_GRADUAL
,
BGL_DIRECT
,
};
enum
{
BL_TYPE_DAY
,
BL_TYPE_EVENING
,
...
...
@@ -52,44 +44,8 @@ enum {
BL_LV_MAX
,
BL_LV_TOTAL
,
};
enum
{
BL_TFT
,
BL_DIAL
,
LED_FUEL
,
LED_TEMP
,
LED_TEMPBL
,
BACKLIGHT_TOTAL
,
};
typedef
struct
{
uint16_t
DestBackLightDuty
;
uint16_t
CurBackLightDuty
;
uint16_t
BackLightDutyMin
;
}
BACKLIGHT_PARA
;
typedef
struct
{
uint8_t
BL_User_PowerSt
;
uint8_t
BL_User_WakeFlag
;
uint16_t
BL_User_TFTDuty
;
uint16_t
BL_User_GaugesDuty
;
uint16_t
BL_User_RDuty
;
uint16_t
BL_User_GDuty
;
uint16_t
BL_User_BDuty
;
uint16_t
BL_User_TFTDuty_MIN
;
uint16_t
BL_User_GaugesDuty_MIN
;
uint16_t
BL_User_RDuty_MIN
;
uint16_t
BL_User_GDuty_MIN
;
uint16_t
BL_User_BDuty_MIN
;
}
BL_USER_PARA
;
typedef
struct
{
uint8_t
BL_User_Theme
;
uint8_t
BL_User_Type
;
uint8_t
BL_User_Lvl
;
uint8_t
BL_User_Lvl_Total
;
uint16_t
BL_User_NTC_AD
;
uint16_t
BL_User_NTC_AD_MAX
;
uint8_t
BL_User_effect
;
}
BL_STATE_PARA
;
extern
void
BGLPwm_Config
(
uint8_t
BGLType
,
uint16_t
DutyVal
);
extern
void
BackLightDeal
(
BL_USER_PARA
BL_FunPara
,
BL_STATE_PARA
BLFunStatePara
);
extern
void
BGLPwm_Stop
(
uint8_t
BGLType
);
extern
void
BGLPwm_Start
(
uint8_t
BGLType
);
/*以下主函数调用*/
...
...
@@ -116,4 +72,7 @@ extern void SetRDebugPara(uint16_t TestRDuty);
extern
void
SetGDebugPara
(
uint16_t
TestGDuty
);
extern
void
SetBDebugPara
(
uint16_t
TestBDuty
);
#endif
#endif
\ No newline at end of file
extern
void
BGTask
(
void
);
extern
uint8_t
BackLightTestWakeFlag
;
#endif
source/Application/APP/BackLight/BackGroundLight.c
View file @
d759f4a3
...
...
@@ -7,6 +7,8 @@
#include "Telltales.h"
#include "Menu.h"
#define THERMISTLISTCN 10
uint16_t
IgnOffKeepMs
;
uint16_t
IgnOnKeepMs
;
uint8_t
BGLCurIgnSt
=
BGL_IGN_OFF
;
...
...
@@ -51,6 +53,7 @@ void SetBacklightMinVal(uint8_t n, uint16_t val)
* @since 1.0.0.0
*/
uint16_t
NTCUpdateTime
=
0u
;
uint16_t
Thermistoimes
=
0
;
void
BackLightDamp
(
uint8_t
TimeX
)
{
uint16_t
tmpval
=
0u
;
...
...
@@ -60,16 +63,16 @@ void BackLightDamp(uint8_t TimeX)
TmpStep
=
1u
;
if
(
BGLCurIgnSt
==
BGL_IGN_ON
)
{
LcdDownDelay
=
4
00u
;
TmpStep
=
5
u
;
LcdDownDelay
=
10
00u
;
TmpStep
=
10
u
;
}
else
{
LcdDownDelay
=
2u
;
TmpStep
=
5
u
;
TmpStep
=
10
u
;
}
if
(
NTCUpdateTime
<
100
0
u
)
if
(
NTCUpdateTime
<
100u
)
{
NTCUpdateTime
+=
TimeX
;
}
...
...
@@ -78,6 +81,7 @@ void BackLightDamp(uint8_t TimeX)
CurBackLightAdjustValid
=
1u
;
NTCUpdateTime
=
0u
;
}
Thermistoimes
+=
TimeX
;
if
((
BGLCurIgnSt
==
BGL_IGN_ON
)
||
(
BGLWakeupSt
))
{
if
(
IgnOnKeepMs
<
60000u
)
...
...
@@ -187,7 +191,12 @@ void BackLightDamp(uint8_t TimeX)
}
else
{
;
for
(
i
=
0u
;
i
<
BACKLIGHT_TOTAL
;
i
++
)
{
BackLightPara
[
i
].
CurBackLightDuty
=
0
;
}
}
}
...
...
@@ -201,38 +210,48 @@ void BackLightDamp(uint8_t TimeX)
--------------------------------------------------------------------------*/
uint32_t
Calculate_Thermistor
(
BL_STATE_PARA
BLFunStatePara
)
{
uint32_t
resistance
=
0
;
uint32_t
ThermistorADValue
=
0
;
uint8_t
i
=
0
;
uint16_t
AdValue
=
0
;
AdValue
=
BLFunStatePara
.
BL_User_NTC_AD
;
if
(
ThermistorIndex
==
0
)
{
ThermistorList
[
ThermistorIndex
++
]
=
AdValue
;
}
else
uint32_t
resistance
=
0u
;
uint32_t
TmpNTCADMax
=
0u
;
uint32_t
ThermistorADValue
=
0u
;
uint8_t
i
=
0u
;
TmpNTCADMax
=
BLFunStatePara
.
BL_User_NTC_AD_MAX
;
TmpNTCADMax
=
TmpNTCADMax
*
10u
;
if
(
Thermistoimes
>
50u
)
{
for
(
i
=
0
;
i
<
ThermistorIndex
;
i
++
)
Thermistoimes
=
0u
;
if
(
ThermistorIndex
==
0
)
{
if
(
AdValue
<
ThermistorList
[
i
])
{
memmove
((
uint8_t
*
)
&
ThermistorList
[
i
+
1
],
(
uint8_t
*
)
&
ThermistorList
[
i
],
(
ThermistorIndex
-
i
)
*
sizeof
(
ThermistorList
[
i
]));
ThermistorList
[
i
]
=
AdValue
;
ThermistorIndex
++
;
break
;
}
ThermistorList
[
ThermistorIndex
++
]
=
BLFunStatePara
.
BL_User_NTC_AD
;
}
if
(
i
==
ThermistorIndex
)
else
{
ThermistorList
[
ThermistorIndex
++
]
=
AdValue
;
for
(
i
=
0
;
i
<
ThermistorIndex
;
i
++
)
{
if
(
BLFunStatePara
.
BL_User_NTC_AD
<
ThermistorList
[
i
])
{
memmove
((
uint8_t
*
)
&
ThermistorList
[
i
+
1
],
(
uint8_t
*
)
&
ThermistorList
[
i
],
(
ThermistorIndex
-
i
)
*
sizeof
(
ThermistorList
[
i
]));
ThermistorList
[
i
]
=
BLFunStatePara
.
BL_User_NTC_AD
;
ThermistorIndex
++
;
break
;
}
}
if
(
i
==
ThermistorIndex
)
{
ThermistorList
[
ThermistorIndex
++
]
=
BLFunStatePara
.
BL_User_NTC_AD
;
}
}
}
else
{
;
}
if
(
ThermistorIndex
>
THERMISTLISTCN
)
{
ThermistorIndex
=
0
;
// App_SortShort(ThermistorList, THERMISTLISTCN);
ThermistorADValue
=
(
ThermistorList
[
0
]
+
ThermistorList
[
1
]
+
ThermistorList
[
2
]
\
+
ThermistorList
[
3
]
+
ThermistorList
[
4
]
+
ThermistorList
[
5
])
/
6
;
if
((
ThermistorCurValue
>
(
ThermistorADValue
+
3
))
||
((
ThermistorCurValue
+
3
)
<
ThermistorADValue
))
...
...
@@ -252,7 +271,7 @@ uint32_t Calculate_Thermistor(BL_STATE_PARA BLFunStatePara)
*/
if
(
ThermistorCurValue
)
{
resistance
=
((
40960
-
(
10u
*
ThermistorCurValue
))
*
100u
)
/
ThermistorCurValue
;
resistance
=
((
TmpNTCADMax
-
(
10u
*
ThermistorCurValue
))
*
100u
)
/
ThermistorCurValue
;
}
else
{
...
...
@@ -260,16 +279,16 @@ uint32_t Calculate_Thermistor(BL_STATE_PARA BLFunStatePara)
}
return
resistance
;
}
uint32_t
NTCresistance
;
void
BackLightDeal_NTC
(
BL_USER_PARA
BL_FunPara
,
BL_STATE_PARA
BLFunStatePara
)
{
uint16_t
tmpval
;
uint32_t
NTCresistance
;
uint16_t
BacklightTftDestVal
;
uint32_t
tmpDestVal
;
NTCresistance
=
Calculate_Thermistor
(
BLFunStatePara
);
/* high temprature TFT decrease brightness*/
if
((
NTCresistance
>=
1
507
)
&&
(
NTCresistance
<=
1712u
))
if
((
NTCresistance
>=
1
607u
)
&&
(
NTCresistance
<=
1712u
))
{
CurBacklightLv
=
BACKLIGHT_LV80
;
BackLightDerating
=
1u
;
...
...
@@ -283,9 +302,9 @@ void BackLightDeal_NTC(BL_USER_PARA BL_FunPara, BL_STATE_PARA BLFunStatePara)
{
CurBacklightLv
=
BACKLIGHT_LV100
;
BackLightDerating
=
0u
;
tmpval
=
BLFunStatePara
.
BL_User_Lvl
;
tmpval
=
BLFunStatePara
.
BL_User_
TFT
Lvl
;
CurBackLightAdjustNum
=
(
uint8_t
)((
tmpval
*
100u
)
/
BLFunStatePara
.
BL_User_Lvl_Total
)
;
CurBackLightAdjustNum
=
100
;
}
else
{
...
...
@@ -323,8 +342,13 @@ void BackLightDeal_NTC(BL_USER_PARA BL_FunPara, BL_STATE_PARA BLFunStatePara)
tmpDestVal
=
BL_FunPara
.
BL_User_TFTDuty
;
BacklightTftDestVal
=
(
uint16_t
)(
tmpDestVal
*
CurBackLightAdjustNum
/
100u
);
SetBacklightDestVal
(
BL_TFT
,
BacklightTftDestVal
);
SetBacklightDestVal
(
BL_DIAL
,
BacklightTftDestVal
);
}
}
uint32_t
Get_NTCresistance
(
void
)
{
return
NTCresistance
;
}
/*------------------------------------------------------------------------------
Description: The main function of backlight deal.
Function :
...
...
@@ -341,7 +365,7 @@ void BackLightDeal(BL_USER_PARA BL_FunPara, BL_STATE_PARA BLFunStatePara)
if
((
BL_FunPara
.
BL_User_PowerSt
==
BGL_IGN_ON
)
&&
(
IgnOnKeepMs
<=
IGN_ON_BACK_LIGHT_DELAY_MS
))
{
SetBacklightDestVal
(
BL_TFT
,
BL_FunPara
.
BL_User_TFTDuty
);
SetBacklightCurVal
(
BL_TFT
,
BL_FunPara
.
BL_User_TFTDuty
-
5u
);
SetBacklightCurVal
(
BL_TFT
,
BL_FunPara
.
BL_User_TFTDuty
-
5
0
u
);
SetBacklightDestVal
(
BL_DIAL
,
BL_FunPara
.
BL_User_GaugesDuty
);
SetBacklightMinVal
(
BL_TFT
,
BL_FunPara
.
BL_User_TFTDuty_MIN
);
...
...
@@ -442,7 +466,7 @@ void BackLightDeal(BL_USER_PARA BL_FunPara, BL_STATE_PARA BLFunStatePara)
if
((
BL_FunPara
.
BL_User_WakeFlag
&
0x01u
)
==
1u
)
{
SetBacklightDestVal
(
BL_TFT
,
BL_FunPara
.
BL_User_TFTDuty
);
SetBacklightCurVal
(
BL_TFT
,
BL_FunPara
.
BL_User_TFTDuty
-
5u
);
SetBacklightCurVal
(
BL_TFT
,
BL_FunPara
.
BL_User_TFTDuty
-
5
0
u
);
}
else
{
...
...
@@ -453,7 +477,7 @@ void BackLightDeal(BL_USER_PARA BL_FunPara, BL_STATE_PARA BLFunStatePara)
if
((
BL_FunPara
.
BL_User_WakeFlag
&
0x02u
)
==
2u
)
{
SetBacklightDestVal
(
BL_DIAL
,
BL_FunPara
.
BL_User_GaugesDuty
);
SetBacklightCurVal
(
BL_DIAL
,
BL_FunPara
.
BL_User_GaugesDuty
-
5u
);
SetBacklightCurVal
(
BL_DIAL
,
BL_FunPara
.
BL_User_GaugesDuty
-
5
0
u
);
}
else
{
...
...
source/Application/APP/BackLight/BackgroundLight.h
View file @
d759f4a3
...
...
@@ -6,12 +6,73 @@
/*#define uint16_t unsigned int*/
/*Freesecale */
/*#define uint32_t unsigned long*//*Freesecale */
/*#define uint32_t unsigned int*/
typedef
struct
{
uint16_t
DestBackLightDuty
;
uint16_t
CurBackLightDuty
;
uint16_t
BackLightDutyMin
;
}
BACKLIGHT_PARA
;
typedef
struct
{
uint8_t
BL_User_PowerSt
;
uint8_t
BL_User_WakeFlag
;
uint16_t
BL_User_TFTDuty
;
uint16_t
BL_User_GaugesDuty
;
uint16_t
BL_User_TFTDuty_MIN
;
uint16_t
BL_User_GaugesDuty_MIN
;
#if (RGB_FUCTION ==1)
uint16_t
BL_User_RDuty
;
uint16_t
BL_User_GDuty
;
uint16_t
BL_User_BDuty
;
uint16_t
BL_User_RDuty_MIN
;
uint16_t
BL_User_GDuty_MIN
;
uint16_t
BL_User_BDuty_MIN
;
#endif
}
BL_USER_PARA
;
typedef
struct
{
uint8_t
BL_User_Theme
;
uint8_t
BL_User_Type
;
uint8_t
BL_User_TFTLvl
;
uint8_t
BL_User_DIALLvl
;
uint8_t
BL_User_RGBLvl
;
uint8_t
BL_User_Lvl_Total
;
uint16_t
BL_User_NTC_AD
;
uint16_t
BL_User_NTC_AD_MAX
;
uint8_t
BL_User_effect
;
}
BL_STATE_PARA
;
enum
{
BGL_IGN_OFF
,
BGL_IGN_ON
,
};
enum
{
BL_TFT
,
BL_DIAL
,
LED_FUEL
,
LED_TEMP
,
LED_TEMPBL
,
#if (RGB_FUCTION ==1)
BL_R
,
BL_G
,
BL_B
,
#endif
BACKLIGHT_TOTAL
,
};
enum
{
BGL_GRADUAL
,
BGL_DIRECT
,
};
extern
uint16_t
IgnOffKeepMs
;
#define IGN_ON_BACK_LIGHT_DELAY_MS 400u
#define IGN_OFF_BACK_LIGHT_DELAY_MS 10u
#define BACKLIGHT_LV100 0u
#define BACKLIGHT_LV80 1u
#define BACKLIGHT_LV40 2u
#define THERMISTLISTCN 120
extern
void
SetBackLightOutput
(
uint8_t
n
,
uint16_t
val
);
extern
void
SetBacklightDestVal
(
uint8_t
n
,
const
uint16_t
val
);
...
...
@@ -20,7 +81,14 @@ extern void SetBacklightMinVal(uint8_t n, uint16_t val);
extern
void
BackLightDamp
(
uint8_t
TimeX
);
extern
void
BackLightDeal
(
BL_USER_PARA
BL_FunPara
,
BL_STATE_PARA
BLFunStatePara
);
extern
void
SetBacklightMinVal
(
uint8_t
n
,
uint16_t
val
);
/*TFT高温处理函数*/
extern
void
BGLPwm_Config
(
uint8_t
BGLType
,
uint16_t
DutyVal
);
extern
void
BGLPwm_Start
(
uint8_t
BGLType
);
extern
void
BGLPwm_Stop
(
uint8_t
BGLType
);
/**/
extern
void
BackLightDeal_NTC
(
BL_USER_PARA
BL_FunPara
,
BL_STATE_PARA
BLFunStatePara
);
extern
void
AD_SwapShort
(
uint16_t
*
pData1
,
uint16_t
*
pData2
);
extern
void
AD_SortShort
(
uint16_t
SortData
[],
uint8_t
len
);
extern
uint32_t
Calculate_Thermistor
(
BL_STATE_PARA
BLFunStatePara
);
extern
uint32_t
Get_NTCresistance
(
void
);
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment