Commit 059a9add authored by 李俭双's avatar 李俭双

🐞 fix:43285,胎压值计算四舍五入

parent 63829cb3
...@@ -40,13 +40,12 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -40,13 +40,12 @@ void Data_TPMS_Processing_Service ( void )
TPMS.Rear_TPMS_Valid = 1; TPMS.Rear_TPMS_Valid = 1;
TPMS.Front_Press_Value = 99; TPMS.Front_Press_Value = 99;
TPMS.Rear_Press_Value = Rear_TPMS * 275; TPMS.Rear_Press_Value = Rear_TPMS * 275;
TPMS.Rear_Press_Value /= 10 ;
TPMS.Rear_Press_Value /= 102 ; TPMS.Rear_Press_Value /= 102 ;
if(TPMS.Rear_Press_Value > 99) if(TPMS.Rear_Press_Value > 990)
{ {
TPMS.Rear_Press_Value = 99; TPMS.Rear_Press_Value = 990;
} }
if((TPMS.Rear_Press_Value < 17) || (TPMS.Rear_Press_Value > 25)) if((TPMS.Rear_Press_Value < 170) || (TPMS.Rear_Press_Value > 250))
{ {
TPMS.TPMS_Warning = 1; TPMS.TPMS_Warning = 1;
} }
...@@ -61,13 +60,12 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -61,13 +60,12 @@ void Data_TPMS_Processing_Service ( void )
TPMS.Rear_TPMS_Valid = 0; TPMS.Rear_TPMS_Valid = 0;
TPMS.Rear_Press_Value = 99; TPMS.Rear_Press_Value = 99;
TPMS.Front_Press_Value = Front_TPMS *275 ; TPMS.Front_Press_Value = Front_TPMS *275 ;
TPMS.Front_Press_Value /= 10 ;
TPMS.Front_Press_Value /= 102 ; TPMS.Front_Press_Value /= 102 ;
if(TPMS.Front_Press_Value > 99) if(TPMS.Front_Press_Value > 990)
{ {
TPMS.Front_Press_Value = 99; TPMS.Front_Press_Value = 990;
} }
if((TPMS.Front_Press_Value < 17) || (TPMS.Front_Press_Value > 23)) if((TPMS.Front_Press_Value < 170) || (TPMS.Front_Press_Value > 230))
{ {
TPMS.TPMS_Warning = 1; TPMS.TPMS_Warning = 1;
} }
...@@ -78,8 +76,8 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -78,8 +76,8 @@ void Data_TPMS_Processing_Service ( void )
} }
else else
{ {
TPMS.Front_Press_Value = 99; TPMS.Front_Press_Value = 990;
TPMS.Rear_Press_Value = 99; TPMS.Rear_Press_Value = 990;
TPMS.TPMS_Warning = 0; TPMS.TPMS_Warning = 0;
TPMS.Front_TPMS_Valid = 0; TPMS.Front_TPMS_Valid = 0;
TPMS.Rear_TPMS_Valid = 0; TPMS.Rear_TPMS_Valid = 0;
...@@ -89,22 +87,20 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -89,22 +87,20 @@ void Data_TPMS_Processing_Service ( void )
{ {
TPMS.Front_TPMS_Valid = 1; TPMS.Front_TPMS_Valid = 1;
TPMS.Rear_TPMS_Valid = 1; TPMS.Rear_TPMS_Valid = 1;
TPMS.Front_Press_Value = Front_TPMS * 275 ; TPMS.Front_Press_Value = Front_TPMS * 275 ;
TPMS.Front_Press_Value /= 10 ;
TPMS.Front_Press_Value /= 102 ; TPMS.Front_Press_Value /= 102 ;
if(TPMS.Front_Press_Value > 99) if(TPMS.Front_Press_Value > 990)
{ {
TPMS.Front_Press_Value = 99; TPMS.Front_Press_Value = 990;
} }
TPMS.Rear_Press_Value = Rear_TPMS * 275; TPMS.Rear_Press_Value = Rear_TPMS * 275;
TPMS.Rear_Press_Value /= 10 ;
TPMS.Rear_Press_Value /= 102 ; TPMS.Rear_Press_Value /= 102 ;
if(TPMS.Rear_Press_Value > 99) if(TPMS.Rear_Press_Value > 990)
{ {
TPMS.Rear_Press_Value = 99; TPMS.Rear_Press_Value = 990;
} }
if ((TPMS.Front_Press_Value < 17) || (TPMS.Front_Press_Value > 23) || (TPMS.Rear_Press_Value < 17) || (TPMS.Rear_Press_Value > 25)) if ((TPMS.Front_Press_Value < 170) || (TPMS.Front_Press_Value > 230) || (TPMS.Rear_Press_Value < 170) || (TPMS.Rear_Press_Value > 250))
{ {
TPMS.TPMS_Warning = 1; TPMS.TPMS_Warning = 1;
} }
...@@ -129,10 +125,7 @@ uint16_t Data_Bar_To_Psi (uint16_t bar) ...@@ -129,10 +125,7 @@ uint16_t Data_Bar_To_Psi (uint16_t bar)
{ {
bar *= 145; bar *= 145;
bar /= 10; bar /= 10;
if((bar % 5) >= 5) bar += 5;
{
bar += 5;
}
return bar; return bar;
} }
uint8_t Get_Led_TPMS_Waring (void) uint8_t Get_Led_TPMS_Waring (void)
...@@ -153,15 +146,16 @@ uint16_t Get_Front_TPMS_Sig_Value (void) ...@@ -153,15 +146,16 @@ uint16_t Get_Front_TPMS_Sig_Value (void)
uint16_t value = 0; uint16_t value = 0;
if (TPMS.TPMS_Unit == 1) if (TPMS.TPMS_Unit == 1)
{ {
value = Data_Bar_To_Psi(TPMS.Front_Press_Value) / 10; value = Data_Bar_To_Psi(TPMS.Front_Press_Value) / 100;
if(value > 99) if(value > 99)
{ {
value = 99; value = 99;
} }
} }
else else
{ {
value = TPMS.Front_Press_Value; TPMS.Front_Press_Value += 5;
value = TPMS.Front_Press_Value / 10;
} }
return value; return value;
} }
...@@ -170,7 +164,7 @@ uint16_t Get_Rear_TPMS_Sig_Value (void) ...@@ -170,7 +164,7 @@ uint16_t Get_Rear_TPMS_Sig_Value (void)
uint16_t value = 0; uint16_t value = 0;
if (TPMS.TPMS_Unit == 1) if (TPMS.TPMS_Unit == 1)
{ {
value = Data_Bar_To_Psi(TPMS.Rear_Press_Value) / 10; value = Data_Bar_To_Psi(TPMS.Rear_Press_Value) / 100;
if(value > 99) if(value > 99)
{ {
value = 99; value = 99;
...@@ -178,8 +172,9 @@ uint16_t Get_Rear_TPMS_Sig_Value (void) ...@@ -178,8 +172,9 @@ uint16_t Get_Rear_TPMS_Sig_Value (void)
} }
else else
{ {
value = TPMS.Rear_Press_Value; TPMS.Rear_Press_Value += 5;
value = TPMS.Rear_Press_Value / 10;
} }
return value; return value;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment