From 3968b4eb4f5882e511872364b07c4cdabaf23212 Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 17 Jan 2024 23:41:18 -0800 Subject: [PATCH] proper hour hand math --- src/displayapp/screens/WatchFaceAnalog.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index a5922771..df9c996a 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -44,11 +44,6 @@ namespace { .y = CoordinateYRelocate(radius * static_cast(Cosine(angle)) / LV_TRIG_SCALE)}; } - lv_point_t CoordinateRelocateTriangle(int16_t radius, int16_t angle, int16_t base_offset) { - return lv_point_t {.x = CoordinateXRelocate((radius + base_offset) * static_cast(Sine(angle)) / LV_TRIG_SCALE), - .y = CoordinateYRelocate(radius * static_cast(Cosine(angle)) / LV_TRIG_SCALE)}; - } - void printKoku(const char* str, uint8_t i, bool big){ lv_obj_t* koku = lv_label_create(lv_scr_act(), NULL); lv_label_set_align(koku, LV_LABEL_ALIGN_CENTER); @@ -307,11 +302,11 @@ void WatchFaceAnalog::drawWatchFaceWadokei(){ sHour = hour; sMinute = minute; - hour_point_trace[0] = CoordinateRelocateTriangle(HourLength/4, hourAngle+90, -25); - hour_point_trace[1] = CoordinateRelocateTriangle(HourLength, hourAngle+90, 0); + hour_point_trace[0] = CoordinateRelocate(HourLength*.7, hourAngle+90-33); + hour_point_trace[1] = CoordinateRelocate(HourLength, hourAngle+90); - hour_point[0] = CoordinateRelocateTriangle(HourLength/4, hourAngle+90, 25); - hour_point[1] = CoordinateRelocateTriangle(HourLength, hourAngle+90, 0); + hour_point[0] = CoordinateRelocate(HourLength*.7, hourAngle+90+33); + hour_point[1] = CoordinateRelocate(HourLength, hourAngle+90); lv_line_set_points(hour_body, hour_point, 2); lv_line_set_points(hour_body_trace, hour_point_trace, 2);