summaryrefslogtreecommitdiffstats
path: root/stm32/app/hands.c
diff options
context:
space:
mode:
authorroot <root@lumpy.lan>2021-11-27 19:32:49 +0000
committerroot <root@lumpy.lan>2021-11-27 19:32:49 +0000
commitc04969c3a5eff3f73840856f207f204414653da3 (patch)
treed40cd5ce4a28902297bf7349d732f68b2751e4ce /stm32/app/hands.c
parentf75d0b7eabe275a4330eb72dc4a4c5d2af1fb13d (diff)
downloadmetric_clock-c04969c3a5eff3f73840856f207f204414653da3.tar.gz
metric_clock-c04969c3a5eff3f73840856f207f204414653da3.tar.bz2
metric_clock-c04969c3a5eff3f73840856f207f204414653da3.zip
laptop-to-desktop
Diffstat (limited to 'stm32/app/hands.c')
-rw-r--r--stm32/app/hands.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/stm32/app/hands.c b/stm32/app/hands.c
index 7ac8bb9..8261b1b 100644
--- a/stm32/app/hands.c
+++ b/stm32/app/hands.c
@@ -9,7 +9,7 @@ static unsigned calc_second_pos (MTIME *m)
{
uint64_t p;
- p += m->second;
+ p = m->second;
p *= 1000;
p += m->nanosecond / 1000000;
@@ -89,7 +89,13 @@ void hands_tick (void)
hands_pos[0] = calc_hour_pos (&m);
+
+if ((e.s & 31) <5) {
+ hands_pos[1] =hands_pos[0];
+} else {
hands_pos[1] = calc_minute_pos (&m);
+}
+
//hands_pos[1] = calc_second_pos (&m);
hands_ready = 1;
@@ -101,6 +107,7 @@ void hands_tick (void)
}
if (p) {
+ printf("Epoch %d.%09d\r\n",(unsigned) e.s,(unsigned) e.ns);
time_print_utc ("UTC: ", &u, NULL);
time_print_metric ("Metric: ", &m, NULL);
printf ("Hands: hour %4d/%4d min %4d/%4d\r\n", hands_pos[0], MOTOR_STEPS, hands_pos[1], MOTOR_STEPS);