Rev 902 | Rev 1281 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 902 | Rev 1197 | ||
---|---|---|---|
Line 71... | Line 71... | ||
71 | /** |
71 | /** |
72 | * draw a compass rose at <x>/<y> for <heading> |
72 | * draw a compass rose at <x>/<y> for <heading> |
73 | */ |
73 | */ |
74 | void draw_compass(uint8_t x, uint8_t y, uint16_t heading) { |
74 | void draw_compass(uint8_t x, uint8_t y, uint16_t heading) { |
75 | //char* rose = "---N---O---S---W---N---O---S---W---N---O---S---W"; |
75 | //char* rose = "---N---O---S---W---N---O---S---W---N---O---S---W"; |
76 | static char rose[48] PROGMEM = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212, |
76 | static char rose[] PROGMEM = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212, |
77 | 216, 215, 216, 214, 216, 215, 216, 211, 216, 215, 216, 213, |
77 | 216, 215, 216, 214, 216, 215, 216, 211, 216, 215, 216, 213, |
78 | 216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211, |
78 | 216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211, |
79 | 216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214}; |
79 | 216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214}; |
80 | // the center is char 19 (north), we add the current heading in 8th |
80 | // the center is char 19 (north), we add the current heading in 8th |
81 | // which would be 22.5 degrees, but float would bloat up the code |
81 | // which would be 22.5 degrees, but float would bloat up the code |
Line 107... | Line 107... | ||
107 | 107 | ||
108 | /** |
108 | /** |
109 | * draw variometer arrows at <x>/<y> according to <variometer> |
109 | * draw variometer arrows at <x>/<y> according to <variometer> |
110 | */ |
110 | */ |
111 | void draw_variometer(uint8_t x, uint8_t y, int16_t variometer) { |
111 | void draw_variometer(uint8_t x, uint8_t y, int16_t variometer) { |
112 | if (variometer == 0) { |
- | |
113 | write_char_xy(x, y, 0xbb); // plain line |
112 | uint8_t chr = 0xbb; |
114 | } else if (variometer > 0) { // gain height |
113 | if (variometer > 0) { // gain height |
115 | switch (variometer / 5) { |
- | |
116 | case 0: |
- | |
117 | //write_char_xy(x, y, 0xba); // smallest arrow up |
- | |
118 | write_char_xy(x, y, 0x70); // one arrow up |
- | |
119 | break; |
- | |
120 | case 1: |
- | |
121 | //write_char_xy(x, y, 0xb9); // small arrow up |
- | |
122 | write_char_xy(x, y, 0x71); // two arrows up |
- | |
123 | break; |
- | |
124 | case 2: |
- | |
125 | //write_char_xy(x, y, 0xb8); // large arrow up |
- | |
126 | write_char_xy(x, y, 0x72); // three arrows up |
114 | chr = 0x70 + (variometer / 5); |
127 | break; |
- | |
128 | default: |
- | |
129 | //write_char_xy(x, y, 0xb7); // largest arrow up |
- | |
130 | write_char_xy(x, y, 0x73); // three black arrows up |
- | |
131 | } |
115 | if (chr > 0x73) chr = 0x73; |
132 | } else { // sink |
116 | } else { // sink |
133 | switch (variometer / -5) { |
- | |
134 | case 0: |
- | |
135 | //write_char_xy(x, y, 0xbc); // smallest arrow down |
- | |
136 | write_char_xy(x, y, 0x77); // one arrow down |
- | |
137 | break; |
- | |
138 | case 1: |
- | |
139 | //write_char_xy(x, y, 0xbd); // small arrow down |
- | |
140 | write_char_xy(x, y, 0x76); // two arrows down |
- | |
141 | break; |
- | |
142 | case 2: |
- | |
143 | //write_char_xy(x, y, 0xbe); // large arrow down |
- | |
144 | write_char_xy(x, y, 0x75); // three arrows down |
117 | chr = 0x77 - (variometer / -5); |
145 | break; |
- | |
146 | default: |
- | |
147 | //write_char_xy(x, y, 0xbf); // largest arrow down |
- | |
148 | write_char_xy(x, y, 0x74); // three black arrows down |
- | |
149 | } |
118 | if (chr < 0x74) chr = 0x74; |
- | 119 | } |
|
150 | } |
120 | write_char_xy(x, y, chr); |
Line 151... | Line 121... | ||
151 | } |
121 | } |
152 | 122 | ||
153 | // big vario arrays |
123 | // big vario arrays |
Line 340... | Line 310... | ||
340 | */ |
310 | */ |
341 | void draw_stats() { |
311 | void draw_stats() { |
342 | #if FCONLY |
312 | #if FCONLY |
343 | #else |
313 | #else |
344 | uint8_t line = 3; |
314 | uint8_t line = 3; |
345 | write_ascii_string_pgm(1, line, (const char *)(pgm_read_word(&(stats_item_pointers[0])))); // max Altitude |
315 | write_ascii_string_pgm(1, line, PSTR("max Altitude:")); // max Altitude |
346 | write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[1])))); // max Speed |
316 | write_ascii_string_pgm(1, ++line, PSTR("max Speed :")); // max Speed |
347 | write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[2])))); // max Distance |
317 | write_ascii_string_pgm(1, ++line, PSTR("max Distance:")); // max Distance |
Line 348... | Line 318... | ||
348 | 318 | ||
349 | if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) { |
319 | if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) { |
350 | write_ndigit_number_s(16, line - 2, max_Altimeter * 32 / 10, 4, 0); |
320 | write_ndigit_number_s(16, line - 2, max_Altimeter * 32 / 10, 4, 0); |
351 | write_char_xy(20, line - 2, 0x7E); // small feet ft |
321 | write_char_xy(20, line - 2, 0x7E); // small feet ft |
Line 360... | Line 330... | ||
360 | write_char_xy(20, line - 1, 203); // km/h |
330 | write_char_xy(20, line - 1, 203); // km/h |
361 | write_ndigit_number_u(16, line - 0, max_Distance / 10, 4, 0); |
331 | write_ndigit_number_u(16, line - 0, max_Distance / 10, 4, 0); |
362 | write_char_xy(20, line - 0, 204); // small meters m |
332 | write_char_xy(20, line - 0, 204); // small meters m |
363 | } |
333 | } |
Line 364... | Line 334... | ||
364 | 334 | ||
365 | write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[3])))); // min voltage |
335 | write_ascii_string_pgm(1, ++line, PSTR("min Voltage :")); // min voltage |
366 | write_ndigit_number_u_10th(16, line, min_UBat, 3, 0); |
336 | write_ndigit_number_u_10th(16, line, min_UBat, 3, 0); |
367 | write_char_xy(20, line, 0x9E); // small V |
337 | write_char_xy(20, line, 0x9E); // small V |
368 | if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) { |
338 | if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) { |
369 | write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[7])))); // ampere |
339 | write_ascii_string_pgm(1, ++line, PSTR("max current :")); // ampere |
370 | write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0); |
340 | write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0); |
Line 371... | Line 341... | ||
371 | write_char_xy(20, line, 0x9F); // small A |
341 | write_char_xy(20, line, 0x9F); // small A |
372 | 342 | ||
Line 378... | Line 348... | ||
378 | write_ndigit_number_u(21, line, naviData.UsedCapacity - wasted_ampere_offset, 5, 0); |
348 | write_ndigit_number_u(21, line, naviData.UsedCapacity - wasted_ampere_offset, 5, 0); |
379 | } |
349 | } |
Line 380... | Line 350... | ||
380 | 350 | ||
381 | write_char_xy(26, line, 0xB5); // mah |
351 | write_char_xy(26, line, 0xB5); // mah |
382 | } |
352 | } |
383 | write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[4])))); // max time |
353 | write_ascii_string_pgm(1, ++line, PSTR("max Time:")); // max time |
384 | write_time(14, line, max_FlyingTime); |
354 | write_time(14, line, max_FlyingTime); |
385 | write_char_xy(20, line, 210); // fly clock |
355 | write_char_xy(20, line, 210); // fly clock |
386 | write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[5])))); // longitude |
356 | write_ascii_string_pgm(1, ++line, PSTR("longitude :")); // longitude |
387 | write_gps_pos(14, line, naviData.CurrentPosition.Longitude); |
357 | write_gps_pos(14, line, naviData.CurrentPosition.Longitude); |
388 | write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[6])))); // latitude |
358 | write_ascii_string_pgm(1, ++line, PSTR("latitude:")); // latitude |
389 | write_gps_pos(14, line, naviData.CurrentPosition.Latitude); |
359 | write_gps_pos(14, line, naviData.CurrentPosition.Latitude); |
390 | #endif |
360 | #endif |
Line 391... | Line 361... | ||
391 | } |
361 | } |