This commit is contained in:
rusefi 2018-03-18 12:15:51 -04:00
parent 23b02ec375
commit b23fea4dd5
9 changed files with 98 additions and 48 deletions

View File

@ -378,6 +378,8 @@ public:
float fsioTimingAdjustment;
float servoValues[SERVO_COUNT];
/**
* Are we experiencing knock right now?
*/

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 17 19:54:04 EDT 2018
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Mar 18 11:56:18 EDT 2018
// begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -1322,19 +1322,19 @@ typedef struct {
bool hasFrequencyReportingMapSensor : 1;
/**
offset 1472 bit 21 */
bool unused_bit_1472_21 : 1;
bool useFSIO8ForServo1 : 1;
/**
offset 1472 bit 22 */
bool unused_bit_1472_22 : 1;
bool useFSIO9ForServo2 : 1;
/**
offset 1472 bit 23 */
bool unused_bit_1472_23 : 1;
bool useFSIO10ForServo3 : 1;
/**
offset 1472 bit 24 */
bool unused_bit_1472_24 : 1;
bool useFSIO11ForServo4 : 1;
/**
offset 1472 bit 25 */
bool unused_bit_1472_25 : 1;
bool useFSIO12ForServo5 : 1;
/**
offset 1472 bit 26 */
bool unused_bit_1472_26 : 1;
@ -2364,4 +2364,4 @@ typedef struct {
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 17 19:54:04 EDT 2018
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Mar 18 11:56:18 EDT 2018

View File

@ -908,16 +908,16 @@
#define step1SparkCutEnable_offset_hex 5c0
#define hasFrequencyReportingMapSensor_offset 1472
#define hasFrequencyReportingMapSensor_offset_hex 5c0
#define unused_bit_1472_21_offset 1472
#define unused_bit_1472_21_offset_hex 5c0
#define unused_bit_1472_22_offset 1472
#define unused_bit_1472_22_offset_hex 5c0
#define unused_bit_1472_23_offset 1472
#define unused_bit_1472_23_offset_hex 5c0
#define unused_bit_1472_24_offset 1472
#define unused_bit_1472_24_offset_hex 5c0
#define unused_bit_1472_25_offset 1472
#define unused_bit_1472_25_offset_hex 5c0
#define useFSIO8ForServo1_offset 1472
#define useFSIO8ForServo1_offset_hex 5c0
#define useFSIO9ForServo2_offset 1472
#define useFSIO9ForServo2_offset_hex 5c0
#define useFSIO10ForServo3_offset 1472
#define useFSIO10ForServo3_offset_hex 5c0
#define useFSIO11ForServo4_offset 1472
#define useFSIO11ForServo4_offset_hex 5c0
#define useFSIO12ForServo5_offset 1472
#define useFSIO12ForServo5_offset_hex 5c0
#define unused_bit_1472_26_offset 1472
#define unused_bit_1472_26_offset_hex 5c0
#define unused_bit_1472_27_offset 1472

View File

@ -382,6 +382,17 @@ static void setFsioFrequency(int index, int frequency) {
}
}
static void useFsioForServo(int servoIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
LEElement * element = fsioLogics[8 - 1 + servoIndex];
if (element == NULL) {
warning(CUSTOM_FSIO_INVALID_EXPRESSION, "invalid expression for %s", "servo");
} else {
engine->servoValues[servoIndex] = calc.getValue2(engine->servoValues[servoIndex], element PASS_ENGINE_PARAMETER_SUFFIX);
}
}
/**
* this method should be invoked periodically to calculate FSIO and toggle corresponding FSIO outputs
*/
@ -435,6 +446,23 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
}
if (engineConfiguration->useFSIO8ForServo1) {
useFsioForServo(0 PASS_ENGINE_PARAMETER_SUFFIX);
}
if (engineConfiguration->useFSIO9ForServo2) {
useFsioForServo(1 PASS_ENGINE_PARAMETER_SUFFIX);
}
if (engineConfiguration->useFSIO10ForServo3) {
useFsioForServo(2 PASS_ENGINE_PARAMETER_SUFFIX);
}
if (engineConfiguration->useFSIO11ForServo4) {
useFsioForServo(3 PASS_ENGINE_PARAMETER_SUFFIX);
}
if (engineConfiguration->useFSIO12ForServo5) {
useFsioForServo(4 PASS_ENGINE_PARAMETER_SUFFIX);
}
}
#endif /* EFI_PROD_CODE */

View File

