Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
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
时昊
haoJin750TFT
Commits
c7c3d7e8
Commit
c7c3d7e8
authored
Nov 10, 2024
by
张金硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:新版机油压力功能
parent
2a596bfb
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
148 additions
and
15 deletions
+148
-15
HaoJin750TFT.uvprojx
.../Project/Cmsemicon/BAT32A279/MDK_ARM/HaoJin750TFT.uvprojx
+10
-0
Data_OilPressure.c
Firmware/Source/Application/Data_OilPressure.c
+102
-0
Data_OilPressure.h
Firmware/Source/Application/Data_OilPressure.h
+10
-0
Analog_Signals.c
Firmware/Source/Component/Analog/Analog_Signals.c
+5
-3
Analog_Signals.h
Firmware/Source/Component/Analog/Analog_Signals.h
+4
-3
Components.h
Firmware/Source/Component/Components.h
+1
-0
Line_In_user.c
Firmware/Source/Component/Line_In/Line_In_user.c
+3
-3
PowerManag_user.c
Firmware/Source/Component/PowerManagement/PowerManag_user.c
+3
-0
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+1
-0
Analog_Signals_HaoJin750TFT.xlsm
...ware/utility/MCU_Cfg/cfg/Analog_Signals_HaoJin750TFT.xlsm
+0
-0
Analog_Signals.h
Firmware/utility/MCU_Cfg/inc/Analog_Signals.h
+4
-3
Analog_Signals.c
Firmware/utility/MCU_Cfg/src/Analog_Signals.c
+5
-3
No files found.
Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/HaoJin750TFT.uvprojx
View file @
c7c3d7e8
...
...
@@ -748,6 +748,16 @@
<FileType>
4
</FileType>
<FilePath>
..\..\..\..\Source\Application\Hysteresis_V10_239.lib
</FilePath>
</File>
<File>
<FileName>
Data_OilPressure.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
..\..\..\..\Source\Application\Data_OilPressure.c
</FilePath>
</File>
<File>
<FileName>
Data_OilPressure.h
</FileName>
<FileType>
5
</FileType>
<FilePath>
..\..\..\..\Source\Application\Data_OilPressure.h
</FilePath>
</File>
</Files>
</Group>
<Group>
...
...
Firmware/Source/Application/Data_OilPressure.c
0 → 100644
View file @
c7c3d7e8
#include "Data_OilPressure.h"
#include "Components.h"
#define OIL_DATA_TIME 25u
/*这里填写多长时间采集一个数据,单位ms*/
#define OIL_DATA_NUM 20u
/*机油压力电阻采集数据总数 最大255*/
#define OIL_CAL_START 5u
/*数据排序后取中间部分计算平均:起始*/
#define OIL_CAL_END 15u
/*数据排序后取中间部分计算平均:结束*/
uint16_t
g_u16OilData
[
OIL_DATA_NUM
];
uint8_t
g_u8OilDataCount
=
0u
;
// uint8_t g_u8OILStateInitFlag = 0u;
uint16_t
OilPressureR
=
0u
;
/*滤波后的机油压力电阻,精度0.1*/
uint8_t
g_u8OilADCompleteFlg
=
0u
;
void
Oil_Pressure_KL30_Init
(
void
)
{
// g_u8OILStateInitFlag = 1u;
g_u8OilADCompleteFlg
=
0u
;
}
void
Oil_Pressure_KL15_Init
(
void
)
{
// g_u8OILStateInitFlag = 1u;
g_u8OilADCompleteFlg
=
0u
;
}
void
Oil_R_Cal
(
uint8_t
deltaTime
)
{
uint16_t
OilPressureRes
=
0
;
uint8_t
i
,
j
;
uint32_t
temp32
;
static
uint16_t
timeCount
=
0
;
// if(g_u8OILStateInitFlag)
// {
// OilPressureR = ADC_Read_Signal(ADC_CH_OIL_PRESSURE_R);
// }
if
(
timeCount
>=
OIL_DATA_TIME
)
{
timeCount
=
0
;
if
(
g_u8OilDataCount
<
OIL_DATA_NUM
)
{
/*获取机油压力电阻*/
OilPressureRes
=
ADC_Read_Signal
(
ADC_CH_OIL_PRESSURE_R
);
/*四舍五入*/
if
(
OilPressureRes
<
60000
)
//针对此项目机油压力采集电路补偿后的阻值
{
if
(
OilPressureRes
%
10
>=
5
)
{
OilPressureRes
+=
5
;
}
}
else
{
OilPressureRes
=
0xFFFF
;
}
/*由小到大插入数据*/
for
(
i
=
0
;
i
<
g_u8OilDataCount
;
i
++
)
{
if
(
OilPressureRes
<
g_u16OilData
[
i
])
{
break
;
}
}
for
(
j
=
g_u8OilDataCount
;
j
>
i
;
j
--
)
{
g_u16OilData
[
j
]
=
g_u16OilData
[
j
-
1
];
}
g_u16OilData
[
i
]
=
OilPressureRes
;
g_u8OilDataCount
++
;
}
else
{
/*一组数据采集完毕,取中间部分计算平均值*/
temp32
=
0
;
for
(
i
=
OIL_CAL_START
;
i
<
OIL_CAL_END
;
i
++
)
{
temp32
+=
g_u16OilData
[
i
];
}
OilPressureR
=
temp32
/
(
OIL_CAL_END
-
OIL_CAL_START
);
g_u8OilDataCount
=
0
;
g_u8OilADCompleteFlg
=
1
;
}
}
timeCount
+=
deltaTime
;
}
uint8_t
Get_OilPressureStauts
(
void
)
{
if
(
OilPressureR
<
59500
)
{
return
1U
;
}
else
{
return
0u
;
}
}
\ No newline at end of file
Firmware/Source/Application/Data_OilPressure.h
0 → 100644
View file @
c7c3d7e8
#ifndef DATA_OILPRESSURE_H
#define DATA_OILPRESSURE_H
#include "stdint.h"
void
Oil_Pressure_KL30_Init
(
void
);
void
Oil_Pressure_KL15_Init
(
void
);
void
Oil_R_Cal
(
uint8_t
deltaTime
);
uint8_t
Get_OilPressureStauts
(
void
);
#endif
\ No newline at end of file
Firmware/Source/Component/Analog/Analog_Signals.c
View file @
c7c3d7e8
...
...
@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/1
0/25 18:44:13
* Date : 2024/1
1/6 19:09:16
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
...
...
@@ -74,7 +74,7 @@ ADC_Data_st_t stADCData[ADC_SIGNAL_CH_NUMBER];
const
uint8_t
__attribute__
((
aligned
(
4
)))
u8ADCChList
[
ADC_CONV_CH_NUMBER
]
=
{
2U
,
3U
,
7U
,
5U
,
6U
,
12U
,
4U
,
2U
,
3U
,
7U
,
5U
,
6U
,
12U
,
11U
,
4U
,
};
const
__attribute__
((
aligned
(
4
)))
ADC_Ch_Cfg_st_t
stADCChCfg
[
ADC_SIGNAL_CH_NUMBER
]
=
...
...
@@ -85,7 +85,8 @@ const __attribute__((aligned(4))) ADC_Ch_Cfg_st_t stADCChCfg[ADC_SIGNAL_CH_NUMBE
{
3U
,
2U
,
0U
,
2U
,
0U
,
1U
,
ADC_Res_Calc_Circuit101
,},
{
4U
,
2U
,
0U
,
2U
,
0U
,
1U
,
ADC_Res_Calc_Circuit101
,},
{
5U
,
0U
,
0U
,
0U
,
0U
,
1U
,
ADC_Voltage_Calc_Circuit101
,},
{
6U
,
3U
,
0U
,
5000U
,
0U
,
10U
,
ADC_Res_Calc_Circuit201
,},
{
6U
,
3U
,
0U
,
5000U
,
0U
,
1U
,
ADC_Res_Calc_Circuit101
,},
{
7U
,
3U
,
0U
,
5000U
,
0U
,
10U
,
ADC_Res_Calc_Circuit201
,},
};
const
__attribute__
((
aligned
(
4
)))
ADC_Res_List_st_t
stADCResList
[
ADC_SIGNAL_CH_NUMBER
]
=
...
...
@@ -96,6 +97,7 @@ const __attribute__((aligned(4))) ADC_Res_List_st_t stADCResList[ADC_SIGNAL_CH_N
{
0U
,
0U
,
500U
,
300U
,},
{
0U
,
0U
,
500U
,
0U
,},
{
0U
,
100000U
,
0U
,
0U
,},
{
47000U
,
0U
,
47000U
,
0U
,},
{
47000U
,
0U
,
100000U
,
0U
,},
};
...
...
Firmware/Source/Component/Analog/Analog_Signals.h
View file @
c7c3d7e8
...
...
@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/1
0/25 18:44:13
* Date : 2024/1
1/6 19:09:16
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
...
...
@@ -34,12 +34,13 @@ enum ADCChName
ADC_CH_FUEL1
,
ADC_CH_COOLANT_TEMP1_R
,
ADC_CH_LIGHT_SENSITIVE
,
ADC_CH_OIL_PRESSURE_R
,
ADC_CH_NTC_TEMP
,
};
/* Exported macro ------------------------------------------------------------*/
#define ADC_TOTAL_CH_NUMBER (
7
U)
#define ADC_SIGNAL_CH_NUMBER (
7
U)
#define ADC_TOTAL_CH_NUMBER (
8
U)
#define ADC_SIGNAL_CH_NUMBER (
8
U)
#define ADC_REF_VOLTAGE u16ADCRefVoltage
/* Exported variables --------------------------------------------------------*/
...
...
Firmware/Source/Component/Components.h
View file @
c7c3d7e8
...
...
@@ -28,6 +28,7 @@
#include "Data_VSpeed.h"
#include "Data_Coolant.h"
#include "Data_Fuel.h"
#include "Data_OilPressure.h"
#include "Hysteresis.h"
#include "Mileage\Services_Mileage_User.h"
#include "BackLight.h"
...
...
Firmware/Source/Component/Line_In/Line_In_user.c
View file @
c7c3d7e8
...
...
@@ -95,13 +95,13 @@ Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void)
Linelib_uint8_t
Get_LINE_IN_Oil_Pressure_Alert
(
void
)
{
Linelib_uint8_t
ret
=
0U
;
if
(
RTE_GPIO_Get_Level
(
MCU_SPI_MOSI
))
if
(
Get_OilPressureStauts
(
))
{
ret
=
1
u
;
ret
=
0
u
;
}
else
{
ret
=
0
UL
;
ret
=
1
UL
;
}
return
ret
;
}
...
...
Firmware/Source/Component/PowerManagement/PowerManag_user.c
View file @
c7c3d7e8
...
...
@@ -55,6 +55,7 @@ static void Power_KL30_Init(void)
Key_KL30_Init_EXample
();
Data_User_Mileage_KL30Init
();
Fuel_KL30_Init
();
Oil_Pressure_KL30_Init
();
BackLight_30_Init
();
Amt630hInit
();
Telltales_Init
();
...
...
@@ -91,6 +92,7 @@ static void Power_Wakeup_Init(void)
Key_Wakeup_Init_EXample
();
Line_In_KL15_ON_Init
();
Fuel_KL30_Init
();
Oil_Pressure_KL30_Init
();
BackLight_WakeUp_Init
();
RTE_UART_Sleep_Init
(
UART_CH2
);
loc_config
.
u32UARTChEn
=
1U
;
...
...
@@ -131,6 +133,7 @@ static void Power_IG_ON_Init(void)
Line_In_KL15_ON_Init
();
Telltales_KL15_Init
();
Fuel_KL15_Init
();
Oil_Pressure_KL15_Init
();
TEMP_KL15_Init
();
//RTE_GPIO_Set_Level(Blacklight_PWM, 1);
FaultCode_Init
();
...
...
Firmware/Source/System/Sys_Task_List.c
View file @
c7c3d7e8
...
...
@@ -41,6 +41,7 @@ void Sys_10ms_Tasks(void)
Key_Clear_Time
();
Key_TimeOut_Service
();
Fuel_R_Cal
(
10u
);
Oil_R_Cal
(
10u
);
Data_Light_Res_service
(
10
);
BackLight_Process
();
}
...
...
Firmware/utility/MCU_Cfg/cfg/Analog_Signals_HaoJin750TFT.xlsm
View file @
c7c3d7e8
No preview for this file type
Firmware/utility/MCU_Cfg/inc/Analog_Signals.h
View file @
c7c3d7e8
...
...
@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/1
0/25 18:44:13
* Date : 2024/1
1/9 15:54:41
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
...
...
@@ -34,12 +34,13 @@ enum ADCChName
ADC_CH_FUEL1
,
ADC_CH_COOLANT_TEMP1_R
,
ADC_CH_LIGHT_SENSITIVE
,
ADC_CH_OIL_PRESSURE_R
,
ADC_CH_NTC_TEMP
,
};
/* Exported macro ------------------------------------------------------------*/
#define ADC_TOTAL_CH_NUMBER (
7
U)
#define ADC_SIGNAL_CH_NUMBER (
7
U)
#define ADC_TOTAL_CH_NUMBER (
8
U)
#define ADC_SIGNAL_CH_NUMBER (
8
U)
#define ADC_REF_VOLTAGE u16ADCRefVoltage
/* Exported variables --------------------------------------------------------*/
...
...
Firmware/utility/MCU_Cfg/src/Analog_Signals.c
View file @
c7c3d7e8
...
...
@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/1
0/25 18:44:13
* Date : 2024/1
1/9 15:54:41
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
...
...
@@ -74,7 +74,7 @@ ADC_Data_st_t stADCData[ADC_SIGNAL_CH_NUMBER];
const
uint8_t
__attribute__
((
aligned
(
4
)))
u8ADCChList
[
ADC_CONV_CH_NUMBER
]
=
{
2U
,
3U
,
7U
,
5U
,
6U
,
12U
,
4U
,
2U
,
3U
,
7U
,
5U
,
6U
,
12U
,
11U
,
4U
,
};
const
__attribute__
((
aligned
(
4
)))
ADC_Ch_Cfg_st_t
stADCChCfg
[
ADC_SIGNAL_CH_NUMBER
]
=
...
...
@@ -85,7 +85,8 @@ const __attribute__((aligned(4))) ADC_Ch_Cfg_st_t stADCChCfg[ADC_SIGNAL_CH_NUMBE
{
3U
,
2U
,
0U
,
2U
,
0U
,
1U
,
ADC_Res_Calc_Circuit101
,},
{
4U
,
2U
,
0U
,
2U
,
0U
,
1U
,
ADC_Res_Calc_Circuit101
,},
{
5U
,
0U
,
0U
,
0U
,
0U
,
1U
,
ADC_Voltage_Calc_Circuit101
,},
{
6U
,
3U
,
0U
,
5000U
,
0U
,
10U
,
ADC_Res_Calc_Circuit201
,},
{
6U
,
3U
,
0U
,
5000U
,
0U
,
1U
,
ADC_Res_Calc_Circuit101
,},
{
7U
,
3U
,
0U
,
5000U
,
0U
,
10U
,
ADC_Res_Calc_Circuit201
,},
};
const
__attribute__
((
aligned
(
4
)))
ADC_Res_List_st_t
stADCResList
[
ADC_SIGNAL_CH_NUMBER
]
=
...
...
@@ -96,6 +97,7 @@ const __attribute__((aligned(4))) ADC_Res_List_st_t stADCResList[ADC_SIGNAL_CH_N
{
0U
,
0U
,
500U
,
300U
,},
{
0U
,
0U
,
500U
,
0U
,},
{
0U
,
100000U
,
0U
,
0U
,},
{
47000U
,
0U
,
47000U
,
0U
,},
{
47000U
,
0U
,
100000U
,
0U
,},
};
...
...
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