From 49364085a44ef8fdf38b590c0d939c5caabb0a27 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 15 Sep 2019 11:47:48 +0200 Subject: [PATCH] Remove battery --- nanovna.h | 13 ----------- plot.c | 70 ------------------------------------------------------- 2 files changed, 83 deletions(-) diff --git a/nanovna.h b/nanovna.h index 98b8909..f2d3fa7 100644 --- a/nanovna.h +++ b/nanovna.h @@ -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*/ diff --git a/plot.c b/plot.c index 3f10a2a..3ee640a 100644 --- a/plot.c +++ b/plot.c @@ -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) {