Skip to content

Commit

Permalink
proper hour hand math
Browse files Browse the repository at this point in the history
  • Loading branch information
zyphlar committed Jan 18, 2024
1 parent 0fc2e61 commit 3968b4e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/displayapp/screens/WatchFaceAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ namespace {
.y = CoordinateYRelocate(radius * static_cast<int32_t>(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<int32_t>(Sine(angle)) / LV_TRIG_SCALE),
.y = CoordinateYRelocate(radius * static_cast<int32_t>(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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3968b4e

Please sign in to comment.