speeduino
speeduino copied to clipboard
Fix Jeep2000 decoder
getCrankAngle_Jeep2000() sets crankangle = 146 if toothcurrentcount = 0, because last tooth was cam tooth which is 146 ATDC, however, all the timing and angle calculations are not done on the cam tooth read, so crankangle should be set to 114 for previous crank tooth. problem was found by @jaky 47 on Slack, and fix tested and confirmed by him.
ooh, should this have been a PR against the 202207-fixes branch instead?
Problem description in #897
@jonbills, should the code comment have said "//This is the special case to handle when the 'last tooth' seen was the cam tooth. 146 is the angle at which the cam tooth goes high." Did 118 degrees fix the #897 issue? Perhaps 114 degrees vs. 118 degrees is close enough but the crank tooth degrees in this decoder use rising edge so 114 degrees would be more accurate.
It certainly fixed the problem of the duplicate and very early signal. I think you're right that 114 would be more correct. I'll update to that. Most of the comment is the original authors, I just appended a note on the correction, but yes!
redoing as two PRs - one an LTS 'fix' for the original logic error , the other a non LTS 'improvements' (noise filtering)