From 8aea068532fa4313c6fc234ac830be3640b93704 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 13 Jan 2019 23:25:15 -0500 Subject: [PATCH] enjoying C++11 --- firmware/controllers/algo/engine.h | 9 ++++----- firmware/controllers/sensors/thermistors.cpp | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 62896843e1..ad9a43406f 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -65,16 +65,15 @@ private: class ThermistorMath { public: - ThermistorMath(); void setConfig(thermistor_conf_s *config); void prepareThermistorCurve(thermistor_conf_s *tc); bool isLinearSensor(); float getKelvinTemperatureByResistance(float resistance); - float s_h_a; - float s_h_b; - float s_h_c; + float s_h_a = 0; + float s_h_b = 0; + float s_h_c = 0; private: - thermistor_conf_s currentConfig; + thermistor_conf_s currentConfig = {}; }; class Accelerometer { diff --git a/firmware/controllers/sensors/thermistors.cpp b/firmware/controllers/sensors/thermistors.cpp index b8d865abb3..efe925cdda 100644 --- a/firmware/controllers/sensors/thermistors.cpp +++ b/firmware/controllers/sensors/thermistors.cpp @@ -249,11 +249,6 @@ void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { #endif } -ThermistorMath::ThermistorMath() { - memset(¤tConfig, 0, sizeof(currentConfig)); - s_h_a = s_h_b = s_h_c = 0; -} - void ThermistorMath::setConfig(thermistor_conf_s *config) { bool isSameConfig = memcmp(config, ¤tConfig, sizeof(currentConfig)) == 0; if (isSameConfig) {