Subversion Repositories Projects

Rev

Rev 837 | Rev 1281 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 837 Rev 902
Line 1... Line 1...
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2011 by Claas Anders "CaScAdE" Rathje               *
3
 *   admiralcascade@gmail.com                                               *
3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
5
 *                                                                          *
5
 *                                                                          *
6
 *   This program is free software; you can redistribute it and/or modify   *
6
 *   This program is free software; you can redistribute it and/or modify   *
7
 *   it under the terms of the GNU General Public License as published by   *
7
 *   it under the terms of the GNU General Public License as published by   *
Line 326... Line 326...
326
        write_char_xy(scope[4], scope[5], 0xEE);
326
        write_char_xy(scope[4], scope[5], 0xEE);
327
        write_char_xy(scope[6], scope[7], 0xEF);
327
        write_char_xy(scope[6], scope[7], 0xEF);
328
     */
328
     */
329
    // save 20 byte :)
329
    // save 20 byte :)
330
    for (int i = 0; i < 4; i++) {
330
    for (int i = 0; i < 4; i++) {
-
 
331
        write_char_xy(
-
 
332
            scope[i * 3],
-
 
333
            scope[(i * 3) + 1],
331
        write_char_xy(scope[i * 2], scope[(i * 2) + 1], 0xEC + i);
334
            0xEC + i + (scope[(i * 3) + 2] * 4));
332
    }
335
    }
333
}
336
}
Line -... Line 337...
-
 
337
 
-
 
338
/**
-
 
339
 * draw stats
-
 
340
 */
-
 
341
void draw_stats() {
-
 
342
#if FCONLY
-
 
343
#else
-
 
344
    uint8_t line = 3;
-
 
345
    write_ascii_string_pgm(1, line, (const char *)(pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
-
 
346
    write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[1])))); // max Speed
-
 
347
    write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[2])))); // max Distance
-
 
348
 
-
 
349
    if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
-
 
350
        write_ndigit_number_s(16, line - 2, max_Altimeter * 32 / 10, 4, 0);
-
 
351
        write_char_xy(20, line - 2, 0x7E); // small feet ft
-
 
352
        write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)279) / (uint32_t)12500), 3, 0);
-
 
353
        write_char_xy(20, line - 1, 0x7D); // mp/h
-
 
354
        write_ndigit_number_u(16, line - 0, max_Distance / 10 * 32 / 10, 4, 0);
-
 
355
        write_char_xy(20, line - 0, 0x7E); // small feet ft
-
 
356
    } else {
-
 
357
        write_ndigit_number_s(16, line - 2, max_Altimeter, 4, 0);
-
 
358
        write_char_xy(20, line - 2, 204); // small meters m
-
 
359
        write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
-
 
360
        write_char_xy(20, line - 1, 203); // km/h
-
 
361
        write_ndigit_number_u(16, line - 0, max_Distance / 10, 4, 0);
-
 
362
        write_char_xy(20, line - 0, 204); // small meters m
-
 
363
    }
-
 
364
 
-
 
365
    write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[3])))); // min voltage
-
 
366
    write_ndigit_number_u_10th(16, line, min_UBat, 3, 0);
-
 
367
    write_char_xy(20, line, 0x9E); // small V
-
 
368
    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
-
 
370
        write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0);
-
 
371
        write_char_xy(20, line, 0x9F); // small A
-
 
372
 
-
 
373
        // wasted mampere in this flight (will count up after landing)
-
 
374
        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
-
 
375
            write_ndigit_number_u(21, line, (ampere_wasted / 10) - wasted_ampere_offset, 5, 0);
-
 
376
        } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
-
 
377
 
-
 
378
            write_ndigit_number_u(21, line, naviData.UsedCapacity - wasted_ampere_offset, 5, 0);
-
 
379
        }
-
 
380
 
-
 
381
        write_char_xy(26, line, 0xB5); // mah
-
 
382
    }
-
 
383
    write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[4])))); // max time
-
 
384
    write_time(14, line, max_FlyingTime);
-
 
385
    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
-
 
387
    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
-
 
389
    write_gps_pos(14, line, naviData.CurrentPosition.Latitude);
-
 
390
#endif
-
 
391
}
334
 
392