stanleyhuangyc / Freematics

Official source code repository for Freematics
https://freematics.com
419 stars 345 forks source link

pidmap always set to 0xff #197

Closed i-like-rockets closed 3 months ago

i-like-rockets commented 3 months ago

https://github.com/stanleyhuangyc/Freematics/blob/8612784dbb481933b9e356d6c8cbf3e483a27360/libraries/FreematicsPlus/FreematicsOBD.cpp#L412

Since the pidmap reference in #399 memset(pidmap, 0xff, sizeof(pidmap)); sets all values to 0xff, there seems to be no instance where this |= would ever equate to anything except 0xff.

If this interpretation is correct, either this sign should changed to = (default to keep PID in map) or the memset command should be removed (default to ignore PID).

ankostis commented 3 months ago

Unfortunately there is no useful commit message to explain why |= was necessitated, 3yago.

stanleyhuangyc commented 3 months ago

It seems to be truly an unnecessary change 3 years ago while the same code is right in the library for OBD-II UART adapter. It really should be = instead of |=.

stanleyhuangyc commented 3 months ago

This issue is fixed now and thanks for the finding.