auto-sync

This commit is contained in:
rusEfi 2016-08-20 23:02:09 -04:00
parent e0fff92cd0
commit 0d23824726
9 changed files with 42 additions and 15 deletions

View File

@ -16,12 +16,12 @@
EXTERN_ENGINE;
void setTestEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
// setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
// engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE;
// setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
// engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
// trigger_config_s *triggerConfig = &engineConfiguration->trigger;
// triggerConfig->customTotalToothCount = 60;
// triggerConfig->customSkippedToothCount = 0;
@ -65,4 +65,10 @@ void setTestVVTEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
// set_algorithm 3
setAlgorithm(LM_SPEED_DENSITY PASS_ENGINE_PARAMETER);
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
engineConfiguration->camInput = GPIOA_5;
// set_global_trigger_offset_angle
engineConfiguration->globalTriggerAngleOffset = 545;
}

View File

@ -127,7 +127,8 @@ typedef struct {
int warningCounter; // 236
int lastErrorCode; // 240
float internalMcuTemperature; // 244
int unused3[7];
float vvtPosition; // 248
int unused3[6];
} TunerStudioOutputChannels;
#endif /* TUNERSTUDIO_CONFIGURATION_H_ */

View File

@ -677,6 +677,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->cltCorrection = ENGINE(engineState.cltFuelCorrection);
tsOutputChannels->checkEngine = hasErrorCodes();
tsOutputChannels->vvtPosition = engine->triggerCentral.vvtPosition;
#if EFI_PROD_CODE || defined(__DOXYGEN__)
tsOutputChannels->internalMcuTemperature = getMCUInternalTemperature();
tsOutputChannels->idlePosition = getIdlePosition();

View File

@ -54,7 +54,7 @@
#if HAL_USE_ADC || defined(__DOXYGEN__)
#include "AdcConfiguration.h"
#endif
#endif /* HAL_USE_ADC */
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "pwm_generator.h"
@ -65,7 +65,7 @@
#include "lcd_controller.h"
#include "pin_repository.h"
#include "tachometer.h"
#endif
#endif /* EFI_PROD_CODE */
extern bool hasFirmwareErrorFlag;
@ -93,7 +93,7 @@ static LoggingWithStorage logger("Engine Controller");
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
static engine_configuration2_s ec2 CCM_OPTIONAL;
engine_configuration2_s * engineConfiguration2 = &ec2;
#endif
#endif /* EFI_ENGINE_CONTROL */
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
@ -103,7 +103,7 @@ engine_configuration2_s * engineConfiguration2 = &ec2;
*/
Engine _engine(&persistentState.persistentConfiguration);
Engine * engine = &_engine;
#endif
#endif /* EFI_PROD_CODE */
/**
* I am not sure if this needs to be configurable.

View File

@ -19,6 +19,7 @@
#include "pwm_generator_logic.h"
#include "efilib2.h"
#include "settings.h"
#include "engine_math.h"
#include "rpm_calculator.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__)
@ -75,7 +76,16 @@ extern bool isInsideTriggerHandler;
void hwHandleVvtCamSignal(trigger_value_e front) {
// startOfCycleNt
efitick_t offsetNt = getTimeNowNt() - engine->triggerCentral.triggerState.startOfCycleNt;
angle_t vvtPosition = NT2US(offsetNt) / engine->rpmCalculator.oneDegreeUs;
// convert engine cycle angle into trigger cycle angle
vvtPosition += tdcPosition();
fixAngle(vvtPosition);
engine->triggerCentral.vvtPosition = vvtPosition;
if (ENGINE(isEngineChartEnabled)) {
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
@ -102,6 +112,7 @@ void hwHandleShaftSignal(trigger_event_e signal) {
TriggerCentral::TriggerCentral() {
nowNt = 0;
vvtPosition = 0;
// we need this initial to have not_running at first invocation
previousShaftEventTimeNt = (efitimems_t) -10 * US2NT(US_PER_SECOND_LL);

View File

@ -30,6 +30,8 @@ public:
void resetCounters();
TriggerState triggerState;
efitick_t nowNt;
angle_t vvtPosition;
volatile efitime_t previousShaftEventTimeNt;
private:
IntListenerArray<15> triggerListeneres;

View File

@ -28,10 +28,11 @@ EXTERN_ENGINE
static Logging *logger;
static void cam_icu_width_callback(ICUDriver *icup) {
hwHandleVvtCamSignal(TV_RISE);
}
static void cam_icu_period_callback(ICUDriver *icup) {
hwHandleVvtCamSignal(TV_FALL);
}
/**
@ -85,6 +86,9 @@ cam_icu_width_callback, cam_icu_period_callback };
static ICUDriver *turnOnTriggerInputPin(brain_pin_e hwPin, ICUConfig *icucfg) {
if (hwPin == GPIO_UNASSIGNED)
return NULL;
// configure pin
turnOnCapturePin("trigger", hwPin);
icucfg->channel = getInputCaptureChannel(hwPin);
@ -128,11 +132,8 @@ static void rememberPrimaryChannel(void) {
void turnOnTriggerInputPins(Logging *sharedLogger) {
logger = sharedLogger;
for (int i = 0; i < TRIGGER_SUPPORTED_CHANNELS; i++) {
turnOnTriggerInputPin(boardConfiguration->triggerInputPins[i], &shaft_icucfg);
}
rememberPrimaryChannel();
applyNewTriggerInputPins();
}
extern engine_configuration_s activeConfiguration;
@ -158,7 +159,9 @@ void applyNewTriggerInputPins(void) {
}
}
turnOnTriggerInputPin(engineConfiguration->camInput, &cam_icucfg);
if (engineConfiguration->camInput != activeConfiguration.camInput) {
turnOnTriggerInputPin(engineConfiguration->camInput, &cam_icucfg);
}
rememberPrimaryChannel();
}

View File

@ -126,6 +126,7 @@ public enum Sensor {
TIME_SECONDS(SensorCategory.OPERATIONS, FieldType.INT, 224, BackgroundColor.MUD, 0, 5),
SPEED2RPM(SensorCategory.SENSOR_INPUTS, FieldType.FLOAT, 232, BackgroundColor.MUD, 0, 5),
INT_TEMP(SensorCategory.OPERATIONS, FieldType.FLOAT, 244, BackgroundColor.MUD, 0, 5),
vvtPosition(SensorCategory.SENSOR_INPUTS, FieldType.FLOAT, 248, BackgroundColor.MUD, 0, 5),
INJ_1_2_DELTA("inj 1-2 delta", SensorCategory.SNIFFING),
INJ_3_4_DELTA("inj 3-4 delta", SensorCategory.SNIFFING),

View File

@ -38,7 +38,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20160808;
public static final int CONSOLE_VERSION = 20160820;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";