Page 1 of 1

proper way to set default for CAN channels during no CAN

PostPosted: Wed Jul 27, 2016 4:50 pm
by cbracer
I have a M1 and it needs to receive a modifier for traction control so I setup a channel to receive it over CAN. But when the device sending that message gets reset or restarted, there is no CAN message and the ECU decides to nullify the value. It actually removes the value and reports nothing other than a CAN diag error. How does one set a default for a sensor input that is receiving data over CAN ? I can't increase the timeout beyond 0.5 seconds because that is hard coded into M1 :( attached is a picture of the channel inputs I setup as sensors. Is the type "sensor" correct for this?

Re: proper way to set default for CAN channels during no CAN

PostPosted: Fri Jul 29, 2016 7:50 am
by MalcolmG
Personally I wouldn't set it up as a sensor, rather I would use a channel to hold the value and a scheduled function to update the channel. In the function you can then use a conditional to either update the value when you've received a valid message over CAN, or keep the last good value if you have a CAN fault.