rusefi/firmware/controllers/algo/launch_control.h

59 lines
1.2 KiB
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
2023-08-30 20:11:24 -07:00
#include <rusefi/timer.h>
#include "launch_control_state_generated.h"
2020-03-23 17:44:34 -07:00
void initLaunchControl();
2021-11-15 11:40:35 -08:00
2024-03-09 05:39:58 -08:00
enum class LaunchCondition {
Launch,
NotMet
};
class LaunchControlBase : public launch_control_state_s {
public:
LaunchControlBase();
// Update the state of the launch control system
void update();
float getFuelCoefficient() const;
bool isInsideSpeedCondition() const;
bool isInsideTpsCondition() const;
2021-11-15 17:09:03 -08:00
bool isInsideSwitchCondition();
2024-03-09 05:39:58 -08:00
LaunchCondition isInsideRPMCondition(int rpm) const;
LaunchCondition isLaunchConditionMet(int rpm);
2021-11-15 16:54:34 -08:00
bool isLaunchSparkRpmRetardCondition() const;
bool isLaunchFuelRpmRetardCondition() const;
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
2021-11-17 20:34:49 -08:00
/**
* See also SoftLimiterSandbox.java
*/
2021-11-16 10:15:12 -08:00
class SoftSparkLimiter {
public:
2023-05-25 09:41:11 -07:00
SoftSparkLimiter(bool allowHardCut);
2021-11-16 10:15:12 -08:00
/**
* targetSkipRatio of '0' means 'do not skip', would always return false
*/
void setTargetSkipRatio(float targetSkipRatio);
bool shouldSkip();
private:
2023-05-25 09:41:11 -07:00
bool allowHardCut;
2021-11-16 10:15:12 -08:00
bool wasJustSkipped = false;
float targetSkipRatio = 0;
};