rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions
FanController Struct Referenceabstract

#include <fan_control.h>

Inheritance diagram for FanController:
Inheritance graph
[legend]
Collaboration diagram for FanController:
Collaboration graph
[legend]

Public Member Functions

void onSlowCallback () override
 
void setDefaultConfiguration () override
 
- Public Member Functions inherited from EngineModule
virtual void initNoConfiguration ()
 
virtual void onConfigurationChange (engine_configuration_s const *)
 
virtual void onFastCallback ()
 
virtual void onEngineStop ()
 
virtual void onIgnitionStateChanged (bool)
 
virtual bool needsDelayedShutoff ()
 
virtual void onEnginePhase (float, efitick_t, angle_t, angle_t)
 

Protected Member Functions

virtual OutputPingetPin ()=0
 
virtual float getFanOnTemp ()=0
 
virtual float getFanOffTemp ()=0
 
virtual bool enableWithAc ()=0
 
virtual bool disableWhenStopped ()=0
 
virtual int disableAtSpeed ()=0
 

Private Member Functions

bool getState (bool acActive, bool lastState)
 

Additional Inherited Members

- Data Fields inherited from fan_control_s
bool cranking: 1 {}
 
bool notRunning: 1 {}
 
bool disabledWhileEngineStopped: 1 {}
 
bool brokenClt: 1 {}
 
bool enabledForAc: 1 {}
 
bool hot: 1 {}
 
bool cold: 1 {}
 
bool disabledBySpeed: 1 {}
 
bool m_state: 1 {}
 
bool unusedBit_9_9: 1 {}
 
bool unusedBit_9_10: 1 {}
 
bool unusedBit_9_11: 1 {}
 
bool unusedBit_9_12: 1 {}
 
bool unusedBit_9_13: 1 {}
 
bool unusedBit_9_14: 1 {}
 
bool unusedBit_9_15: 1 {}
 
bool unusedBit_9_16: 1 {}
 
bool unusedBit_9_17: 1 {}
 
bool unusedBit_9_18: 1 {}
 
bool unusedBit_9_19: 1 {}
 
bool unusedBit_9_20: 1 {}
 
bool unusedBit_9_21: 1 {}
 
bool unusedBit_9_22: 1 {}
 
bool unusedBit_9_23: 1 {}
 
bool unusedBit_9_24: 1 {}
 
bool unusedBit_9_25: 1 {}
 
bool unusedBit_9_26: 1 {}
 
bool unusedBit_9_27: 1 {}
 
bool unusedBit_9_28: 1 {}
 
bool unusedBit_9_29: 1 {}
 
bool unusedBit_9_30: 1 {}
 
bool unusedBit_9_31: 1 {}
 
uint8_t radiatorFanStatus = (uint8_t)0
 
uint8_t alignmentFill_at_5 [3] = {}
 

Detailed Description

Definition at line 20 of file fan_control.h.

Member Function Documentation

◆ disableAtSpeed()

virtual int FanController::disableAtSpeed ( )
protectedpure virtual

Implemented in FanControl1, and FanControl2.

Referenced by getState().

Here is the caller graph for this function:

◆ disableWhenStopped()

virtual bool FanController::disableWhenStopped ( )
protectedpure virtual

Implemented in FanControl1, and FanControl2.

Referenced by getState().

Here is the caller graph for this function:

◆ enableWithAc()

virtual bool FanController::enableWithAc ( )
protectedpure virtual

Implemented in FanControl1, and FanControl2.

Referenced by getState().

Here is the caller graph for this function:

◆ getFanOffTemp()

virtual float FanController::getFanOffTemp ( )
protectedpure virtual

Implemented in FanControl1, and FanControl2.

Referenced by getState().

Here is the caller graph for this function:

◆ getFanOnTemp()

virtual float FanController::getFanOnTemp ( )
protectedpure virtual

Implemented in FanControl1, and FanControl2.

Referenced by getState().

Here is the caller graph for this function:

◆ getPin()

virtual OutputPin & FanController::getPin ( )
protectedpure virtual

Implemented in FanControl1, and FanControl2.

Referenced by onSlowCallback().

Here is the caller graph for this function:

◆ getState()

bool FanController::getState ( bool  acActive,
bool  lastState 
)
private

Definition at line 15 of file fan_control.cpp.

15 {
18
19#if EFI_SHAFT_POSITION_INPUT
22#else
23 cranking = false;
24 notRunning = true;
25#endif
26
27 disabledBySpeed = disableAtSpeed() > 0 && vss.Valid && vss.Value > disableAtSpeed();
29 brokenClt = !clt;
30 enabledForAc = enableWithAc() && acActive;
31 hot = clt.value_or(0) > getFanOnTemp();
32 cold = clt.value_or(0) < getFanOffTemp();
33
36 return true;
37 } else if (cranking) {
38 // Inhibit while cranking
40 return false;
41 } else if (disabledWhileEngineStopped) {
42 // Inhibit while not running (if so configured)
44 return false;
45 } else if (disabledBySpeed) {
46 // Inhibit while driving fast
48 return false;
49 } else if (fansDisabledByBoardStatus()) {
51 return false;
52 } else if (brokenClt) {
53 // If CLT is broken, turn the fan on
55 return true;
56 } else if (enabledForAc) {
58 return true;
59 } else if (hot) {
61 return true;
62 } else if (cold) {
64 return false;
65 } else {
67 // no condition met, maintain previous state
68 return lastState;
69 }
70}
RpmCalculator rpmCalculator
Definition engine.h:306
bool isRunning() const
bool isCranking() const override
virtual SensorResult get() const =0
static EngineAccessor engine
Definition engine.h:413
PUBLIC_API_WEAK bool fansEnabledByBoardStatus()
bool fansDisabledByBoardStatus()
static CCM_OPTIONAL FunctionalSensor clt(SensorType::Clt, MS2NT(10))
virtual bool enableWithAc()=0
virtual bool disableWhenStopped()=0
virtual float getFanOffTemp()=0
virtual float getFanOnTemp()=0
virtual int disableAtSpeed()=0

Referenced by onSlowCallback().

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

◆ onSlowCallback()

void FanController::onSlowCallback ( )
overridevirtual

Reimplemented from EngineModule.

Definition at line 72 of file fan_control.cpp.

72 {
73#if EFI_PROD_CODE
74 if (isRunningBenchTest()) {
76 return; // let's not mess with bench testing
77 }
78#endif
79
80 bool acActive = engine->module<AcController>()->isAcEnabled();
81
82 auto& pin = getPin();
83
84 bool result = getState(acActive, pin.getLogicValue());
85
86 m_state = result;
87
88 pin.setValue(result);
89}
bool isRunningBenchTest()
constexpr auto & module()
Definition engine.h:200
brain_pin_e pin
Definition stm32_adc.cpp:15
virtual OutputPin & getPin()=0
bool getState(bool acActive, bool lastState)
Here is the call graph for this function:

◆ setDefaultConfiguration()

void FanController::setDefaultConfiguration ( )
overridevirtual

The documentation for this struct was generated from the following files: