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

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

parent 63829cb3
......@@ -40,13 +40,12 @@ void Data_TPMS_Processing_Service ( void )
TPMS.Rear_TPMS_Valid = 1;
TPMS.Front_Press_Value = 99;
TPMS.Rear_Press_Value = Rear_TPMS * 275;
TPMS.Rear_Press_Value /= 10 ;
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;
}
......@@ -61,13 +60,12 @@ void Data_TPMS_Processing_Service ( void )
TPMS.Rear_TPMS_Valid = 0;
TPMS.Rear_Press_Value = 99;
TPMS.Front_Press_Value = Front_TPMS *275 ;
TPMS.Front_Press_Value /= 10 ;
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;
}
......@@ -78,8 +76,8 @@ void Data_TPMS_Processing_Service ( void )
}
else
{
TPMS.Front_Press_Value = 99;
TPMS.Rear_Press_Value = 99;
TPMS.Front_Press_Value = 990;
TPMS.Rear_Press_Value = 990;
TPMS.TPMS_Warning = 0;
TPMS.Front_TPMS_Valid = 0;
TPMS.Rear_TPMS_Valid = 0;
......@@ -90,21 +88,19 @@ void Data_TPMS_Processing_Service ( void )
TPMS.Front_TPMS_Valid = 1;
TPMS.Rear_TPMS_Valid = 1;
TPMS.Front_Press_Value = Front_TPMS * 275 ;
TPMS.Front_Press_Value /= 10 ;
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 /= 10 ;
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;
}
......@@ -129,10 +125,7 @@ uint16_t Data_Bar_To_Psi (uint16_t bar)
{
bar *= 145;
bar /= 10;
if((bar % 5) >= 5)
{
bar += 5;
}
return bar;
}
uint8_t Get_Led_TPMS_Waring (void)
......@@ -153,7 +146,7 @@ uint16_t Get_Front_TPMS_Sig_Value (void)
uint16_t value = 0;
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)
{
value = 99;
......@@ -161,7 +154,8 @@ uint16_t Get_Front_TPMS_Sig_Value (void)
}
else
{
value = TPMS.Front_Press_Value;
TPMS.Front_Press_Value += 5;
value = TPMS.Front_Press_Value / 10;
}
return value;
}
......@@ -170,7 +164,7 @@ uint16_t Get_Rear_TPMS_Sig_Value (void)
uint16_t value = 0;
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)
{
value = 99;
......@@ -179,7 +173,8 @@ uint16_t Get_Rear_TPMS_Sig_Value (void)
}
else
{
value = TPMS.Rear_Press_Value;
TPMS.Rear_Press_Value += 5;
value = TPMS.Rear_Press_Value / 10;
}
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