NA6 progress

A/C toggle switch indicator in TS
renaming "pedalPosition" to "throttlePedalPosition"
This commit is contained in:
rusefi 2019-01-27 00:02:58 -05:00
parent 1066f8f3c0
commit ee4ac9b240
19 changed files with 60 additions and 34 deletions

View File

@ -34,7 +34,7 @@ void setFordFiestaDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE)
// etb testing
// boardConfiguration->clutchUpPin
boardConfiguration->etbControlPin1 = GPIOD_3;
engineConfiguration->pedalPositionAdcChannel = EFI_ADC_1;
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_1;
boardConfiguration->etbDirectionPin2 = GPIOD_5;
engineConfiguration->tpsMin = 337;

View File

@ -129,8 +129,8 @@ void setMiataNA6_MAP_Configuration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
memcpy(config->veLoadBins, ve16LoadBins, sizeof(ve16LoadBins));
copyFuelTable(mapBased16VeTable, config->veTable);
// Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM
engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3
// Wide band oxygen (from middle plug) to W52
engineConfiguration->afr.hwChannel = EFI_ADC_13; // PA3
setWholeFuelMap(6 PASS_CONFIG_PARAMETER_SUFFIX);
@ -204,10 +204,19 @@ void setMiataNA6_MAP_Configuration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
// white wire from 1E - TOP of W4 to BOTTOM W62
boardConfiguration->malfunctionIndicatorPin = GPIOD_5;
engineConfiguration->injectionMode = IM_BATCH;
// yellow wire from 1V/W22 to bottom of W48
boardConfiguration->clutchDownPin = GPIOA_3;
boardConfiguration->clutchDownPinMode = PI_PULLUP;
// green wire from 1Q/W17 to bottom of W46
engineConfiguration->acSwitchAdc = EFI_ADC_6; // PA6
miataNAcommon(PASS_ENGINE_PARAMETER_SIGNATURE);
copyFuelTable(miataNA6_maf_fuel_table, config->fuelTable);
}

View File

