diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index a9171af748..08d6e84f0e 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -39,7 +39,7 @@ public: int fakeAdcValues[MOCK_ADC_SIZE]; void setMockVoltage(int hwChannel, float voltage); - int getMockAdcValue(int hwChannel); + int getMockAdcValue(int hwChannel) const; }; #define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT @@ -67,8 +67,7 @@ class ThermistorMath { public: void setConfig(thermistor_conf_s *config); void prepareThermistorCurve(thermistor_conf_s *tc); - bool isLinearSensor(); - float getKelvinTemperatureByResistance(float resistance); + float getKelvinTemperatureByResistance(float resistance) const; float s_h_a = 0; float s_h_b = 0; float s_h_c = 0; @@ -137,7 +136,7 @@ class WarningCodeState { public: WarningCodeState(); 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(); int warningCounter; int lastErrorCode; diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp index d01182afc0..13957b173f 100644 --- a/firmware/controllers/algo/engine2.cpp +++ b/firmware/controllers/algo/engine2.cpp @@ -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 */ -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; return absI(now - timeOfPreviousWarning) < period; } @@ -229,7 +229,7 @@ SensorsState::SensorsState() { reset(); } -int MockAdcState::getMockAdcValue(int hwChannel) { +int MockAdcState::getMockAdcValue(int hwChannel) const { return fakeAdcValues[hwChannel]; } diff --git a/firmware/controllers/sensors/thermistors.cpp b/firmware/controllers/sensors/thermistors.cpp index efe925cdda..b6aaccd796 100644 --- a/firmware/controllers/sensors/thermistors.cpp +++ b/firmware/controllers/sensors/thermistors.cpp @@ -47,7 +47,7 @@ float getVoutInVoltageDividor(float Vin, float r1, float r2) { return r2 * Vin / (r1 + r2); } -float ThermistorMath::getKelvinTemperatureByResistance(float resistance) { +float ThermistorMath::getKelvinTemperatureByResistance(float resistance) const { if (resistance <= 0) { //warning("Invalid resistance in getKelvinTemperature=", resistance); return 0.0f; diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 1d48f6e840..ea0e74ed87 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -120,7 +120,7 @@ efitime_t TriggerState::getTotalEventCounter() { return totalEventCountBase + currentCycle.current_index; } -int TriggerState::getTotalRevolutionCounter() { +int TriggerState::getTotalRevolutionCounter() const { return totalRevolutionCounter; } @@ -263,7 +263,7 @@ void TriggerState::reset() { isFirstEvent = true; } -int TriggerState::getCurrentIndex() { +int TriggerState::getCurrentIndex() const { return currentCycle.current_index; } @@ -271,7 +271,7 @@ void TriggerState::incrementTotalEventCounter() { totalRevolutionCounter++; } -bool TriggerState::isEvenRevolution() { +bool TriggerState::isEvenRevolution() const { return totalRevolutionCounter & 1; } diff --git a/firmware/controllers/trigger/trigger_decoder.h b/firmware/controllers/trigger/trigger_decoder.h index 34db4c155e..c0a458ef49 100644 --- a/firmware/controllers/trigger/trigger_decoder.h +++ b/firmware/controllers/trigger/trigger_decoder.h @@ -50,12 +50,12 @@ public: /** * current trigger processing index, between zero and #size */ - int getCurrentIndex(); - int getTotalRevolutionCounter(); + int getCurrentIndex() const; + int getTotalRevolutionCounter() const; /** * this is important for crank-based virtual trigger and VVT magic */ - bool isEvenRevolution(); + bool isEvenRevolution() const; void incrementTotalEventCounter(); efitime_t getTotalEventCounter(); efitime_t getStartOfRevolutionIndex();