Added printing of battery percent on the right. To be tested
This commit is contained in:
parent
ea4d2017a4
commit
1cd774cc87
34
code/main.c
34
code/main.c
@ -22,6 +22,7 @@
|
|||||||
#define BATTERY_TEMP 8
|
#define BATTERY_TEMP 8
|
||||||
|
|
||||||
#define BATTERY_MILLIOHM 30
|
#define BATTERY_MILLIOHM 30
|
||||||
|
#define BATTERY_CAPACITY_MAH 2200
|
||||||
|
|
||||||
#define BATTERY_CHARGE_MULT 67
|
#define BATTERY_CHARGE_MULT 67
|
||||||
#define BATTERY_CHARGE_DIV (10 * BATTERY_MILLIOHM)
|
#define BATTERY_CHARGE_DIV (10 * BATTERY_MILLIOHM)
|
||||||
@ -1019,6 +1020,38 @@ void print_option(uint8_t option)
|
|||||||
|
|
||||||
void print_battery_icon()
|
void print_battery_icon()
|
||||||
{
|
{
|
||||||
|
// Battery Percent
|
||||||
|
#if 0
|
||||||
|
static uint8_t old_symbols[3] = {0xFF, 0xFF, 0xFF};
|
||||||
|
uint32_t percent = BATTERY_CAPACITY_MAH;
|
||||||
|
uint8_t i;
|
||||||
|
uint8_t symbol;
|
||||||
|
uint8_t is_first = 1;
|
||||||
|
|
||||||
|
// Calculate percent
|
||||||
|
percent -= battery_mAh;
|
||||||
|
percent *= 100;
|
||||||
|
percent /= BATTERY_CAPACITY_MAH;
|
||||||
|
|
||||||
|
// Print percent top to bot
|
||||||
|
for (i = 3; i > 0; --i)
|
||||||
|
{
|
||||||
|
symbol = extract_digit(percent, i);
|
||||||
|
if ((0 == symbol) && (is_first) && (i != 1))
|
||||||
|
{
|
||||||
|
symbol = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3,2,1 -> 1,2,3
|
||||||
|
if (symbol != old_symbols[3 - i + 1])
|
||||||
|
{
|
||||||
|
print_symbol(symbol, OLED_X_SIZE - (CHAR_SIZE + 1) * 2, 3 - i + 1, 0);
|
||||||
|
old_symbols[3 - i + 1] = symbol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// EEPROM IDX
|
||||||
#if 0
|
#if 0
|
||||||
uint32_t idx = (uint32_t) eeprom_idx;
|
uint32_t idx = (uint32_t) eeprom_idx;
|
||||||
|
|
||||||
@ -1029,6 +1062,7 @@ void print_battery_icon()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Graphic Icon
|
||||||
#if 0
|
#if 0
|
||||||
static uint8_t old_percent = 0xFF;
|
static uint8_t old_percent = 0xFF;
|
||||||
uint8_t buf[BUFF_SIZE];
|
uint8_t buf[BUFF_SIZE];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user