diff options
| author | mark9064 <30447455+mark9064@users.noreply.github.com> | 2024-10-17 23:13:38 +0100 |
|---|---|---|
| committer | mark9064 <30447455+mark9064@users.noreply.github.com> | 2025-06-28 18:30:54 +0100 |
| commit | c1b9967d92269d9ad70a3d639f5bf915e83f4813 (patch) | |
| tree | d738cc7adc22363fab3acd866cb778ed6a3246c0 | |
| parent | b3f4831e54d3e8ddbda5d799ea66adec66e93978 (diff) | |
Analog face constexpr fix
| -rw-r--r-- | src/displayapp/screens/WatchFaceAnalog.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 80a1c8b9..3a7a00fa 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -1,5 +1,6 @@ #include "displayapp/screens/WatchFaceAnalog.h" #include <cmath> +#include <limits> #include <lvgl/lvgl.h> #include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BleIcon.h" @@ -15,8 +16,10 @@ namespace { constexpr int16_t MinuteLength = 90; constexpr int16_t SecondLength = 110; + // LVGL sin isn't constexpr (though it could be if it were C++) so fix size here + // All the types are hardcoded anyway and would need changing if the size changed // sin(90) = 1 so the value of _lv_trigo_sin(90) is the scaling factor - const auto LV_TRIG_SCALE = _lv_trigo_sin(90); + constexpr int16_t LV_TRIG_SCALE = std::numeric_limits<int16_t>::max(); // = _lv_trigo_sin(90) int16_t Cosine(int16_t angle) { return _lv_trigo_sin(angle + 90); |
