增加HP203B转换到获取的间隔时间,避免有时获取到错误的数值但实际上传感器没有错误

This commit is contained in:
95384 2024-12-28 17:28:37 +08:00
parent 17f8b720c5
commit 8dd40691af
1 changed files with 4 additions and 2 deletions

View File

@ -103,6 +103,7 @@ BOOL get_HP203_data(float* tempdata, float* press)
for(int i=0; i<COLLECT_HB203_DATA_NUM; i++){ for(int i=0; i<COLLECT_HB203_DATA_NUM; i++){
hp203_set_mode(); hp203_set_mode();
osDelay(5);
ret = Hp203bReadPressure(&collect_pressure[i].fValue); ret = Hp203bReadPressure(&collect_pressure[i].fValue);
if(ret == FALSE) if(ret == FALSE)
{ {
@ -110,7 +111,7 @@ BOOL get_HP203_data(float* tempdata, float* press)
continue; continue;
//goto error_return; //goto error_return;
} }
osDelay(1); osDelay(5);
} }
if(press_falt >= COLLECT_HB203_DATA_NUM) if(press_falt >= COLLECT_HB203_DATA_NUM)
{ {
@ -133,6 +134,7 @@ BOOL get_HP203_data(float* tempdata, float* press)
for(int i=0; i<COLLECT_HB203_DATA_NUM; i++){ for(int i=0; i<COLLECT_HB203_DATA_NUM; i++){
hp203_set_mode(); hp203_set_mode();
osDelay(5);
ret = Hp203bReadTempture(&collect_tempture[i].fValue); ret = Hp203bReadTempture(&collect_tempture[i].fValue);
if(ret == FALSE) if(ret == FALSE)
{ {
@ -140,7 +142,7 @@ BOOL get_HP203_data(float* tempdata, float* press)
continue; continue;
//goto error_return; //goto error_return;
} }
osDelay(1); osDelay(5);
} }
if(temp_falt >= COLLECT_HB203_DATA_NUM) if(temp_falt >= COLLECT_HB203_DATA_NUM)
{ {