|
@@ -17,6 +17,7 @@
|
17
|
17
|
*/
|
18
|
18
|
|
19
|
19
|
#include <stdio.h>
|
|
20
|
+#include <string.h>
|
20
|
21
|
|
21
|
22
|
#include "config.h"
|
22
|
23
|
#include "lcd.h"
|
|
@@ -90,7 +91,10 @@ void draw_splash(void) {
|
90
|
91
|
|
91
|
92
|
void draw_battery_indicator(void) {
|
92
|
93
|
static const float batt_warn_limit = 15.0f;
|
93
|
|
- static char s[30];
|
|
94
|
+ static char prev_s[30] = {0};
|
|
95
|
+ static uint32_t prev_c = 0;
|
|
96
|
+
|
|
97
|
+ char s[30] = {0};
|
94
|
98
|
float v = lipo_voltage();
|
95
|
99
|
uint32_t c = RGB_565(0xFF, 0x00, 0x00);
|
96
|
100
|
if (lipo_charging()) {
|
|
@@ -107,6 +111,13 @@ void draw_battery_indicator(void) {
|
107
|
111
|
}
|
108
|
112
|
}
|
109
|
113
|
|
|
114
|
+ // only re-draw battery indicator when it has changed
|
|
115
|
+ if ((strcmp(s, prev_s) == 0) && (prev_c == c)) {
|
|
116
|
+ return;
|
|
117
|
+ }
|
|
118
|
+ strcpy(prev_s, s);
|
|
119
|
+ prev_c = c;
|
|
120
|
+
|
110
|
121
|
static struct text_font font = {
|
111
|
122
|
.fontname = "fixed_10x20",
|
112
|
123
|
.font = NULL,
|