Rev 9 | Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 9 | Rev 10 | ||
|---|---|---|---|
| Line 11... | Line 11... | ||
| 11 | int const HEIGHT = 64; |
11 | int const HEIGHT = 64; |
| 12 | int const DISPLAY_RAMWIDTH = 132; |
12 | int const DISPLAY_RAMWIDTH = 132; |
| 13 | 13 | ||
| 14 | } |
14 | } |
| 15 | 15 | ||
| - | 16 | float speedMPH = 0.0; |
|
| - | 17 | float speedAVG = 0.0; |
|
| 16 | int heading = 0; |
18 | int heading = 0; |
| 17 | Location loc; |
19 | Location loc; |
| 18 | 20 | ||
| 19 | uint8_t displayBuffer[dataSize (WIDTH, HEIGHT)]; |
21 | uint8_t displayBuffer[dataSize (WIDTH, HEIGHT)]; |
| 20 | 22 | ||
| Line 38... | Line 40... | ||
| 38 | 40 | ||
| 39 | dial.draw_scale (0, 360, 8, 1, 45); |
41 | dial.draw_scale (0, 360, 8, 1, 45); |
| 40 | 42 | ||
| 41 | display1.display (); |
43 | display1.display (); |
| 42 | 44 | ||
| 43 | memset(loc.time,'-',6 ); |
45 | memset (loc.time, '-', 6); |
| 44 | } |
46 | } |
| 45 | 47 | ||
| 46 | - | ||
| 47 | - | ||
| 48 | char fontBuf[] = "01234567"; |
48 | char fontBuf[] = "01234567"; |
| 49 | extern "C" void |
49 | extern "C" void |
| 50 | cc_run () |
50 | cc_run () |
| 51 | { |
51 | { |
| 52 | 52 | ||
| Line 57... | Line 57... | ||
| 57 | if (loc.good) |
57 | if (loc.good) |
| 58 | { |
58 | { |
| 59 | heading = loc.heading; |
59 | heading = loc.heading; |
| 60 | 60 | ||
| 61 | loc.good = false; |
61 | loc.good = false; |
| 62 | } |
62 | } |
| - | 63 | if(loc.valid=='V') |
|
| - | 64 | memset(loc.time,'-',6 ); |
|
| 63 | 65 | ||
| - | 66 | // print out the GMT time at the top of the screen |
|
| - | 67 | display1.gotoxy (0, 0); |
|
| - | 68 | display1.printString (small_font, &loc.time[0], 2, WHITE); |
|
| - | 69 | display1.printString (small_font, ":", 1, WHITE); |
|
| - | 70 | display1.printString (small_font, &loc.time[2], 2, WHITE); |
|
| - | 71 | ||
| - | 72 | display1.printString (small_font, ":", 1, WHITE); |
|
| - | 73 | display1.printString (small_font, &loc.time[4], 2, WHITE); |
|
| - | 74 | int dial_ang = heading + 180; |
|
| - | 75 | dial.draw_needle (dial_ang); |
|
| 64 | 76 | ||
| 65 | display1.gotoxy (0, 0); |
77 | display1.gotoxy (70, 25); |
| 66 | display1.printString (small_font, &loc.time[0], 2, WHITE); |
78 | if (loc.valid=='A') |
| - | 79 | { |
|
| 67 | display1.printString (small_font, ":",1, WHITE); |
80 | display1.fontDigits (large_font, 3, -1, heading); |
| - | 81 | } |
|
| - | 82 | else |
|
| 68 | display1.printString (small_font, &loc.time[2], 2, WHITE); |
83 | display1.printString (large_font, "GPS?", 4, WHITE); |
| 69 | 84 | ||
| 70 | display1.printString (small_font, ":",1, WHITE); |
- | |
| 71 | display1.printString (small_font, &loc.time[4], 2, WHITE); |
- | |
| 72 | int dial_ang = heading + 180; |
- | |
| 73 | dial.draw_needle (dial_ang); |
- | |
| 74 | 85 | ||
| 75 | display1.gotoxy (70, 25); |
- | |
| 76 | if (loc.valid) |
86 | if(loc.valid == 'A') |
| 77 | { |
- | |
| 78 | display1.fontDigits (large_font, 3, -1, heading); |
87 | speedMPH = loc.speed / 1.815; |
| 79 | } |
- | |
| 80 | else |
- | |
| 81 | display1.printString (large_font, "GPS?", 4, WHITE); |
- | |
| 82 | 88 | ||
| 83 | display1.gotoxy (0, 8); |
89 | display1.gotoxy (0, 8); |
| 84 | display1.printString (small_font, fontBuf, 8, WHITE); |
90 | display1.printString(small_font,"Speed",5, WHITE); |
| 85 | - | ||
| 86 | display1.gotoxy (0, 16); |
91 | display1.gotoxy (0, 16); |
| 87 | display1.printScaledString (small_font, fontBuf, 5, 128, WHITE); |
92 | display1.fontDigits(large_font, 4,1,speedMPH * 10); |
| 88 | 93 | ||
| 89 | display1.gotoxy (0, 48); |
94 | display1.gotoxy (0, 32); |
| 90 | display1.printScaledString (large_font, fontBuf, 5, 256, WHITE); |
95 | display1.printString(small_font,"Average",7, WHITE); |
| - | 96 | display1.gotoxy (0, 40); |
|
| 91 | for (size_t i = 0; i < sizeof(fontBuf); i++) |
97 | display1.fontDigits(large_font, 4,1,speedAVG * 10); |
| 92 | { |
98 | |
| 93 | if ((++fontBuf[i]) == 128) |
- | |
| 94 | fontBuf[i] = ' '; |
- | |
| - | 99 | ||
| - | 100 | ||
| 95 | } |
101 | |
| 96 | display1.display (); |
102 | display1.display (); |
| 97 | 103 | ||
| 98 | } |
104 | } |