I'm looking to broadcast some of the analog inputs I have plugged into my racecapture mk3 over the CAN link so my ECU (megasquirt) can use them. I don't currently see a way to do that.
Am I missing it, or is it just not possible yet?
broadcasting analog inputs over CAN
-
- Posts: 138
- Joined: Fri Apr 07, 2017 3:47 pm
- Location: Oakland, CA
I wonder if you can combine the getAnalog() with the above function. Store the output of getAnalog() as a variable, then use that inside the data payload.txCAN(channel, id, isExtended, data, [timeout] ) available in firmware 2.0 Transmit a CAN message.
params
channel: The CAN channel. 0 for the first channel, 1 for the 2nd, if supported on the hardware
identifier: The Identifier value of the message, either in standard (11 bit) or extended (29 bit) format.
isExtended: 0 for Standard (11 bit) Identifier or 1 for Extended (29 bit) Identifier.
data: CAN message payload; array up to 8 elements long.
timeout: (optional) specify a timeout for sending this message. if the transmit queue is full, will block for the specified milliseconds. Defaults to 100ms
returns
1 if successful, 0 if failed, nil if parameters are incorrect
Example:
channel = 0
id = 1234
ext = 0
data = {11,22,33}
res = txCAN(channel, id, ext, data)
I think the output of getAnalog() is already scaled to decimal, so you'll need to rescale it to hexa for the txCAN, and the try transmitting it back onto the bus to see if you can see it. Easy way to check is to println() and see what the getAnalog() output is.
Maybe something like this:
function getSens5()
sensor5 = (getAnalog(5)*.019608)
msg = {sensor5}
txCAN(0, 9999, 0, msg)
end
Good news, we have an example for that:
https://wiki.autosportlabs.com/RaceCapt ... ture_value
The value that is extracted from getAnalog() is the value after it's been scaled. So if your dashboard is reading 200 for engine temperature on the first analog input, then
getAnalog(0) will return 200.
Hope this helps!
https://wiki.autosportlabs.com/RaceCapt ... ture_value
The value that is extracted from getAnalog() is the value after it's been scaled. So if your dashboard is reading 200 for engine temperature on the first analog input, then
getAnalog(0) will return 200.
Hope this helps!