mirror of https://github.com/rusefi/rusefi-1.git
main relay doesn't use fsio (#3580)
* fuel pump * s * call correct callback * more dead * test adjustment * don't overflow * don't need separate function * java * give it a name * generated * generated * add to generate script * import * * this is so cheap we don't need a flag * main relay * plumbing * dead fsio stuff * test it * by 100%, we mean 99.98%
This commit is contained in:
parent
e59ee8deef
commit
81fffe87b7
|
@ -261,7 +261,8 @@ static const void * getStructAddr(live_data_e structId) {
|
||||||
return static_cast<idle_state_s*>(&engine->idle);
|
return static_cast<idle_state_s*>(&engine->idle);
|
||||||
case LDS_TPS_ACCEL:
|
case LDS_TPS_ACCEL:
|
||||||
return static_cast<tps_accel_state_s*>(&engine->tpsAccelEnrichment);
|
return static_cast<tps_accel_state_s*>(&engine->tpsAccelEnrichment);
|
||||||
|
case LDS_MAIN_RELAY:
|
||||||
|
return static_cast<main_relay_s*>(&engine->module<MainRelayController>().unmock());
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
#include "main_relay.h"
|
||||||
|
|
||||||
|
void MainRelayController::onSlowCallback() {
|
||||||
|
isBenchTest = engine->isInMainRelayBench();
|
||||||
|
|
||||||
|
#if EFI_MAIN_RELAY_CONTROL
|
||||||
|
hasIgnitionVoltage = Sensor::getOrZero(SensorType::BatteryVoltage) > 5;
|
||||||
|
|
||||||
|
mainRelayState = isBenchTest | hasIgnitionVoltage;
|
||||||
|
#else // not EFI_MAIN_RELAY_CONTROL
|
||||||
|
mainRelayState = !isBenchTest;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enginePins.mainRelay.setValue(mainRelayState);
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "engine_module.h"
|
||||||
|
#include "main_relay_generated.h"
|
||||||
|
|
||||||
|
struct MainRelayController : public EngineModule, public main_relay_s {
|
||||||
|
void onSlowCallback() override;
|
||||||
|
};
|
|
@ -0,0 +1,5 @@
|
||||||
|
struct_no_prefix main_relay_s
|
||||||
|
bit isBenchTest
|
||||||
|
bit hasIgnitionVoltage
|
||||||
|
bit mainRelayState
|
||||||
|
end_struct
|
|
@ -0,0 +1,108 @@
|
||||||
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/main_relay.txt Fri Nov 19 13:01:22 PST 2021
|
||||||
|
// by class com.rusefi.output.CHeaderConsumer
|
||||||
|
// begin
|
||||||
|
#pragma once
|
||||||
|
#include "rusefi_types.h"
|
||||||
|
// start of main_relay_s
|
||||||
|
struct main_relay_s {
|
||||||
|
/**
|
||||||
|
offset 0 bit 0 */
|
||||||
|
bool isBenchTest : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 1 */
|
||||||
|
bool hasIgnitionVoltage : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 2 */
|
||||||
|
bool mainRelayState : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 3 */
|
||||||
|
bool unusedBit_3_3 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 4 */
|
||||||
|
bool unusedBit_3_4 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 5 */
|
||||||
|
bool unusedBit_3_5 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 6 */
|
||||||
|
bool unusedBit_3_6 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 7 */
|
||||||
|
bool unusedBit_3_7 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 8 */
|
||||||
|
bool unusedBit_3_8 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 9 */
|
||||||
|
bool unusedBit_3_9 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 10 */
|
||||||
|
bool unusedBit_3_10 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 11 */
|
||||||
|
bool unusedBit_3_11 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 12 */
|
||||||
|
bool unusedBit_3_12 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 13 */
|
||||||
|
bool unusedBit_3_13 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 14 */
|
||||||
|
bool unusedBit_3_14 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 15 */
|
||||||
|
bool unusedBit_3_15 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 16 */
|
||||||
|
bool unusedBit_3_16 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 17 */
|
||||||
|
bool unusedBit_3_17 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 18 */
|
||||||
|
bool unusedBit_3_18 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 19 */
|
||||||
|
bool unusedBit_3_19 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 20 */
|
||||||
|
bool unusedBit_3_20 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 21 */
|
||||||
|
bool unusedBit_3_21 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 22 */
|
||||||
|
bool unusedBit_3_22 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 23 */
|
||||||
|
bool unusedBit_3_23 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 24 */
|
||||||
|
bool unusedBit_3_24 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 25 */
|
||||||
|
bool unusedBit_3_25 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 26 */
|
||||||
|
bool unusedBit_3_26 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 27 */
|
||||||
|
bool unusedBit_3_27 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 28 */
|
||||||
|
bool unusedBit_3_28 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 29 */
|
||||||
|
bool unusedBit_3_29 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 30 */
|
||||||
|
bool unusedBit_3_30 : 1;
|
||||||
|
/**
|
||||||
|
offset 0 bit 31 */
|
||||||
|
bool unusedBit_3_31 : 1;
|
||||||
|
/** total size 4*/
|
||||||
|
};
|
||||||
|
|
||||||
|
// end
|
||||||
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/main_relay.txt Fri Nov 19 13:01:22 PST 2021
|
|
@ -538,7 +538,7 @@ bool Engine::isInMainRelayBench() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Engine::isInShutdownMode() const {
|
bool Engine::isInShutdownMode() const {
|
||||||
#if EFI_MAIN_RELAY_CONTROL
|
#if EFI_MAIN_RELAY_CONTROL && EFI_PROD_CODE
|
||||||
// if we are in "ignition_on" mode and not in shutdown mode
|
// if we are in "ignition_on" mode and not in shutdown mode
|
||||||
if (stopEngineRequestTimeNt == 0 && ignitionOnTimeNt > 0) {
|
if (stopEngineRequestTimeNt == 0 && ignitionOnTimeNt > 0) {
|
||||||
const float vBattThresholdOff = 5.0f;
|
const float vBattThresholdOff = 5.0f;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "launch_control.h"
|
#include "launch_control.h"
|
||||||
#include "trigger_scheduler.h"
|
#include "trigger_scheduler.h"
|
||||||
#include "fuel_pump.h"
|
#include "fuel_pump.h"
|
||||||
|
#include "main_relay.h"
|
||||||
#include "type_list.h"
|
#include "type_list.h"
|
||||||
|
|
||||||
#ifndef EFI_UNIT_TEST
|
#ifndef EFI_UNIT_TEST
|
||||||
|
@ -135,6 +136,7 @@ public:
|
||||||
#endif // EFI_HPFP && EFI_ENGINE_CONTROL
|
#endif // EFI_HPFP && EFI_ENGINE_CONTROL
|
||||||
|
|
||||||
FuelPumpController,
|
FuelPumpController,
|
||||||
|
MainRelayController,
|
||||||
EngineModule // dummy placeholder so the previous entries can all have commas
|
EngineModule // dummy placeholder so the previous entries can all have commas
|
||||||
> engineModules;
|
> engineModules;
|
||||||
|
|
||||||
|
|
|
@ -21,5 +21,6 @@ LDS_TRIGGER_STATE,
|
||||||
LDS_AC_CONTROL,
|
LDS_AC_CONTROL,
|
||||||
LDS_FUEL_PUMP,
|
LDS_FUEL_PUMP,
|
||||||
LDS_IDLE,
|
LDS_IDLE,
|
||||||
LDS_TPS_ACCEL
|
LDS_TPS_ACCEL,
|
||||||
|
LDS_MAIN_RELAY,
|
||||||
} live_data_e;
|
} live_data_e;
|
||||||
|
|
|
@ -21,6 +21,7 @@ CONTROLLERS_SRC_CPP = \
|
||||||
$(CONTROLLERS_DIR)/actuators/idle_thread_io.cpp \
|
$(CONTROLLERS_DIR)/actuators/idle_thread_io.cpp \
|
||||||
$(CONTROLLERS_DIR)/actuators/idle_hardware.cpp \
|
$(CONTROLLERS_DIR)/actuators/idle_hardware.cpp \
|
||||||
$(CONTROLLERS_DIR)/actuators/idle_thread.cpp \
|
$(CONTROLLERS_DIR)/actuators/idle_thread.cpp \
|
||||||
|
$(CONTROLLERS_DIR)/actuators/main_relay.cpp \
|
||||||
$(CONTROLLERS_DIR)/actuators/pwm_tester.cpp \
|
$(CONTROLLERS_DIR)/actuators/pwm_tester.cpp \
|
||||||
$(CONTROLLERS_DIR)/actuators/vvt.cpp \
|
$(CONTROLLERS_DIR)/actuators/vvt.cpp \
|
||||||
$(CONTROLLERS_DIR)/actuators/gppwm/gppwm_channel.cpp \
|
$(CONTROLLERS_DIR)/actuators/gppwm/gppwm_channel.cpp \
|
||||||
|
|
|
@ -33,7 +33,6 @@ typedef enum {
|
||||||
LE_METHOD_RPM = 100,
|
LE_METHOD_RPM = 100,
|
||||||
LE_METHOD_COOLANT = 101,
|
LE_METHOD_COOLANT = 101,
|
||||||
LE_METHOD_FAN = 102,
|
LE_METHOD_FAN = 102,
|
||||||
LE_METHOD_TIME_SINCE_BOOT = 103,
|
|
||||||
LE_METHOD_TPS = 106,
|
LE_METHOD_TPS = 106,
|
||||||
LE_METHOD_MAF = 107,
|
LE_METHOD_MAF = 107,
|
||||||
LE_METHOD_INTAKE_AIR = 108,
|
LE_METHOD_INTAKE_AIR = 108,
|
||||||
|
@ -52,7 +51,6 @@ typedef enum {
|
||||||
LE_METHOD_FSIO_DIGITAL_INPUT = 123,
|
LE_METHOD_FSIO_DIGITAL_INPUT = 123,
|
||||||
LE_METHOD_FSIO_SETTING = 124,
|
LE_METHOD_FSIO_SETTING = 124,
|
||||||
LE_METHOD_PPS = 125,
|
LE_METHOD_PPS = 125,
|
||||||
LE_METHOD_IN_MR_BENCH = 128,
|
|
||||||
LE_METHOD_FUEL_FLOW_RATE = 131,
|
LE_METHOD_FUEL_FLOW_RATE = 131,
|
||||||
LE_METHOD_OIL_PRESSURE = 132,
|
LE_METHOD_OIL_PRESSURE = 132,
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ static LENameOrdinalPair leOilPressure(LE_METHOD_OIL_PRESSURE, "oilp");
|
||||||
static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch");
|
static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch");
|
||||||
// @returns float number of seconds since last A/C toggle
|
// @returns float number of seconds since last A/C toggle
|
||||||
static LENameOrdinalPair leTimeSinceAcToggle(LE_METHOD_TIME_SINCE_AC_TOGGLE, "time_since_ac_on_switch");
|
static LENameOrdinalPair leTimeSinceAcToggle(LE_METHOD_TIME_SINCE_AC_TOGGLE, "time_since_ac_on_switch");
|
||||||
static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT, "time_since_boot");
|
|
||||||
static LENameOrdinalPair leFsioSetting(LE_METHOD_FSIO_SETTING, FSIO_METHOD_FSIO_SETTING);
|
static LENameOrdinalPair leFsioSetting(LE_METHOD_FSIO_SETTING, FSIO_METHOD_FSIO_SETTING);
|
||||||
static LENameOrdinalPair leFsioAnalogInput(LE_METHOD_FSIO_ANALOG_INPUT, FSIO_METHOD_FSIO_ANALOG_INPUT);
|
static LENameOrdinalPair leFsioAnalogInput(LE_METHOD_FSIO_ANALOG_INPUT, FSIO_METHOD_FSIO_ANALOG_INPUT);
|
||||||
static LENameOrdinalPair leFsioDigitalInput(LE_METHOD_FSIO_DIGITAL_INPUT, FSIO_METHOD_FSIO_DIGITAL_INPUT);
|
static LENameOrdinalPair leFsioDigitalInput(LE_METHOD_FSIO_DIGITAL_INPUT, FSIO_METHOD_FSIO_DIGITAL_INPUT);
|
||||||
|
@ -63,7 +62,6 @@ static LENameOrdinalPair leIntakeVVT(LE_METHOD_INTAKE_VVT, "ivvt");
|
||||||
static LENameOrdinalPair leExhaustVVT(LE_METHOD_EXHAUST_VVT, "evvt");
|
static LENameOrdinalPair leExhaustVVT(LE_METHOD_EXHAUST_VVT, "evvt");
|
||||||
static LENameOrdinalPair leCrankingRpm(LE_METHOD_CRANKING_RPM, "cranking_rpm");
|
static LENameOrdinalPair leCrankingRpm(LE_METHOD_CRANKING_RPM, "cranking_rpm");
|
||||||
static LENameOrdinalPair leInShutdown(LE_METHOD_IN_SHUTDOWN, "in_shutdown");
|
static LENameOrdinalPair leInShutdown(LE_METHOD_IN_SHUTDOWN, "in_shutdown");
|
||||||
static LENameOrdinalPair leInMrBench(LE_METHOD_IN_MR_BENCH, "in_mr_bench");
|
|
||||||
static LENameOrdinalPair leFuelRate(LE_METHOD_FUEL_FLOW_RATE, "fuel_flow");
|
static LENameOrdinalPair leFuelRate(LE_METHOD_FUEL_FLOW_RATE, "fuel_flow");
|
||||||
|
|
||||||
#include "fsio_names.def"
|
#include "fsio_names.def"
|
||||||
|
@ -76,10 +74,6 @@ CCM_OPTIONAL LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE);
|
||||||
|
|
||||||
static LEElement * starterRelayDisableLogic;
|
static LEElement * starterRelayDisableLogic;
|
||||||
|
|
||||||
#if EFI_MAIN_RELAY_CONTROL
|
|
||||||
static LEElement * mainRelayLogic;
|
|
||||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
|
||||||
FsioResult getEngineValue(le_action_e action) {
|
FsioResult getEngineValue(le_action_e action) {
|
||||||
|
@ -108,20 +102,10 @@ FsioResult getEngineValue(le_action_e action) {
|
||||||
case LE_METHOD_EXHAUST_VVT:
|
case LE_METHOD_EXHAUST_VVT:
|
||||||
return engine->triggerCentral.getVVTPosition(0, 1);
|
return engine->triggerCentral.getVVTPosition(0, 1);
|
||||||
#endif
|
#endif
|
||||||
case LE_METHOD_TIME_SINCE_BOOT:
|
|
||||||
#if EFI_MAIN_RELAY_CONTROL
|
|
||||||
// in main relay control mode, we return the number of seconds since the ignition is turned on
|
|
||||||
// (or negative if the ignition key is switched off)
|
|
||||||
return engine->getTimeIgnitionSeconds();
|
|
||||||
#else
|
|
||||||
return getTimeNowSeconds();
|
|
||||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
|
||||||
case LE_METHOD_CRANKING_RPM:
|
case LE_METHOD_CRANKING_RPM:
|
||||||
return engineConfiguration->cranking.rpm;
|
return engineConfiguration->cranking.rpm;
|
||||||
case LE_METHOD_IN_SHUTDOWN:
|
case LE_METHOD_IN_SHUTDOWN:
|
||||||
return engine->isInShutdownMode();
|
return engine->isInShutdownMode();
|
||||||
case LE_METHOD_IN_MR_BENCH:
|
|
||||||
return engine->isInMainRelayBench();
|
|
||||||
case LE_METHOD_VBATT:
|
case LE_METHOD_VBATT:
|
||||||
return Sensor::getOrZero(SensorType::BatteryVoltage);
|
return Sensor::getOrZero(SensorType::BatteryVoltage);
|
||||||
case LE_METHOD_TPS:
|
case LE_METHOD_TPS:
|
||||||
|
@ -159,8 +143,6 @@ static const char * action2String(le_action_e action) {
|
||||||
return "fan";
|
return "fan";
|
||||||
case LE_METHOD_IN_SHUTDOWN:
|
case LE_METHOD_IN_SHUTDOWN:
|
||||||
return leInShutdown.name;
|
return leInShutdown.name;
|
||||||
case LE_METHOD_IN_MR_BENCH:
|
|
||||||
return leInMrBench.name;
|
|
||||||
#include "fsio_strings.def"
|
#include "fsio_strings.def"
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
|
@ -198,18 +180,6 @@ static void setPinState(const char * msg, OutputPin *pin, LEElement *element) {
|
||||||
* this method should be invoked periodically to calculate FSIO and toggle corresponding FSIO outputs
|
* this method should be invoked periodically to calculate FSIO and toggle corresponding FSIO outputs
|
||||||
*/
|
*/
|
||||||
void runFsio() {
|
void runFsio() {
|
||||||
#if EFI_MAIN_RELAY_CONTROL
|
|
||||||
if (isBrainPinValid(engineConfiguration->mainRelayPin))
|
|
||||||
// the MAIN_RELAY_LOGIC calls engine->isInShutdownMode()
|
|
||||||
setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic);
|
|
||||||
#else /* EFI_MAIN_RELAY_CONTROL */
|
|
||||||
/**
|
|
||||||
* main relay is always on if ECU is on, that's a good enough initial implementation
|
|
||||||
*/
|
|
||||||
if (isBrainPinValid(engineConfiguration->mainRelayPin))
|
|
||||||
enginePins.mainRelay.setValue(!engine->isInMainRelayBench());
|
|
||||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
|
||||||
|
|
||||||
if (isBrainPinValid(engineConfiguration->starterRelayDisablePin))
|
if (isBrainPinValid(engineConfiguration->starterRelayDisablePin))
|
||||||
setPinState("starter_relay", &enginePins.starterRelayDisable, starterRelayDisableLogic);
|
setPinState("starter_relay", &enginePins.starterRelayDisable, starterRelayDisableLogic);
|
||||||
|
|
||||||
|
@ -314,10 +284,6 @@ void initFsioImpl() {
|
||||||
sysPool.reset();
|
sysPool.reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_MAIN_RELAY_CONTROL
|
|
||||||
if (isBrainPinValid(engineConfiguration->mainRelayPin))
|
|
||||||
mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC);
|
|
||||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
|
||||||
if (isBrainPinValid(engineConfiguration->starterRelayDisablePin))
|
if (isBrainPinValid(engineConfiguration->starterRelayDisablePin))
|
||||||
starterRelayDisableLogic = sysPool.parseExpression(STARTER_RELAY_LOGIC);
|
starterRelayDisableLogic = sysPool.parseExpression(STARTER_RELAY_LOGIC);
|
||||||
|
|
||||||
|
@ -342,10 +308,6 @@ void runHardcodedFsio() {
|
||||||
}
|
}
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
// see MAIN_RELAY_LOGIC
|
|
||||||
if (isBrainPinValid(engineConfiguration->mainRelayPin)) {
|
|
||||||
enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (Sensor::getOrZero(SensorType::BatteryVoltage) > LOW_VBATT) || engine->isInShutdownMode());
|
|
||||||
}
|
|
||||||
// see STARTER_RELAY_LOGIC
|
// see STARTER_RELAY_LOGIC
|
||||||
if (isBrainPinValid(engineConfiguration->starterRelayDisablePin)) {
|
if (isBrainPinValid(engineConfiguration->starterRelayDisablePin)) {
|
||||||
enginePins.starterRelayDisable.setValue(engine->rpmCalculator.getRpm() < engineConfiguration->cranking.rpm);
|
enginePins.starterRelayDisable.setValue(engine->rpmCalculator.getRpm() < engineConfiguration->cranking.rpm);
|
||||||
|
|
|
@ -750,7 +750,7 @@ void initEngineContoller() {
|
||||||
#define RAM_UNUSED_SIZE 9000
|
#define RAM_UNUSED_SIZE 9000
|
||||||
#endif
|
#endif
|
||||||
#ifndef CCM_UNUSED_SIZE
|
#ifndef CCM_UNUSED_SIZE
|
||||||
#define CCM_UNUSED_SIZE 32
|
#define CCM_UNUSED_SIZE 16
|
||||||
#endif
|
#endif
|
||||||
static char UNUSED_RAM_SIZE[RAM_UNUSED_SIZE];
|
static char UNUSED_RAM_SIZE[RAM_UNUSED_SIZE];
|
||||||
static char UNUSED_CCM_SIZE[CCM_UNUSED_SIZE] CCM_OPTIONAL;
|
static char UNUSED_CCM_SIZE[CCM_UNUSED_SIZE] CCM_OPTIONAL;
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
|
|
||||||
// Human-readable: (rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
|
// Human-readable: (rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
|
||||||
#define COMBINED_WARNING_LIGHT "rpm 2 fsio_setting > coolant 3 fsio_setting > vbatt 4 fsio_setting < | |"
|
#define COMBINED_WARNING_LIGHT "rpm 2 fsio_setting > coolant 3 fsio_setting > vbatt 4 fsio_setting < | |"
|
||||||
//needed by EFI_MAIN_RELAY_CONTROL which is currently FALSE for most of the boards
|
|
||||||
// todo: make '5' a setting?
|
|
||||||
// todo: always have 'EFI_MAIN_RELAY_CONTROL'?
|
|
||||||
// at the moment microRusEFI would not be happy with vbatt > 5 since microRusEFI senses main relay output
|
|
||||||
// todo https://github.com/rusefi/rusefi/issues/2258
|
|
||||||
//MAIN_RELAY_LOGIC=(time_since_boot >= 0 & time_since_boot < 2) | (vbatt > 5) | in_shutdown
|
|
||||||
//MAIN_RELAY_LOGIC=(!in_mr_bench) & ((vbatt > 5) | in_shutdown)
|
|
||||||
|
|
||||||
// Human-readable: (!in_mr_bench) & (vbatt > 5)
|
|
||||||
#define MAIN_RELAY_LOGIC "in_mr_bench ! vbatt 5 > &"
|
|
||||||
// could be used for simple variable intake geometry setups or warning light or starter block
|
|
||||||
|
|
||||||
// Human-readable: rpm > fsio_setting(1)
|
// Human-readable: rpm > fsio_setting(1)
|
||||||
#define RPM_ABOVE_USER_SETTING_1 "rpm 1 fsio_setting >"
|
#define RPM_ABOVE_USER_SETTING_1 "rpm 1 fsio_setting >"
|
||||||
|
|
|
@ -14,15 +14,6 @@ TOO_HOT_LOGIC=coolant > 120
|
||||||
# Combined RPM, CLT and VBATT warning light
|
# Combined RPM, CLT and VBATT warning light
|
||||||
COMBINED_WARNING_LIGHT=(rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
|
COMBINED_WARNING_LIGHT=(rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
|
||||||
|
|
||||||
#needed by EFI_MAIN_RELAY_CONTROL which is currently FALSE for most of the boards
|
|
||||||
# todo: make '5' a setting?
|
|
||||||
# todo: always have 'EFI_MAIN_RELAY_CONTROL'?
|
|
||||||
# at the moment microRusEFI would not be happy with vbatt > 5 since microRusEFI senses main relay output
|
|
||||||
# todo https://github.com/rusefi/rusefi/issues/2258
|
|
||||||
#MAIN_RELAY_LOGIC=(time_since_boot >= 0 & time_since_boot < 2) | (vbatt > 5) | in_shutdown
|
|
||||||
#MAIN_RELAY_LOGIC=(!in_mr_bench) & ((vbatt > 5) | in_shutdown)
|
|
||||||
MAIN_RELAY_LOGIC=(!in_mr_bench) & (vbatt > 5)
|
|
||||||
|
|
||||||
# could be used for simple variable intake geometry setups or warning light or starter block
|
# could be used for simple variable intake geometry setups or warning light or starter block
|
||||||
RPM_ABOVE_USER_SETTING_1=rpm > fsio_setting(1)
|
RPM_ABOVE_USER_SETTING_1=rpm > fsio_setting(1)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ bash gen_live_documentation_one_file.sh ac_control AcControl.java controllers/ac
|
||||||
bash gen_live_documentation_one_file.sh fuel_pump FuelPump.java controllers/actuators
|
bash gen_live_documentation_one_file.sh fuel_pump FuelPump.java controllers/actuators
|
||||||
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
||||||
|
|
||||||
|
bash gen_live_documentation_one_file.sh main_relay MainRelay.java controllers/actuators
|
||||||
|
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
||||||
|
|
||||||
bash gen_live_documentation_one_file.sh pid_state PidState.java util/math
|
bash gen_live_documentation_one_file.sh pid_state PidState.java util/math
|
||||||
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
||||||
|
|
||||||
|
|
|
@ -16,4 +16,5 @@ public enum live_data_e {
|
||||||
LDS_FUEL_PUMP,
|
LDS_FUEL_PUMP,
|
||||||
LDS_IDLE,
|
LDS_IDLE,
|
||||||
LDS_TPS_ACCEL,
|
LDS_TPS_ACCEL,
|
||||||
|
LDS_MAIN_RELAY,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.rusefi.config.generated;
|
||||||
|
|
||||||
|
// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/main_relay.txt Fri Nov 19 13:01:22 PST 2021
|
||||||
|
|
||||||
|
// by class com.rusefi.output.FileJavaFieldsConsumer
|
||||||
|
import com.rusefi.config.*;
|
||||||
|
|
||||||
|
public class MainRelay {
|
||||||
|
public static final Field ISBENCHTEST = Field.create("ISBENCHTEST", 0, FieldType.BIT, 0);
|
||||||
|
public static final Field HASIGNITIONVOLTAGE = Field.create("HASIGNITIONVOLTAGE", 0, FieldType.BIT, 1);
|
||||||
|
public static final Field MAINRELAYSTATE = Field.create("MAINRELAYSTATE", 0, FieldType.BIT, 2);
|
||||||
|
public static final Field UNUSEDBIT_3_3 = Field.create("UNUSEDBIT_3_3", 0, FieldType.BIT, 3);
|
||||||
|
public static final Field UNUSEDBIT_3_4 = Field.create("UNUSEDBIT_3_4", 0, FieldType.BIT, 4);
|
||||||
|
public static final Field UNUSEDBIT_3_5 = Field.create("UNUSEDBIT_3_5", 0, FieldType.BIT, 5);
|
||||||
|
public static final Field UNUSEDBIT_3_6 = Field.create("UNUSEDBIT_3_6", 0, FieldType.BIT, 6);
|
||||||
|
public static final Field UNUSEDBIT_3_7 = Field.create("UNUSEDBIT_3_7", 0, FieldType.BIT, 7);
|
||||||
|
public static final Field UNUSEDBIT_3_8 = Field.create("UNUSEDBIT_3_8", 0, FieldType.BIT, 8);
|
||||||
|
public static final Field UNUSEDBIT_3_9 = Field.create("UNUSEDBIT_3_9", 0, FieldType.BIT, 9);
|
||||||
|
public static final Field UNUSEDBIT_3_10 = Field.create("UNUSEDBIT_3_10", 0, FieldType.BIT, 10);
|
||||||
|
public static final Field UNUSEDBIT_3_11 = Field.create("UNUSEDBIT_3_11", 0, FieldType.BIT, 11);
|
||||||
|
public static final Field UNUSEDBIT_3_12 = Field.create("UNUSEDBIT_3_12", 0, FieldType.BIT, 12);
|
||||||
|
public static final Field UNUSEDBIT_3_13 = Field.create("UNUSEDBIT_3_13", 0, FieldType.BIT, 13);
|
||||||
|
public static final Field UNUSEDBIT_3_14 = Field.create("UNUSEDBIT_3_14", 0, FieldType.BIT, 14);
|
||||||
|
public static final Field UNUSEDBIT_3_15 = Field.create("UNUSEDBIT_3_15", 0, FieldType.BIT, 15);
|
||||||
|
public static final Field UNUSEDBIT_3_16 = Field.create("UNUSEDBIT_3_16", 0, FieldType.BIT, 16);
|
||||||
|
public static final Field UNUSEDBIT_3_17 = Field.create("UNUSEDBIT_3_17", 0, FieldType.BIT, 17);
|
||||||
|
public static final Field UNUSEDBIT_3_18 = Field.create("UNUSEDBIT_3_18", 0, FieldType.BIT, 18);
|
||||||
|
public static final Field UNUSEDBIT_3_19 = Field.create("UNUSEDBIT_3_19", 0, FieldType.BIT, 19);
|
||||||
|
public static final Field UNUSEDBIT_3_20 = Field.create("UNUSEDBIT_3_20", 0, FieldType.BIT, 20);
|
||||||
|
public static final Field UNUSEDBIT_3_21 = Field.create("UNUSEDBIT_3_21", 0, FieldType.BIT, 21);
|
||||||
|
public static final Field UNUSEDBIT_3_22 = Field.create("UNUSEDBIT_3_22", 0, FieldType.BIT, 22);
|
||||||
|
public static final Field UNUSEDBIT_3_23 = Field.create("UNUSEDBIT_3_23", 0, FieldType.BIT, 23);
|
||||||
|
public static final Field UNUSEDBIT_3_24 = Field.create("UNUSEDBIT_3_24", 0, FieldType.BIT, 24);
|
||||||
|
public static final Field UNUSEDBIT_3_25 = Field.create("UNUSEDBIT_3_25", 0, FieldType.BIT, 25);
|
||||||
|
public static final Field UNUSEDBIT_3_26 = Field.create("UNUSEDBIT_3_26", 0, FieldType.BIT, 26);
|
||||||
|
public static final Field UNUSEDBIT_3_27 = Field.create("UNUSEDBIT_3_27", 0, FieldType.BIT, 27);
|
||||||
|
public static final Field UNUSEDBIT_3_28 = Field.create("UNUSEDBIT_3_28", 0, FieldType.BIT, 28);
|
||||||
|
public static final Field UNUSEDBIT_3_29 = Field.create("UNUSEDBIT_3_29", 0, FieldType.BIT, 29);
|
||||||
|
public static final Field UNUSEDBIT_3_30 = Field.create("UNUSEDBIT_3_30", 0, FieldType.BIT, 30);
|
||||||
|
public static final Field UNUSEDBIT_3_31 = Field.create("UNUSEDBIT_3_31", 0, FieldType.BIT, 31);
|
||||||
|
public static final Field[] VALUES = {
|
||||||
|
ISBENCHTEST,
|
||||||
|
HASIGNITIONVOLTAGE,
|
||||||
|
MAINRELAYSTATE,
|
||||||
|
UNUSEDBIT_3_3,
|
||||||
|
UNUSEDBIT_3_4,
|
||||||
|
UNUSEDBIT_3_5,
|
||||||
|
UNUSEDBIT_3_6,
|
||||||
|
UNUSEDBIT_3_7,
|
||||||
|
UNUSEDBIT_3_8,
|
||||||
|
UNUSEDBIT_3_9,
|
||||||
|
UNUSEDBIT_3_10,
|
||||||
|
UNUSEDBIT_3_11,
|
||||||
|
UNUSEDBIT_3_12,
|
||||||
|
UNUSEDBIT_3_13,
|
||||||
|
UNUSEDBIT_3_14,
|
||||||
|
UNUSEDBIT_3_15,
|
||||||
|
UNUSEDBIT_3_16,
|
||||||
|
UNUSEDBIT_3_17,
|
||||||
|
UNUSEDBIT_3_18,
|
||||||
|
UNUSEDBIT_3_19,
|
||||||
|
UNUSEDBIT_3_20,
|
||||||
|
UNUSEDBIT_3_21,
|
||||||
|
UNUSEDBIT_3_22,
|
||||||
|
UNUSEDBIT_3_23,
|
||||||
|
UNUSEDBIT_3_24,
|
||||||
|
UNUSEDBIT_3_25,
|
||||||
|
UNUSEDBIT_3_26,
|
||||||
|
UNUSEDBIT_3_27,
|
||||||
|
UNUSEDBIT_3_28,
|
||||||
|
UNUSEDBIT_3_29,
|
||||||
|
UNUSEDBIT_3_30,
|
||||||
|
UNUSEDBIT_3_31,
|
||||||
|
};
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import com.rusefi.enums.live_data_e;
|
||||||
public enum LiveDataView {
|
public enum LiveDataView {
|
||||||
AC_CONTROL(live_data_e.LDS_AC_CONTROL, AcControl.VALUES, "ac_control.cpp"),
|
AC_CONTROL(live_data_e.LDS_AC_CONTROL, AcControl.VALUES, "ac_control.cpp"),
|
||||||
FUEL_PUMP(live_data_e.LDS_FUEL_PUMP, FuelPump.VALUES, "fuel_pump.cpp"),
|
FUEL_PUMP(live_data_e.LDS_FUEL_PUMP, FuelPump.VALUES, "fuel_pump.cpp"),
|
||||||
|
MAIN_RELAY(live_data_e.LDS_MAIN_RELAY, MainRelay.VALUES, "main_relay.cpp"),
|
||||||
TPS_ACCEL(live_data_e.LDS_TPS_ACCEL, TpsAccelState.VALUES, "accel_enrichment.cpp"),
|
TPS_ACCEL(live_data_e.LDS_TPS_ACCEL, TpsAccelState.VALUES, "accel_enrichment.cpp"),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -74,3 +74,5 @@
|
||||||
#define EFI_LUA TRUE
|
#define EFI_LUA TRUE
|
||||||
|
|
||||||
#define EFI_HPFP TRUE
|
#define EFI_HPFP TRUE
|
||||||
|
|
||||||
|
#define EFI_MAIN_RELAY_CONTROL TRUE
|
||||||
|
|
|
@ -24,8 +24,6 @@ FsioResult getEngineValue(le_action_e action) {
|
||||||
return engine->fsioState.mockRpm;
|
return engine->fsioState.mockRpm;
|
||||||
case LE_METHOD_CRANKING_RPM:
|
case LE_METHOD_CRANKING_RPM:
|
||||||
return engine->fsioState.mockCrankingRpm;
|
return engine->fsioState.mockCrankingRpm;
|
||||||
case LE_METHOD_TIME_SINCE_BOOT:
|
|
||||||
return engine->fsioState.mockTimeSinceBoot;
|
|
||||||
case LE_METHOD_VBATT:
|
case LE_METHOD_VBATT:
|
||||||
return 12;
|
return 12;
|
||||||
case LE_METHOD_AC_TOGGLE:
|
case LE_METHOD_AC_TOGGLE:
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
#include "main_relay.h"
|
||||||
|
|
||||||
|
TEST(MainRelay, mr) {
|
||||||
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
|
MainRelayController dut;
|
||||||
|
|
||||||
|
// Low battery voltage, MR is off
|
||||||
|
Sensor::setMockValue(SensorType::BatteryVoltage, 1);
|
||||||
|
dut.onSlowCallback();
|
||||||
|
EXPECT_EQ(enginePins.mainRelay.getLogicValue(), false);
|
||||||
|
|
||||||
|
// Ignition is now on, MR is on
|
||||||
|
Sensor::setMockValue(SensorType::BatteryVoltage, 12);
|
||||||
|
dut.onSlowCallback();
|
||||||
|
EXPECT_EQ(enginePins.mainRelay.getLogicValue(), true);
|
||||||
|
}
|
|
@ -46,6 +46,7 @@ TESTS_SRC_CPP = \
|
||||||
tests/test_etb.cpp \
|
tests/test_etb.cpp \
|
||||||
tests/test_dc_motor.cpp \
|
tests/test_dc_motor.cpp \
|
||||||
tests/test_fan_control.cpp \
|
tests/test_fan_control.cpp \
|
||||||
|
tests/test_main_relay.cpp \
|
||||||
tests/test_vvt.cpp \
|
tests/test_vvt.cpp \
|
||||||
tests/test_launch.cpp \
|
tests/test_launch.cpp \
|
||||||
tests/test_fuel_map.cpp \
|
tests/test_fuel_map.cpp \
|
||||||
|
|
Loading…
Reference in New Issue