From: Lukáš Jiřiště Date: Tue, 10 Dec 2024 15:33:43 +0000 (+0100) Subject: Make compile-time consts into constexpr X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=bbbdcd32b334ae649911207e496c96c17803cf28;p=Servomatic.git Make compile-time consts into constexpr I thought I did this in every file, but I forgot to do it in the PressureSensor.h one. This is now rectified. --- diff --git a/PressureSensor.h b/PressureSensor.h index ea72baa..21fa83b 100644 --- a/PressureSensor.h +++ b/PressureSensor.h @@ -10,10 +10,10 @@ class PressureSensor const float m_resistance; // in Ohms const float m_max_pressure; - static const float MIN_CURRENT = 4e-3; // in A - static const float MAX_CURRENT = 20e-3; // in A - static const float REFERENCE_VOLTAGE = 5; // in V - static const int CONVERSION_BIT_NUM = 10; + static constexpr float MIN_CURRENT = 4e-3; // in A + static constexpr float MAX_CURRENT = 20e-3; // in A + static constexpr float REFERENCE_VOLTAGE = 5; // in V + static constexpr int CONVERSION_BIT_NUM = 10; float signal_to_pressure(int ad_signal) const;