learning C++
This commit is contained in:
parent
f71ac2d11d
commit
86a0d67d70
|
@ -39,7 +39,7 @@ public:
|
||||||
int fakeAdcValues[MOCK_ADC_SIZE];
|
int fakeAdcValues[MOCK_ADC_SIZE];
|
||||||
|
|
||||||
void setMockVoltage(int hwChannel, float voltage);
|
void setMockVoltage(int hwChannel, float voltage);
|
||||||
int getMockAdcValue(int hwChannel);
|
int getMockAdcValue(int hwChannel) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT
|
#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT
|
||||||
|
@ -67,8 +67,7 @@ class ThermistorMath {
|
||||||
public:
|
public:
|
||||||
void setConfig(thermistor_conf_s *config);
|
void setConfig(thermistor_conf_s *config);
|
||||||
void prepareThermistorCurve(thermistor_conf_s *tc);
|
void prepareThermistorCurve(thermistor_conf_s *tc);
|
||||||
bool isLinearSensor();
|
float getKelvinTemperatureByResistance(float resistance) const;
|
||||||
float getKelvinTemperatureByResistance(float resistance);
|
|
||||||
float s_h_a = 0;
|
float s_h_a = 0;
|
||||||
float s_h_b = 0;
|
float s_h_b = 0;
|
||||||
float s_h_c = 0;
|
float s_h_c = 0;
|
||||||
|
@ -137,7 +136,7 @@ class WarningCodeState {
|
||||||
public:
|
public:
|
||||||
WarningCodeState();
|
WarningCodeState();
|
||||||
void addWarningCode(obd_code_e code);
|
void addWarningCode(obd_code_e code);
|
||||||
bool isWarningNow(efitimesec_t now, bool forIndicator DECLARE_ENGINE_PARAMETER_SUFFIX);
|
bool isWarningNow(efitimesec_t now, bool forIndicator DECLARE_ENGINE_PARAMETER_SUFFIX) const;
|
||||||
void clear();
|
void clear();
|
||||||
int warningCounter;
|
int warningCounter;
|
||||||
int lastErrorCode;
|
int lastErrorCode;
|
||||||
|
|
|
@ -58,7 +58,7 @@ void WarningCodeState::addWarningCode(obd_code_e code) {
|
||||||
/**
|
/**
|
||||||
* @param forIndicator if we want to retrieving value for TS indicator, this case a minimal period is applued
|
* @param forIndicator if we want to retrieving value for TS indicator, this case a minimal period is applued
|
||||||
*/
|
*/
|
||||||
bool WarningCodeState::isWarningNow(efitimesec_t now, bool forIndicator DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
bool WarningCodeState::isWarningNow(efitimesec_t now, bool forIndicator DECLARE_ENGINE_PARAMETER_SUFFIX) const {
|
||||||
int period = forIndicator ? maxI(3, engineConfiguration->warningPeriod) : engineConfiguration->warningPeriod;
|
int period = forIndicator ? maxI(3, engineConfiguration->warningPeriod) : engineConfiguration->warningPeriod;
|
||||||
return absI(now - timeOfPreviousWarning) < period;
|
return absI(now - timeOfPreviousWarning) < period;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ SensorsState::SensorsState() {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MockAdcState::getMockAdcValue(int hwChannel) {
|
int MockAdcState::getMockAdcValue(int hwChannel) const {
|
||||||
return fakeAdcValues[hwChannel];
|
return fakeAdcValues[hwChannel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ float getVoutInVoltageDividor(float Vin, float r1, float r2) {
|
||||||
return r2 * Vin / (r1 + r2);
|
return r2 * Vin / (r1 + r2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ThermistorMath::getKelvinTemperatureByResistance(float resistance) {
|
float ThermistorMath::getKelvinTemperatureByResistance(float resistance) const {
|
||||||
if (resistance <= 0) {
|
if (resistance <= 0) {
|
||||||
//warning("Invalid resistance in getKelvinTemperature=", resistance);
|
//warning("Invalid resistance in getKelvinTemperature=", resistance);
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
|
@ -120,7 +120,7 @@ efitime_t TriggerState::getTotalEventCounter() {
|
||||||
return totalEventCountBase + currentCycle.current_index;
|
return totalEventCountBase + currentCycle.current_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TriggerState::getTotalRevolutionCounter() {
|
int TriggerState::getTotalRevolutionCounter() const {
|
||||||
return totalRevolutionCounter;
|
return totalRevolutionCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ void TriggerState::reset() {
|
||||||
isFirstEvent = true;
|
isFirstEvent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TriggerState::getCurrentIndex() {
|
int TriggerState::getCurrentIndex() const {
|
||||||
return currentCycle.current_index;
|
return currentCycle.current_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ void TriggerState::incrementTotalEventCounter() {
|
||||||
totalRevolutionCounter++;
|
totalRevolutionCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TriggerState::isEvenRevolution() {
|
bool TriggerState::isEvenRevolution() const {
|
||||||
return totalRevolutionCounter & 1;
|
return totalRevolutionCounter & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* current trigger processing index, between zero and #size
|
* current trigger processing index, between zero and #size
|
||||||
*/
|
*/
|
||||||
int getCurrentIndex();
|
int getCurrentIndex() const;
|
||||||
int getTotalRevolutionCounter();
|
int getTotalRevolutionCounter() const;
|
||||||
/**
|
/**
|
||||||
* this is important for crank-based virtual trigger and VVT magic
|
* this is important for crank-based virtual trigger and VVT magic
|
||||||
*/
|
*/
|
||||||
bool isEvenRevolution();
|
bool isEvenRevolution() const;
|
||||||
void incrementTotalEventCounter();
|
void incrementTotalEventCounter();
|
||||||
efitime_t getTotalEventCounter();
|
efitime_t getTotalEventCounter();
|
||||||
efitime_t getStartOfRevolutionIndex();
|
efitime_t getStartOfRevolutionIndex();
|
||||||
|
|
Loading…
Reference in New Issue