气压传感器滤波移除,sensor2移除

This commit is contained in:
吴俊潮 2025-05-12 18:43:08 +08:00
parent d6b045c169
commit 3ca3a0b9ef
13 changed files with 6262 additions and 6389 deletions

View File

@ -95,6 +95,7 @@ int main(void)
/* Configure the system clock */ /* Configure the system clock */
SystemClock_Config(); SystemClock_Config();
/* USER CODE BEGIN SysInit */ /* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */ /* USER CODE END SysInit */

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -740,7 +740,7 @@
<Group> <Group>
<GroupName>board</GroupName> <GroupName>board</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>

Binary file not shown.

View File

@ -27,9 +27,9 @@ Project File Date: 04/09/2025
<h2>Output:</h2> <h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin' *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin'
Build target 'VOQC' Build target 'VOQC'
compiling main.c... compiling mf5803.c...
linking... linking...
Program Size: Code=41886 RO-data=514 RW-data=568 ZI-data=18280 Program Size: Code=41610 RO-data=514 RW-data=564 ZI-data=17804
FromELF: creating hex file... FromELF: creating hex file...
"VOQC\VOQC.axf" - 0 Error(s), 0 Warning(s). "VOQC\VOQC.axf" - 0 Error(s), 0 Warning(s).

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
<title>Static Call Graph - [VOQC\VOQC.axf]</title></head> <title>Static Call Graph - [VOQC\VOQC.axf]</title></head>
<body><HR> <body><HR>
<H1>Static Call Graph for image VOQC\VOQC.axf</H1><HR> <H1>Static Call Graph for image VOQC\VOQC.axf</H1><HR>
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060960: Last Updated: Fri May 09 13:48:14 2025 <BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060960: Last Updated: Mon May 12 17:05:46 2025
<BR><P> <BR><P>
<H3>Maximum Stack Usage = 2392 bytes + Unknown(Functions without stacksize, Cycles, Untraceable Function Pointers)</H3><H3> <H3>Maximum Stack Usage = 2392 bytes + Unknown(Functions without stacksize, Cycles, Untraceable Function Pointers)</H3><H3>
Call chain for Maximum Stack Depth:</H3> Call chain for Maximum Stack Depth:</H3>
@ -2960,14 +2960,11 @@ Global Symbols
<BR>[Called By]<UL><LI><a href="#[79]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__rt_entry_main <BR>[Called By]<UL><LI><a href="#[79]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__rt_entry_main
</UL> </UL>
<P><STRONG><a name="[11b]"></a>mf5803_loop</STRONG> (Thumb, 518 bytes, Stack size 40 bytes, mf5803.o(i.mf5803_loop)) <P><STRONG><a name="[11b]"></a>mf5803_loop</STRONG> (Thumb, 266 bytes, Stack size 8 bytes, mf5803.o(i.mf5803_loop))
<BR><BR>[Stack]<UL><LI>Max Depth = 80<LI>Call Chain = mf5803_loop &rArr; GetSensorData &rArr; wf5803_WriteReg &rArr; SPI_Write_OneByte <BR><BR>[Stack]<UL><LI>Max Depth = 48<LI>Call Chain = mf5803_loop &rArr; GetSensorData &rArr; wf5803_WriteReg &rArr; SPI_Write_OneByte
</UL> </UL>
<BR>[Calls]<UL><LI><a href="#[94]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;HAL_GPIO_WritePin <BR>[Calls]<UL><LI><a href="#[94]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;HAL_GPIO_WritePin
<LI><a href="#[9c]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;GetSensorData <LI><a href="#[9c]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;GetSensorData
<LI><a href="#[98]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__aeabi_i2d
<LI><a href="#[10b]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__aeabi_d2iz
<LI><a href="#[10a]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__aeabi_ddiv
</UL> </UL>
<BR>[Called By]<UL><LI><a href="#[11a]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;analog_gather <BR>[Called By]<UL><LI><a href="#[11a]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;analog_gather
</UL> </UL>
@ -3368,9 +3365,9 @@ Global Symbols
<P><STRONG><a name="[1d4]"></a>__aeabi_dadd</STRONG> (Thumb, 0 bytes, Stack size 16 bytes, daddsub_clz.o(x$fpl$dadd), UNUSED) <P><STRONG><a name="[1d4]"></a>__aeabi_dadd</STRONG> (Thumb, 0 bytes, Stack size 16 bytes, daddsub_clz.o(x$fpl$dadd), UNUSED)
<P><STRONG><a name="[193]"></a>_dadd</STRONG> (Thumb, 332 bytes, Stack size 16 bytes, daddsub_clz.o(x$fpl$dadd), UNUSED) <P><STRONG><a name="[193]"></a>_dadd</STRONG> (Thumb, 332 bytes, Stack size 16 bytes, daddsub_clz.o(x$fpl$dadd), UNUSED)
<BR><BR>[Calls]<UL><LI><a href="#[195]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__fpl_dretinf <BR><BR>[Calls]<UL><LI><a href="#[194]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;_dsub1
<LI><a href="#[195]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__fpl_dretinf
<LI><a href="#[196]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__fpl_dnaninf <LI><a href="#[196]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;__fpl_dnaninf
<LI><a href="#[194]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;_dsub1
</UL> </UL>
<P><STRONG><a name="[10a]"></a>__aeabi_ddiv</STRONG> (Thumb, 0 bytes, Stack size 32 bytes, ddiv.o(x$fpl$ddiv)) <P><STRONG><a name="[10a]"></a>__aeabi_ddiv</STRONG> (Thumb, 0 bytes, Stack size 32 bytes, ddiv.o(x$fpl$ddiv))
@ -3378,7 +3375,6 @@ Global Symbols
</UL> </UL>
<BR>[Called By]<UL><LI><a href="#[106]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1220_get_data <BR>[Called By]<UL><LI><a href="#[106]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1220_get_data
<LI><a href="#[112]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1256_get_data <LI><a href="#[112]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1256_get_data
<LI><a href="#[11b]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;mf5803_loop
</UL> </UL>
<P><STRONG><a name="[197]"></a>_ddiv</STRONG> (Thumb, 552 bytes, Stack size 32 bytes, ddiv.o(x$fpl$ddiv), UNUSED) <P><STRONG><a name="[197]"></a>_ddiv</STRONG> (Thumb, 552 bytes, Stack size 32 bytes, ddiv.o(x$fpl$ddiv), UNUSED)
@ -3390,7 +3386,6 @@ Global Symbols
<BR><BR>[Stack]<UL><LI>Max Depth = 32<LI>Call Chain = __aeabi_d2iz <BR><BR>[Stack]<UL><LI>Max Depth = 32<LI>Call Chain = __aeabi_d2iz
</UL> </UL>
<BR>[Called By]<UL><LI><a href="#[106]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1220_get_data <BR>[Called By]<UL><LI><a href="#[106]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1220_get_data
<LI><a href="#[11b]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;mf5803_loop
</UL> </UL>
<P><STRONG><a name="[198]"></a>_dfix</STRONG> (Thumb, 94 bytes, Stack size 32 bytes, dfix.o(x$fpl$dfix), UNUSED) <P><STRONG><a name="[198]"></a>_dfix</STRONG> (Thumb, 94 bytes, Stack size 32 bytes, dfix.o(x$fpl$dfix), UNUSED)
@ -3411,7 +3406,6 @@ Global Symbols
<P><STRONG><a name="[98]"></a>__aeabi_i2d</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, dflt_clz.o(x$fpl$dflt)) <P><STRONG><a name="[98]"></a>__aeabi_i2d</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, dflt_clz.o(x$fpl$dflt))
<BR><BR>[Called By]<UL><LI><a href="#[106]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1220_get_data <BR><BR>[Called By]<UL><LI><a href="#[106]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ads1220_get_data
<LI><a href="#[91]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ADS1256ReadData <LI><a href="#[91]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;ADS1256ReadData
<LI><a href="#[11b]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;mf5803_loop
</UL> </UL>
<P><STRONG><a name="[1d5]"></a>_dflt</STRONG> (Thumb, 46 bytes, Stack size 0 bytes, dflt_clz.o(x$fpl$dflt), UNUSED) <P><STRONG><a name="[1d5]"></a>_dflt</STRONG> (Thumb, 46 bytes, Stack size 0 bytes, dflt_clz.o(x$fpl$dflt), UNUSED)

