From 3a7013a72c5ed810083f332243aacd0679457eaa Mon Sep 17 00:00:00 2001 From: rusefillc Date: Tue, 19 Oct 2021 19:48:18 -0400 Subject: [PATCH] Aux analog inputs via CAN #3378 --- firmware/controllers/sensors/sensor_type.h | 4 +++ firmware/init/sensor/init_aux.cpp | 4 +++ firmware/integration/rusefi_config.txt | 7 +++-- firmware/tunerstudio/rusefi.input | 36 ++++++++++++++-------- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/firmware/controllers/sensors/sensor_type.h b/firmware/controllers/sensors/sensor_type.h index cd404fce62..17b0a72fa2 100644 --- a/firmware/controllers/sensors/sensor_type.h +++ b/firmware/controllers/sensors/sensor_type.h @@ -69,6 +69,10 @@ typedef enum __attribute__ ((__packed__)) { Aux2, Aux3, Aux4, + Aux5, + Aux6, + Aux7, + Aux8, VehicleSpeed, diff --git a/firmware/init/sensor/init_aux.cpp b/firmware/init/sensor/init_aux.cpp index bbd31d6ed1..8e82e8dcf4 100644 --- a/firmware/init/sensor/init_aux.cpp +++ b/firmware/init/sensor/init_aux.cpp @@ -12,6 +12,10 @@ static FunctionalSensor auxSensors[] = { { SensorType::Aux2, MS2NT(50) }, { SensorType::Aux3, MS2NT(50) }, { SensorType::Aux4, MS2NT(50) }, + { SensorType::Aux5, MS2NT(50) }, + { SensorType::Aux6, MS2NT(50) }, + { SensorType::Aux7, MS2NT(50) }, + { SensorType::Aux8, MS2NT(50) }, }; static_assert(efi::size(auxSensors) == AUX_ANALOG_INPUT_COUNT); diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 58de08573c..35c60cb900 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -75,7 +75,7 @@ struct_no_prefix engine_configuration_s ! see 'blockingFactor' in rusefi.ini #define BLOCKING_FACTOR 256 -#define AUX_ANALOG_INPUT_COUNT 4 +#define AUX_ANALOG_INPUT_COUNT 8 #define FSIO_ANALOG_INPUT_COUNT 4 #define LUA_PWM_COUNT 8 @@ -1380,7 +1380,7 @@ int16_t tps2Max;Full throttle#2. tpsMax value as 10 bit ADC value. Not Voltage!\ float[MAP_ACCEL_TAPER] mapAccelTaperBins;;"counter", 1, 0, 0, 300, 0 float[MAP_ACCEL_TAPER] mapAccelTaperMult;;"mult", 1, 0, 0, 300, 2 - adc_channel_e[AUX_ANALOG_INPUT_COUNT iterate] fsioAdc;todo: rename to fsioAnalogInputs + float unusedAnotherOneOfThose;EGO value correction;"value", 1, 0, -10, 10, 2 float fixedTiming;Fixed timing, useful for TDC testing;"deg", 1, 0, -720, 720, 2 float mapLowValueVoltage;MAP voltage for low point;"v", 1, 0, 0, 10, 2 float mapHighValueVoltage;MAP voltage for low point;"v", 1, 0, 0, 10, 2 @@ -1409,7 +1409,8 @@ float[MAP_ACCEL_TAPER] mapAccelTaperMult;;"mult", 1, 0, 0, 300, 2 vvt_mode_e[CAMS_PER_BANK iterate] vvtMode;set vvt_mode X uint8_t[CAMS_PER_BANK_padding] vvtModePadding;; uint8_t fan2ExtraIdle;+Additional idle % when fan #2 is active;"%", 1, 0, 0, 100, 0 - uint8_t[9] unusedOldBiquad;;"units", 1, 0, -20, 100, 0 + uint8_t[1] unusedOldBiquad;;"units", 1, 0, -20, 100, 0 + adc_channel_e[AUX_ANALOG_INPUT_COUNT iterate] auxAnalogInputs;todo: rename to fsioAnalogInputs output_pin_e[MAX_CYLINDER_COUNT iterate] trailingCoilPins; float[CLT_TIMING_CURVE_SIZE] cltTimingBins;CLT-based timing correction;"C", 1, 0, -100, 250, 1 diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 17a71ff572..e8e5f987ab 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -531,10 +531,14 @@ enable2ndByteCanID = false requiresPowerCycle = fsioFrequency5 requiresPowerCycle = fsioFrequency6 - requiresPowerCycle = fsioAdc1 - requiresPowerCycle = fsioAdc2 - requiresPowerCycle = fsioAdc3 - requiresPowerCycle = fsioAdc4 + requiresPowerCycle = auxAnalogInputs1 + requiresPowerCycle = auxAnalogInputs2 + requiresPowerCycle = auxAnalogInputs3 + requiresPowerCycle = auxAnalogInputs4 + requiresPowerCycle = auxAnalogInputs5 + requiresPowerCycle = auxAnalogInputs6 + requiresPowerCycle = auxAnalogInputs7 + requiresPowerCycle = auxAnalogInputs8 readOnly = warning_message @@ -2412,10 +2416,14 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00" panel = allPinsMC33 dialog = allPins1_3 - field = "FSIO ADC #1", fsioAdc1 - field = "FSIO ADC #2", fsioAdc2 - field = "FSIO ADC #3", fsioAdc3 - field = "FSIO ADC #4", fsioAdc4 + field = "FSIO ADC #1", auxAnalogInputs1 + field = "FSIO ADC #2", auxAnalogInputs2 + field = "FSIO ADC #3", auxAnalogInputs3 + field = "FSIO ADC #4", auxAnalogInputs4 + field = "FSIO ADC #5", auxAnalogInputs5 + field = "FSIO ADC #6", auxAnalogInputs6 + field = "FSIO ADC #7", auxAnalogInputs7 + field = "FSIO ADC #8", auxAnalogInputs8 field = "GPS RX", gps_rx_pin @@if_ts_show_gps field = "GPS TX", gps_tx_pin @@if_ts_show_gps field = "CAN RX pin", canRxPin @@if_ts_show_can_pins @@ -3315,10 +3323,14 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00" field = "#6", fsioFormulas6 dialog = auxInputsDialog, "Aux inputs" - field = "ADC #1", fsioAdc1 - field = "ADC #2", fsioAdc2 - field = "ADC #3", fsioAdc3 - field = "ADC #4", fsioAdc4 + field = "ADC #1", auxAnalogInputs1 + field = "ADC #2", auxAnalogInputs2 + field = "ADC #3", auxAnalogInputs3 + field = "ADC #4", auxAnalogInputs4 + field = "ADC #5", auxAnalogInputs5 + field = "ADC #6", auxAnalogInputs6 + field = "ADC #7", auxAnalogInputs7 + field = "ADC #8", auxAnalogInputs8 dialog = luaOutputs, "Lua Outputs" field = "#Call startPwm to initialize, then call"