diff --git a/firmware/config/boards/microrusefi/board_configuration.cpp b/firmware/config/boards/microrusefi/board_configuration.cpp index fda717012f..0c4b3f7e62 100644 --- a/firmware/config/boards/microrusefi/board_configuration.cpp +++ b/firmware/config/boards/microrusefi/board_configuration.cpp @@ -133,6 +133,13 @@ static void setupDefaultSensorInputs() { engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE; + + // EFI_ADC_10: "27 - AN volt 1" + engineConfiguration->map.sensor.hwChannel = EFI_ADC_10; + + // EFI_ADC_2: "24 - AN temp 3" + engineConfiguration->afr.hwChannel = EFI_ADC_2; + // clt = "18 - AN temp 1" engineConfiguration->clt.adcChannel = EFI_ADC_0; engineConfiguration->clt.config.bias_resistor = 2700; diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index f2a0576c0a..ce61ccf75b 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -328,7 +328,7 @@ void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // 0.2#3 has wrong R139 // 56k high side/10k low side multiplied by above analogInputDividerCoefficient = 11 -// engineConfiguration->vbattDividerCoeff = (66f / 10f) * engineConfiguration->analogInputDividerCoefficient; +// engineConfiguration->vbattDividerCoeff = (66.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient; boardConfiguration->isHip9011Enabled = false; diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index 8e138a750f..2b0a010d93 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -39,6 +39,7 @@ #include "custom_engine.h" #include "fsio_impl.h" #include "ego.h" +#include "thermistors.h" EXTERN_CONFIG; @@ -242,6 +243,38 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setOperationMode(engineConfiguration, FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR); engineConfiguration->specs.displacement = 1.8; + engineConfiguration->map.sensor.type = MT_GM_3_BAR; + setEgoSensor(ES_Innovate_MTX_L PASS_CONFIG_PARAMETER_SUFFIX); + + setCommonNTCSensor(&engineConfiguration->clt); + setCommonNTCSensor(&engineConfiguration->iat); + + // 0.0825 + // 0.1375 + // 6.375 + // 10.625 + boardConfiguration->miataNb2VVTRatioFrom = 8.50 * 0.75; + boardConfiguration->miataNb2VVTRatioTo = 14; + engineConfiguration->nbVvtIndex = 0; + + engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control + + // set idle_position 35 + boardConfiguration->manIdlePosition = 35; + + engineConfiguration->specs.cylindersCount = 4; + engineConfiguration->specs.firingOrder = FO_1_3_4_2; + + engineConfiguration->injectionMode = IM_SEQUENTIAL; + + engineConfiguration->ignitionMode = IM_WASTED_SPARK; + /** + * http://miataturbo.wikidot.com/fuel-injectors + * 01-05 (purple) - #195500-4060 + */ + engineConfiguration->injector.flow = 265; + + // enable altdebug engineConfiguration->targetVBatt = 13.8; engineConfiguration->alternatorControl.offset = 40; @@ -286,6 +319,17 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->isCylinderCleanupEnabled = true; setMazdaMiataNbTpsTps(PASS_CONFIG_PARAMETER_SIGNATURE); + + // set_whole_ve_map 80 + setMazdaMiataNbInjectorLag(PASS_CONFIG_PARAMETER_SIGNATURE); + + engineConfiguration->debugMode = DBG_IDLE_CONTROL; + //set idle_offset 30 + engineConfiguration->idleRpmPid.offset = 30; + engineConfiguration->idleRpmPid.pFactor = 0.07; + engineConfiguration->idleRpmPid.iFactor = 0.0001; + engineConfiguration->idleRpmPid.dFactor = 5; + engineConfiguration->idleRpmPid.periodMs = 10; } // end of setMazdaMiataEngineNB2Defaults @@ -301,7 +345,6 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // boardConfiguration->is_enabled_spi_1 = true; - engineConfiguration->twoWireBatchInjection = true; // this is needed for #492 testing boardConfiguration->alternatorControlPin = GPIOE_10; @@ -309,14 +352,10 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8; - // set idle_position 35 - boardConfiguration->manIdlePosition = 35; - boardConfiguration->vvtCamSensorUseRise = true; engineConfiguration->vvtDisplayInverted = true; - engineConfiguration->auxPidFrequency[0] = 300; engineConfiguration->auxPidPins[0] = GPIOE_3; // VVT solenoid control // /** // * set_fsio_setting 1 0.55 @@ -353,37 +392,14 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { boardConfiguration->ignitionPins[2] = GPIOC_9; boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; - // set_whole_ve_map 80 - - setMazdaMiataNbInjectorLag(PASS_CONFIG_PARAMETER_SIGNATURE); - engineConfiguration->tpsMin = 100; // convert 12to10 bit (ADC/4) engineConfiguration->tpsMax = 650; // convert 12to10 bit (ADC/4) -// 0.0825 -// 0.1375 -// 6.375 -// 10.625 - boardConfiguration->miataNb2VVTRatioFrom = 8.50 * 0.75; - boardConfiguration->miataNb2VVTRatioTo = 14; - engineConfiguration->nbVvtIndex = 0; - engineConfiguration->specs.cylindersCount = 4; - engineConfiguration->specs.firingOrder = FO_1_3_4_2; - - engineConfiguration->injectionMode = IM_SEQUENTIAL; - - engineConfiguration->ignitionMode = IM_WASTED_SPARK; - boardConfiguration->malfunctionIndicatorPin = GPIOE_6; // just for a test - /** - * http://miataturbo.wikidot.com/fuel-injectors - * 01-05 (purple) - #195500-4060 - */ - engineConfiguration->injector.flow = 265; // boardConfiguration->malfunctionIndicatorPin = GPIOD_9; // boardConfiguration->malfunctionIndicatorPinMode = OM_INVERTED; @@ -395,18 +411,13 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // see setFrankensoConfiguration // map.sensor.hwChannel = EFI_ADC_0; W53 - engineConfiguration->map.sensor.type = MT_GM_3_BAR; - /** * PA4 Wideband O2 Sensor */ // todo: re-wire the board to use "Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM" //engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3 - engineConfiguration->afr.hwChannel = EFI_ADC_4; - setEgoSensor(ES_Innovate_MTX_L PASS_CONFIG_PARAMETER_SUFFIX); - // /** * Combined RPM, CLT and VBATT warning light @@ -432,13 +443,6 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // set idle_rpm 1700 // see setDefaultIdleParameters - engineConfiguration->debugMode = DBG_IDLE_CONTROL; - //set idle_offset 30 - engineConfiguration->idleRpmPid.offset = 30; - engineConfiguration->idleRpmPid.pFactor = 0.07; - engineConfiguration->idleRpmPid.iFactor = 0.0001; - engineConfiguration->idleRpmPid.dFactor = 5; - engineConfiguration->idleRpmPid.periodMs = 10; } void setMazdaMiata2003EngineConfigurationNaFuelRail(DECLARE_CONFIG_PARAMETER_SIGNATURE) { @@ -508,13 +512,26 @@ void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGN * set engine_type 13 */ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE); + // MRE has a special main relay control low side pin - rusEfi firmware is totally not involved with main relay control // fuelPumpPin is inherited from boards/microrusefi/board_configuration.cpp // crank trigger input is inherited from boards/microrusefi/board_configuration.cpp + // map.sensor.hwChannel input is inherited from boards/microrusefi/board_configuration.cpp + // tps1_1AdcChannel input is inherited from boards/microrusefi/board_configuration.cpp + // afr.hwChannel input is inherited from boards/microrusefi/board_configuration.cpp + + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->camInputs[0] = GPIOA_5; engineConfiguration->useOnlyRisingEdgeForTrigger = false; + // GPIOD_6: "13 - GP Out 6" - selected to +12v + boardConfiguration->alternatorControlPin = GPIOD_6; + // GPIOD_7: "14 - GP Out 5" - selected to +12v + engineConfiguration->dizzySparkOutputPin = GPIOD_7; // tachometer + engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE? engineConfiguration->etb.iFactor = 0; @@ -537,4 +554,12 @@ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + + // set vbatt_divider 11 + // 0.3#4 has wrong R139 as well? + // 56k high side/10k low side multiplied by above analogInputDividerCoefficient = 11 + engineConfiguration->vbattDividerCoeff = (66.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient; + + + } diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 90d4debbb3..ee18d6c7db 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -74,8 +74,6 @@ extern bool main_loop_started; #include "vehicle_speed.h" #include "single_timer_executor.h" #include "periodic_task.h" -extern int vvtEventRiseCounter; -extern int vvtEventFallCounter; extern int icuWidthCallbackCounter; extern int icuWidthPeriodCounter; #endif /* EFI_PROD_CODE */ @@ -773,8 +771,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->debugIntField2 = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_FALLING); tsOutputChannels->debugIntField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_FALLING); #if EFI_PROD_CODE - tsOutputChannels->debugIntField4 = vvtEventRiseCounter; - tsOutputChannels->debugIntField5 = vvtEventFallCounter; + tsOutputChannels->debugIntField4 = engine->triggerCentral.vvtEventRiseCounter; + tsOutputChannels->debugIntField5 = engine->triggerCentral.vvtEventFallCounter; tsOutputChannels->debugFloatField5 = icuWidthCallbackCounter + icuWidthPeriodCounter; #endif /* EFI_PROD_CODE */ diff --git a/firmware/controllers/generated/rusefi_generated.h b/firmware/controllers/generated/rusefi_generated.h index 2965607a27..49390b9f82 100644 --- a/firmware/controllers/generated/rusefi_generated.h +++ b/firmware/controllers/generated/rusefi_generated.h @@ -366,6 +366,8 @@ #define clutchUpPinInverted_offset_hex 3d0 #define clutchUpPinMode_offset 971 #define clutchUpPinMode_offset_hex 3cb +#define CMD_CALIBRATE_PEDAL_DOWN "calibrate_pedal_down" +#define CMD_CALIBRATE_PEDAL_UP "calibrate_pedal_up" #define CMD_DISABLE "disable" #define CMD_ENABLE "enable" #define CMD_REBOOT "reboot" diff --git a/firmware/controllers/generated/trigger_generated.h b/firmware/controllers/generated/trigger_generated.h index 30488ad3a8..030f704d87 100644 --- a/firmware/controllers/generated/trigger_generated.h +++ b/firmware/controllers/generated/trigger_generated.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger.txt Sat Aug 31 23:11:37 EDT 2019 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 20:41:37 EDT 2019 // by class com.rusefi.output.CHeaderConsumer // begin #ifndef CONTROLLERS_GENERATED_TRIGGER_GENERATED_H @@ -12,11 +12,23 @@ struct trigger_central_s { * offset 0 */ int hwEventCounters[HW_EVENT_TYPES]; - /** total size 24*/ + /** + * offset 24 + */ + int vvtCamCounter = (int)0; + /** + * offset 28 + */ + int vvtEventRiseCounter = (int)0; + /** + * offset 32 + */ + int vvtEventFallCounter = (int)0; + /** total size 36*/ }; typedef struct trigger_central_s trigger_central_s; #endif // end -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger.txt Sat Aug 31 23:11:37 EDT 2019 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 20:41:37 EDT 2019 diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp index 42df022ec9..0b30a4ed9a 100644 --- a/firmware/controllers/sensors/tps.cpp +++ b/firmware/controllers/sensors/tps.cpp @@ -178,6 +178,7 @@ void grabPedalIsUp() { #if EFI_PROD_CODE float voltage = getVoltageDivided("pPS", engineConfiguration->throttlePedalPositionAdcChannel); engineConfiguration->throttlePedalUpVoltage = voltage; + printTPSInfo(); #endif /* EFI_PROD_CODE */ } @@ -185,6 +186,7 @@ void grabPedalIsWideOpen() { #if EFI_PROD_CODE float voltage = getVoltageDivided("pPS", engineConfiguration->throttlePedalPositionAdcChannel); engineConfiguration->throttlePedalWOTVoltage = voltage; + printTPSInfo(); #endif /* EFI_PROD_CODE */ } diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 343243a2d5..6d3eaa9277 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -417,6 +417,14 @@ void printTPSInfo(void) { scheduleMsg(&logger, "tps min (closed) %d/max (full) %d v=%.2f @%s", engineConfiguration->tpsMin, engineConfiguration->tpsMax, getTPSVoltage(PASS_ENGINE_PARAMETER_SIGNATURE), getPinNameByAdcChannel("tps", engineConfiguration->tps1_1AdcChannel, pinNameBuffer)); + + if (hasPedalPositionSensor()) { + scheduleMsg(&logger, "pedal up %f / down %f", + engineConfiguration->throttlePedalUpVoltage, + engineConfiguration->throttlePedalWOTVoltage); + } + + #endif /* EFI_PROD_CODE */ scheduleMsg(&logger, "current 10bit=%d value=%.2f rate=%.2f", getTPS10bitAdc(), getTPS(PASS_ENGINE_PARAMETER_SIGNATURE), getTpsRateOfChange()); @@ -1370,8 +1378,8 @@ void initSettings(void) { addConsoleAction("tpsinfo", printTPSInfo); addConsoleAction("calibrate_tps_1_closed", grabTPSIsClosed); addConsoleAction("calibrate_tps_1_wot", grabTPSIsWideOpen); - addConsoleAction("calibrate_pedal_up", grabPedalIsUp); - addConsoleAction("calibrate_pedal_down", grabPedalIsWideOpen); + addConsoleAction(CMD_CALIBRATE_PEDAL_UP, grabPedalIsUp); + addConsoleAction(CMD_CALIBRATE_PEDAL_DOWN, grabPedalIsWideOpen); addConsoleAction("info", printAllInfo); addConsoleAction("set_one_coil_ignition", setOneCoilIgnition); diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index 4026b628b7..03e8c86381 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -498,7 +498,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D if (trgEventIndex == 0) { if (HAVE_CAM_INPUT()) { - engine->triggerCentral.triggerState.validateCamVvtCounters(); + engine->triggerCentral.validateCamVvtCounters(); } if (checkIfTriggerConfigChanged(PASS_ENGINE_PARAMETER_SIGNATURE)) { diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 46cd6528ba..ea2a37927d 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -89,6 +89,14 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E } void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX) { + TriggerCentral *tc = &engine->triggerCentral; + if (front == TV_RISE) { + tc->vvtEventRiseCounter++; + } else { + tc->vvtEventFallCounter++; + } + + addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN); if (CONFIGB(vvtCamSensorUseRise) ^ (front != TV_FALL)) { @@ -102,8 +110,7 @@ void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX) return; } - TriggerCentral *tc = &engine->triggerCentral; - tc->triggerState.vvtCamCounter++; + tc->vvtCamCounter++; efitick_t nowNt = getTimeNowNt(); @@ -511,9 +518,6 @@ extern bool hwTriggerInputEnabled; extern uint32_t maxSchedulingPrecisionLoss; extern uint32_t *cyccnt; -extern int vvtEventRiseCounter; -extern int vvtEventFallCounter; - void resetMaxValues() { #if EFI_PROD_CODE || EFI_SIMULATOR maxEventCallbackDuration = triggerMaxDuration = 0; @@ -592,7 +596,7 @@ void triggerInfo(void) { if (HAVE_CAM_INPUT()) { scheduleMsg(logger, "VVT input: %s mode %s", hwPortname(engineConfiguration->camInputs[0]), getVvt_mode_e(engineConfiguration->vvtMode)); - scheduleMsg(logger, "VVT event counters: %d/%d", vvtEventRiseCounter, vvtEventFallCounter); + scheduleMsg(logger, "VVT event counters: %d/%d", engine->triggerCentral.vvtEventRiseCounter, engine->triggerCentral.vvtEventFallCounter); } diff --git a/firmware/controllers/trigger/trigger_central.h b/firmware/controllers/trigger/trigger_central.h index b73f7e15d9..5352d863a2 100644 --- a/firmware/controllers/trigger/trigger_central.h +++ b/firmware/controllers/trigger/trigger_central.h @@ -32,6 +32,7 @@ public: void resetCounters(); void resetAccumSignalData(); bool noiseFilter(efitick_t nowNt, trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX); + void validateCamVvtCounters(); TriggerStateWithRunningStatistics triggerState; efitick_t nowNt = 0; angle_t vvtPosition = 0; diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 7463e6c01a..3873404291 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -309,9 +309,9 @@ int TriggerState::getCurrentIndex() const { return currentCycle.current_index; } -void TriggerState::validateCamVvtCounters() { +void TriggerCentral::validateCamVvtCounters() { // micro-optimized 'totalRevolutionCounter % 256' - int camVvtValidationIndex = totalRevolutionCounter & 0xFF; + int camVvtValidationIndex = triggerState.getTotalRevolutionCounter() & 0xFF; if (camVvtValidationIndex == 0) { vvtCamCounter = 0; } else if (camVvtValidationIndex == 0xFE && vvtCamCounter < 60) { @@ -500,6 +500,13 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no DISPLAY(DISPLAY_FIELD(HWEVENTCOUNTERS3)); DISPLAY_TEXT(Rise); DISPLAY(DISPLAY_FIELD(HWEVENTCOUNTERS4)); + DISPLAY_TEXT(EOL); + + DISPLAY_TEXT(VVT_1); + DISPLAY(DISPLAY_CONFIG(CAMINPUTS1)); + DISPLAY(DISPLAY_FIELD(vvtEventRiseCounter)); + DISPLAY(DISPLAY_FIELD(vvtEventFallCounter)); + DISPLAY(DISPLAY_FIELD(vvtCamCounter)); if (triggerShape->isSynchronizationNeeded) { // this is getting a little out of hand, any ideas? diff --git a/firmware/controllers/trigger/trigger_decoder.h b/firmware/controllers/trigger/trigger_decoder.h index 925d341197..bbe9150193 100644 --- a/firmware/controllers/trigger/trigger_decoder.h +++ b/firmware/controllers/trigger/trigger_decoder.h @@ -56,7 +56,6 @@ public: * this is important for crank-based virtual trigger and VVT magic */ bool isEvenRevolution() const; - void validateCamVvtCounters(); void incrementTotalEventCounter(); efitime_t getTotalEventCounter() const; void decodeTriggerEvent(trigger_event_e const signal, efitime_t nowUs DECLARE_ENGINE_PARAMETER_SUFFIX); @@ -111,7 +110,6 @@ public: * for virtual double trigger see timeAtVirtualZeroNt */ efitick_t startOfCycleNt; - int vvtCamCounter = 0; private: void resetCurrentCycleState(); diff --git a/firmware/hw_layer/trigger_input.cpp b/firmware/hw_layer/trigger_input.cpp index 2966f5f04e..e624e8f256 100644 --- a/firmware/hw_layer/trigger_input.cpp +++ b/firmware/hw_layer/trigger_input.cpp @@ -36,9 +36,6 @@ EXTERN_ENGINE ; static Logging *logger; -int vvtEventRiseCounter = 0; -int vvtEventFallCounter = 0; - #if EFI_PROD_CODE /* PAL based implementation */ #if (HAL_TRIGGER_USE_PAL == TRUE) && (PAL_USE_CALLBACKS == TRUE) @@ -80,10 +77,8 @@ static void cam_callback(void *arg) { bool rise = (palReadLine(pal_line) == PAL_HIGH); if (rise) { - vvtEventRiseCounter++; hwHandleVvtCamSignal(TV_RISE); } else { - vvtEventFallCounter++; hwHandleVvtCamSignal(TV_FALL); } } @@ -114,13 +109,11 @@ static ICUDriver *primaryCrankDriver; static void cam_icu_width_callback(ICUDriver *icup) { (void)icup; - vvtEventRiseCounter++; hwHandleVvtCamSignal(TV_RISE); } static void cam_icu_period_callback(ICUDriver *icup) { (void)icup; - vvtEventFallCounter++; hwHandleVvtCamSignal(TV_FALL); } diff --git a/firmware/hw_layer/trigger_input_comp.cpp b/firmware/hw_layer/trigger_input_comp.cpp index d3783f609a..2192e3015a 100644 --- a/firmware/hw_layer/trigger_input_comp.cpp +++ b/firmware/hw_layer/trigger_input_comp.cpp @@ -28,9 +28,6 @@ EXTERN_ENGINE ; static Logging *logger; -int vvtEventRiseCounter = 0; -int vvtEventFallCounter = 0; - static void comp_shaft_callback(COMPDriver *comp) { bool isRising = (comp_lld_get_status(comp) & COMP_IRQ_RISING) != 0; int isPrimary = (comp == EFI_COMP_PRIMARY_DEVICE); @@ -56,10 +53,8 @@ static void comp_shaft_callback(COMPDriver *comp) { #if 0 static void comp_cam_callback(COMPDriver *comp) { if (isRising) { - vvtEventRiseCounter++; hwHandleVvtCamSignal(TV_RISE); } else { - vvtEventFallCounter++; hwHandleVvtCamSignal(TV_FALL); } } diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 601b0910ee..64c58ee7ba 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1237,6 +1237,9 @@ end_struct #define GAUGE_NAME_DEBUG_I5 "debug i5" +#define CMD_CALIBRATE_PEDAL_UP "calibrate_pedal_up" +#define CMD_CALIBRATE_PEDAL_DOWN "calibrate_pedal_down" + #define CMD_TRIGGERINFO "triggerinfo" #define CMD_WRITECONFIG "writeconfig" #define CMD_REBOOT "reboot" diff --git a/firmware/integration/trigger_state.txt b/firmware/integration/trigger_state.txt index c93e09942a..925afa59ec 100644 --- a/firmware/integration/trigger_state.txt +++ b/firmware/integration/trigger_state.txt @@ -4,5 +4,10 @@ struct_no_prefix define_constructor trigger_central_s int[HW_EVENT_TYPES iterate] hwEventCounters; +int vvtCamCounter + +int vvtEventRiseCounter +int vvtEventFallCounter + end_struct diff --git a/java_console/models/src/com/rusefi/config/generated/Fields.java b/java_console/models/src/com/rusefi/config/generated/Fields.java index 77060a7476..c5c6020ff6 100644 --- a/java_console/models/src/com/rusefi/config/generated/Fields.java +++ b/java_console/models/src/com/rusefi/config/generated/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Tue Sep 03 18:36:09 EDT 2019 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Mon Sep 02 22:52:53 EDT 2019 // by class com.rusefi.output.JavaFieldsConsumer import com.rusefi.config.*; @@ -186,7 +186,6 @@ public class Fields { public static final int cj125CsPinMode_offset = 2225; public static final int cj125isLsu49_offset = 76; public static final int cj125isUaDivided_offset = 76; - public static final int cj125isUrDivided_offset = 76; public static final int cj125SpiDevice_offset = 2224; public static final int cj125ua_offset = 2609; public static final int cj125ur_offset = 2610; @@ -235,6 +234,8 @@ public class Fields { public static final int clutchUpPin_offset = 969; public static final int clutchUpPinInverted_offset = 976; public static final int clutchUpPinMode_offset = 971; + public static final String CMD_CALIBRATE_PEDAL_DOWN = "calibrate_pedal_down"; + public static final String CMD_CALIBRATE_PEDAL_UP = "calibrate_pedal_up"; public static final String CMD_DISABLE = "disable"; public static final String CMD_ENABLE = "enable"; public static final String CMD_REBOOT = "reboot"; @@ -836,6 +837,7 @@ public class Fields { public static final int isManualSpinningMode_offset = 1476; public static final int isMapAveragingEnabled_offset = 1476; public static final int isSdCardEnabled_offset = 744; + public static final int issue_294_15_offset = 76; public static final int issue_294_16_offset = 76; public static final int issue_294_17_offset = 76; public static final int issue_294_18_offset = 76; @@ -1299,7 +1301,7 @@ public class Fields { public static final Field ETB1_USE_TWO_WIRES = Field.create("ETB1_USE_TWO_WIRES", 76, FieldType.BIT, 12); public static final Field ETB2_USE_TWO_WIRES = Field.create("ETB2_USE_TWO_WIRES", 76, FieldType.BIT, 13); public static final Field SHOWSDCARDWARNING = Field.create("SHOWSDCARDWARNING", 76, FieldType.BIT, 14); - public static final Field CJ125ISURDIVIDED = Field.create("CJ125ISURDIVIDED", 76, FieldType.BIT, 15); + public static final Field ISSUE_294_15 = Field.create("ISSUE_294_15", 76, FieldType.BIT, 15); public static final Field ISSUE_294_16 = Field.create("ISSUE_294_16", 76, FieldType.BIT, 16); public static final Field ISSUE_294_17 = Field.create("ISSUE_294_17", 76, FieldType.BIT, 17); public static final Field ISSUE_294_18 = Field.create("ISSUE_294_18", 76, FieldType.BIT, 18); @@ -2083,7 +2085,7 @@ public class Fields { ETB1_USE_TWO_WIRES, ETB2_USE_TWO_WIRES, SHOWSDCARDWARNING, - CJ125ISURDIVIDED, + ISSUE_294_15, ISSUE_294_16, ISSUE_294_17, ISSUE_294_18, diff --git a/java_console/models/src/com/rusefi/config/generated/TriggerState.java b/java_console/models/src/com/rusefi/config/generated/TriggerState.java index 644ec2367a..961b7de954 100644 --- a/java_console/models/src/com/rusefi/config/generated/TriggerState.java +++ b/java_console/models/src/com/rusefi/config/generated/TriggerState.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Sat Jul 20 12:28:04 EDT 2019 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 20:41:37 EDT 2019 // by class com.rusefi.output.JavaFieldsConsumer import com.rusefi.config.*; @@ -13,6 +13,9 @@ public class TriggerState { public static final Field HWEVENTCOUNTERS4 = Field.create("HWEVENTCOUNTERS4", 12, FieldType.INT); public static final Field HWEVENTCOUNTERS5 = Field.create("HWEVENTCOUNTERS5", 16, FieldType.INT); public static final Field HWEVENTCOUNTERS6 = Field.create("HWEVENTCOUNTERS6", 20, FieldType.INT); + public static final Field VVTCAMCOUNTER = Field.create("VVTCAMCOUNTER", 24, FieldType.INT); + public static final Field VVTEVENTRISECOUNTER = Field.create("VVTEVENTRISECOUNTER", 28, FieldType.INT); + public static final Field VVTEVENTFALLCOUNTER = Field.create("VVTEVENTFALLCOUNTER", 32, FieldType.INT); public static final Field[] VALUES = { HWEVENTCOUNTERS1, HWEVENTCOUNTERS2, @@ -20,5 +23,8 @@ public class TriggerState { HWEVENTCOUNTERS4, HWEVENTCOUNTERS5, HWEVENTCOUNTERS6, + VVTCAMCOUNTER, + VVTEVENTRISECOUNTER, + VVTEVENTFALLCOUNTER, }; } diff --git a/java_console/ui/src/com/rusefi/ldmp/generated/TriggerDecoderMeta.java b/java_console/ui/src/com/rusefi/ldmp/generated/TriggerDecoderMeta.java index fc3f35a773..b182edb9ca 100644 --- a/java_console/ui/src/com/rusefi/ldmp/generated/TriggerDecoderMeta.java +++ b/java_console/ui/src/com/rusefi/ldmp/generated/TriggerDecoderMeta.java @@ -15,5 +15,11 @@ public class TriggerDecoderMeta { new FieldRequest("Trigger", "HWEVENTCOUNTERS3"), new TextRequest("Rise"), new FieldRequest("Trigger", "HWEVENTCOUNTERS4"), + new TextRequest("EOL"), + new TextRequest("VVT_1"), + new ConfigRequest("CAMINPUTS1"), + new FieldRequest("Trigger", "vvtEventRiseCounter"), + new FieldRequest("Trigger", "vvtEventFallCounter"), + new FieldRequest("Trigger", "vvtCamCounter"), }; } \ No newline at end of file diff --git a/java_console/ui/src/com/rusefi/ui/etb/CalibrationPanel.java b/java_console/ui/src/com/rusefi/ui/etb/CalibrationPanel.java index c47cd17b60..e425e3883b 100644 --- a/java_console/ui/src/com/rusefi/ui/etb/CalibrationPanel.java +++ b/java_console/ui/src/com/rusefi/ui/etb/CalibrationPanel.java @@ -1,5 +1,6 @@ package com.rusefi.ui.etb; +import com.rusefi.config.generated.Fields; import com.rusefi.io.CommandQueue; import org.jetbrains.annotations.NotNull; import org.putgemin.VerticalFlowLayout; @@ -18,8 +19,8 @@ public class CalibrationPanel { content.add(createCommandButton("Grab TPS#1 fully closed", "calibrate_tps_1_closed")); content.add(createCommandButton("Grab TPS#1 Wide Open", "calibrate_tps_1_wot")); - content.add(createCommandButton("Grab Pedal Up", "calibrate_pedal_up")); - content.add(createCommandButton("Grab Pedal Down", "calibrate_pedal_down")); + content.add(createCommandButton("Grab Pedal Up", Fields.CMD_CALIBRATE_PEDAL_UP)); + content.add(createCommandButton("Grab Pedal Down", Fields.CMD_CALIBRATE_PEDAL_DOWN)); } @NotNull