Rev 6 | Rev 10 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 6 | Rev 8 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | SPI_NSS1_Pin), |
44 | SPI_NSS1_Pin), |
| 45 | }; |
45 | }; |
| 46 | // display from 0 to 1000 rpm , and 0 to 1000mB |
46 | // display from 0 to 1000 rpm , and 0 to 1000mB |
| 47 | displayXY_t dispXY(displays[0], 500, 6000, 1000, 0); |
47 | displayXY_t dispXY(displays[0], 500, 6000, 1000, 0); |
| 48 | 48 | ||
| - | 49 | // display 1 bottom left 90 degrees |
|
| - | 50 | displayLeftQuadrantDial_t displayDial1(displays[0]); |
|
| - | 51 | ||
| - | 52 | // display2 bottom right 90 degrees; |
|
| - | 53 | displayRightQuadrantDial_t displayDial2(displays[0]); |
|
| - | 54 | ||
| 49 | // set up sine tables |
55 | // set up sine tables |
| 50 | ap_math m; |
56 | ap_math m; |
| 51 | 57 | ||
| 52 | #if defined __cplusplus |
58 | #if defined __cplusplus |
| 53 | extern "C" |
59 | extern "C" |
| Line 78... | Line 84... | ||
| 78 | 84 | ||
| 79 | if (dialIndex < 0 && dialIndex > MAX_DISPLAYS) |
85 | if (dialIndex < 0 && dialIndex > MAX_DISPLAYS) |
| 80 | return -1; |
86 | return -1; |
| 81 | stm32_halDisplay_t &display = displays[dialIndex]; |
87 | stm32_halDisplay_t &display = displays[dialIndex]; |
| 82 | display.clearDisplay(BLACK); |
88 | display.clearDisplay(BLACK); |
| - | 89 | ||
| - | 90 | displayDial1.draw_scale(0, 100, 4, 2, 25); |
|
| - | 91 | displayDial2.draw_scale(0, 100, 4, 2, 25); |
|
| - | 92 | ||
| 83 | dispXY.drawAxes(); |
93 | // dispXY.drawAxes(); |
| 84 | x += 50; |
94 | x += 50; |
| 85 | y = (m.ap_sin(ph + (x / 10)) * 39) / 20 + 500; // wobbling about 1000 mB down to about 490mB |
95 | y = (m.ap_sin(ph + (x / 10)) * 39) / 20 + 500; // wobbling about 1000 mB down to about 490mB |
| 86 | 96 | ||
| 87 | if (x > 6000) |
97 | if (x > 6000) |
| 88 | { |
98 | { |
| Line 99... | Line 109... | ||
| 99 | small_sprintf(buff1, "x=%4d", x); |
109 | small_sprintf(buff1, "x=%4d", x); |
| 100 | small_sprintf(buff2, "y=%4d", y); |
110 | small_sprintf(buff2, "y=%4d", y); |
| 101 | int tim = timing(x, 1000 - y); |
111 | int tim = timing(x, 1000 - y); |
| 102 | small_sprintf(buff, "%2d.%1d\xb0", tim / 10, tim % 10); |
112 | small_sprintf(buff, "%2d.%1d\xb0", tim / 10, tim % 10); |
| 103 | 113 | ||
| 104 | dispXY.plotPoint(x, y, buff, buff1, buff2); |
114 | // dispXY.plotPoint(x, y, buff, buff1, buff2); |
| - | 115 | ||
| - | 116 | displayDial1.draw_value(buff2); |
|
| - | 117 | displayDial2.draw_value(buff1); |
|
| - | 118 | ||
| - | 119 | displayDial1.draw_limits(); |
|
| - | 120 | displayDial2.draw_limits(); |
|
| - | 121 | ||
| - | 122 | displayDial1.draw_needle(y / 3); |
|
| - | 123 | displayDial2.draw_needle(y / 3); |
|
| - | 124 | ||
| 105 | display.dim(true); |
125 | display.dim(true); |
| 106 | display.display(); |
126 | display.display(); |
| 107 | 127 | ||
| 108 | return 0; |
128 | return 0; |
| 109 | } |
129 | } |