Skip to content

Commit

Permalink
fix incorrect evaluation order for decoding STmin parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sauci committed Jul 31, 2019
1 parent 165ffaf commit 45bb9ed
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions source/CanTp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2377,21 +2377,21 @@ static uint8 CanTp_EncodeSTMinValue(const uint16 value)
{
uint8 result;

if (CanTp_ConvertUsToMs(value) <= 0x7Fu)
if ((value == 100u) ||
(value == 200u) ||
(value == 300u) ||
(value == 400u) ||
(value == 500u) ||
(value == 600u) ||
(value == 700u) ||
(value == 800u) ||
(value == 900u))
{
result = (uint8)CanTp_ConvertUsToMs(value);
result = (uint8)(0x00F0u | (value / 100u));
}
else if ((value == 100u) ||
(value == 200u) ||
(value == 300u) ||
(value == 400u) ||
(value == 500u) ||
(value == 600u) ||
(value == 700u) ||
(value == 800u) ||
(value == 900u))
else if (CanTp_ConvertUsToMs(value) <= 0x7Fu)
{
result = (uint8)(0x00F0u | (value / 100u));
result = (uint8)CanTp_ConvertUsToMs(value);
}
else
{
Expand Down

0 comments on commit 45bb9ed

Please sign in to comment.