Rev 5 | Rev 8 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5 | Rev 6 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | 26 | ||
27 | int x = 500; |
27 | int x = 500; |
28 | int y = 20; |
28 | int y = 20; |
29 | int ph = 0; |
29 | int ph = 0; |
30 | 30 | ||
31 | - | ||
32 | } |
31 | } |
33 | 32 | ||
34 | uint8_t displayBuffer[2][dataSize(WIDTH, HEIGHT)]; |
33 | uint8_t displayBuffer[2][dataSize(WIDTH, HEIGHT)]; |
35 | 34 | ||
36 | stm32_halDisplay_t displays[MAX_DISPLAYS] = |
35 | stm32_halDisplay_t displays[MAX_DISPLAYS] = |
Line 42... | Line 41... | ||
42 | SPI_RESET_GPIO_Port, |
41 | SPI_RESET_GPIO_Port, |
43 | SPI_RESET_Pin, |
42 | SPI_RESET_Pin, |
44 | SPI_NSS1_GPIO_Port, |
43 | SPI_NSS1_GPIO_Port, |
45 | SPI_NSS1_Pin), |
44 | SPI_NSS1_Pin), |
46 | }; |
45 | }; |
47 | // display from 0 to 1000 rpm , and 0 to 1000mB |
46 | // display from 0 to 1000 rpm , and 0 to 1000mB |
48 | displayXY_t dispXY(displays[0], 500, 6000, 1000, 0); |
47 | displayXY_t dispXY(displays[0], 500, 6000, 1000, 0); |
49 | 48 | ||
50 | // set up sine tables |
49 | // set up sine tables |
51 | ap_math m; |
50 | ap_math m; |
52 | 51 | ||
Line 81... | Line 80... | ||
81 | return -1; |
80 | return -1; |
82 | stm32_halDisplay_t &display = displays[dialIndex]; |
81 | stm32_halDisplay_t &display = displays[dialIndex]; |
83 | display.clearDisplay(BLACK); |
82 | display.clearDisplay(BLACK); |
84 | dispXY.drawAxes(); |
83 | dispXY.drawAxes(); |
85 | x += 50; |
84 | x += 50; |
86 | y = m.ap_sin(ph + (x / 20)) + 1000-256; // wobbling about 1000 mB down to about 490mB |
85 | y = (m.ap_sin(ph + (x / 10)) * 39) / 20 + 500; // wobbling about 1000 mB down to about 490mB |
87 | 86 | ||
88 | if (x > 6000) |
87 | if (x > 6000) |
89 | { |
88 | { |
90 | ph += 200; |
89 | ph += 200; |
91 | if (ph > 360 * m.SINE_SCALING) |
90 | if (ph > 360 * m.SINE_SCALING) |
Line 97... | Line 96... | ||
97 | char buff[10]; |
96 | char buff[10]; |
98 | char buff1[10]; |
97 | char buff1[10]; |
99 | char buff2[10]; |
98 | char buff2[10]; |
100 | small_sprintf(buff1, "x=%4d", x); |
99 | small_sprintf(buff1, "x=%4d", x); |
101 | small_sprintf(buff2, "y=%4d", y); |
100 | small_sprintf(buff2, "y=%4d", y); |
102 | int tim = timing(x,1000-y); |
101 | int tim = timing(x, 1000 - y); |
103 | small_sprintf(buff, "%2d.%1d\xb0",tim/10, tim%10 ); |
102 | small_sprintf(buff, "%2d.%1d\xb0", tim / 10, tim % 10); |
104 | 103 | ||
105 | dispXY.plotPoint(x, y, buff, buff1, buff2); |
104 | dispXY.plotPoint(x, y, buff, buff1, buff2); |
106 | display.dim(true); |
105 | display.dim(true); |
107 | display.display(); |
106 | display.display(); |
108 | 107 |