From c1b9967d92269d9ad70a3d639f5bf915e83f4813 Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Thu, 17 Oct 2024 23:13:38 +0100 Subject: [PATCH] Analog face constexpr fix --- src/displayapp/screens/WatchFaceAnalog.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 +#include #include #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::max(); // = _lv_trigo_sin(90) int16_t Cosine(int16_t angle) { return _lv_trigo_sin(angle + 90);