Hi, i'm new in Freematics One + and I'd like some help to configurate datalogger, i need to read and save the next information:
- PID_SPEED
- PID_RPM
- PID_THROTTLE
- PID_COOLANT_TEMP
- PID_INTAKE_TEMP
- PID_BAROMETRIC
- PID_SHORT_TERM_FUEL_TRIM_1
- PID_LONG_TERM_FUEL_TRIM_1
- PID_INTAKE_MAP
- PID_FUEL_INJECTION_TIMING
- PID_ENGINE_FUEL_RATE
I tried to change the PID_POLLING_INFO obdData introducing by the next way
PID_POLLING_INFO obdData[]= {
{PID_SPEED, 1},
{PID_RPM, 1},
{PID_THROTTLE, 1},
{PID_COOLANT_TEMP, 3},
{PID_INTAKE_TEMP, 3},
{PID_BAROMETRIC, 3},
{PID_SHORT_TERM_FUEL_TRIM_1, 5},
{PID_LONG_TERM_FUEL_TRIM_1, 5},
{PID_INTAKE_MAP, 6},
{PID_FUEL_INJECTION_TIMING, 3},
{PID_ENGINE_FUEL_RATE, 3},
{0, 0},
};
But i can't get the last 4 PIDS, please help me how to get them.
Thank you
configurate DATALOGGER
-
- Posts: 3
- Joined: Wed Jun 20, 2018 9:55 pm
Re: configurate DATALOGGER
Yep, me too. Any help at all would be much appreciated.
If it anything to do with the declaration of
// bit map of supported PIDs
byte pidmap[4 * 4] = {0};
in FreematicsOBD.h
This seems to imply that there are a max of 16 entries (unless this is increased).
If it anything to do with the declaration of
// bit map of supported PIDs
byte pidmap[4 * 4] = {0};
in FreematicsOBD.h
This seems to imply that there are a max of 16 entries (unless this is increased).
-
- Posts: 3
- Joined: Wed Jun 20, 2018 9:55 pm
Re: configurate DATALOGGER
You too?
If I get anywhere I'll let you know.
If I get anywhere I'll let you know.
Re: configurate DATALOGGER
clochardm33 wrote:
> If it anything to do with the declaration of
> // bit map of supported PIDs
> byte pidmap[4 * 4] = {0};
> in FreematicsOBD.h
> This seems to imply that there are a max of 16 entries (unless this is
> increased).
pidmap is a bitmap (see for example COBD::isValidPID) so the entries should be 16*8.
also, I would try to keep the PIDs sorted by increasing tier: from reading the code in loop() I'd say it expects that.
> If it anything to do with the declaration of
> // bit map of supported PIDs
> byte pidmap[4 * 4] = {0};
> in FreematicsOBD.h
> This seems to imply that there are a max of 16 entries (unless this is
> increased).
pidmap is a bitmap (see for example COBD::isValidPID) so the entries should be 16*8.
also, I would try to keep the PIDs sorted by increasing tier: from reading the code in loop() I'd say it expects that.
-
- Posts: 3
- Joined: Wed Jun 20, 2018 9:55 pm
Re: configurate DATALOGGER
This is starting to make sense a bit now. As the code isn't commented it is all a bit of a muddle at first glance.
I think the short answer is that you are not getting the PIDs you want as your car doesn't support them (despite what you may think).
In the routine COBD::init there is the section after the line stage = 3;
This is where the pidmap[] array is populated. This is the bit map (as aboaboit says) of the PIDs that the car reports back as being valid.
The array contains the entries of responses of the PID address x0, x20, x40, x60. These are the car coming back giving a 1/0 for each of the addresses.
It is in https://en.wikipedia.org/wiki/OBD-II_PIDs
pidmap[] is then a map of which PIDs the car will give a response to (a 1) and which the car will not give a response to (a 0).
The line in the datalogger.ino
if (!obd.isValidPID(pid)) {
continue;
}
simply compares the address of the pid you request to that pid's location in the pidmap. If the map contains a 1 then the pid you are trying to read is valid and can be read from. If it contains a 0 then the pid is not valid, the continue; drops out of the loop and moves onto the next pid.
There is also another condition in the obd.isValidPID() function which means that any pid with an address above x7F is always returned false. This is because the pidmap[] only reads the addresses x0, x20, x40, x60, and x60 + 32 takes you to x80, which is not something that the pidmap config reads.
Therefore if the car comes back and says that the pid address is not one that it reports then you get nothing (regardless of the tier).
The tier is the relative frequency of polling, but (again as aboaboit says) this should be in numerical order.
I think the short answer is that you are not getting the PIDs you want as your car doesn't support them (despite what you may think).
In the routine COBD::init there is the section after the line stage = 3;
This is where the pidmap[] array is populated. This is the bit map (as aboaboit says) of the PIDs that the car reports back as being valid.
The array contains the entries of responses of the PID address x0, x20, x40, x60. These are the car coming back giving a 1/0 for each of the addresses.
It is in https://en.wikipedia.org/wiki/OBD-II_PIDs
pidmap[] is then a map of which PIDs the car will give a response to (a 1) and which the car will not give a response to (a 0).
The line in the datalogger.ino
if (!obd.isValidPID(pid)) {
continue;
}
simply compares the address of the pid you request to that pid's location in the pidmap. If the map contains a 1 then the pid you are trying to read is valid and can be read from. If it contains a 0 then the pid is not valid, the continue; drops out of the loop and moves onto the next pid.
There is also another condition in the obd.isValidPID() function which means that any pid with an address above x7F is always returned false. This is because the pidmap[] only reads the addresses x0, x20, x40, x60, and x60 + 32 takes you to x80, which is not something that the pidmap config reads.
Therefore if the car comes back and says that the pid address is not one that it reports then you get nothing (regardless of the tier).
The tier is the relative frequency of polling, but (again as aboaboit says) this should be in numerical order.
Re: configurate DATALOGGER
Hmm, right now the isValid method returns true when the PID index is above 0x7F which makes no sense to me: there is no space to map supported PIDs above that number and also no transcoding of values in the library.
Re: configurate DATALOGGER
Great information..
-
- Posts: 1
- Joined: Fri Jun 19, 2020 12:07 am