cantools / cantools

CAN bus tools.
MIT License
1.9k stars 566 forks source link

Multiplexed signals counting size incorrectly #148

Open thekenu opened 5 years ago

thekenu commented 5 years ago

Tested on 32.19.2

If I have two mux signals like this in .sym:

{SENDRECEIVE}
[TestAlert]
ID=700h
Len=4
CycleTime=1000
Mux=FSM 0,8 1
Var=alert1 unsigned 8,1

[TestAlert]
Len=8
Mux=TestMuxFloat 0,8 2
Var=float float 8,32

I get a error: The signal float does not fit in message TestAlert.

However, if I change Len=4 to Len=5, the error goes away (Since Len=5 will fit TestMuxFloat and float?). It seems to me that the code isn't taking into account that each mux signal may have different length.

eerimoq commented 5 years ago

Please implement a fix and I'll merge it. Thanks.