diff options
Diffstat (limited to 'stm32/app/hands.c')
-rw-r--r-- | stm32/app/hands.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/stm32/app/hands.c b/stm32/app/hands.c index 5414d9e..7ac8bb9 100644 --- a/stm32/app/hands.c +++ b/stm32/app/hands.c @@ -5,6 +5,24 @@ unsigned hands_pos[HANDS]; unsigned hands_ready; +static unsigned calc_second_pos (MTIME *m) +{ + uint64_t p; + + p += m->second; + p *= 1000; + p += m->nanosecond / 1000000; + + p *= MOTOR_STEPS; + p /= 100000; + + + + return (unsigned) p; + +} + + static unsigned calc_minute_pos (MTIME *m) { uint64_t p; @@ -58,7 +76,7 @@ void hands_tick (void) static uint32_t last; - if ((ticks - last) < 100) return; + if ((ticks - last) < 10) return; last = ticks; @@ -72,6 +90,7 @@ void hands_tick (void) hands_pos[0] = calc_hour_pos (&m); hands_pos[1] = calc_minute_pos (&m); + //hands_pos[1] = calc_second_pos (&m); hands_ready = 1; for (i = 0, p = 0; i < HANDS; ++i) { |