Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 390 → Rev 470

/C-OSD/trunk/osd_helpers.c
90,10 → 90,10
/**
* draw a battery symbol at <x>/<y> according to <voltage>
*/
void draw_battery(uint8_t x, uint8_t y, uint16_t voltage) {
uint8_t percent = (100* (voltage - UBAT_WRN) / (UBAT_MAX - UBAT_WRN));
void draw_battery(uint8_t x, uint8_t y, uint8_t min_voltage, uint8_t voltage, uint8_t max_voltage) {
uint8_t percent = (100* (voltage - min_voltage) / (max_voltage - min_voltage));
if (percent > 100) percent = 100;
if (voltage < UBAT_WRN) percent = 0;
if (voltage < min_voltage) percent = 0;
write_char_xy(x, y, 0x9d - (percent * 13 / 100));
//write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0);
}