Fsio progress (#449)

* gen_config.bat

* FSIO: fuelPump & mainRelay progress

* typo
This commit is contained in:
andreika-git 2017-06-25 08:35:46 +03:00 committed by rusefi
parent 2bca79e9dc
commit 77ba93d464
12 changed files with 78 additions and 18 deletions

View File

@ -20,6 +20,7 @@
#include "speed_density.h"
#include "advance_map.h"
#include "efilib2.h"
#include "settings.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "injector_central.h"
@ -341,6 +342,32 @@ void Engine::watchdog() {
#endif
}
void Engine::checkShutdown() {
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
int rpm = rpmCalculator.rpmValue;
const float vBattThreshold = 5.0f;
if (isValidRpm(rpm) && sensors.vBatt < vBattThreshold) {
stopEngine();
// todo: add stepper motor parking
}
#endif /* EFI_MAIN_RELAY_CONTROL */
}
bool Engine::isInShutdownMode() {
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
if (stopEngineRequestTimeNt == 0) // the shutdown procedure is not started
return false;
const efitime_t engineStopWaitTimeoutNt = 5LL * 1000000LL;
// The engine is still spinning! Give it some time to stop (but wait no more than 5 secs)
if (isSpinning && (getTimeNowNt() - stopEngineRequestTimeNt) < US2NT(engineStopWaitTimeoutNt))
return true;
// todo: add checks for stepper motor parking
#endif /* EFI_MAIN_RELAY_CONTROL */
return false;
}
injection_mode_e Engine::getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
int rpm = rpmCalculator.rpmValue;
return isCrankingR(rpm) ? CONFIG(crankingInjectionMode) : CONFIG(injectionMode);

View File

@ -427,6 +427,17 @@ public:
void watchdog();
/**
* Needed by EFI_MAIN_RELAY_CONTROL to shut down the engine correctly.
*/
void checkShutdown();
/**
* Allows to finish some long-term shutdown procedures (stepper motor parking etc.)
Returns true if some operations are in progress on background.
*/
bool isInShutdownMode();
monitoring_timestamps_s m;
void knockLogic(float knockVolts);

View File

@ -697,6 +697,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->fuelClosedLoopPid.pFactor = -0.1;
engineConfiguration->cranking.baseFuel = 5;
engineConfiguration->startUpFuelPumpDuration = 4;
engineConfiguration->idleRpmPid.pFactor = 0.05;
engineConfiguration->idleRpmPid.iFactor = 0.002;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jun 22 09:24:53 MSK 2017
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jun 25 00:14:59 EEST 2017
// begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -1551,7 +1551,11 @@ typedef struct {
/**
* offset 2024
*/
float unusedetb;
int16_t startUpFuelPumpDuration;
/**
* offset 2026
*/
int16_t unusedetb;
/**
* CLT-based target RPM for automatic idle controller
* offset 2028
@ -2122,4 +2126,4 @@ typedef struct {
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jun 22 09:24:53 MSK 2017
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jun 25 00:14:59 EEST 2017

View File

@ -1102,8 +1102,10 @@
#define throttlePedalWOTVoltage_offset_hex 7e0
#define stepperDirectionPinMode_offset 2020
#define stepperDirectionPinMode_offset_hex 7e4
#define unusedetb_offset 2024
#define unusedetb_offset_hex 7e8
#define startUpFuelPumpDuration_offset 2024
#define startUpFuelPumpDuration_offset_hex 7e8
#define unusedetb_offset 2026
#define unusedetb_offset_hex 7ea
#define cltIdleRpmBins_offset 2028
#define cltIdleRpmBins_offset_hex 7ec
#define cltIdleRpm_offset 2092

View File

@ -54,6 +54,8 @@ typedef enum {
LE_METHOD_EXHAUST_VVT = 118,
LE_METHOD_IS_COOLANT_BROKEN = 119,
LE_METHOD_CRANKING_RPM = 120,
LE_METHOD_STARTUP_FUEL_PUMP_DURATION = 121,
LE_METHOD_IN_SHUTDOWN = 122,
Force_4b_le_action = ENUM_32_BITS,

View File

@ -45,6 +45,8 @@ static LENameOrdinalPair leKnock(LE_METHOD_KNOCK, "knock");
static LENameOrdinalPair leIntakeVVT(LE_METHOD_INTAKE_VVT, "ivvt");
static LENameOrdinalPair leExhaustVVT(LE_METHOD_EXHAUST_VVT, "evvt");
static LENameOrdinalPair leCrankingRpm(LE_METHOD_CRANKING_RPM, "cranking_rpm");
static LENameOrdinalPair leStartupFuelPumpDuration(LE_METHOD_STARTUP_FUEL_PUMP_DURATION, "startup_fuel_pump_duration");
static LENameOrdinalPair leInShutdown(LE_METHOD_IN_SHUTDOWN, "in_shutdown");
#define LE_EVAL_POOL_SIZE 32
@ -109,6 +111,11 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
return engineConfiguration->fanOnTemperature;
case LE_METHOD_CRANKING_RPM:
return engineConfiguration->cranking.rpm;
case LE_METHOD_STARTUP_FUEL_PUMP_DURATION:
// todo: remove default value check and finish migration to startUpFuelPumpDuration param.
return (engineConfiguration->startUpFuelPumpDuration == 0) ? 4 : engineConfiguration->startUpFuelPumpDuration;
case LE_METHOD_IN_SHUTDOWN:
return engine->isInShutdownMode();
case LE_METHOD_VBATT:
return getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
default:
@ -301,6 +308,11 @@ static const char * action2String(le_action_e action) {
return "fan_off";
case LE_METHOD_FAN:
return "fan";
case LE_METHOD_STARTUP_FUEL_PUMP_DURATION:
return "startup_fuel_pump_duration";
case LE_METHOD_IN_SHUTDOWN:
return "in_shutdown";
default: {
// this is here to make compiler happy
}

View File

@ -273,6 +273,7 @@ static void periodicSlowCallback(Engine *engine) {
engine->watchdog();
engine->updateSlowSensors();
engine->checkShutdown();
#if (EFI_PROD_CODE && EFI_FSIO) || defined(__DOXYGEN__)
runFsio();

View File

@ -1,6 +1,6 @@
// this https://en.wikipedia.org/wiki/Reverse_Polish_notation is generated automatically
// from controllers/system_fsio.txt
// on 2017-06-14_11_10_39
// on 2017-06-25_01_22_09
//
//
// in this file we define system FSIO expressions
@ -15,10 +15,9 @@
// Human-readable: (fan and (coolant > fan_off_setting)) | (coolant > fan_on_setting)
#define FAN_CONTROL_LOGIC "fan coolant fan_off_setting > and coolant fan_on_setting > |"
// todo: start-up fuel pump priming time should probably be configurable?
// Human-readable: (time_since_boot < 4) | (rpm > 0)
#define FUEL_PUMP_LOGIC "time_since_boot 4 < rpm 0 > |"
// Human-readable: (time_since_boot < startup_fuel_pump_duration) | (rpm > 0)
#define FUEL_PUMP_LOGIC "time_since_boot startup_fuel_pump_duration < rpm 0 > |"
// Human-readable: vbatt < 14.5
#define ALTERNATOR_LOGIC "vbatt 14.5 <"
@ -31,8 +30,8 @@
#define COMBINED_WARNING_LIGHT "rpm 2 fsio_setting > coolant 3 fsio_setting > vbatt 4 fsio_setting < | |"
//needed by EFI_MAIN_RELAY_CONTROL
// Human-readable: (time_since_boot < 2) | (vbatt > 5)
#define MAIN_RELAY_LOGIC "time_since_boot 2 < vbatt 5 > |"
// Human-readable: (time_since_boot < 2) | (vbatt > 5) | in_shutdown
#define MAIN_RELAY_LOGIC "time_since_boot 2 < vbatt 5 > | in_shutdown |"
// could be used for simple variable intake geometry setups or warning light or starter block
// Human-readable: rpm > fsio_setting(1)

View File

@ -11,8 +11,7 @@
FAN_CONTROL_LOGIC=(fan and (coolant > fan_off_setting)) | (coolant > fan_on_setting)
# todo: start-up fuel pump priming time should probably be configurable?
FUEL_PUMP_LOGIC=(time_since_boot < 4) | (rpm > 0)
FUEL_PUMP_LOGIC=(time_since_boot < startup_fuel_pump_duration) | (rpm > 0)
ALTERNATOR_LOGIC=vbatt < 14.5
@ -22,7 +21,7 @@ AC_RELAY_LOGIC=ac_on_switch
COMBINED_WARNING_LIGHT=(rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
#needed by EFI_MAIN_RELAY_CONTROL
MAIN_RELAY_LOGIC=(time_since_boot < 2) | (vbatt > 5)
MAIN_RELAY_LOGIC=(time_since_boot < 2) | (vbatt > 5) | in_shutdown
# could be used for simple variable intake geometry setups or warning light or starter block
RPM_ABOVE_USER_SETTING_1=rpm > fsio_setting(1)

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jun 22 09:24:53 MSK 2017
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jun 25 00:14:59 EEST 2017
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int BLOCKING_FACTOR = 400;
@ -802,7 +802,8 @@ public class Fields {
public static final int throttlePedalUpVoltage_offset = 2012;
public static final int throttlePedalWOTVoltage_offset = 2016;
public static final int stepperDirectionPinMode_offset = 2020;
public static final int unusedetb_offset = 2024;
public static final int startUpFuelPumpDuration_offset = 2024;
public static final int unusedetb_offset = 2026;
public static final int cltIdleRpmBins_offset = 2028;
public static final int cltIdleRpm_offset = 2092;
public static final int targetVBatt_offset = 2156;
@ -1591,7 +1592,8 @@ public class Fields {
public static final Field THROTTLEPEDALUPVOLTAGE = Field.create("THROTTLEPEDALUPVOLTAGE", 2012, FieldType.FLOAT);
public static final Field THROTTLEPEDALWOTVOLTAGE = Field.create("THROTTLEPEDALWOTVOLTAGE", 2016, FieldType.FLOAT);
public static final Field STEPPERDIRECTIONPINMODE = Field.create("STEPPERDIRECTIONPINMODE", 2020, FieldType.INT, pin_output_mode_e);
public static final Field UNUSEDETB = Field.create("UNUSEDETB", 2024, FieldType.FLOAT);
public static final Field STARTUPFUELPUMPDURATION = Field.create("STARTUPFUELPUMPDURATION", 2024, FieldType.INT);
public static final Field UNUSEDETB = Field.create("UNUSEDETB", 2026, FieldType.INT);
public static final Field TARGETVBATT = Field.create("TARGETVBATT", 2156, FieldType.FLOAT);
public static final Field ALTERNATOROFFABOVETPS = Field.create("ALTERNATOROFFABOVETPS", 2160, FieldType.FLOAT);
public static final Field TPSACCELLENGTH = Field.create("TPSACCELLENGTH", 2184, FieldType.INT);

View File

@ -1,6 +1,6 @@
<roms>
<!-- Generated by ConfigDefinition utility on Mon Mar 27 22:26:07 EDT 2017 -->
<!-- Generated by ConfigDefinition utility on Sun Jun 25 00:15:02 EEST 2017 -->
<rom>
<romid>