RaccoonlabDev / mini_v2_node

Mini v2 node Cyphal/DroneCAN application example
GNU General Public License v3.0
8 stars 4 forks source link

circuit_id value bug #85

Open olegogogo opened 1 week ago

olegogogo commented 1 week ago

circuit_id value miscalculated if node_id > 25 here is an example:

Expected behaviour

node_id == 24

### Message from 24 to All  ts_mono=4705.564778  ts_real=1732175071.509685
circuit_id: 241
voltage: 5.3594
current: nan
error_flags: 0

### Message from 24 to All  ts_mono=4706.063576  ts_real=1732175072.008484
circuit_id: 240
voltage: 4.9336
current: nan
error_flags: 0

and this messages are followed by rule: .circuit_id = static_cast<uint8_t>(node_id * 10), and .circuit_id = static_cast<uint8_t>(node_id * 10 + 1),

Unexpected behaviour

but if node_id == 26

### Message from 26 to All  ts_mono=4967.872189  ts_real=1732175333.817097
circuit_id: 4
voltage: 4.9102
current: nan
error_flags: 0

### Message from 26 to All  ts_mono=4967.872927  ts_real=1732175333.817834
circuit_id: 5
voltage: 5.2969
current: nan
error_flags: 0

if node_id == 42

### Message from 42 to All  ts_mono=5052.216468  ts_real=1732175418.161376
circuit_id: 164
voltage: 4.9219
current: nan
error_flags: 0

### Message from 42 to All  ts_mono=5052.217260  ts_real=1732175418.162167
circuit_id: 165
voltage: 5.3750
current: nan
error_flags: 0