File diff suppressed because it is too large Load Diff

View File

@ -1737,7 +1737,7 @@ I (../CH395Q/ch395inc.h)(0x6800CA4E)
I (../Core/Inc/spi.h)(0x668F85FC) I (../Core/Inc/spi.h)(0x668F85FC)
I (../CH395Q/ch395cmd.h)(0x664FF969) I (../CH395Q/ch395cmd.h)(0x664FF969)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2) I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)
F (..\board\Src\mf5803.c)(0x680DD7B9)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\mf5803.o --omf_browse voqc\mf5803.crf --depend voqc\mf5803.d) F (..\board\Src\mf5803.c)(0x6821B9C4)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\mf5803.o --omf_browse voqc\mf5803.crf --depend voqc\mf5803.d)
I (../board/Inc/mf5803.h)(0x66C7DE98) I (../board/Inc/mf5803.h)(0x66C7DE98)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\math.h)(0x5E8E3CC2) I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\math.h)(0x5E8E3CC2)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2) I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)

Binary file not shown.

Binary file not shown.

View File

@ -195,8 +195,8 @@ void mf5803_setup()
wf5803_WriteReg(0x00, 0x81); wf5803_WriteReg(0x00, 0x81);
delay_ms(10); delay_ms(10);
NSS_Select = 1; NSS_Select = 4;
SENSOR_SELECT(0); SENSOR_SELECT(1);
delay_ms(10); delay_ms(10);
} }
@ -204,11 +204,11 @@ long reading = 0;
float press = 0; //kPa float press = 0; //kPa
long temp_5803 = 0; //℃ long temp_5803 = 0; //℃
float fDat; float fDat;
uint8_t flt_cnt = 0; // float sums = 0;
float p_flt_window[6][FLT_SIZE] = {0}; //sliding window, sensor_1&2 -> pressure[A,B,S] //uint8_t flt_cnt = 0;
//float p_flt_window[6][FLT_SIZE] = {0}; //sliding window, sensor_1&2 -> pressure[A,B,S]
void mf5803_loop() void mf5803_loop()
{ {
float sums = 0;
uint8_t* p1 = GetSensorData(); uint8_t* p1 = GetSensorData();
reading = p1[0]; reading = p1[0];
reading = reading << 8; reading = reading << 8;
@ -227,50 +227,58 @@ void mf5803_loop()
press = (10000 * fDat + 9000) / 12.0f; //单位0.1Kpa press = (10000 * fDat + 9000) / 12.0f; //单位0.1Kpa
if(press > 700) press = 0; if(press > 700) press = 0;
p_flt_window[ NSS_Select -1 ][flt_cnt] = press*10; //滑动窗口记录 InputReg[ 13 + NSS_Select - 1 ] = press*10;
//p_flt_window[ NSS_Select -1 ][flt_cnt] = press*10; //滑动窗口记录
NSS_Select++; NSS_Select = (NSS_Select >= 6)?(4):(NSS_Select + 1);
if(NSS_Select > 3)
if(NSS_Select > 3) //记录完3路气压后进入此处每3*10ms
{ {
SENSOR_SELECT(1); SENSOR_SELECT(1);
for( uint8_t i = 0; i < 6; i++ ) //均值滤波
{
sums = 0;
for( uint8_t j = 0; j < FLT_SIZE; j++ )
{
sums += p_flt_window[i][j];
}
InputReg[ 13 + i ] = sums/FLT_SIZE; //InputReg[13]~InputReg[18]
temp_5803 = p1[3];
temp_5803 = temp_5803 << 8;
temp_5803 += p1[4];
if (temp_5803 > 32768)
{
temp_5803 = (temp_5803 - 65844) / 256.0;
}
else
{
temp_5803 = (temp_5803 - 308) / 256.0;
}
}
} }
if(NSS_Select > 6) //记录完6路气压后进入此处每6*10ms else
{
NSS_Select = 1;
flt_cnt++;
if(flt_cnt > (FLT_SIZE - 1) ) //滑动窗口长度FLT_SIZE循环记录
{
flt_cnt = 0;
}
}
if(NSS_Select < 4)
{ {
SENSOR_SELECT(0); SENSOR_SELECT(0);
} }
// if(NSS_Select > 3) //记录完3路气压后进入此处每3*10ms
// {
// SENSOR_SELECT(1);
// for( uint8_t i = 0; i < 6; i++ ) //均值滤波
// {
// sums = 0;
// for( uint8_t j = 0; j < FLT_SIZE; j++ )
// {
// sums += p_flt_window[i][j];
// }
// InputReg[ 13 + i ] = sums/FLT_SIZE; //InputReg[13]~InputReg[18]
// temp_5803 = p1[3];
// temp_5803 = temp_5803 << 8;
// temp_5803 += p1[4];
// if (temp_5803 > 32768)
// {
// temp_5803 = (temp_5803 - 65844) / 256.0;
// }
// else
// {
// temp_5803 = (temp_5803 - 308) / 256.0;
// }
//}
// }
// if(NSS_Select > 6) //记录完6路气压后进入此处每6*10ms
// {
// NSS_Select = 1;
// flt_cnt++;
// if(flt_cnt > (FLT_SIZE - 1) ) //滑动窗口长度FLT_SIZE循环记录
// {
// flt_cnt = 0;
// }
// }
// if(NSS_Select < 4)
// {
// SENSOR_SELECT(0);
// }
} }