@ -75,6 +75,7 @@ typedef struct {
unsigned int knockNowIndicator : 1; // bit 14
unsigned int brakePedalState : 1; // bit 15. 0 - not pressed, 1 = pressed
unsigned int toothLogReady : 1; // bit 16
unsigned int acSwitchState : 1; // bit 17. 0 - not pressed, 1 = pressed
float vehicleSpeedKph; // 76
unsigned int isTpsError : 1; // bit 0, 80
unsigned int isCltError : 1; // bit 1

View File

@ -919,6 +919,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->clutchUpState = engine->clutchUpState;
tsOutputChannels->clutchDownState = engine->clutchDownState;
tsOutputChannels->brakePedalState = engine->brakePedalState;
tsOutputChannels->acSwitchState = engine->acSwitchState;
// tCharge depends on the previous state, so we should use the stored value.
tsOutputChannels->tCharge = ENGINE(engineState.tCharge);

View File

@ -449,6 +449,7 @@ public:
bool clutchUpState = false;
bool clutchDownState = false;
bool brakePedalState = false;
bool acSwitchState = false;
bool isRunningPwmTest = false;

View File

@ -843,7 +843,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->map.sensor.hwChannel = EFI_ADC_4;
engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE;
engineConfiguration->pedalPositionAdcChannel = EFI_ADC_NONE;
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 26 11:15:45 EST 2019
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 26 23:18:47 EST 2019
// begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -1268,11 +1268,11 @@ typedef struct {
*/
afr_sensor_s afr;
/**
* Electronic pedal position input
* Electronic throttle pedal position input
* See also tpsAdcChannel
* offset 588
*/
adc_channel_e pedalPositionAdcChannel;
adc_channel_e throttlePedalPositionAdcChannel;
/**
* @see hasBaroSensor
* offset 592
@ -2480,4 +2480,4 @@ typedef struct {
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 26 11:15:45 EST 2019
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 26 23:18:47 EST 2019

View File

@ -344,8 +344,8 @@
#define afr_v2_offset_hex 244
#define afr_value2_offset 584
#define afr_value2_offset_hex 248
#define pedalPositionAdcChannel_offset 588
#define pedalPositionAdcChannel_offset_hex 24c
#define throttlePedalPositionAdcChannel_offset 588
#define throttlePedalPositionAdcChannel_offset_hex 24c
#define baroSensor_offset 592
#define baroSensor_offset_hex 250
#define baroSensor_lowValue_offset 592

View File

@ -207,7 +207,7 @@ static void showEthInfo(void) {
getPedalPosition(),
engineConfiguration->throttlePedalUpVoltage,
engineConfiguration->throttlePedalWOTVoltage,
getPinNameByAdcChannel("tPedal", engineConfiguration->pedalPositionAdcChannel, pinNameBuffer));
getPinNameByAdcChannel("tPedal", engineConfiguration->throttlePedalPositionAdcChannel, pinNameBuffer));
scheduleMsg(&logger, "TPS=%.2f", getTPS());

View File

@ -376,7 +376,7 @@ static void printAnalogInfo(void) {
printAnalogChannelInfo("hip9011", engineConfiguration->hipOutputChannel);
printAnalogChannelInfo("fuel gauge", engineConfiguration->fuelLevelSensor);
printAnalogChannelInfo("TPS", engineConfiguration->tpsAdcChannel);
printAnalogChannelInfo("pPS", engineConfiguration->pedalPositionAdcChannel);
printAnalogChannelInfo("pPS", engineConfiguration->throttlePedalPositionAdcChannel);
if (engineConfiguration->clt.adcChannel != EFI_ADC_NONE) {
printAnalogChannelInfo("CLT", engineConfiguration->clt.adcChannel);
}
@ -768,5 +768,5 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20190124;
return 20190125;
}

View File

@ -296,6 +296,7 @@ static msg_t ivThread(int param) {
if (CONFIGB(clutchDownPin) != GPIO_UNASSIGNED) {
engine->clutchDownState = efiReadPin(CONFIGB(clutchDownPin));
}
engine->acSwitchState = getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE);
if (CONFIGB(clutchUpPin) != GPIO_UNASSIGNED) {
engine->clutchUpState = efiReadPin(CONFIGB(clutchUpPin));
}
@ -487,7 +488,7 @@ void startIdleThread(Logging*sharedLogger) {
chThdCreateStatic(ivThreadStack, sizeof(ivThreadStack), NORMALPRIO, (tfunc_t)(void*) ivThread, NULL);
// this is idle switch INPUT - sometimes there is a switch on the throttle pedal
// this is neutral/no gear switch input. on Miata it's wired both to clutch pedal and neutral in gearbox
// this switch is not used yet
if (CONFIGB(clutchDownPin) != GPIO_UNASSIGNED) {
efiSetPadMode("clutch down switch", CONFIGB(clutchDownPin),

View File

@ -134,14 +134,14 @@ static percent_t getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#define NO_TPS_MAGIC_VALUE 66.611
bool hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return engineConfiguration->pedalPositionAdcChannel != EFI_ADC_NONE;
return engineConfiguration->throttlePedalPositionAdcChannel != EFI_ADC_NONE;
}
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (mockPedalPosition != MOCK_UNDEFINED) {
return mockPedalPosition;
}
float voltage = getVoltageDivided("pPS", engineConfiguration->pedalPositionAdcChannel);
float voltage = getVoltageDivided("pPS", engineConfiguration->throttlePedalPositionAdcChannel);
float result = interpolateMsg("pedal", engineConfiguration->throttlePedalUpVoltage, 0, engineConfiguration->throttlePedalWOTVoltage, 100, voltage);
// this would put the value into the 0-100 range

View File

@ -621,7 +621,7 @@ static void configureInputs(void) {
addChannel("TPS", engineConfiguration->tpsAdcChannel, ADC_SLOW);
addChannel("fuel", engineConfiguration->fuelLevelSensor, ADC_SLOW);
addChannel("pPS", engineConfiguration->pedalPositionAdcChannel, ADC_SLOW);
addChannel("pPS", engineConfiguration->throttlePedalPositionAdcChannel, ADC_SLOW);
addChannel("VBatt", engineConfiguration->vbattAdcChannel, ADC_SLOW);
// not currently used addChannel("Vref", engineConfiguration->vRefAdcChannel, ADC_SLOW);
addChannel("CLT", engineConfiguration->clt.adcChannel, ADC_SLOW);

View File

@ -431,7 +431,7 @@ end_struct
afr_sensor_s afr
adc_channel_e pedalPositionAdcChannel;Electronic pedal position input\nSee also tpsAdcChannel
adc_channel_e throttlePedalPositionAdcChannel;Electronic throttle pedal position input\nSee also tpsAdcChannel
air_pressure_sensor_config_s baroSensor;@see hasBaroSensor

View File

@ -63,7 +63,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 26 11:31:58 EST 2019
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jan 27 00:00:46 EST 2019
pageSize = 20000
page = 1
@ -191,7 +191,7 @@ page = 1
afr_value1 = scalar, F32, 576, "AFR", 1, 0.0, 0, 1000.0, 2
afr_v2 = scalar, F32, 580, "volts", 1, 0.0, 0, 10.0, 2
afr_value2 = scalar, F32, 584, "AFR", 1, 0.0, 0, 1000.0, 2
pedalPositionAdcChannel = bits, U32, 588, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
throttlePedalPositionAdcChannel = bits, U32, 588, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
baroSensor_lowValue = scalar, F32, 592, "kpa", 1, 0, -400, 800, 2
baroSensor_highValue = scalar, F32, 596, "kpa", 1, 0, -400, 800, 2
baroSensor_type = bits, U32, 600, [0:3] "Custom", "DENSO183", "MPX4250", "HONDA3BAR", "NEON_2003", "22012AA090", "3 Bar", "MPX4100", "Toyota 89420-02010", "MPX4250A", "INVALID"
@ -1055,6 +1055,7 @@ fileVersion = { 20171101 }
knockNowIndicator=bits, U32, 72, [14:14], "true", "false";
brakePedalIndicator=bits, U32, 72, [15:15], "true", "false";
toothLogReady =bits, U32, 72, [16:16], "true", "false";
acSwitchIndicator =bits, U32, 72, [17:17], "true", "false";
vehicleSpeedKph = scalar, F32, 76, "kph", 1, 0.0;
ind_tps_error = bits, U32, 80, [0:0], "true", "false";
@ -1738,8 +1739,9 @@ gaugeCategory = Fuel Data
indicator = { hasSdCard}, "no SD", "with SD", white, black, green, black
indicator = { ind_fuel_pump}, "no pump", "pump", white, black, green, black
indicator = { clutchUpState }, "clutch", "cltch Up", white, black, red, black
indicator = { clutchDownState }, "clutch", "cltch Down", white, black, red, black
indicator = { clutchDownState }, "clutch", "cltch Down", white, black, yellow, black
indicator = { brakePedalIndicator }, "brake", "brake down", white, black, red, black
indicator = { acSwitchIndicator }, "AC on", "AC off", yellow, black, white, black
; error codes
indicator = { ind_tps_error}, "tps", "tps error", white, black, red, black
@ -1874,6 +1876,7 @@ gaugeCategory = Fuel Data
entry = clutchUpState, "clutch: up",int,"%d"
entry = clutchDownState, "clutch: down",int,"%d"
entry = brakePedalIndicator, "brake: down",int,"%d"
entry = acSwitchIndicator, "AC switch",int,"%d"
entry = ind_fan, "radiator fan",int,"%d"
@ -2291,7 +2294,8 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F"
field = "clutchDownPin", clutchDownPin
field = "clutchUpPin", clutchUpPin
field = "brakePedalPin", brakePedalPin
field = "A/C Switch", acSwitchAdc
dialog = mainSensorInputs, "Main Sensor Inputs"
field = "MAP ADC input", map_sensor_hwChannel, {hasFrequencyReportingMapSensor == 0}
field = "MAP Freq", frequencyReportingMapInputPin, {hasFrequencyReportingMapSensor == 1}
@ -2338,6 +2342,7 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F"
field = "clutchDownPin", clutchDownPin
field = "clutchUpPin", clutchUpPin
field = "brakePedalPin", brakePedalPin
field = "A/C Switch", acSwitchAdc
field = "servo#1", servoOutputPins1
field = "servo#2", servoOutputPins2
field = "servo#3", servoOutputPins3
@ -3116,8 +3121,8 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F"
panel = testMisc, East
dialog = engineTypeDialog, "Popular vehicles"
commandButton = "Miata NA6 VAF", cmd_set_engine_type_Miata_NA6_VAF
commandButton = "Miata NA6 MAP", cmd_set_engine_type_Miata_NA6_MAP
commandButton = "Miata NA6 Stage 0", cmd_set_engine_type_Miata_NA6_VAF
commandButton = "Miata NA6 Stage 1", cmd_set_engine_type_Miata_NA6_MAP
commandButton = "Miata NB2 MAP", cmd_set_engine_type_Miata_NA2

View File

@ -195,6 +195,7 @@ fileVersion = { 20171101 }
knockNowIndicator=bits, U32, 72, [14:14], "true", "false";
brakePedalIndicator=bits, U32, 72, [15:15], "true", "false";
toothLogReady =bits, U32, 72, [16:16], "true", "false";
acSwitchIndicator =bits, U32, 72, [17:17], "true", "false";
vehicleSpeedKph = scalar, F32, 76, "kph", 1, 0.0;
ind_tps_error = bits, U32, 80, [0:0], "true", "false";
@ -878,8 +879,9 @@ gaugeCategory = Fuel Data
indicator = { hasSdCard}, "no SD", "with SD", white, black, green, black
indicator = { ind_fuel_pump}, "no pump", "pump", white, black, green, black
indicator = { clutchUpState }, "clutch", "cltch Up", white, black, red, black
indicator = { clutchDownState }, "clutch", "cltch Down", white, black, red, black
indicator = { clutchDownState }, "clutch", "cltch Down", white, black, yellow, black
indicator = { brakePedalIndicator }, "brake", "brake down", white, black, red, black
indicator = { acSwitchIndicator }, "AC on", "AC off", yellow, black, white, black
; error codes
indicator = { ind_tps_error}, "tps", "tps error", white, black, red, black
@ -1014,6 +1016,7 @@ gaugeCategory = Fuel Data
entry = clutchUpState, @@INDICATOR_NAME_CLUTCH_UP@@,int,"%d"
entry = clutchDownState, @@INDICATOR_NAME_CLUTCH_DOWN@@,int,"%d"
entry = brakePedalIndicator, @@INDICATOR_NAME_BRAKE_DOWN@@,int,"%d"
entry = acSwitchIndicator, "AC switch",int,"%d"
entry = ind_fan, "radiator fan",int,"%d"
@ -1431,7 +1434,8 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F"
field = "clutchDownPin", clutchDownPin
field = "clutchUpPin", clutchUpPin
field = "brakePedalPin", brakePedalPin
field = "A/C Switch", acSwitchAdc
dialog = mainSensorInputs, "Main Sensor Inputs"
field = "MAP ADC input", map_sensor_hwChannel, {hasFrequencyReportingMapSensor == 0}
field = "MAP Freq", frequencyReportingMapInputPin, {hasFrequencyReportingMapSensor == 1}
@ -1478,6 +1482,7 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F"
field = "clutchDownPin", clutchDownPin
field = "clutchUpPin", clutchUpPin
field = "brakePedalPin", brakePedalPin
field = "A/C Switch", acSwitchAdc
field = "servo#1", servoOutputPins1
field = "servo#2", servoOutputPins2
field = "servo#3", servoOutputPins3
@ -2256,8 +2261,8 @@ cmd_set_engine_type_Miata_NA2 = "w\x00\x30\x00\x2F"
panel = testMisc, East
dialog = engineTypeDialog, "Popular vehicles"
commandButton = "Miata NA6 VAF", cmd_set_engine_type_Miata_NA6_VAF
commandButton = "Miata NA6 MAP", cmd_set_engine_type_Miata_NA6_MAP
commandButton = "Miata NA6 Stage 0", cmd_set_engine_type_Miata_NA6_VAF
commandButton = "Miata NA6 Stage 1", cmd_set_engine_type_Miata_NA6_MAP
commandButton = "Miata NB2 MAP", cmd_set_engine_type_Miata_NA2

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Jan 07 19:25:33 EST 2019
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 26 23:18:47 EST 2019
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int BLOCKING_FACTOR = 400;
@ -35,6 +35,7 @@ public class Fields {
public static final int DIGIPOT_COUNT = 4;
public static final int HW_MAX_ADC_INDEX = 17;
public static final int TRIGGER_SIMULATOR_PIN_COUNT = 3;
public static final int TRIGGER_INPUT_PIN_COUNT = 3;
public static final int LOGIC_ANALYZER_CHANNEL_COUNT = 4;
public static final int FSIO_COMMAND_COUNT = 16;
public static final int AUX_PID_COUNT = 4;
@ -234,7 +235,7 @@ public class Fields {
public static final int afr_v2_offset_hex = 244;
public static final int afr_value2_offset = 584;
public static final int afr_value2_offset_hex = 248;
public static final int pedalPositionAdcChannel_offset = 588;
public static final int throttlePedalPositionAdcChannel_offset = 588;
public static final int baroSensor_offset = 592;
public static final int baroSensor_offset_hex = 250;
public static final int baroSensor_lowValue_offset = 592;
@ -1317,7 +1318,7 @@ public class Fields {
public static final Field AFR_VALUE1 = Field.create("AFR_VALUE1", 576, FieldType.FLOAT);
public static final Field AFR_V2 = Field.create("AFR_V2", 580, FieldType.FLOAT);
public static final Field AFR_VALUE2 = Field.create("AFR_VALUE2", 584, FieldType.FLOAT);
public static final Field PEDALPOSITIONADCCHANNEL = Field.create("PEDALPOSITIONADCCHANNEL", 588, FieldType.INT, adc_channel_e);
public static final Field THROTTLEPEDALPOSITIONADCCHANNEL = Field.create("THROTTLEPEDALPOSITIONADCCHANNEL", 588, FieldType.INT, adc_channel_e);
public static final Field BAROSENSOR_LOWVALUE = Field.create("BAROSENSOR_LOWVALUE", 592, FieldType.FLOAT);
public static final Field BAROSENSOR_HIGHVALUE = Field.create("BAROSENSOR_HIGHVALUE", 596, FieldType.FLOAT);
public static final Field BAROSENSOR_TYPE = Field.create("BAROSENSOR_TYPE", 600, FieldType.INT);

View File

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

View File

@ -12,13 +12,15 @@ import java.awt.event.ActionListener;
*/
public class PresetsPane {
// see rusefi_enums.h
private static final int MIATA_NA_1_6 = 41;
private static final int MIATA_NA6_MAP = 41;
private static final int MIATA_NA6_VAF = 57;
private static final int MAZDA_MIATA_2003 = 47;
private JPanel content = new JPanel(new GridLayout(2, 4));
public PresetsPane() {
content.add(new SetEngineTypeCommandControl("Miata NA6", "engines/miata_na.png", MIATA_NA_1_6).getContent());
content.add(new SetEngineTypeCommandControl("Miata NA6 Stage 0", "engines/miata_na.png", MIATA_NA6_VAF).getContent());
content.add(new SetEngineTypeCommandControl("Miata NA6 Stage 1", "engines/miata_na.png", MIATA_NA6_MAP).getContent());
content.add(new SetEngineTypeCommandControl("Miata NB2", "engines/miata_nb.png", MAZDA_MIATA_2003).getContent());
}