... | ... |
@@ -5,6 +5,7 @@ |
5 | 5 |
|
6 | 6 |
#include "LcdDisplay.h" |
7 | 7 |
|
8 |
+ |
|
8 | 9 |
void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp) |
9 | 10 |
{ |
10 | 11 |
uint8_t x, y; |
... | ... |
@@ -20,7 +21,7 @@ void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_ |
20 | 21 |
} |
21 | 22 |
} |
22 | 23 |
|
23 |
-void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend) |
|
24 |
+void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend) |
|
24 | 25 |
{ |
25 | 26 |
int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err; |
26 | 27 |
|
... | ... |
@@ -65,7 +66,7 @@ void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend) |
65 | 66 |
// lcd_update_display(); |
66 | 67 |
} |
67 | 68 |
|
68 |
-void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness) |
|
69 |
+void DrawLcdLineBresenhamWW(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness) |
|
69 | 70 |
{ |
70 | 71 |
int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err; |
71 | 72 |
|
... | ... |
@@ -122,7 +123,7 @@ void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thic |
122 | 123 |
// lcd_update_display(); |
123 | 124 |
} |
124 | 125 |
|
125 |
-u8t WriteLcdCharacter(u8t x, u8t y, u8t Character) |
|
126 |
+u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character) |
|
126 | 127 |
{ |
127 | 128 |
u8t CharacterHeight = GetCharacterHeight(); |
128 | 129 |
u8t CharacterWidth = GetCharacterWidth(Character); |
... | ... |
@@ -137,10 +138,10 @@ u8t WriteLcdCharacter(u8t x, u8t y, u8t Character) |
137 | 138 |
if (bitmap[ly] & (1<<lx)) { |
138 | 139 |
hal_lcd_set_pixel(lx+x, ly+y, TRUE); |
139 | 140 |
// printf("."); |
140 |
- } else { |
|
141 |
+ } /*else { |
|
141 | 142 |
hal_lcd_set_pixel(lx+x, ly+y, FALSE); |
142 | 143 |
// printf(" "); |
143 |
- } |
|
144 |
+ }*/ |
|
144 | 145 |
} |
145 | 146 |
// printf("\n"); |
146 | 147 |
} |
... | ... |
@@ -148,11 +149,11 @@ u8t WriteLcdCharacter(u8t x, u8t y, u8t Character) |
148 | 149 |
return CharacterWidth + GetFontSpacing(); |
149 | 150 |
} |
150 | 151 |
|
151 |
-u8t WriteLcdString(u8t x, u8t y, char *str) |
|
152 |
+u8t WriteLcdString(const uint8_t x, const uint8_t y, const char *str) |
|
152 | 153 |
{ |
153 | 154 |
int lx, i, strl; |
154 | 155 |
|
155 |
- strl = oswald_strlen(str); |
|
156 |
+ strl = oswald_strlen((char *)str); |
|
156 | 157 |
if (strl == 0) |
157 | 158 |
return 0; |
158 | 159 |
|
... | ... |
@@ -164,7 +165,7 @@ u8t WriteLcdString(u8t x, u8t y, char *str) |
164 | 165 |
} |
165 | 166 |
|
166 | 167 |
|
167 |
-void WriteLcdNumber(u8t x, u8t y, s16t number) |
|
168 |
+void WriteLcdNumber(const uint8_t x, const uint8_t y, const int16_t number) |
|
168 | 169 |
{ |
169 | 170 |
int lx, i, strl; |
170 | 171 |
char str[8]; |
... | ... |
@@ -4,11 +4,11 @@ |
4 | 4 |
// #include "oswald_hal.h" |
5 | 5 |
|
6 | 6 |
void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp); |
7 |
-void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend); |
|
8 |
-void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness); |
|
9 |
-u8t WriteLcdCharacter(u8t x, u8t y, u8t Character); |
|
10 |
-u8t WriteLcdString(u8t x, u8t y, char *str); |
|
11 |
-void WriteLcdNumber(u8t x, u8t y, s16t number); |
|
7 |
+void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend); |
|
8 |
+void DrawLcdLineBresenhamWW(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness); |
|
9 |
+u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character); |
|
10 |
+u8t WriteLcdString(const uint8_t x, const uint8_t y, const char *str); |
|
11 |
+void WriteLcdNumber(const uint8_t x, const uint8_t y, const int16_t number); |
|
12 | 12 |
|
13 | 13 |
#endif |
14 | 14 |
|
15 | 15 |
deleted file mode 100644 |
... | ... |
@@ -1,84 +0,0 @@ |
1 |
-#define Oswald_width 80 |
|
2 |
-#define Oswald_height 96 |
|
3 |
-static const char Oswald_bits[] = { |
|
4 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
5 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
6 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, |
|
7 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, |
|
8 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, |
|
9 |
- 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
10 |
- 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
11 |
- 0xF0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, |
|
12 |
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, |
|
13 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x00, |
|
14 |
- 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
15 |
- 0x00, 0x00, 0x00, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
16 |
- 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xBA, 0x01, 0x00, 0x00, 0xF8, |
|
17 |
- 0x3F, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0x00, 0xF0, 0x7F, 0x00, |
|
18 |
- 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0x00, |
|
19 |
- 0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, |
|
20 |
- 0xFF, 0x0F, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x3F, |
|
21 |
- 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x7F, 0x00, 0xC0, |
|
22 |
- 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0x00, 0x80, 0x7F, 0x00, |
|
23 |
- 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0x03, 0x80, 0x3F, 0x00, 0x00, 0x00, |
|
24 |
- 0xE0, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x59, |
|
25 |
- 0xE9, 0xFF, 0x0F, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, |
|
26 |
- 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, |
|
27 |
- 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x83, 0x0F, 0x00, |
|
28 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x01, 0x0F, 0x00, 0x00, 0x00, |
|
29 |
- 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
30 |
- 0x00, 0x0C, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, |
|
31 |
- 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, |
|
32 |
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x18, 0x00, |
|
33 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x18, 0x00, 0x00, 0x00, |
|
34 |
- 0x00, 0x00, 0x00, 0x83, 0x07, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
35 |
- 0x00, 0x83, 0x07, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x81, |
|
36 |
- 0x0F, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x07, 0x7C, |
|
37 |
- 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC3, 0x07, 0x7C, 0x38, 0x00, |
|
38 |
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x07, 0x7C, 0x38, 0x00, 0x00, 0x00, |
|
39 |
- 0x00, 0x00, 0x80, 0x87, 0x07, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
40 |
- 0x80, 0xCF, 0x07, 0x7C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCF, |
|
41 |
- 0x87, 0x7C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, |
|
42 |
- 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xF8, 0x03, 0x16, 0x00, |
|
43 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xF8, 0x03, 0x13, 0x00, 0x00, 0x00, |
|
44 |
- 0x00, 0x00, 0x00, 0x1A, 0xF0, 0x81, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
45 |
- 0x00, 0x34, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, |
|
46 |
- 0x01, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xF7, 0xCF, |
|
47 |
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x58, 0xFC, 0x1E, 0x00, |
|
48 |
- 0x00, 0x00, 0x00, 0x00, 0xE0, 0x9F, 0xFF, 0x67, 0xFE, 0x00, 0x00, 0x00, |
|
49 |
- 0x00, 0x00, 0xF8, 0xBF, 0xF0, 0x63, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x00, |
|
50 |
- 0xFC, 0xFF, 0xE6, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xDF, 0xFF, |
|
51 |
- 0xDF, 0xA2, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x80, 0xE1, 0xEF, 0x00, 0xF1, |
|
52 |
- 0xB6, 0x63, 0x00, 0x00, 0x00, 0x40, 0x00, 0x74, 0x00, 0xF0, 0x13, 0x80, |
|
53 |
- 0x00, 0x00, 0x00, 0x70, 0x00, 0x96, 0x00, 0x9C, 0x21, 0x00, 0x01, 0x00, |
|
54 |
- 0x00, 0x48, 0xC0, 0x89, 0x03, 0x27, 0xC1, 0x00, 0x01, 0x00, 0x00, 0x64, |
|
55 |
- 0xD1, 0xC8, 0xFE, 0x66, 0x82, 0x11, 0x01, 0x00, 0x00, 0x3C, 0x33, 0x44, |
|
56 |
- 0x06, 0x3C, 0x02, 0x91, 0x03, 0x00, 0x00, 0x10, 0x11, 0x84, 0x03, 0x00, |
|
57 |
- 0x02, 0xB3, 0x04, 0x00, 0x00, 0xE0, 0x09, 0x04, 0x01, 0x00, 0x02, 0xB1, |
|
58 |
- 0x04, 0x00, 0x00, 0x00, 0x07, 0x04, 0x00, 0x00, 0x02, 0x91, 0x05, 0x00, |
|
59 |
- 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x07, 0x9E, 0x07, 0x00, 0x00, 0x00, |
|
60 |
- 0x00, 0x0C, 0x00, 0x00, 0x04, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, |
|
61 |
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, |
|
62 |
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xA4, 0xC7, 0x07, 0x00, |
|
63 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x78, 0xF9, 0x0F, 0x00, 0x00, 0x00, |
|
64 |
- 0x00, 0x00, 0x00, 0xFE, 0x0F, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
65 |
- 0x00, 0xFF, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, |
|
66 |
- 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xE0, |
|
67 |
- 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xE0, 0x1F, 0x00, |
|
68 |
- 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, |
|
69 |
- 0x00, 0x00, 0x00, 0xFF, 0x01, 0xFC, 0x2F, 0x10, 0x00, 0x00, 0x00, 0x00, |
|
70 |
- 0x80, 0xFF, 0x05, 0xF2, 0xF3, 0xFF, 0x01, 0x00, 0x00, 0x00, 0xD4, 0xFC, |
|
71 |
- 0x04, 0x02, 0x3C, 0x00, 0x03, 0x00, 0x00, 0x80, 0xEF, 0x01, 0x0C, 0x8E, |
|
72 |
- 0x07, 0x00, 0x02, 0x00, 0x00, 0xC0, 0x00, 0x07, 0x1E, 0xF9, 0x03, 0x00, |
|
73 |
- 0x04, 0x00, 0x00, 0x20, 0x00, 0xFC, 0xB1, 0x81, 0x00, 0x00, 0x06, 0x00, |
|
74 |
- 0x00, 0x10, 0x00, 0x30, 0xE0, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x10, |
|
75 |
- 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x10, 0x00, 0x00, |
|
76 |
- 0xE0, 0x3C, 0x00, 0x80, 0x05, 0x00, 0x00, 0x38, 0x00, 0x00, 0xF8, 0x83, |
|
77 |
- 0x07, 0xE0, 0x02, 0x00, 0x00, 0x78, 0x00, 0x00, 0x6F, 0x7E, 0xFE, 0x3E, |
|
78 |
- 0x03, 0x00, 0x00, 0xD0, 0x01, 0x30, 0x30, 0xC0, 0x81, 0xC3, 0x01, 0x00, |
|
79 |
- 0x00, 0x20, 0xFF, 0x4F, 0x0F, 0x00, 0x0E, 0x78, 0x00, 0x00, 0x00, 0xC0, |
|
80 |
- 0x09, 0xFA, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x07, |
|
81 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
82 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
83 |
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
84 |
- }; |
106 | 21 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,7 @@ |
1 |
+#define bluetooth_con_icon_width 15 |
|
2 |
+#define bluetooth_con_icon_height 20 |
|
3 |
+static unsigned char bluetooth_con_icon_bits[] = { |
|
4 |
+ 0x6c, 0x00, 0xce, 0x00, 0xaa, 0x00, 0xc6, 0x00, 0xaa, 0x00, 0xce, 0x00, |
|
5 |
+ 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
6 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
7 |
+ 0x00, 0x00, 0x00, 0x00, }; |
... | ... |
@@ -5,7 +5,7 @@ |
5 | 5 |
* these functions must be implemented for a concrete hardware |
6 | 6 |
*/ |
7 | 7 |
|
8 |
-void hal_lcd_set_pixel(unsigned int x, unsigned int y, unsigned char state); |
|
8 |
+void hal_lcd_set_pixel(uint8_t x, uint8_t y, uint8_t color); |
|
9 | 9 |
void hal_lcd_clear_display(void); |
10 | 10 |
void hal_lcd_update_display(void); |
11 | 11 |
/* sets the backlight on/off, on=TRUE, off=FALSE */ |
... | ... |
@@ -161,8 +161,9 @@ void oswald_handle_comm_input(uint16_t mlen, const void *mdat) |
161 | 161 |
if (icmd[0] == '$') { |
162 | 162 |
if (strncmp(icmd, "$GRT", 4) == 0) { // get current RTC |
163 | 163 |
char rtime[16]; |
164 |
- snprintf(rtime, 10, "%02d%02d%02d\n", OswaldClk.hour, OswaldClk.minute, OswaldClk.second); |
|
164 |
+ snprintf(rtime, 16, "#RTC%02d%02d%02d\n", OswaldClk.hour, OswaldClk.minute, OswaldClk.second); |
|
165 | 165 |
hal_bluetooth_send_data(rtime, strlen(rtime)); |
166 |
+ } else if (strncmp(icmd, "$SRT", 4) == 0) { // set current RTC |
|
166 | 167 |
} else if (strncmp(icmd, "$MSG", 4) == 0) { // message on main screen |
167 | 168 |
char *msg = (icmd+4); |
168 | 169 |
mlen -= 4; |
... | ... |
@@ -170,6 +171,10 @@ void oswald_handle_comm_input(uint16_t mlen, const void *mdat) |
170 | 171 |
strncpy(MainMessage, msg, (mlen > 147) ? 147 : mlen); |
171 | 172 |
} else if (strncmp(icmd, "$MCL", 4) == 0) { // clear message |
172 | 173 |
memset(MainMessage, 0, 148); |
174 |
+ } else if (strncmp(icmd, "$BAT", 4) == 0) { // clear message |
|
175 |
+ char rtime[16]; |
|
176 |
+ snprintf(rtime, 16, "#BAT%d,%d\n", OswaldPowerState.charge_state, OswaldPowerState.percent); |
|
177 |
+ hal_bluetooth_send_data(rtime, strlen(rtime)); |
|
173 | 178 |
} |
174 | 179 |
} |
175 | 180 |
} |
... | ... |
@@ -16,6 +16,7 @@ |
16 | 16 |
#include "battery100_icon.xbm" |
17 | 17 |
#include "charger_icon.xbm" |
18 | 18 |
#include "bluetooth_icon.xbm" |
19 |
+#include "bluetooth_con_icon.xbm" |
|
19 | 20 |
|
20 | 21 |
|
21 | 22 |
/* sine table, per degree, factor 100 */ |
... | ... |
@@ -71,6 +72,43 @@ int16_t f_cos(int16_t v) |
71 | 72 |
return sintab[v]; |
72 | 73 |
} |
73 | 74 |
|
75 |
+void draw_status_icons(void) |
|
76 |
+{ |
|
77 |
+ static uint8_t ci = 0; |
|
78 |
+ |
|
79 |
+ if (OswaldPowerState.source) { |
|
80 |
+ oswald_draw_bitmap(81, 0, charger_icon_width, charger_icon_height, charger_icon_bits); |
|
81 |
+ |
|
82 |
+ if (OswaldPowerState.charge_state != POWER_CHARGER_DONE) { |
|
83 |
+ if (ci==0) oswald_draw_bitmap(81, 0, battery0_icon_width, battery0_icon_height, battery0_icon_bits); |
|
84 |
+ else if (ci==1) oswald_draw_bitmap(81, 0, battery25_icon_width, battery25_icon_height, battery25_icon_bits); |
|
85 |
+ else if (ci==2) oswald_draw_bitmap(81, 0, battery50_icon_width, battery50_icon_height, battery50_icon_bits); |
|
86 |
+ else if (ci==3) oswald_draw_bitmap(81, 0, battery75_icon_width, battery75_icon_height, battery75_icon_bits); |
|
87 |
+ else if (ci==4) oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits); |
|
88 |
+ ci++; |
|
89 |
+ ci %= 5; |
|
90 |
+ } else { |
|
91 |
+ oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits); |
|
92 |
+ } |
|
93 |
+ } else { |
|
94 |
+ if (OswaldPowerState.percent > 75) |
|
95 |
+ oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits); |
|
96 |
+ else if (OswaldPowerState.percent > 50) |
|
97 |
+ oswald_draw_bitmap(81, 0, battery75_icon_width, battery75_icon_height, battery75_icon_bits); |
|
98 |
+ else if (OswaldPowerState.percent > 25) |
|
99 |
+ oswald_draw_bitmap(81, 0, battery50_icon_width, battery50_icon_height, battery50_icon_bits); |
|
100 |
+ else if (OswaldPowerState.percent > 5) |
|
101 |
+ oswald_draw_bitmap(81, 0, battery25_icon_width, battery25_icon_height, battery25_icon_bits); |
|
102 |
+ else |
|
103 |
+ oswald_draw_bitmap(81, 0, battery0_icon_width, battery0_icon_height, battery0_icon_bits); |
|
104 |
+ } |
|
105 |
+ |
|
106 |
+ if (hal_bluetooth_get_state() == BLUETOOTH_ON) |
|
107 |
+ oswald_draw_bitmap(81, 0, bluetooth_icon_width, bluetooth_icon_height, bluetooth_icon_bits); |
|
108 |
+ else if (hal_bluetooth_get_state() == BLUETOOTH_CONNECTED) |
|
109 |
+ oswald_draw_bitmap(81, 0, bluetooth_con_icon_width, bluetooth_con_icon_height, bluetooth_con_icon_bits); |
|
110 |
+} |
|
111 |
+ |
|
74 | 112 |
void DrawLcdAnaClock(boolean show_seconds) |
75 | 113 |
{ |
76 | 114 |
int16_t i, x, y, x2, y2; |
... | ... |
@@ -99,40 +137,42 @@ void DrawLcdAnaClock(boolean show_seconds) |
99 | 137 |
snprintf(tstr, 16, "%02d", OswaldClk.day); |
100 | 138 |
WriteLcdString(70, 40, tstr); |
101 | 139 |
|
140 |
+ // Marker |
|
102 | 141 |
// plot(R*cos(360° * i/N), R*sin(360° * i/N)) |
103 | 142 |
for (i=0; i<12; i++) { |
104 |
- tmp = 48 + ((43 * f_cos((360 / 12) * i)) / 100); |
|
105 |
- x = tmp; |
|
106 |
- tmp = 48 + ((43 * f_sin((360 / 12) * i)) / 100); |
|
107 |
- y = tmp; |
|
108 |
- tmp = 48 + ((48 * f_cos((360 / 12) * i)) / 100); |
|
109 |
- x2 = tmp; |
|
110 |
- tmp = 48 + ((48 * f_sin((360 / 12) * i)) / 100); |
|
111 |
- y2 = tmp; |
|
143 |
+ x = 47 + ((43 * f_cos((360 / 12) * i)) / 100); |
|
144 |
+ y = 47 + ((43 * f_sin((360 / 12) * i)) / 100); |
|
145 |
+ x2 = 47 + ((47 * f_cos((360 / 12) * i)) / 100); |
|
146 |
+ y2 = 47 + ((47 * f_sin((360 / 12) * i)) / 100); |
|
112 | 147 |
DrawLcdLineBresenhamWW(x, y, x2, y2, 2); |
148 |
+ // g_printerr("br %d,%d %d,%d\n", x,y,x2,y2); |
|
113 | 149 |
}; |
114 | 150 |
|
115 | 151 |
// Hour |
116 |
- tmp = 48 + (30 * f_cos(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100); |
|
152 |
+ tmp = 47 + (30 * f_cos(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100); |
|
117 | 153 |
x = tmp; |
118 |
- tmp = 48 + (30 * f_sin(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100); |
|
154 |
+ tmp = 47 + (30 * f_sin(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100); |
|
119 | 155 |
y = tmp; |
120 |
- DrawLcdLineBresenhamWW(48, 48, x, y, 2); |
|
156 |
+ DrawLcdLineBresenhamWW(47, 47, x, y, 2); |
|
157 |
+ |
|
121 | 158 |
// Minute |
122 |
- tmp = 48 + ((40 * f_cos((360 / 60) * minute)) / 100); |
|
159 |
+ tmp = 47 + ((40 * f_cos((360 / 60) * minute)) / 100); |
|
123 | 160 |
x = tmp; |
124 |
- tmp = 48 + ((40 * f_sin((360 / 60) * minute)) / 100); |
|
161 |
+ tmp = 47 + ((40 * f_sin((360 / 60) * minute)) / 100); |
|
125 | 162 |
y = tmp; |
126 |
- DrawLcdLineBresenhamWW(48, 48, x, y, 2); |
|
163 |
+ DrawLcdLineBresenhamWW(47, 47, x, y, 2); |
|
164 |
+ |
|
127 | 165 |
if (show_seconds) { |
128 | 166 |
// Seconds |
129 |
- tmp = 48 + ((40 * f_cos((360 / 60) * seconds)) / 100); |
|
167 |
+ tmp = 47 + ((40 * f_cos((360 / 60) * seconds)) / 100); |
|
130 | 168 |
x = tmp; |
131 |
- tmp = 48 + ((40 * f_sin((360 / 60) * seconds)) / 100); |
|
169 |
+ tmp = 47 + ((40 * f_sin((360 / 60) * seconds)) / 100); |
|
132 | 170 |
y = tmp; |
133 |
- DrawLcdLineBresenham(48, 48, x, y); |
|
171 |
+ DrawLcdLineBresenham(47, 47, x, y); |
|
134 | 172 |
}; |
135 | 173 |
|
174 |
+ draw_status_icons(); |
|
175 |
+ |
|
136 | 176 |
hal_lcd_update_display(); |
137 | 177 |
} |
138 | 178 |
|
... | ... |
@@ -186,6 +226,7 @@ void DrawLcdDigitalClock(boolean show_seconds) |
186 | 226 |
snprintf(tstr, 16, "%d/%d %d", OswaldClk.month, OswaldClk.day, OswaldClk.year); |
187 | 227 |
WriteLcdString(3, 25, tstr); |
188 | 228 |
|
229 |
+#if 0 |
|
189 | 230 |
if (OswaldPowerState.source) |
190 | 231 |
oswald_draw_bitmap(81, 4, charger_icon_width, charger_icon_height, charger_icon_bits); |
191 | 232 |
|
... | ... |
@@ -203,6 +244,9 @@ void DrawLcdDigitalClock(boolean show_seconds) |
203 | 244 |
|
204 | 245 |
if (hal_bluetooth_get_state() >= BLUETOOTH_ON) |
205 | 246 |
oswald_draw_bitmap(81, 4, bluetooth_icon_width, bluetooth_icon_height, bluetooth_icon_bits); |
247 |
+#else |
|
248 |
+ draw_status_icons(); |
|
249 |
+#endif |
|
206 | 250 |
|
207 | 251 |
gRow = 0; |
208 | 252 |
gColumn = 45; |