Conversation
|
As a side note, I guess some more commands needs to be sent into the socket to properly configure the device. As if I open torque and then my app everything works just fine, while if I connect the ODB device and open directly my app I get a bunch of garbage data. Any help in that direction will be more than appreciated, so that I can include it in this PR. |
|
There are some init commands that you need to send over to setup the connection. Here is a snippet from an app I have connecting to the ELM327 device and right after this block it sends a normal request for a pid and they work. |
|
Im sure this code can be cut down from instructions |
| ``` | ||
| //Request MODE 1, PID 0C - RPM | ||
| val pid = PID(ObdModes.MODE_01, "0C") | ||
| pid.formula = "(256A+B)/4" // Engine RPM formula https://en.wikipedia.org/wikiOBD-II_PIDs#Service_01 |
There was a problem hiding this comment.
You dont have to build this PID yourself.
You can request a fully built pid from the built in library this way:
val pid = PIDUtils.getPid(ObdModes.MODE_01, "OC")
|
Im sure this init code could be encapsulated into a method and have default values which would allow the consumer to init with a specific set of values if they need to change them. This might be a great enhancement to add to allow a one call init method to prevent others from having to all this initial command work to get it connected. |
|
Can you try 1.8.1 and see what you get with it? I have now built in the init code needed and the readme has been updated to reflect how to init the ELM device. |
Hi,
I would first like to thank you for this very useful library.
I started using it with my simulated ECU: https://github.com/spoonieau/OBD2-ECU-Simulator but I was not getting out the right data, while Torque or other ODB apps were able to get them.
I found that the readme lacked some PID configuration for the command to parse the data.
So before I got this data:
Then after passing the right parameters to the PID I got ( I configured the simulator to 2000RPM):
I hope this will be helpful to other developers using this library.