ebroecker / canmatrix

Converting Can (Controller Area Network) Database Formats .arxml .dbc .dbf .kcd ...
BSD 2-Clause "Simplified" License
907 stars 400 forks source link

The cancompare return wrong result if the can frame has differrent ID #551

Closed annguyen0 closed 3 years ago

annguyen0 commented 3 years ago

The current comparison logic of frame between 2 dbc is based on the Frame ID. If the ID is changed, the result is returned that this frame is removed/added. It's not correct because only the ID has changed.

Example:

Comparison result:

PS D:\repo> cancompare.exe .\toyota_rav4_2017_pt_generated.dbc .\toyota_rav4_hybrid_2017_pt_generated.dbc
arxml is not supported
kcd is not supported
fibex is not supported
xls is not supported
xlsx is not supported
yaml is not supported
INFO - compare - Importing .\toyota_rav4_2017_pt_generated.dbc ...
error with line no: 298
b'CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque";\n'
error with line no: 299
b'CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value";\n'
INFO - compare - 42 Frames found
INFO - compare - Importing .\toyota_rav4_hybrid_2017_pt_generated.dbc ...
error with line no: 298
b'CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque";\n'
error with line no: 299
b'CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value";\n'
INFO - compare - 42 Frames found
  FRAME deleted  BRAKE_MODULE
  FRAME deleted  GAS_PEDAL
  FRAME changed  GEAR_PACKET
    SIGNAL added  SPORT_ON
    SIGNAL added  SPORT_GEAR_ON
    SIGNAL added  SPORT_GEAR
    SIGNAL added  ECON_ON
    SIGNAL added  DRIVE_ENGAGED
  FRAME added  BRAKE_MODULE
  FRAME added  GAS_PEDAL
PS D:\repo>

Expected result:

annguyen0 commented 3 years ago

To fix it: https://github.com/ebroecker/canmatrix/pull/552