Skip to content

Commit

Permalink
toyota 3 tooth cam decoder #237
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Sep 14, 2023
1 parent a47bc88 commit a6a25ba
Show file tree
Hide file tree
Showing 4 changed files with 1,632 additions and 6 deletions.
13 changes: 7 additions & 6 deletions firmware/controllers/trigger/trigger_central.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,15 @@ void hwHandleVvtCamSignal(bool isRising, efitick_t nowNt, int index) {
}

switch(engineConfiguration->vvtMode[camIndex]) {
case VVT_2JZ:
// we do not know if we are in sync or out of sync, so we have to be looking for both possibilities
if ((currentPosition < engineConfiguration->scriptSetting[4] || currentPosition > engineConfiguration->scriptSetting[5]) &&
(currentPosition < engineConfiguration->scriptSetting[4] + 360 || currentPosition > engineConfiguration->scriptSetting[5] + 360)) {
// outside of the expected range
case VVT_2JZ: {
// Consider the tooth in the first 1/3 of the engine phase
bool inRange = angleFromPrimarySyncPoint > 0 && angleFromPrimarySyncPoint < (720 / 3);

if (!inRange) {
return;
}
break;

} break;
default:
// else, do nothing
break;
Expand Down
1 change: 1 addition & 0 deletions unit_tests/tests/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ TESTS_SRC_CPP = \
tests/trigger/test_real_gm_24x.cpp \
tests/trigger/test_real_k24a2.cpp \
tests/trigger/test_real_k20.cpp \
tests/trigger/test_real_toyota_3_tooth_cam.cpp \
tests/trigger/test_map_cam.cpp \
tests/trigger/test_rpm_multiplier.cpp \
tests/trigger/test_quad_cam.cpp \
Expand Down
Loading

0 comments on commit a6a25ba

Please sign in to comment.