Subversion Repositories Projects

Rev

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

Rev 390 Rev 453
Line 88... Line 88...
88
 * battery index
88
 * battery index
89
 * ##########################################################################*/
89
 * ##########################################################################*/
90
/**
90
/**
91
 * draw a battery symbol at <x>/<y> according to <voltage>
91
 * draw a battery symbol at <x>/<y> according to <voltage>
92
 */
92
 */
93
void draw_battery(uint8_t x, uint8_t y, uint16_t voltage) {
93
void draw_battery(uint8_t x, uint8_t y, uint8_t min_voltage, uint8_t voltage, uint8_t max_voltage) {
94
        uint8_t percent = (100* (voltage - UBAT_WRN) / (UBAT_MAX - UBAT_WRN));
94
        uint8_t percent = (100* (voltage - min_voltage) / (max_voltage - min_voltage));
95
        if (percent > 100) percent = 100;
95
        if (percent > 100) percent = 100;
96
        if (voltage < UBAT_WRN) percent = 0;
96
        if (voltage < min_voltage) percent = 0;
97
        write_char_xy(x, y, 0x9d - (percent * 13 / 100));
97
        write_char_xy(x, y, 0x9d - (percent * 13 / 100));
98
        //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0);
98
        //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0);
99
}
99
}
Line 100... Line 100...
100
 
100