auto-sync

This commit is contained in:
rusEfi 2015-09-10 22:01:35 -04:00
parent 1bfda63efe
commit b2fc28fa59
6 changed files with 45 additions and 3 deletions

View File

@ -121,6 +121,8 @@ case TT_HONDA_ACCORD_1_24:
return "TT_HONDA_ACCORD_1_24"; return "TT_HONDA_ACCORD_1_24";
case TT_DODGE_STRATUS: case TT_DODGE_STRATUS:
return "TT_DODGE_STRATUS"; return "TT_DODGE_STRATUS";
case TT_36_2_2_2:
return "TT_36_2_2_2";
case TT_HONDA_ACCORD_CD_DIP: case TT_HONDA_ACCORD_CD_DIP:
return "TT_HONDA_ACCORD_CD_DIP"; return "TT_HONDA_ACCORD_CD_DIP";
case TT_HONDA_ACCORD_CD_TWO_WIRES: case TT_HONDA_ACCORD_CD_TWO_WIRES:

View File

@ -145,7 +145,9 @@ typedef enum {
TT_DODGE_STRATUS = 22, TT_DODGE_STRATUS = 22,
TT_UNUSED = 23, // this is used if we want to iterate over all trigger types TT_36_2_2_2 = 23,
TT_UNUSED = 24, // this is used if we want to iterate over all trigger types
Force_4b_trigger_type = ENUM_32_BITS, Force_4b_trigger_type = ENUM_32_BITS,
} trigger_type_e; } trigger_type_e;

View File

@ -8,6 +8,7 @@ TRIGGER_DECODERS_SRC_CPP = \
$(PROJECT_DIR)/controllers/trigger/trigger_structure.cpp \ $(PROJECT_DIR)/controllers/trigger/trigger_structure.cpp \
$(PROJECT_DIR)/controllers/trigger/trigger_decoder.cpp \ $(PROJECT_DIR)/controllers/trigger/trigger_decoder.cpp \
$(PROJECT_DIR)/controllers/trigger/trigger_mitsubishi.cpp \ $(PROJECT_DIR)/controllers/trigger/trigger_mitsubishi.cpp \
$(PROJECT_DIR)/controllers/trigger/trigger_subaru.cpp \
$(PROJECT_DIR)/controllers/trigger/trigger_gm.cpp $(PROJECT_DIR)/controllers/trigger/trigger_gm.cpp
TRIGGER_SRC_CPP = \ TRIGGER_SRC_CPP = \

View File

@ -30,6 +30,7 @@
#include "trigger_gm.h" #include "trigger_gm.h"
#include "trigger_bmw.h" #include "trigger_bmw.h"
#include "trigger_mitsubishi.h" #include "trigger_mitsubishi.h"
#include "trigger_subaru.h"
#include "auto_generated_enums.h" #include "auto_generated_enums.h"
#include "trigger_structure.h" #include "trigger_structure.h"
#include "efiGpio.h" #include "efiGpio.h"
@ -41,7 +42,7 @@ EXTERN_ENGINE
; ;
// todo: better name for this constant // todo: better name for this constant
#define HELPER_PERIOD 100000 #define HELPER_PERIOD 720000
static cyclic_buffer<int> errorDetection; static cyclic_buffer<int> errorDetection;
@ -184,7 +185,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
scheduleMsg(logger, "gap=%f @ %d", gap, currentCycle.current_index); scheduleMsg(logger, "gap=%f @ %d", gap, currentCycle.current_index);
#else #else
actualSynchGap = gap; actualSynchGap = gap;
print("current gap %f\r\n", gap); print("current gap %f c=%d prev=%d\r\n", gap, currentDuration, toothed_previous_duration);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
@ -431,6 +432,10 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET
initDodgeRam(triggerShape); initDodgeRam(triggerShape);
break; break;
case TT_36_2_2_2:
initialize36_2_2_2(triggerShape);
break;
default: default:
firmwareError("initializeTriggerShape() not implemented: %d", triggerConfig->type); firmwareError("initializeTriggerShape() not implemented: %d", triggerConfig->type);
; ;

View File

@ -0,0 +1,17 @@
/**
* @file trigger_subaru.cpp
*
* @date Sep 10, 2015
* @author Andrey Belomutskiy, (c) 2012-2015
*/
#include "trigger_subaru.h"
void initialize36_2_2_2(TriggerShape *s) {
float wide = 30;
s->isSynchronizationNeeded = false;
s->addEvent(720 - wide / 2, T_SECONDARY, TV_HIGH);
s->addEvent(720, T_SECONDARY, TV_LOW);
}

View File

@ -0,0 +1,15 @@
/**
* @file trigger_subaru.h
*
* @date Sep 10, 2015
* @author Andrey Belomutskiy, (c) 2012-2015
*/
#ifndef CONTROLLERS_TRIGGER_TRIGGER_SUBARU_H_
#define CONTROLLERS_TRIGGER_TRIGGER_SUBARU_H_
#include "engine.h"
void initialize36_2_2_2(TriggerShape *s);
#endif /* CONTROLLERS_TRIGGER_TRIGGER_SUBARU_H_ */