Comments (7)
you'll have to code it yourself. Just copy one of the other PID functions, and replace the PID with 166. Something like this (I've not tested it):
uint8_t ELM327::odometer()
{
return (uint8_t)processPID(SERVICE_01, 166, 1, 4, 0.1);
}
Note that it returns 4 bytes, and you need to divide the result by 10 (that's what the 0.1 scale factor is for)
from elmduino.
Hi Patrick,
thanks for your suggestion, I modified the library to also read the odometer value, but when compiling it returns the following error:
c:\Users\Administrator\Documents\Arduino\libraries\ELMDuino\src\ELMduino.cpp: In member function 'uint32_t ELM327::supportedPIDs_161_192()':
c:\Users\Administrator\Documents\Arduino\libraries\ELMDuino\src\ELMduino.cpp:2261:42: error: 'SUPPORTED_PIDS_161_192' was not declared in this scope
return (uint32_t)processPID(SERVICE_01, SUPPORTED_PIDS_161_192, 1, 4);
^~~~~~~~~~~~~~~~~~~~~~
c:\Users\Administrator\Documents\Arduino\libraries\ELMDuino\src\ELMduino.cpp:2261:42: note: suggested alternative: 'SUPPORTED_PIDS_61_80'
return (uint32_t)processPID(SERVICE_01, SUPPORTED_PIDS_161_192, 1, 4);
^~~~~~~~~~~~~~~~~~~~~~
SUPPORTED_PIDS_61_80
c:\Users\Administrator\Documents\Arduino\libraries\ELMDuino\src\ELMduino.cpp: In member function 'uint32_t ELM327::odometer()':
c:\Users\Administrator\Documents\Arduino\libraries\ELMDuino\src\ELMduino.cpp:2284:42: error: 'ODOMETER' was not declared in this scope
return (uint32_t)processPID(SERVICE_01, ODOMETER, 1, 4, 1.0 / 10.0);
this error is returned at compile time. The changes made on the two library files are:
`uint32_t supportedPIDs_161_192();
uint32_t odometer();`
these lines have been inserted in the elmduino.h file!
In the elmduino.cpp file i inserted:
uint32_t ELM327::supportedPIDs_161_192()
{
return (uint32_t)processPID(SERVICE_01, SUPPORTED_PIDS_161_192, 1, 4);
}
uint32_t ELM327::odometer()
{
return (uint32_t)processPID(SERVICE_01, ODOMETER, 1, 4, 1.0 / 10.0);
}
I'm sorry if I bother you for this triviality, but I can't understand the error and it is the last step of the project that is still missing.
Thank you.
Roberto.
from elmduino.
I wouldn't worry about the uint32_t supportedPIDs_161_192()
, it's not needed, for the moment, lets just assume your vehicle supports reporting of odometer.
Also you've referenced ODOMETER
when it hasn't been defined in the .h file. To start with, just hard code everything as per my example, if it works, then maybe it's worth defining ODOMETER constant etc. I assumed you knew you needed to add the function prototype to the class.
In the .h file where all the other functions are defined - it doesn't really matter where - but I suggest here
Line 410 in eabbb1a
add
uint8_t odometer();
and paste in the original function I provided in the .cpp file.
that should be all you need to do.
from elmduino.
from elmduino.
try turning debug on to see what your vehicle is reporting - this will be independent of your Nextion display.
have a look at the multiple PIDs example for how to turn debug on
https://github.com/PowerBroker2/ELMduino/blob/master/examples/multiple_pids/multiple_pids.ino
from elmduino.
from elmduino.
I have created a new method to get the odometer reading and an example program to run it. It should be working (works with an emulator) but I'm unable to properly test it as I don't have a vehicle that supports the OBDII spec PID ("A6") to test it with. If someone wants to have a go at it, it's on the "odometer" branch of my ELMduino fork. https://github.com/jimwhitelaw/ELMduino.git
from elmduino.
Related Issues (20)
- ELM327::isPidSupported Error
- Custom PID, how it works HOT 9
- PID 70: Boost pressure control (Service 01) HOT 1
- Problem with flashing RPM value on OLED when using latest version of ELMduino HOT 8
- ESP32 not connecting to ELM327 HOT 5
- Protocol Data Point HOT 4
- Couldn't connect to OBD scanner (stucked) HOT 18
- First time Bluetooth pairing between ESP32 and ELM327 HOT 1
- custom pid for DPF HOT 17
- BT Pairing problem between ESP-32 and ELM327 HOT 6
- How to change OBD protocol HOT 5
- Response not detected HOT 28
- Error in getting Multiple PID's HOT 9
- ESP32 s3 BLE compatibility? HOT 3
- Attempting to read non-standard PID HOT 1
- When does `queryPid` return `true`? HOT 4
- ESP32_CheckPIDs_1_20.ino HOT 1
- How to read data if I know TXD RXF RXD and MTH HOT 2
- ERROR: ELM_BUFFER_OVERFLOW on Honda Vezel 2023 HOT 4
- Problems in phase 1, can't connect with ELM327 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elmduino.