Remove battery

This commit is contained in:
erikkaashoek 2019-09-15 11:47:48 +02:00
parent bd047b7b30
commit 49364085a4
2 changed files with 0 additions and 83 deletions

View file

@ -232,7 +232,6 @@ void marker_position(int m, int t, int *x, int *y);
int search_nearest_index(int x, int y, int t);
extern int8_t redraw_requested;
extern int16_t vbat;
/*
* ili9341.c
@ -316,7 +315,6 @@ int config_recall(void);
void clear_all_config_prop_data(void);
int16_t adc_vbat_read(ADC_TypeDef *adc);
/*
* ui.c
@ -355,21 +353,10 @@ uint16_t adc_single_read(ADC_TypeDef *adc, uint32_t chsel);
void adc_start_analog_watchdogd(ADC_TypeDef *adc, uint32_t chsel);
void adc_stop(ADC_TypeDef *adc);
void adc_interrupt(ADC_TypeDef *adc);
int16_t adc_vbat_read(ADC_TypeDef *adc);
/*
* misclinous
*/
#define PULSE do { palClearPad(GPIOC, GPIOC_LED); palSetPad(GPIOC, GPIOC_LED);} while(0)
// convert vbat [mV] to battery indicator
static inline uint8_t vbat2bati(int16_t vbat)
{
if (vbat < 3200) return 0;
if (vbat < 3450) return 25;
if (vbat < 3700) return 50;
if (vbat < 4100) return 75;
return 100;
}
/*EOF*/

70
plot.c
View file

@ -1497,76 +1497,6 @@ draw_cal_status(void)
}
}
void
draw_battery_status(void)
{
int w = 10, h = 14;
int x = 0, y = 0;
int i, c;
uint16_t *buf = spi_buffer;
uint8_t vbati = vbat2bati(vbat);
uint16_t col = vbati == 0 ? RGB565(0, 255, 0) : RGB565(0, 0, 240);
memset(spi_buffer, 0, w * h * 2);
// battery head
x = 3;
buf[y * w + x++] = col;
buf[y * w + x++] = col;
buf[y * w + x++] = col;
buf[y * w + x++] = col;
y++;
x = 3;
buf[y * w + x++] = col;
x++; x++;
buf[y * w + x++] = col;
y++;
x = 1;
for (i = 0; i < 8; i++)
buf[y * w + x++] = col;
for (c = 0; c < 3; c++) {
y++;
x = 1;
buf[y * w + x++] = col;
x++; x++; x++; x++; x++; x++;
buf[y * w + x++] = col;
y++;
x = 1;
buf[y * w + x++] = col;
x++;
for (i = 0; i < 4; i++)
buf[y * w + x++] = ( ((c+1) * 25) >= (100 - vbati)) ? col : 0;
x++;
buf[y * w + x++] = col;
y++;
x = 1;
buf[y * w + x++] = col;
x++;
for (i = 0; i < 4; i++)
buf[y * w + x++] = ( ((c+1) * 25) >= (100 - vbati)) ? col : 0;
x++;
buf[y * w + x++] = col;
}
// battery foot
y++;
x = 1;
buf[y * w + x++] = col;
x++; x++; x++; x++; x++; x++;
buf[y * w + x++] = col;
y++;
x = 1;
for (i = 0; i < 8; i++)
buf[y * w + x++] = col;
ili9341_bulk(0, 1, w, h);
}
void
request_to_redraw_grid(void)
{