rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
start_stop.cpp File Reference

Functions

void initStartStopButton ()
 
void doStartCranking ()
 
void startStopButtonToggle ()
 
static void disengageStarterIfNeeded ()
 
PUBLIC_API_WEAK bool isCrankingSuppressed ()
 
void slowStartStopButtonCallback ()
 

Function Documentation

◆ disengageStarterIfNeeded()

static void disengageStarterIfNeeded ( )
static

Definition at line 39 of file start_stop.cpp.

39 {
41 // turn starter off once engine is now running!
42 bool wasStarterEngaged = enginePins.starterControl.getAndSet(0);
43 if (wasStarterEngaged) {
44 efiPrintf("Engine runs we can disengage the starter");
45 }
46 } else {
48 bool wasStarterEngaged = enginePins.starterControl.getAndSet(0);
49 if (wasStarterEngaged) {
50 efiPrintf("Cranking timeout %d seconds", engineConfiguration->startCrankingDuration);
51 }
52 }
53 }
54}
RpmCalculator rpmCalculator
Definition engine.h:306
StartStopState startStopState
Definition engine.h:106
RegisteredOutputPin starterControl
Definition efi_gpio.h:82
bool getAndSet(int logicValue)
Definition efi_gpio.cpp:575
bool isRunning() const
EnginePins enginePins
Definition efi_gpio.cpp:24
static EngineAccessor engine
Definition engine.h:413
static constexpr engine_configuration_s * engineConfiguration
Timer startStopStateLastPush
Definition start_stop.h:8

Referenced by slowStartStopButtonCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doStartCranking()

void doStartCranking ( )

Definition at line 19 of file start_stop.cpp.

19 {
20 bool wasStarterEngaged = enginePins.starterControl.getAndSet(1);
21 if (!wasStarterEngaged) {
23 efiPrintf("Let's crank this engine for up to %d seconds via %s!",
26 }
27}
const char * hwPortname(brain_pin_e brainPin)

Referenced by configureRusefiLuaHooks(), and startStopButtonToggle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initStartStopButton()

void initStartStopButton ( )

See test_start_stop.cpp

Definition at line 11 of file start_stop.cpp.

11 {
12 /* startCrankingDuration is efitimesec_t, so we need to multiply it by 1000 to get milliseconds*/
17}
void init(efitimems_t threshold, brain_pin_e &pin, pin_input_mode_e &mode, bool inverted=false)
Definition debounce.cpp:23
ButtonDebounce startStopButtonDebounce
Definition start_stop.h:6

Referenced by startHardware().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCrankingSuppressed()

PUBLIC_API_WEAK bool isCrankingSuppressed ( )

Definition at line 56 of file start_stop.cpp.

56 {
57 return false;
58}

Referenced by slowStartStopButtonCallback().

Here is the caller graph for this function:

◆ slowStartStopButtonCallback()

void slowStartStopButtonCallback ( )

Definition at line 60 of file start_stop.cpp.

60 {
61 if (!isIgnVoltage()) {
62 // nothing to crank if we are powered only via USB
64 return;
65 } else if (engine->startStopState.isFirstTime) {
66 // initialize when first time with proper power
69 }
70
72 // where are odd cases of start button combined with ECU power source button we do not want to crank right on start
73 return;
74 }
75
78 return;
79 }
81 return;
82 }
83
85 return;
86 }
87 }
88
90
92 // we are here on transition from 0 to 1
94 }
95 // todo: we shall extract start_stop.txt from engine_state.txt
98
99 bool isStarterEngaged = enginePins.starterControl.getLogicValue();
100
101 if (isStarterEngaged) {
103 }
104}
bool readPinEvent()
bool getPhysicalState()
EngineState engineState
Definition engine.h:344
SwitchedState brakePedalSwitchedState
Definition engine.h:215
SwitchedState clutchUpSwitchedState
Definition engine.h:214
bool getLogicValue() const
Definition efi_gpio.cpp:667
bool isStopped() const override
bool isIgnVoltage()
startStopState("startStopState", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1372, 1.0, -1.0, -1.0, "")
PUBLIC_API_WEAK bool isCrankingSuppressed()
static void disengageStarterIfNeeded()
void startStopButtonToggle()
Timer timeSinceIgnitionPower
Definition start_stop.h:7

Referenced by doPeriodicSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startStopButtonToggle()

void startStopButtonToggle ( )

Definition at line 29 of file start_stop.cpp.

29 {
31
34 } else if (engine->rpmCalculator.isRunning()) {
36 }
37}
void doScheduleStopEngine(StopRequestedReason reason)
void doStartCranking()

Referenced by handleCommandX14(), and slowStartStopButtonCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.