Page 1 of 1

Bitwise AND operators , interpreting Engine Status

Posted: Thu Oct 01, 2020 3:52 pm
by Canyonfive
So, I'd like to map a channel for my clutch switch which is wired to my megasquirt.

The clutch switch is wired to "Launch in" so when that is active my clutch is depressed.

"Launch in" is located in Engine Status 2, status1-8 These bitfield variables is a combination of binary bits about engine status. These are used to drive various
status indicators.
Image

This is broadcast on decimal ID 1530 with an offset of 1
Image

This thread explains something that I don't understand. Bitwise AND operators. It also explains how this bit field works.
https://www.msextra.com/forums/viewtopi ... 00&t=73499
More explaining, http://www.msextra.com/doc/pdf/html/Meg ... 5-136.html

I can easily map engine status 2 into Racecapture, my question is, using lua how would I evaluate the integer sent to see if "Launch in" is active?

Re: Bitwise AND operators , interpreting Engine Status

Posted: Thu Oct 01, 2020 6:33 pm
by brentp
Hi,

You can do this in 2 steps:

Step one, map a CAN channel for the bit field you want. This will result in a channel with a 0 or 1 value.
https://wiki.autosportlabs.com/CAN_Bus_Integration

Step two, if you want to do additional processing in Lua, you can fetch that channel value by name, and then do what you need with that value. Use the getChannel() function: https://wiki.autosportlabs.com/RaceCapt ... r_name_.29