Skip to content

Commit c1b9967

Browse files
committed
Analog face constexpr fix
1 parent b3f4831 commit c1b9967

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/displayapp/screens/WatchFaceAnalog.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "displayapp/screens/WatchFaceAnalog.h"
22
#include <cmath>
3+
#include <limits>
34
#include <lvgl/lvgl.h>
45
#include "displayapp/screens/BatteryIcon.h"
56
#include "displayapp/screens/BleIcon.h"
@@ -15,8 +16,10 @@ namespace {
1516
constexpr int16_t MinuteLength = 90;
1617
constexpr int16_t SecondLength = 110;
1718

19+
// LVGL sin isn't constexpr (though it could be if it were C++) so fix size here
20+
// All the types are hardcoded anyway and would need changing if the size changed
1821
// sin(90) = 1 so the value of _lv_trigo_sin(90) is the scaling factor
19-
const auto LV_TRIG_SCALE = _lv_trigo_sin(90);
22+
constexpr int16_t LV_TRIG_SCALE = std::numeric_limits<int16_t>::max(); // = _lv_trigo_sin(90)
2023

2124
int16_t Cosine(int16_t angle) {
2225
return _lv_trigo_sin(angle + 90);

0 commit comments

Comments
 (0)