rusefi-1/firmware/controllers/algo/launch_control.h

51 lines
981 B
C
Raw Normal View History

2020-03-23 17:44:34 -07:00
/*
* @file launch_control.h
*
* @date Mar 23, 2020
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
2020-11-30 16:35:06 -08:00
#include "timer.h"
2020-03-23 17:44:34 -07:00
void initLaunchControl();
2021-11-15 11:40:35 -08:00
class LaunchControlBase {
public:
// Update the state of the launch control system
void update();
bool isInsideSpeedCondition() const;
bool isInsideTpsCondition() const;
2021-11-15 17:09:03 -08:00
bool isInsideSwitchCondition();
bool isInsideRPMCondition(int rpm) const;
2021-11-15 17:09:03 -08:00
bool isLaunchConditionMet(int rpm);
2021-11-15 16:54:34 -08:00
bool isLaunchSparkRpmRetardCondition() const;
bool isLaunchFuelRpmRetardCondition() const;
2021-11-15 11:40:35 -08:00
int retardThresholdRpm;
2021-11-15 17:09:03 -08:00
bool launchActivatePinState = false;
bool isLaunchCondition = false;
private:
2021-11-15 16:54:34 -08:00
bool isLaunchRpmRetardCondition() const;
2020-11-30 16:35:06 -08:00
Timer m_launchTimer;
};
2021-11-16 10:15:12 -08:00
class SoftSparkLimiter {
public:
/**
* targetSkipRatio of '0' means 'do not skip', would always return false
*/
void setTargetSkipRatio(float targetSkipRatio);
bool shouldSkip();
private:
bool wasJustSkipped = false;
float targetSkipRatio = 0;
};