Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tpms_nissan.c #2906

Merged
merged 3 commits into from
Apr 18, 2024
Merged

Conversation

CppBaddy
Copy link
Contributor

Fixed reported pressure_psi value.

Fixed reported pressure_psi value.
@zuckschwerdt
Copy link
Collaborator

Thanks!
The inversion of the documented (PSI+THREE)*FOUR would be float pressure_psi = (float)pressure_raw / 4.0f - 3.0f;, won't it?

@CppBaddy
Copy link
Contributor Author

CppBaddy commented Apr 18, 2024

I found by accident that the pressure value tracks my tire gauge better. Original formula gives much lower values. To verify, I am going to capture some data from my winter wheels tonight.
BTW: do you remember the source of original formula? From what I see in schrader_SMD3MA4_decode raw value just gets divided by 5. This decoder gets my original Nissan sensors. The tpms_nissan reads aftermarket sensors I use in winter tires.

@zuckschwerdt
Copy link
Collaborator

The decoder was merged from #2536 but I messed up the pressure by applying the factor twice.

I think only that error should be corrected. The difference in measurement you see is more likely due to operating temperature?

@zuckschwerdt
Copy link
Collaborator

See #2157 (reply in thread) which I might have missed back then.

the TPMS sensor uses "sealed gauge" (internal absolute pressure reference) it may or may not read the same as your tire pressure gauge, depending on your elevation.

It should be corrected to use just / 4 with no offset.

@CppBaddy
Copy link
Contributor Author

Ok, this makes sense, I'll make changes then.

Cleaned pressure calculations as zuckschwerdt suggested
@zuckschwerdt
Copy link
Collaborator

Thanks! Sorry to be picky, could you use 4.0f to be consistent with other float literals?

adding trailing zero to float
@CppBaddy
Copy link
Contributor Author

No worries, fixed.
Cheers!

@zuckschwerdt zuckschwerdt merged commit a8fa751 into merbanan:master Apr 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants