修复了气压传感器错误会将0扔给DSP导致系统重启的问题
This commit is contained in:
parent
0da9b8f2da
commit
17f8b720c5
|
@ -95,7 +95,9 @@ BOOL Hp203bReadTempture(float *press)
|
|||
#define COLLECT_HB203_DATA_NUM 10
|
||||
BOOL get_HP203_data(float* tempdata, float* press)
|
||||
{
|
||||
int ret;
|
||||
uint8_t ret;
|
||||
uint8_t temp_falt = 0;
|
||||
uint8_t press_falt = 0;
|
||||
// ѹǿ
|
||||
U_DataType collect_pressure[COLLECT_HB203_DATA_NUM]={0x00};
|
||||
|
||||
|
@ -104,12 +106,18 @@ BOOL get_HP203_data(float* tempdata, float* press)
|
|||
ret = Hp203bReadPressure(&collect_pressure[i].fValue);
|
||||
if(ret == FALSE)
|
||||
{
|
||||
goto error_return;
|
||||
press_falt++;
|
||||
continue;
|
||||
//goto error_return;
|
||||
}
|
||||
osDelay(1);
|
||||
}
|
||||
if(press_falt >= COLLECT_HB203_DATA_NUM)
|
||||
{
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
U_DataType tmp_press = filter_middle(collect_pressure, COLLECT_HB203_DATA_NUM, FILTER_DATA_TYPE_FLOAT);
|
||||
U_DataType tmp_press = filter_middle(collect_pressure, COLLECT_HB203_DATA_NUM - press_falt, FILTER_DATA_TYPE_FLOAT);
|
||||
if(tmp_press.fValue < 300)
|
||||
{
|
||||
// return FALSE;
|
||||
|
@ -128,12 +136,18 @@ BOOL get_HP203_data(float* tempdata, float* press)
|
|||
ret = Hp203bReadTempture(&collect_tempture[i].fValue);
|
||||
if(ret == FALSE)
|
||||
{
|
||||
goto error_return;
|
||||
temp_falt++;
|
||||
continue;
|
||||
//goto error_return;
|
||||
}
|
||||
osDelay(1);
|
||||
}
|
||||
if(temp_falt >= COLLECT_HB203_DATA_NUM)
|
||||
{
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
U_DataType tmp_tempture = filter_middle(collect_tempture, COLLECT_HB203_DATA_NUM, FILTER_DATA_TYPE_FLOAT);
|
||||
U_DataType tmp_tempture = filter_middle(collect_tempture, COLLECT_HB203_DATA_NUM - temp_falt, FILTER_DATA_TYPE_FLOAT);
|
||||
if(tmp_tempture.fValue < -50)
|
||||
{
|
||||
// return FALSE;
|
||||
|
|
Loading…
Reference in New Issue