Subversion Repositories Projects

Rev

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

Rev 377 Rev 378
Line 196... Line 196...
196
 * draw a battery symbol at <x>/<y> according to <voltage>
196
 * draw a battery symbol at <x>/<y> according to <voltage>
197
 */
197
 */
198
void draw_battery(uint8_t x, uint8_t y, uint16_t voltage) {
198
void draw_battery(uint8_t x, uint8_t y, uint16_t voltage) {
199
        uint8_t percent = (100* (voltage - UBAT_WRN) / (UBAT_MAX - UBAT_WRN));
199
        uint8_t percent = (100* (voltage - UBAT_WRN) / (UBAT_MAX - UBAT_WRN));
200
        if (percent > 100) percent = 100;
200
        if (percent > 100) percent = 100;
-
 
201
        if (voltage < UBAT_WRN) percent = 0;
201
        write_char_xy(x, y, 0x9d - (percent * 13 / 100));
202
        write_char_xy(x, y, 0x9d - (percent * 13 / 100));
202
        //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0);
203
        //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0);
203
}
204
}
Line 204... Line 205...
204
 
205