@ -23,7 +23,7 @@ EXTERN_ENGINE;
THD_WORKING_AREA(seThreadStack, UTILITY_THREAD_STACK_SIZE);
OutputPin pin;
static OutputPin pins[SERVO_COUNT];
static int countServos() {
int result = 0;
@ -41,15 +41,17 @@ static int countServos() {
static scheduling_s servoTurnSignalOff;
// todo: extract common 'pin off' callback?
static void servoTachPinLow(void) {
pin.setValue(false);
static void servoTachPinLow(OutputPin *pin) {
pin->setValue(false);
}
static msg_t seThread(void *arg) {
(void)arg;
chRegSetThreadName("servo");
while (true) {
pin.setValue(1);
OutputPin *pin = &pins[0];
pin->setValue(1);
percent_t position = (currentTimeMillis() / 5) % 200;
@ -58,7 +60,7 @@ static msg_t seThread(void *arg) {
float durationMs = 0 + position * 0.02f;
scheduleForLater(&servoTurnSignalOff, (int)MS2US(durationMs), (schfunc_t) &servoTachPinLow, NULL);
scheduleForLater(&servoTurnSignalOff, (int)MS2US(durationMs), (schfunc_t) &servoTachPinLow, pin);
chThdSleepMilliseconds(19);
@ -68,12 +70,15 @@ static msg_t seThread(void *arg) {
void initServo(void) {
brain_pin_e p = engineConfiguration->servoOutputPins[0];
if (p != TEMP_FOR_COMPATIBILITY) {
pin.initPin("servo", p);
for (int i = 0; i < SERVO_COUNT; i ++) {
brain_pin_e p = engineConfiguration->servoOutputPins[i];
if (p != TEMP_FOR_COMPATIBILITY) {
pins[i].initPin("servo", p);
}
}
chThdCreateStatic(seThreadStack, sizeof(seThreadStack), NORMALPRIO, (tfunc_t) seThread, NULL);
}

View File

@ -652,16 +652,17 @@ bit vvtDisplayInverted
bit isAlternatorControlEnabled
bit invertPrimaryTriggerSignal
bit invertSecondaryTriggerSignal
bit cutFuelOnHardLimit
bit cutSparkOnHardLimit
bit step1fuelCutEnable
bit step1SparkCutEnable
bit hasFrequencyReportingMapSensor;
bit unused_bit_1472_21;
bit unused_bit_1472_22
bit unused_bit_1472_23;
bit unused_bit_1472_24;
bit unused_bit_1472_25;
bit useFSIO8ForServo1
bit useFSIO9ForServo2
bit useFSIO10ForServo3
bit useFSIO11ForServo4
bit useFSIO12ForServo5
bit unused_bit_1472_26;
bit unused_bit_1472_27;
adc_channel_e hipOutputChannel;

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 Sun Mar 18 09:02:09 EDT 2018
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Mar 18 11:56:18 EDT 2018
pageSize = 20000
page = 1
@ -472,11 +472,11 @@ page = 1
step1fuelCutEnable = bits, U32, 1472, [18:18], "false", "true"
step1SparkCutEnable = bits, U32, 1472, [19:19], "false", "true"
hasFrequencyReportingMapSensor= bits, U32, 1472, [20:20], "false", "true"
unused_bit_1472_21 = bits, U32, 1472, [21:21], "false", "true"
unused_bit_1472_22 = bits, U32, 1472, [22:22], "false", "true"
unused_bit_1472_23 = bits, U32, 1472, [23:23], "false", "true"
unused_bit_1472_24 = bits, U32, 1472, [24:24], "false", "true"
unused_bit_1472_25 = bits, U32, 1472, [25:25], "false", "true"
useFSIO8ForServo1 = bits, U32, 1472, [21:21], "false", "true"
useFSIO9ForServo2 = bits, U32, 1472, [22:22], "false", "true"
useFSIO10ForServo3 = bits, U32, 1472, [23:23], "false", "true"
useFSIO11ForServo4 = bits, U32, 1472, [24:24], "false", "true"
useFSIO12ForServo5 = bits, U32, 1472, [25:25], "false", "true"
unused_bit_1472_26 = bits, U32, 1472, [26:26], "false", "true"
unused_bit_1472_27 = bits, U32, 1472, [27:27], "false", "true"
hipOutputChannel = bits, U32, 1476, [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"
@ -2134,6 +2134,10 @@ cmd_stop_engine = "w\x00\x99\x00\x00"
field = "clutchUpPin", clutchUpPin
field = "brakePedalPin", brakePedalPin
field = "servo#1", servoOutputPins1
field = "servo#2", servoOutputPins2
field = "servo#3", servoOutputPins3
field = "servo#4", servoOutputPins4
field = "servo#5", servoOutputPins5
dialog = allPins2
field = "Tachometer output Pin", tachOutputPin
@ -2802,10 +2806,15 @@ cmd_stop_engine = "w\x00\x99\x00\x00"
field = "#5", fsioFormulas5
field = "#6", fsioFormulas6
field = "#7", fsioFormulas7
field = "use FSIO #8 for servo #1", useFSIO8ForServo1
field = "#8", fsioFormulas8
field = "use FSIO #9 for servo #2", useFSIO8ForServo1
field = "#9", fsioFormulas9
field = "use FSIO #10 for servo #3", useFSIO8ForServo1
field = "#10", fsioFormulas10
field = "use FSIO #11 for servo #4", useFSIO8ForServo1
field = "#11", fsioFormulas11
field = "use FSIO #12 for servo #5", useFSIO8ForServo1
field = "#12", fsioFormulas12
field = "#13", fsioFormulas13
field = "#14", fsioFormulas14

View File

@ -1973,10 +1973,15 @@ cmd_stop_engine = "w\x00\x99\x00\x00"
field = "#5", fsioFormulas5
field = "#6", fsioFormulas6
field = "#7", fsioFormulas7
field = "use FSIO #8 for servo #1", useFSIO8ForServo1
field = "#8", fsioFormulas8
field = "use FSIO #9 for servo #2", useFSIO8ForServo1
field = "#9", fsioFormulas9
field = "use FSIO #10 for servo #3", useFSIO8ForServo1
field = "#10", fsioFormulas10
field = "use FSIO #11 for servo #4", useFSIO8ForServo1
field = "#11", fsioFormulas11
field = "use FSIO #12 for servo #5", useFSIO8ForServo1
field = "#12", fsioFormulas12
field = "#13", fsioFormulas13
field = "#14", fsioFormulas14

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Mar 17 19:54:04 EDT 2018
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Mar 18 11:56:18 EDT 2018
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int BLOCKING_FACTOR = 400;
@ -624,11 +624,11 @@ public class Fields {
public static final int step1fuelCutEnable_offset = 1472;
public static final int step1SparkCutEnable_offset = 1472;
public static final int hasFrequencyReportingMapSensor_offset = 1472;
public static final int unused_bit_1472_21_offset = 1472;
public static final int unused_bit_1472_22_offset = 1472;
public static final int unused_bit_1472_23_offset = 1472;
public static final int unused_bit_1472_24_offset = 1472;
public static final int unused_bit_1472_25_offset = 1472;
public static final int useFSIO8ForServo1_offset = 1472;
public static final int useFSIO9ForServo2_offset = 1472;
public static final int useFSIO10ForServo3_offset = 1472;
public static final int useFSIO11ForServo4_offset = 1472;
public static final int useFSIO12ForServo5_offset = 1472;
public static final int unused_bit_1472_26_offset = 1472;
public static final int unused_bit_1472_27_offset = 1472;
public static final int hipOutputChannel_offset = 1476;
@ -1572,11 +1572,11 @@ public class Fields {
public static final Field STEP1FUELCUTENABLE = Field.create("STEP1FUELCUTENABLE", 1472, FieldType.BIT, 18);
public static final Field STEP1SPARKCUTENABLE = Field.create("STEP1SPARKCUTENABLE", 1472, FieldType.BIT, 19);
public static final Field HASFREQUENCYREPORTINGMAPSENSOR = Field.create("HASFREQUENCYREPORTINGMAPSENSOR", 1472, FieldType.BIT, 20);
public static final Field UNUSED_BIT_1472_21 = Field.create("UNUSED_BIT_1472_21", 1472, FieldType.BIT, 21);
public static final Field UNUSED_BIT_1472_22 = Field.create("UNUSED_BIT_1472_22", 1472, FieldType.BIT, 22);
public static final Field UNUSED_BIT_1472_23 = Field.create("UNUSED_BIT_1472_23", 1472, FieldType.BIT, 23);
public static final Field UNUSED_BIT_1472_24 = Field.create("UNUSED_BIT_1472_24", 1472, FieldType.BIT, 24);
public static final Field UNUSED_BIT_1472_25 = Field.create("UNUSED_BIT_1472_25", 1472, FieldType.BIT, 25);
public static final Field USEFSIO8FORSERVO1 = Field.create("USEFSIO8FORSERVO1", 1472, FieldType.BIT, 21);
public static final Field USEFSIO9FORSERVO2 = Field.create("USEFSIO9FORSERVO2", 1472, FieldType.BIT, 22);
public static final Field USEFSIO10FORSERVO3 = Field.create("USEFSIO10FORSERVO3", 1472, FieldType.BIT, 23);
public static final Field USEFSIO11FORSERVO4 = Field.create("USEFSIO11FORSERVO4", 1472, FieldType.BIT, 24);
public static final Field USEFSIO12FORSERVO5 = Field.create("USEFSIO12FORSERVO5", 1472, FieldType.BIT, 25);
public static final Field UNUSED_BIT_1472_26 = Field.create("UNUSED_BIT_1472_26", 1472, FieldType.BIT, 26);
public static final Field UNUSED_BIT_1472_27 = Field.create("UNUSED_BIT_1472_27", 1472, FieldType.BIT, 27);
public static final Field HIPOUTPUTCHANNEL = Field.create("HIPOUTPUTCHANNEL", 1476, FieldType.INT, adc_channel_e);