Rev 30 | Rev 47 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 30 | Rev 46 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | 16 | ||
17 | /* percent is integer from 0 to 100 */ |
17 | /* percent is integer from 0 to 100 */ |
18 | void |
18 | void |
19 | dial_draw_needle (uint16_t percent) |
19 | dial_draw_needle (uint16_t percent) |
20 | { |
20 | { |
21 | int ang = ((percent - 50) * a1) / 50; |
21 | int ang = SINE_SCALING * ((percent - 50) * a1) / 50; |
22 | 22 | ||
23 | int si = ap_sin (ang); |
23 | int si = ap_sin (ang); |
24 | int co = ap_cos (ang); |
24 | int co = ap_cos (ang); |
25 | 25 | ||
26 | /* calculate a shift for a second side of the needle */ |
26 | /* calculate a shift for a second side of the needle */ |
27 | int xl = ap_sin (ang - 90); |
27 | int xl = ap_sin (ang - SINE_STEPS); |
28 | int yl = ap_cos (ang - 90); |
28 | int yl = ap_cos (ang - SINE_STEPS); |
29 | 29 | ||
30 | int si2 = siz + 2; |
30 | int si2 = siz + 2; |
31 | int si3 = 2 * siz / 3; |
31 | int si3 = 2 * siz / 3; |
32 | 32 | ||
33 | int xs,ys; |
33 | int xs,ys; |
Line 62... | Line 62... | ||
62 | int step = 256 * a1 * 2 / (4 * (sc_high - sc_low)); |
62 | int step = 256 * a1 * 2 / (4 * (sc_high - sc_low)); |
63 | int t; |
63 | int t; |
64 | ang = -a1 * 256; |
64 | ang = -a1 * 256; |
65 | for (t = sc_low * 4; t <= sc_high * 4; t++) |
65 | for (t = sc_low * 4; t <= sc_high * 4; t++) |
66 | { |
66 | { |
67 | int si = ap_sin (ang / 256); |
67 | int si = ap_sin ((ang*SINE_SCALING) / 256); |
68 | int co = ap_cos (ang / 256); |
68 | int co = ap_cos ((ang*SINE_SCALING) / 256); |
69 | 69 | ||
70 | int len; |
70 | int len; |
71 | switch (t % 4) |
71 | switch (t % 4) |
72 | { |
72 | { |
73 | case 0: |
73 | case 0: |