diff options
Diffstat (limited to 'apps/plugins/clock.c')
-rw-r--r-- | apps/plugins/clock.c | 654 |
1 files changed, 333 insertions, 321 deletions
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c index 5e16415d4d..612f283e33 100644 --- a/apps/plugins/clock.c +++ b/apps/plugins/clock.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: clock.c,v 2.31 2003/12/8 | 8 | * $Id: clock.c,v 2.40 2003/12/8 |
9 | * | 9 | * |
10 | * Copyright (C) 2003 Zakk Roberts | 10 | * Copyright (C) 2003 Zakk Roberts |
11 | * | 11 | * |
@@ -20,6 +20,13 @@ | |||
20 | /***************************** | 20 | /***************************** |
21 | * RELEASE NOTES | 21 | * RELEASE NOTES |
22 | 22 | ||
23 | ***** VERSION 2.40 ** | ||
24 | -Cleaned and optimized code, -removed unused code and bitmaps, | ||
25 | -Progressbar and more animations at credits screen, -centered | ||
26 | text all over, -general settings added at ON+F3, -new arrow bitmap | ||
27 | for general settings and mode selector, -bugfix: 12:00AM is no longer | ||
28 | 00:00AM | ||
29 | |||
23 | ***** VERSION 2.31 ** | 30 | ***** VERSION 2.31 ** |
24 | Fixed credits roll - now displays all names. Features | 31 | Fixed credits roll - now displays all names. Features |
25 | improved animations. Also revised release notes. | 32 | improved animations. Also revised release notes. |
@@ -61,7 +68,7 @@ Original release, featuring analog / digital modes and a few options. | |||
61 | 68 | ||
62 | #ifdef HAVE_LCD_BITMAP | 69 | #ifdef HAVE_LCD_BITMAP |
63 | 70 | ||
64 | #define CLOCK_VERSION "2.31" | 71 | #define CLOCK_VERSION "2.40" |
65 | 72 | ||
66 | /* prototypes */ | 73 | /* prototypes */ |
67 | void show_logo(bool animate, bool show_clock_text); | 74 | void show_logo(bool animate, bool show_clock_text); |
@@ -85,11 +92,15 @@ int remaining_h=0, remaining_m=0, remaining_s=0; | |||
85 | bool editing_target = false; | 92 | bool editing_target = false; |
86 | bool display_counter = true; | 93 | bool display_counter = true; |
87 | 94 | ||
95 | /* used for centering of text all over */ | ||
96 | char buf[20]; | ||
97 | int buf_w, buf_h; | ||
98 | |||
88 | static struct plugin_api* rb; | 99 | static struct plugin_api* rb; |
89 | 100 | ||
90 | /*********************************************************** | 101 | /*********************************************************** |
91 | * Used for hands to define lengths at a given time - ANALOG | 102 | * Used for hands to define lengths at a given time - ANALOG |
92 | ***********************************************************/ | 103 | **********************************************************/ |
93 | static unsigned char xminute[] = { | 104 | static unsigned char xminute[] = { |
94 | 56,59,61,64,67,70,72,75,77,79,80,82,83,84,84,84,84,84,83,82,80,79,77,75,72,70,67,64,61,59,56,53,51,48,45,42,40,37,35,33,32,30,29,28,28,28,28,28,29,30,32,33,35,37,40,42,45,48,51,53, | 105 | 56,59,61,64,67,70,72,75,77,79,80,82,83,84,84,84,84,84,83,82,80,79,77,75,72,70,67,64,61,59,56,53,51,48,45,42,40,37,35,33,32,30,29,28,28,28,28,28,29,30,32,33,35,37,40,42,45,48,51,53, |
95 | }; | 106 | }; |
@@ -105,7 +116,7 @@ static unsigned char xhour[] = { | |||
105 | 116 | ||
106 | /************************************************************** | 117 | /************************************************************** |
107 | * Used for hands to define lengths at a give time - FULLSCREEN | 118 | * Used for hands to define lengths at a give time - FULLSCREEN |
108 | **************************************************************/ | 119 | *************************************************************/ |
109 | static unsigned char xminute_full[] = { | 120 | static unsigned char xminute_full[] = { |
110 | 56,58,61,65,69,74,79,84,91,100,110,110,110,110,110,110,110,110,110,110,110,100,91,84,79,74,69,65,61,58,56,54,51,47,43,38,33,28,21,12,1,1,1,1,1,1,1,1,1,1,1,12,21,28,33,38,43,47,51,54 | 121 | 56,58,61,65,69,74,79,84,91,100,110,110,110,110,110,110,110,110,110,110,110,100,91,84,79,74,69,65,61,58,56,54,51,47,43,38,33,28,21,12,1,1,1,1,1,1,1,1,1,1,1,12,21,28,33,38,43,47,51,54 |
111 | }; | 122 | }; |
@@ -122,9 +133,9 @@ static unsigned char yhour_full[] = { | |||
122 | /**************************** | 133 | /**************************** |
123 | * BITMAPS | 134 | * BITMAPS |
124 | ****************************/ | 135 | ****************************/ |
125 | /**************************** | 136 | /************************* |
126 | * "0" bitmap - for binary | 137 | * "0" bitmap - for binary |
127 | ****************************/ | 138 | ************************/ |
128 | static unsigned char bitmap_0[] = { | 139 | static unsigned char bitmap_0[] = { |
129 | 0xc0, 0xf0, 0x3c, 0x0e, 0x06, 0x03, 0x03, 0x03, 0x03, 0x06, 0x0e, 0x3c, 0xf0, | 140 | 0xc0, 0xf0, 0x3c, 0x0e, 0x06, 0x03, 0x03, 0x03, 0x03, 0x06, 0x0e, 0x3c, 0xf0, |
130 | 0xc0, 0x00, | 141 | 0xc0, 0x00, |
@@ -132,9 +143,9 @@ static unsigned char bitmap_0[] = { | |||
132 | 0x1f, 0x00, | 143 | 0x1f, 0x00, |
133 | 0x00, 0x00, 0x01, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x03, 0x03, 0x01, 0x00, | 144 | 0x00, 0x00, 0x01, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x03, 0x03, 0x01, 0x00, |
134 | 0x00, 0x00 }; | 145 | 0x00, 0x00 }; |
135 | /**************************** | 146 | /************************* |
136 | * "1" bitmap - for binary | 147 | * "1" bitmap - for binary |
137 | ****************************/ | 148 | ************************/ |
138 | static unsigned char bitmap_1[] = { | 149 | static unsigned char bitmap_1[] = { |
139 | 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | 150 | 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, |
140 | 0x00, 0x00, | 151 | 0x00, 0x00, |
@@ -144,170 +155,21 @@ static unsigned char bitmap_1[] = { | |||
144 | 0x06, 0x00 }; | 155 | 0x06, 0x00 }; |
145 | /**************************** | 156 | /**************************** |
146 | * PM indicator (moon + text) | 157 | * PM indicator (moon + text) |
147 | ****************************/ | 158 | ***************************/ |
148 | static unsigned char pm[] = { 0xFF,0xFF,0x33,0x33,0x33,0x1E,0x0C,0x00,0xFF,0xFF,0x06,0x0C,0x06,0xFF,0xFF }; | 159 | static unsigned char pm[] = { 0xFF,0xFF,0x33,0x33,0x33,0x1E,0x0C,0x00,0xFF,0xFF,0x06,0x0C,0x06,0xFF,0xFF }; |
149 | /**************************** | 160 | /**************************** |
150 | * AM Indicator (sun and text | 161 | * AM Indicator (sun and text |
151 | ****************************/ | 162 | ***************************/ |
152 | static unsigned char am[] = { 0xFE,0xFF,0x1B,0x1B,0xFF,0xFE,0x00,0x00,0xFF,0xFF,0x06,0x0C,0x06,0xFF,0xFF }; | 163 | static unsigned char am[] = { 0xFE,0xFF,0x1B,0x1B,0xFF,0xFE,0x00,0x00,0xFF,0xFF,0x06,0x0C,0x06,0xFF,0xFF }; |
153 | 164 | /************** | |
154 | /***************************************** | 165 | * Arrow bitmap |
155 | * We've got 4 different clock logos... | 166 | *************/ |
156 | * The currently used one is #4, | 167 | static unsigned char arrow[] = { 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x1E, 0x0C }; |
157 | * "clockbox" -- the others are kept here | 168 | |
158 | * in case the logo selector is ever | 169 | /************************************ |
159 | * brought back or we want to switch.. | 170 | * "Clockbox" clock logo - by Adam S. |
160 | ****************************************/ | 171 | ***********************************/ |
161 | /* Logo #1 - Standard (by Zakk Roberts) */ | 172 | const unsigned char clocklogo[] = { |
162 | const unsigned char clocklogo_1[] = { | ||
163 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
164 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
165 | 0x00, 0xe0, 0xf8, 0xfc, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
166 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
167 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
168 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
169 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, | ||
170 | 0xf8, 0xfc, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
171 | 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xc0, 0x00, | ||
172 | 0x80, 0xe0, 0xf0, 0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, | ||
173 | 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x3e, 0x3e, 0x3e, 0x1e, 0x0e, 0x00, 0x00, | ||
174 | 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf0, | ||
175 | 0xf8, 0xfc, 0xfc, 0x7e, 0x3e, 0x3e, 0x3e, 0x3e, 0xbe, 0xbe, 0x3e, 0x3e, 0x3e, | ||
176 | 0x3e, 0x7e, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x80, 0xe0, | ||
177 | 0xf0, 0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, | ||
178 | 0x7e, 0x7e, 0x7e, 0x7e, 0x3e, 0x3e, 0x3e, 0x1e, 0x0e, 0x00, 0x00, 0x00, 0xff, | ||
179 | 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, | ||
180 | 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x00, | ||
181 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
183 | 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, | ||
184 | 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x3f, 0xc0, 0xc0, 0xc0, | ||
185 | 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
186 | 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
187 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
188 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xc7, 0x83, 0x01, | ||
189 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
190 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, | ||
191 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
192 | 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, | ||
193 | 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, | ||
194 | 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
195 | 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, | ||
196 | 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
197 | 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, | ||
198 | 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, | ||
199 | 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, | ||
200 | 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e, 0x1c, 0x00, 0x00, | ||
201 | 0x00, 0x1f, 0x1f, 0x1f, 0x0f, 0x07, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x1f, | ||
202 | 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, | ||
203 | 0x1f, 0x1f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, | ||
204 | 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, | ||
205 | 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e, 0x1c, 0x00, 0x00, 0x00, 0x1f, | ||
206 | 0x1f, 0x1f, 0x0f, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
207 | 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f | ||
208 | }; | ||
209 | |||
210 | /* Logo #2 - Digital Segments (by Zakk Roberts) */ | ||
211 | const unsigned char clocklogo_2[] = { | ||
212 | 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfd, 0xfb, 0xf7, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, | ||
213 | 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, | ||
214 | 0xfe, 0xfc, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
215 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfd, 0xfb, 0xf7, | ||
216 | 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xf7, 0xfb, | ||
217 | 0xfd, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0xfd, 0xfb, 0xf7, 0x0f, 0x0f, 0x0f, 0x0f, | ||
218 | 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, | ||
219 | 0x00, 0xfe, 0xfc, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | ||
220 | 0xe0, 0xf0, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, | ||
221 | 0x00, 0x00, 0x00, 0x00, 0xbf, 0x1f, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
222 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
223 | 0xbf, 0x1f, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
224 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x1f, 0x0f, 0x07, | ||
225 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0f, | ||
226 | 0x1f, 0xbf, 0x00, 0x00, 0x00, 0xbf, 0x1f, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, | ||
227 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
228 | 0x00, 0xbf, 0x5f, 0xef, 0xf7, 0xf0, 0xf0, 0xf0, 0xe0, 0x40, 0x00, 0x06, 0x07, | ||
229 | 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
230 | 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
231 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
232 | 0xff, 0xff, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xfc, | ||
234 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, | ||
235 | 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, | ||
236 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
237 | 0x00, 0xff, 0xff, 0xfe, 0xfd, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x3c, | ||
238 | 0xfc, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
239 | 0xc0, 0x00, 0x40, 0x40, 0x4f, 0x17, 0x1b, 0xdd, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, | ||
240 | 0x1e, 0x1e, 0x1e, 0xde, 0x1e, 0x5e, 0x5c, 0x58, 0x10, 0xc0, 0x00, 0x00, 0xc0, | ||
241 | 0x0f, 0x57, 0x5b, 0x5d, 0x1e, 0x1e, 0x1e, 0x1e, 0xde, 0x1e, 0x1e, 0x1e, 0x9e, | ||
242 | 0x1e, 0x1e, 0x1c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xd7, 0x1b, 0x5d, | ||
243 | 0x5e, 0x5e, 0x1e, 0xde, 0x1e, 0x1e, 0xde, 0x1e, 0x5e, 0x5e, 0x5e, 0x1d, 0xdb, | ||
244 | 0x17, 0x0f, 0xc0, 0x00, 0x40, 0x4f, 0x57, 0x1b, 0x1d, 0x1e, 0x1e, 0xde, 0x1e, | ||
245 | 0x1e, 0x1e, 0x9e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1c, 0x18, 0x10, 0x00, 0x00, 0x00, | ||
246 | 0x00, 0x0f, 0x07, 0x03, 0x01, 0x40, 0x40, 0x40, 0x00, 0xc0, 0x00, 0x00, 0x00, | ||
247 | 0x00, 0xc1, 0x01, 0x41, 0x40, 0x40, 0x00, 0xc0, | ||
248 | 0x1d, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x1d, 0x00, 0x10, 0x10, 0x10, 0x00, | ||
249 | 0x00, 0x00, 0x00, 0x1d, 0x00, 0x10, 0x10, 0x10, 0x00, 0x1d, 0x00, 0x00, 0x1d, | ||
250 | 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x02, 0x00, 0x0d, | ||
251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x02, | ||
252 | 0x00, 0x02, 0x05, 0x18, 0x00, 0x00, 0x1d, 0x00, 0x10, 0x10, 0x10, 0x00, 0x1d, | ||
253 | 0x00, 0x00, 0x1d, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, | ||
254 | 0x02, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
255 | 0x00, 0x00, 0x00, 0x1c, 0x00, 0x12, 0x10, 0x12, 0x00, 0x01, 0x00, 0x10, 0x10, | ||
256 | 0x00, 0x1d, 0x00, 0x14, 0x10, 0x11, 0x00, 0x1d | ||
257 | }; | ||
258 | |||
259 | /* Logo #3 - Electroplate (by Adam S. & Zakk Roberts) | ||
260 | * Definition: (N) any artifact that has been plated with a thin coat of metal by electrolysis */ | ||
261 | const unsigned char clocklogo_3[] = { | ||
262 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
263 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0xfc, | ||
264 | 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x5c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
265 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xf8, | ||
266 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
267 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
268 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x1c, 0x3c, 0xfc, 0xfc, 0xfc, | ||
269 | 0xfc, 0xf8, 0xe8, 0xb8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
270 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
271 | 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0, 0xb0, | ||
272 | 0xf0, 0xd0, 0x70, 0x50, 0x70, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
273 | 0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
274 | 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf8, 0xff, 0xff, 0xff, | ||
275 | 0xf8, 0xf0, 0xf0, 0xf0, 0xa0, 0xe0, 0x40, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, | ||
276 | 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0x70, 0xf0, | ||
277 | 0xb0, 0xf0, 0x70, 0x70, 0x70, 0x60, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, | ||
278 | 0xff, 0xff, 0xff, 0xaa, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, | ||
279 | 0xe0, 0xe0, 0x60, 0xe0, 0x20, 0x00, 0x00, 0x00, | ||
280 | 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xfb, 0x0e, 0x01, 0x00, | ||
281 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
282 | 0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xfe, | ||
283 | 0xff, 0xff, 0xff, 0xff, 0xff, 0x6b, 0x0f, 0x02, 0x01, 0x00, 0xff, 0xff, 0xff, | ||
284 | 0xe0, 0xe0, 0xe1, 0xe3, 0xef, 0xff, 0xff, 0xff, 0xfd, 0xf6, 0xf8, 0xe0, 0xe0, | ||
285 | 0xc0, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xfd, 0x0f, 0x01, 0x00, | ||
286 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, | ||
287 | 0xff, 0xff, 0xff, 0xaa, 0xff, 0xf8, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0x5f, 0xf7, | ||
288 | 0x3f, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
289 | 0x00, 0x00, 0x03, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xfe, 0xfb, 0xee, 0xf8, 0xd0, | ||
290 | 0xe0, 0xa0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, | ||
291 | 0xff, 0xff, 0xff, 0xff, 0x7f, 0xd5, 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, | ||
292 | 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xfd, 0xf6, 0xf8, 0xf0, 0xf0, 0xf0, 0xf1, 0xf1, | ||
293 | 0xf1, 0xf1, 0xf1, 0xb9, 0xfd, 0x5f, 0x7f, 0x2f, 0x3f, 0x0b, 0x07, 0x01, 0x01, | ||
294 | 0x00, 0x00, 0x03, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xfe, 0xfb, 0xee, 0xf8, 0xd0, | ||
295 | 0xe0, 0xe0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, | ||
296 | 0xff, 0x7f, 0xff, 0xaa, 0x7f, 0x03, 0x03, 0x0f, 0x3f, 0x7f, 0x7f, 0xff, 0xfd, | ||
297 | 0xf6, 0xfc, 0xd8, 0xe0, 0x40, 0x00, 0x00, 0x00, | ||
298 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, | ||
299 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
300 | 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
302 | 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
303 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, | ||
304 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
305 | 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
306 | 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
307 | }; | ||
308 | |||
309 | /* Logo #4 - "Clockbox" (by Adam S.) */ | ||
310 | const unsigned char clocklogo_4[] = { | ||
311 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, | 173 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, |
312 | 0x78, 0x78, 0x3c, 0x3c, 0xfc, 0xfc, 0xfc, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, | 174 | 0x78, 0x78, 0x3c, 0x3c, 0xfc, 0xfc, 0xfc, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, |
313 | 0x1e, 0x3c, 0x3c, 0x3c, 0x7c, 0x7c, 0xf8, 0xf8, 0xf0, 0x30, 0x00, 0x00, 0x00, | 175 | 0x1e, 0x3c, 0x3c, 0x3c, 0x7c, 0x7c, 0xf8, 0xf8, 0xf0, 0x30, 0x00, 0x00, 0x00, |
@@ -352,8 +214,7 @@ const unsigned char clocklogo_4[] = { | |||
352 | 0x0f, 0x1f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1c, 0x1e, 0x1f, 0x0f, 0x07, 0x07, 0x01, | 214 | 0x0f, 0x1f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1c, 0x1e, 0x1f, 0x0f, 0x07, 0x07, 0x01, |
353 | 0x00, 0x00, 0x00, 0x10, 0x1c, 0x1e, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x01, 0x07, | 215 | 0x00, 0x00, 0x00, 0x10, 0x1c, 0x1e, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x01, 0x07, |
354 | 0x1f, 0x1f, 0x1f, 0x1c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 216 | 0x1f, 0x1f, 0x1f, 0x1c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
355 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 217 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
356 | }; | ||
357 | 218 | ||
358 | /****************** | 219 | /****************** |
359 | * Time's Up bitmap | 220 | * Time's Up bitmap |
@@ -421,8 +282,7 @@ const unsigned char timesup[] = { | |||
421 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 282 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
422 | 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 283 | 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
423 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 284 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
424 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 285 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
425 | }; | ||
426 | 286 | ||
427 | /* settings saved to this location */ | 287 | /* settings saved to this location */ |
428 | static char default_filename[] = "/.rockbox/rocks/.clock_settings"; | 288 | static char default_filename[] = "/.rockbox/rocks/.clock_settings"; |
@@ -460,7 +320,6 @@ char* jobs[] = { | |||
460 | }; | 320 | }; |
461 | 321 | ||
462 | bool done = false; /* This bool is used for most of the while loops */ | 322 | bool done = false; /* This bool is used for most of the while loops */ |
463 | int logo = 4; /* must be set before we show the logo */ | ||
464 | 323 | ||
465 | /*********************************** | 324 | /*********************************** |
466 | * This is saved to default_filename | 325 | * This is saved to default_filename |
@@ -538,8 +397,10 @@ void save_settings(void) | |||
538 | rb->lcd_clear_display(); | 397 | rb->lcd_clear_display(); |
539 | 398 | ||
540 | /* display information */ | 399 | /* display information */ |
400 | rb->snprintf(buf, sizeof(buf), "Saving Settings"); | ||
401 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
402 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
541 | show_logo(true, true); | 403 | show_logo(true, true); |
542 | rb->lcd_puts(0, 7, "Saving..."); | ||
543 | 404 | ||
544 | rb->lcd_update(); | 405 | rb->lcd_update(); |
545 | 406 | ||
@@ -550,10 +411,19 @@ void save_settings(void) | |||
550 | { | 411 | { |
551 | rb->write (fd, &settings, sizeof(struct saved_settings)); | 412 | rb->write (fd, &settings, sizeof(struct saved_settings)); |
552 | rb->close(fd); | 413 | rb->close(fd); |
553 | rb->lcd_puts(0, 7, "Save Succeeded"); | 414 | |
415 | rb->lcd_clearrect(0, 56, 112, 8); | ||
416 | rb->snprintf(buf, sizeof(buf), "Saved Settings"); | ||
417 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
418 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
554 | } | 419 | } |
555 | else | 420 | else |
556 | rb->lcd_puts(0, 7, "Save Failed"); | 421 | { |
422 | rb->lcd_clearrect(0, 56, 112, 8); | ||
423 | rb->snprintf(buf, sizeof(buf), "Save Failed"); | ||
424 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
425 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
426 | } | ||
557 | 427 | ||
558 | rb->lcd_update(); | 428 | rb->lcd_update(); |
559 | 429 | ||
@@ -573,35 +443,57 @@ void load_settings(void) | |||
573 | 443 | ||
574 | rb->lcd_setfont(FONT_SYSFIXED); | 444 | rb->lcd_setfont(FONT_SYSFIXED); |
575 | 445 | ||
576 | rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION); | 446 | rb->snprintf(buf, sizeof(buf), "Clock %s", CLOCK_VERSION); |
447 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
448 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); | ||
449 | |||
450 | rb->snprintf(buf, sizeof(buf), "Loading Settings"); | ||
451 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
452 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
453 | show_logo(true, true); | ||
454 | rb->lcd_update(); | ||
577 | 455 | ||
578 | if(fd >= 0) /* does file exist? */ | 456 | if(fd >= 0) /* does file exist? */ |
579 | { | 457 | { |
580 | if(rb->filesize(fd) == sizeof(struct saved_settings)) /* if so, is it the right size? */ | 458 | if(rb->filesize(fd) == sizeof(struct saved_settings)) /* if so, is it the right size? */ |
581 | { | 459 | { |
582 | rb->lcd_puts(0, 7, "Loading..."); | ||
583 | rb->read(fd, &settings, sizeof(struct saved_settings)); | 460 | rb->read(fd, &settings, sizeof(struct saved_settings)); |
584 | rb->close(fd); | 461 | rb->close(fd); |
585 | show_logo(true, true); | 462 | |
586 | rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION); | 463 | rb->lcd_clearrect(0, 56, 112, 8); |
587 | rb->lcd_puts(0, 7, "Loaded settings"); | 464 | rb->snprintf(buf, sizeof(buf), "Loaded Settings"); |
465 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
466 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
588 | } | 467 | } |
589 | else /* bail out */ | 468 | else /* bail out */ |
590 | { | 469 | { |
591 | rb->lcd_puts(0, 7, "Old settings file"); | 470 | rb->lcd_clearrect(0, 56, 112, 8); |
471 | rb->snprintf(buf, sizeof(buf), "Old Settings File"); | ||
472 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
473 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
592 | reset_settings(); | 474 | reset_settings(); |
593 | } | 475 | } |
594 | } | 476 | } |
595 | else /* bail out */ | 477 | else /* bail out */ |
596 | { | 478 | { |
597 | rb->lcd_puts(0, 7, "Can't find settings"); | 479 | rb->lcd_clearrect(0, 56, 112, 8); |
480 | rb->snprintf(buf, sizeof(buf), "No Settings File"); | ||
481 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
482 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
483 | |||
484 | /* use the default in this case */ | ||
598 | reset_settings(); | 485 | reset_settings(); |
599 | } | 486 | } |
600 | 487 | ||
601 | rb->lcd_update(); | 488 | rb->lcd_update(); |
602 | 489 | ||
490 | #ifndef SIMULATOR | ||
491 | rb->ata_sleep(); | ||
492 | #endif | ||
493 | |||
603 | rb->sleep(HZ*2); | 494 | rb->sleep(HZ*2); |
604 | 495 | ||
496 | /* make the logo fly out */ | ||
605 | exit_logo(); | 497 | exit_logo(); |
606 | } | 498 | } |
607 | 499 | ||
@@ -811,7 +703,7 @@ bool colon, bool lcd) | |||
811 | { | 703 | { |
812 | int xpos = x; | 704 | int xpos = x; |
813 | 705 | ||
814 | /* Draw PM indicator */ | 706 | /* Draw AM/PM indicator */ |
815 | if(settings.clock == 2) | 707 | if(settings.clock == 2) |
816 | { | 708 | { |
817 | if(settings.digital_12h) | 709 | if(settings.digital_12h) |
@@ -837,14 +729,22 @@ bool colon, bool lcd) | |||
837 | if(settings.clock == 2) | 729 | if(settings.clock == 2) |
838 | { | 730 | { |
839 | if(settings.digital_12h) | 731 | if(settings.digital_12h) |
732 | { | ||
840 | if(hour > 12) | 733 | if(hour > 12) |
841 | hour -= 12; | 734 | hour -= 12; |
735 | if(hour == 0) | ||
736 | hour = 12; | ||
737 | } | ||
842 | } | 738 | } |
843 | else | 739 | else |
844 | { | 740 | { |
845 | if(settings.lcd_12h) | 741 | if(settings.lcd_12h) |
742 | { | ||
846 | if(hour > 12) | 743 | if(hour > 12) |
847 | hour -= 12; | 744 | hour -= 12; |
745 | if(hour == 0) | ||
746 | hour = 12; | ||
747 | } | ||
848 | } | 748 | } |
849 | 749 | ||
850 | draw_7seg_digit(hour / 10, xpos, y, width, height, lcd); | 750 | draw_7seg_digit(hour / 10, xpos, y, width, height, lcd); |
@@ -1043,48 +943,53 @@ void binary(int hour, int minute, int second) | |||
1043 | ***************/ | 943 | ***************/ |
1044 | void show_logo(bool animate, bool show_clock_text) | 944 | void show_logo(bool animate, bool show_clock_text) |
1045 | { | 945 | { |
1046 | int x_position; | 946 | int y_position; |
1047 | 947 | ||
1048 | unsigned char *clogo = 0; | 948 | unsigned char *clogo = 0; |
1049 | clogo = (unsigned char *)clocklogo_4; | 949 | clogo = (unsigned char *)clocklogo; |
950 | |||
951 | rb->snprintf(buf, sizeof(buf), "Clock %s", CLOCK_VERSION); | ||
952 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
1050 | 953 | ||
1051 | /* animate logo */ | 954 | /* animate logo */ |
1052 | if(animate) | 955 | if(animate) |
1053 | { | 956 | { |
1054 | /* move down the screen */ | 957 | /* move down the screen */ |
1055 | for(x_position = 0; x_position <= 25; x_position++) | 958 | for(y_position = 0; y_position <= 25; y_position++) |
1056 | { | 959 | { |
1057 | rb->lcd_clearline(0, x_position/2-1, 111, x_position/2-1); | 960 | rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); |
1058 | rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38); | 961 | rb->lcd_clearline(0, y_position/2+38, 111, y_position/2+38); |
1059 | rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true); | 962 | rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); |
1060 | if(show_clock_text) | 963 | if(show_clock_text) |
1061 | rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION); | 964 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); |
1062 | rb->lcd_update(); | 965 | rb->lcd_update(); |
1063 | } | 966 | } |
1064 | /* bounce back up a little */ | 967 | /* bounce back up a little */ |
1065 | for(x_position = 25; x_position >= 18; x_position--) | 968 | for(y_position = 25; y_position >= 18; y_position--) |
1066 | { | 969 | { |
1067 | rb->lcd_clearline(0, x_position/2-1, 111, x_position/2-1); | 970 | rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); |
1068 | rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38); | 971 | rb->lcd_clearline(0, y_position/2+38, 111, y_position/2+38); |
1069 | rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true); | 972 | rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); |
1070 | if(show_clock_text) | 973 | if(show_clock_text) |
1071 | rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION); | 974 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); |
1072 | rb->lcd_update(); | 975 | rb->lcd_update(); |
1073 | } | 976 | } |
1074 | /* and go back down again */ | 977 | /* and go back down again */ |
1075 | for(x_position = 18; x_position <= 20; x_position++) | 978 | for(y_position = 18; y_position <= 20; y_position++) |
1076 | { | 979 | { |
1077 | rb->lcd_clearline(0, x_position/2-1, 111, x_position/2-1); | 980 | rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); |
1078 | rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38); | 981 | rb->lcd_clearline(0, y_position/2+38, 111, y_position/2+38); |
1079 | rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true); | 982 | rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); |
1080 | if(show_clock_text) | 983 | if(show_clock_text) |
1081 | rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION); | 984 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); |
1082 | rb->lcd_update(); | 985 | rb->lcd_update(); |
1083 | } | 986 | } |
1084 | } | 987 | } |
1085 | else /* don't animate, just show */ | 988 | else /* don't animate, just show */ |
1086 | { | 989 | { |
1087 | rb->lcd_bitmap(clogo, 0, 10, 112, 37, true); | 990 | rb->lcd_bitmap(clogo, 0, 10, 112, 37, true); |
991 | if(show_clock_text) | ||
992 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); | ||
1088 | rb->lcd_update(); | 993 | rb->lcd_update(); |
1089 | } | 994 | } |
1090 | } | 995 | } |
@@ -1094,28 +999,28 @@ void show_logo(bool animate, bool show_clock_text) | |||
1094 | *******************/ | 999 | *******************/ |
1095 | void exit_logo(void) | 1000 | void exit_logo(void) |
1096 | { | 1001 | { |
1097 | int x_position; | 1002 | int y_position; |
1098 | 1003 | ||
1099 | unsigned char *clogo = 0; | 1004 | unsigned char *clogo = 0; |
1100 | clogo = (unsigned char *)clocklogo_4; | 1005 | clogo = (unsigned char *)clocklogo; |
1101 | 1006 | ||
1102 | /* fly downwards */ | 1007 | /* fly downwards */ |
1103 | for(x_position = 20; x_position <= 128; x_position++) | 1008 | for(y_position = 20; y_position <= 128; y_position++) |
1104 | { | 1009 | { |
1105 | rb->lcd_clearline(0, x_position/2-1, 111, x_position/2-1); | 1010 | rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); |
1106 | rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true); | 1011 | rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); |
1107 | rb->lcd_update(); | 1012 | rb->lcd_update(); |
1108 | } | 1013 | } |
1109 | } | 1014 | } |
1110 | 1015 | ||
1111 | /******************** | 1016 | /******************* |
1112 | * Rolls the credits | 1017 | * Rolls the credits |
1113 | ********************/ | 1018 | ******************/ |
1114 | /* The following function is pretty confusing, so | 1019 | /* The following function is pretty confusing, so |
1115 | * it's extra well commented. */ | 1020 | * it's extra well commented. */ |
1116 | bool roll_credits(void) | 1021 | bool roll_credits(void) |
1117 | { | 1022 | { |
1118 | int j, namepos, jobpos; /* namepos/jobpos are x coords for strings of text */ | 1023 | int j=0, namepos, jobpos; /* namepos/jobpos are x coords for strings of text */ |
1119 | int btn; | 1024 | int btn; |
1120 | int numnames = 12; /* amount of people in the credits array */ | 1025 | int numnames = 12; /* amount of people in the credits array */ |
1121 | int pause; | 1026 | int pause; |
@@ -1125,10 +1030,33 @@ bool roll_credits(void) | |||
1125 | char job[15]; | 1030 | char job[15]; |
1126 | int name_w, name_h; | 1031 | int name_w, name_h; |
1127 | int job_w, job_h; | 1032 | int job_w, job_h; |
1033 | int credits_w, credits_h, credits_pos; | ||
1034 | int progress_pos, progress_percent=0; | ||
1128 | 1035 | ||
1129 | /* Shows "[Credits] X/X" */ | 1036 | /* shows "[Credits] XX/XX" */ |
1130 | char elapsednames[16]; | 1037 | char elapsednames[16]; |
1131 | 1038 | ||
1039 | /* put text into variable, and save the width and height of the text */ | ||
1040 | rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", j+1, numnames); | ||
1041 | rb->lcd_getstringsize(elapsednames, &credits_w, &credits_h); | ||
1042 | |||
1043 | /* fly in text from the left */ | ||
1044 | for(credits_pos = 0 - credits_w; credits_pos <= (LCD_WIDTH/2)-(credits_w/2); credits_pos++) | ||
1045 | { | ||
1046 | rb->lcd_clearline(credits_pos-1, 0, credits_pos-1, 8); | ||
1047 | rb->lcd_putsxy(credits_pos, 0, elapsednames); | ||
1048 | rb->lcd_update(); /* update the whole lcd to slow down the loop */ | ||
1049 | } | ||
1050 | |||
1051 | /* unfold progressbar from the right */ | ||
1052 | for(progress_pos = LCD_WIDTH; progress_pos >= 40; progress_pos--) | ||
1053 | { | ||
1054 | rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); | ||
1055 | rb->lcd_clearline(0, 0, 0, 30); | ||
1056 | rb->lcd_update(); /* update the whole lcd to slow down the loop */ | ||
1057 | } | ||
1058 | |||
1059 | /* now roll the credits */ | ||
1132 | for(j=0; j < numnames; j++) | 1060 | for(j=0; j < numnames; j++) |
1133 | { | 1061 | { |
1134 | rb->lcd_clear_display(); | 1062 | rb->lcd_clear_display(); |
@@ -1136,7 +1064,7 @@ bool roll_credits(void) | |||
1136 | show_logo(false, false); | 1064 | show_logo(false, false); |
1137 | 1065 | ||
1138 | rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", j+1, numnames); | 1066 | rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", j+1, numnames); |
1139 | rb->lcd_puts(0, 0, elapsednames); | 1067 | rb->lcd_putsxy(credits_pos-1, 0, elapsednames); |
1140 | 1068 | ||
1141 | /* used to center the text */ | 1069 | /* used to center the text */ |
1142 | rb->snprintf(name, sizeof(name), "%s", credits[j]); | 1070 | rb->snprintf(name, sizeof(name), "%s", credits[j]); |
@@ -1144,6 +1072,8 @@ bool roll_credits(void) | |||
1144 | rb->lcd_getstringsize(name, &name_w, &name_h); | 1072 | rb->lcd_getstringsize(name, &name_w, &name_h); |
1145 | rb->lcd_getstringsize(job, &job_w, &job_h); | 1073 | rb->lcd_getstringsize(job, &job_w, &job_h); |
1146 | 1074 | ||
1075 | rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); | ||
1076 | |||
1147 | /* line 1 flies in */ | 1077 | /* line 1 flies in */ |
1148 | for (namepos=0-name_w; namepos < (LCD_WIDTH/2)-(name_w/2)-2; namepos++) | 1078 | for (namepos=0-name_w; namepos < (LCD_WIDTH/2)-(name_w/2)-2; namepos++) |
1149 | { | 1079 | { |
@@ -1157,6 +1087,10 @@ bool roll_credits(void) | |||
1157 | return false; | 1087 | return false; |
1158 | } | 1088 | } |
1159 | 1089 | ||
1090 | progress_percent++; | ||
1091 | rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); | ||
1092 | rb->lcd_update_rect(progress_pos, 8, 112-progress_pos, 8); | ||
1093 | |||
1160 | /* now line 2 flies in */ | 1094 | /* now line 2 flies in */ |
1161 | for(jobpos=LCD_WIDTH; jobpos > (LCD_WIDTH/2)-(job_w+2)/2; jobpos--) /* we use (job_w+2) to ensure it fits on the LCD */ | 1095 | for(jobpos=LCD_WIDTH; jobpos > (LCD_WIDTH/2)-(job_w+2)/2; jobpos--) /* we use (job_w+2) to ensure it fits on the LCD */ |
1162 | { | 1096 | { |
@@ -1170,6 +1104,10 @@ bool roll_credits(void) | |||
1170 | return false; | 1104 | return false; |
1171 | } | 1105 | } |
1172 | 1106 | ||
1107 | progress_percent++; | ||
1108 | rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); | ||
1109 | rb->lcd_update_rect(progress_pos, 8, 112-progress_pos, 8); | ||
1110 | |||
1173 | /* pause (2s) and scan for button presses */ | 1111 | /* pause (2s) and scan for button presses */ |
1174 | for (pause = 0; pause < 10; pause++) | 1112 | for (pause = 0; pause < 10; pause++) |
1175 | { | 1113 | { |
@@ -1188,6 +1126,10 @@ bool roll_credits(void) | |||
1188 | return false; | 1126 | return false; |
1189 | } | 1127 | } |
1190 | 1128 | ||
1129 | progress_percent++; | ||
1130 | rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); | ||
1131 | rb->lcd_update_rect(progress_pos, 8, 112-progress_pos, 8); | ||
1132 | |||
1191 | /* fly out both lines at same time */ | 1133 | /* fly out both lines at same time */ |
1192 | namepos=((LCD_WIDTH/2)-(name_w/2))+8; | 1134 | namepos=((LCD_WIDTH/2)-(name_w/2))+8; |
1193 | jobpos=((LCD_WIDTH/2)-(job_w+2)/2)-8; | 1135 | jobpos=((LCD_WIDTH/2)-(job_w+2)/2)-8; |
@@ -1207,6 +1149,9 @@ bool roll_credits(void) | |||
1207 | jobpos--; | 1149 | jobpos--; |
1208 | } | 1150 | } |
1209 | 1151 | ||
1152 | progress_percent++; | ||
1153 | rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); | ||
1154 | |||
1210 | /* pause (.2s) */ | 1155 | /* pause (.2s) */ |
1211 | rb->sleep(HZ/2); | 1156 | rb->sleep(HZ/2); |
1212 | 1157 | ||
@@ -1215,6 +1160,23 @@ bool roll_credits(void) | |||
1215 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | 1160 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) |
1216 | return false; | 1161 | return false; |
1217 | } | 1162 | } |
1163 | |||
1164 | /* now make the text exit to the right */ | ||
1165 | for(credits_pos = (LCD_WIDTH/2)-(credits_w/2); credits_pos <= 112; credits_pos++) | ||
1166 | { | ||
1167 | rb->lcd_clearline(credits_pos-1, 0, credits_pos-1, 8); | ||
1168 | rb->lcd_putsxy(credits_pos, 0, elapsednames); | ||
1169 | rb->lcd_update(); | ||
1170 | } | ||
1171 | |||
1172 | /* fold progressbar in to the right */ | ||
1173 | for(progress_pos = 42; progress_pos < 112; progress_pos++) | ||
1174 | { | ||
1175 | rb->lcd_clearline(progress_pos-1, 8, progress_pos-1, 16); | ||
1176 | rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); | ||
1177 | rb->lcd_update(); /* update the whole lcd to slow down the loop */ | ||
1178 | } | ||
1179 | |||
1218 | exit_logo(); | 1180 | exit_logo(); |
1219 | 1181 | ||
1220 | return true; | 1182 | return true; |
@@ -1230,7 +1192,9 @@ bool show_credits(void) | |||
1230 | 1192 | ||
1231 | rb->lcd_clear_display(); | 1193 | rb->lcd_clear_display(); |
1232 | 1194 | ||
1233 | rb->lcd_puts(0, 7, "Credit Roll..."); | 1195 | rb->snprintf(buf, sizeof(buf), "Credits"); |
1196 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
1197 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
1234 | 1198 | ||
1235 | /* show the logo with an animation and the clock version text */ | 1199 | /* show the logo with an animation and the clock version text */ |
1236 | show_logo(true, true); | 1200 | show_logo(true, true); |
@@ -1292,10 +1256,10 @@ bool f1_screen(void) | |||
1292 | rb->lcd_puts(0, 0, "At any mode, [F3]"); | 1256 | rb->lcd_puts(0, 0, "At any mode, [F3]"); |
1293 | rb->lcd_puts(0, 1, "opens the Options"); | 1257 | rb->lcd_puts(0, 1, "opens the Options"); |
1294 | rb->lcd_puts(0, 2, "screen. In Options"); | 1258 | rb->lcd_puts(0, 2, "screen. In Options"); |
1295 | rb->lcd_puts(0, 3, "move the cursor"); | 1259 | rb->lcd_puts(0, 3, "use UP/DN to move"); |
1296 | rb->lcd_puts(0, 4, "with UP/DOWN and"); | 1260 | rb->lcd_puts(0, 4, "and PLAY to toggle."); |
1297 | rb->lcd_puts(0, 5, "use PLAY to toggle"); | 1261 | rb->lcd_puts(0, 5, "[ON+F3] shows you"); |
1298 | rb->lcd_puts(0, 6, "selected option."); | 1262 | rb->lcd_puts(0, 6, "General Settings."); |
1299 | rb->lcd_puts(0, 7, "<< BACK 3/9 NEXT >>"); | 1263 | rb->lcd_puts(0, 7, "<< BACK 3/9 NEXT >>"); |
1300 | } | 1264 | } |
1301 | else if(screen == 4) | 1265 | else if(screen == 4) |
@@ -1393,76 +1357,6 @@ bool f1_screen(void) | |||
1393 | return true; | 1357 | return true; |
1394 | } | 1358 | } |
1395 | 1359 | ||
1396 | /************************* | ||
1397 | * F2 Screen - Pick a Logo | ||
1398 | * [[ NO LONGER USED ]] | ||
1399 | ************************/ | ||
1400 | void f2_screen(void) | ||
1401 | { | ||
1402 | rb->lcd_clear_display(); | ||
1403 | rb->splash(HZ, true, "LEFT/RIGHT to choose logo"); | ||
1404 | rb->lcd_update(); | ||
1405 | rb->lcd_clear_display(); | ||
1406 | rb->splash(HZ, true, "F2 to select and exit"); | ||
1407 | rb->lcd_update(); | ||
1408 | rb->lcd_clear_display(); | ||
1409 | |||
1410 | /* let's make sure that the logo isn't invalid */ | ||
1411 | if(logo > 4) | ||
1412 | logo = 1; | ||
1413 | |||
1414 | done = false; | ||
1415 | |||
1416 | while(!done) | ||
1417 | { | ||
1418 | show_logo(false, false); | ||
1419 | |||
1420 | rb->lcd_clearrect(0, 48, 112, 16); | ||
1421 | |||
1422 | if(logo == 1) | ||
1423 | { | ||
1424 | rb->lcd_puts(0, 0, "1) 'Default'"); | ||
1425 | rb->lcd_puts(0, 6, "By Zakk Roberts"); | ||
1426 | } | ||
1427 | else if(logo == 2) | ||
1428 | { | ||
1429 | rb->lcd_puts(0, 0, "2) 'Digital'"); | ||
1430 | rb->lcd_puts(0, 6, "By Zakk Roberts"); | ||
1431 | } | ||
1432 | else if(logo == 3) | ||
1433 | { | ||
1434 | rb->lcd_puts(0, 0, "3) 'Electroplate'"); | ||
1435 | rb->lcd_puts(0, 6, "By Adam S. and"); | ||
1436 | rb->lcd_puts(0, 7, "Zakk Roberts"); | ||
1437 | } | ||
1438 | else | ||
1439 | { | ||
1440 | rb->lcd_puts(0, 0, "4) 'Clockbox'"); | ||
1441 | rb->lcd_puts(0, 6, "By Adam S."); | ||
1442 | } | ||
1443 | |||
1444 | rb->lcd_update(); | ||
1445 | |||
1446 | switch(rb->button_get_w_tmo(HZ/4)) | ||
1447 | { | ||
1448 | case BUTTON_F2: | ||
1449 | case BUTTON_OFF: | ||
1450 | done = true; | ||
1451 | break; | ||
1452 | |||
1453 | case BUTTON_RIGHT: | ||
1454 | if(logo < 4) | ||
1455 | logo++; | ||
1456 | break; | ||
1457 | |||
1458 | case BUTTON_LEFT: | ||
1459 | if(logo > 1) | ||
1460 | logo--; | ||
1461 | break; | ||
1462 | } | ||
1463 | } | ||
1464 | } | ||
1465 | |||
1466 | /********************* | 1360 | /********************* |
1467 | * F3 Screen - OPTIONS | 1361 | * F3 Screen - OPTIONS |
1468 | ********************/ | 1362 | ********************/ |
@@ -1856,6 +1750,116 @@ bool f3_screen(void) | |||
1856 | return true; | 1750 | return true; |
1857 | } | 1751 | } |
1858 | 1752 | ||
1753 | /********************************** | ||
1754 | * Confirm resetting of settings, | ||
1755 | * used in general_settings() */ | ||
1756 | void confirm_reset(void) | ||
1757 | { | ||
1758 | bool ask_reset_done = false; | ||
1759 | |||
1760 | while(!ask_reset_done) | ||
1761 | { | ||
1762 | rb->lcd_clear_display(); | ||
1763 | |||
1764 | rb->snprintf(buf, sizeof(buf), "Reset Settings?"); | ||
1765 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
1766 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 0, buf); | ||
1767 | |||
1768 | rb->lcd_puts(0, 2, "PLAY = Yes"); | ||
1769 | rb->lcd_puts(0, 3, "Any Other = No"); | ||
1770 | |||
1771 | rb->lcd_update(); | ||
1772 | |||
1773 | switch(rb->button_get_w_tmo(HZ/4)) | ||
1774 | { | ||
1775 | case BUTTON_PLAY: | ||
1776 | reset_settings(); | ||
1777 | rb->splash(HZ*2, true, "Settings Reset"); | ||
1778 | ask_reset_done = true; | ||
1779 | break; | ||
1780 | |||
1781 | case BUTTON_F1 : | ||
1782 | ask_reset_done = true; | ||
1783 | break; | ||
1784 | } | ||
1785 | } | ||
1786 | } | ||
1787 | |||
1788 | /************************************ | ||
1789 | * General settings. Reset, save, etc | ||
1790 | ***********************************/ | ||
1791 | void general_settings(void) | ||
1792 | { | ||
1793 | int cursorpos = 1; | ||
1794 | |||
1795 | done = false; | ||
1796 | |||
1797 | while(!done) | ||
1798 | { | ||
1799 | rb->lcd_clear_display(); | ||
1800 | |||
1801 | rb->snprintf(buf, sizeof(buf), "General Settings"); | ||
1802 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
1803 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 0, buf); | ||
1804 | |||
1805 | rb->lcd_puts(2, 2, "Reset Settings"); | ||
1806 | rb->lcd_puts(2, 3, "Save Settings"); | ||
1807 | rb->lcd_puts(2, 4, "Show Counter"); | ||
1808 | |||
1809 | rb->snprintf(buf, sizeof(buf), "UP/DOWN to move"); | ||
1810 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
1811 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); | ||
1812 | rb->snprintf(buf, sizeof(buf), "PLAY to select"); | ||
1813 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | ||
1814 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | ||
1815 | |||
1816 | rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); | ||
1817 | rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); | ||
1818 | rb->checkbox(1, 33, 8, 6, display_counter); | ||
1819 | |||
1820 | switch(cursorpos) | ||
1821 | { | ||
1822 | case 1: | ||
1823 | rb->lcd_invertrect(0, 16, 112, 8); break; | ||
1824 | |||
1825 | case 2: | ||
1826 | rb->lcd_invertrect(0, 24, 112, 8); break; | ||
1827 | |||
1828 | case 3: | ||
1829 | rb->lcd_invertrect(0, 32, 112, 8); break; | ||
1830 | } | ||
1831 | |||
1832 | rb->lcd_update(); | ||
1833 | |||
1834 | switch(rb->button_get_w_tmo(HZ/4)) | ||
1835 | { | ||
1836 | case BUTTON_OFF: | ||
1837 | case BUTTON_F3: | ||
1838 | done = true; | ||
1839 | break; | ||
1840 | |||
1841 | case BUTTON_UP: | ||
1842 | if(cursorpos > 1) | ||
1843 | cursorpos--; | ||
1844 | break; | ||
1845 | |||
1846 | case BUTTON_DOWN: | ||
1847 | if(cursorpos < 3) | ||
1848 | cursorpos++; | ||
1849 | break; | ||
1850 | |||
1851 | case BUTTON_PLAY: | ||
1852 | if(cursorpos == 1) | ||
1853 | confirm_reset(); | ||
1854 | else if(cursorpos == 2) | ||
1855 | save_settings(); | ||
1856 | else | ||
1857 | display_counter = !display_counter; | ||
1858 | break; | ||
1859 | } | ||
1860 | } | ||
1861 | } | ||
1862 | |||
1859 | /**************************************** | 1863 | /**************************************** |
1860 | * Draws the extras, IE border, digits... | 1864 | * Draws the extras, IE border, digits... |
1861 | ***************************************/ | 1865 | ***************************************/ |
@@ -2024,11 +2028,6 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second) | |||
2024 | void select_mode(void) | 2028 | void select_mode(void) |
2025 | { | 2029 | { |
2026 | int cursorpos = settings.clock; | 2030 | int cursorpos = settings.clock; |
2027 | bool a = false; /* (a)nalog */ | ||
2028 | bool d = false; /* (d)igital */ | ||
2029 | bool l = false; /* (l)cd */ | ||
2030 | bool f = false; /* (f)ullscreen */ | ||
2031 | bool b = false; /* (b)inary */ | ||
2032 | 2031 | ||
2033 | done = false; | 2032 | done = false; |
2034 | 2033 | ||
@@ -2045,21 +2044,12 @@ void select_mode(void) | |||
2045 | rb->lcd_puts(0, 6, "UP/DOWN: Choose"); | 2044 | rb->lcd_puts(0, 6, "UP/DOWN: Choose"); |
2046 | rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel"); | 2045 | rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel"); |
2047 | 2046 | ||
2048 | switch(settings.clock) | 2047 | /* draw an arrow next to all of them */ |
2049 | { | 2048 | rb->lcd_bitmap(arrow, 1, 9, 8, 6, true); |
2050 | case 1: a=true; d=l=f=b=false; break; | 2049 | rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); |
2051 | case 2: d=true; a=l=f=b=false; break; | 2050 | rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); |
2052 | case 3: l=true; a=d=f=b=false; break; | 2051 | rb->lcd_bitmap(arrow, 1, 33, 8, 6, true); |
2053 | case 4: f=true; a=d=l=b=false; break; | 2052 | rb->lcd_bitmap(arrow, 1, 41, 8, 6, true); |
2054 | case 5: b=true; a=d=l=f=false; break; | ||
2055 | } | ||
2056 | |||
2057 | /* draw a checkbox next to current mode */ | ||
2058 | rb->checkbox(1, 9, 8, 6, a); | ||
2059 | rb->checkbox(1, 17, 8, 6, d); | ||
2060 | rb->checkbox(1, 25, 8, 6, l); | ||
2061 | rb->checkbox(1, 33, 8, 6, f); | ||
2062 | rb->checkbox(1, 41, 8, 6, b); | ||
2063 | 2053 | ||
2064 | /* draw line selector */ | 2054 | /* draw line selector */ |
2065 | switch(cursorpos) | 2055 | switch(cursorpos) |
@@ -2109,6 +2099,7 @@ void counter_finished(void) | |||
2109 | int btn; | 2099 | int btn; |
2110 | int xpos = 0; | 2100 | int xpos = 0; |
2111 | bool bouncing_up = false; | 2101 | bool bouncing_up = false; |
2102 | bool led_on = true; | ||
2112 | unsigned char *times_up = 0; | 2103 | unsigned char *times_up = 0; |
2113 | times_up = (unsigned char *)timesup; | 2104 | times_up = (unsigned char *)timesup; |
2114 | 2105 | ||
@@ -2127,7 +2118,7 @@ void counter_finished(void) | |||
2127 | rb->lcd_update(); | 2118 | rb->lcd_update(); |
2128 | 2119 | ||
2129 | /* pause */ | 2120 | /* pause */ |
2130 | rb->sleep(HZ/15); | 2121 | rb->sleep(HZ/25); |
2131 | 2122 | ||
2132 | /* move bitmap up/down 1px */ | 2123 | /* move bitmap up/down 1px */ |
2133 | if(bouncing_up) | 2124 | if(bouncing_up) |
@@ -2136,6 +2127,8 @@ void counter_finished(void) | |||
2136 | xpos--; | 2127 | xpos--; |
2137 | else | 2128 | else |
2138 | bouncing_up = false; | 2129 | bouncing_up = false; |
2130 | |||
2131 | led_on = true; | ||
2139 | } | 2132 | } |
2140 | else | 2133 | else |
2141 | { | 2134 | { |
@@ -2143,12 +2136,27 @@ void counter_finished(void) | |||
2143 | xpos++; | 2136 | xpos++; |
2144 | else | 2137 | else |
2145 | bouncing_up = true; | 2138 | bouncing_up = true; |
2139 | |||
2140 | led_on = false; | ||
2146 | } | 2141 | } |
2147 | 2142 | ||
2143 | /* turn red led on and off */ | ||
2144 | #ifndef SIMULATOR | ||
2145 | if(led_on) | ||
2146 | or_b(0x40, &PBDRL); | ||
2147 | else | ||
2148 | and_b(~0x40, &PBDRL); | ||
2149 | #endif | ||
2150 | |||
2148 | /* exit on keypress */ | 2151 | /* exit on keypress */ |
2149 | btn = rb->button_get(false); | 2152 | btn = rb->button_get(false); |
2150 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | 2153 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) |
2154 | { | ||
2155 | #ifndef SIMULATOR | ||
2156 | and_b(~0x40, &PBDRL); /* shut off the red led */ | ||
2157 | #endif | ||
2151 | done = true; | 2158 | done = true; |
2159 | } | ||
2152 | } | 2160 | } |
2153 | } | 2161 | } |
2154 | 2162 | ||
@@ -2255,7 +2263,6 @@ void counter_options(void) | |||
2255 | rb->checkbox(1, 17, 8, 6, counting_up); | 2263 | rb->checkbox(1, 17, 8, 6, counting_up); |
2256 | rb->checkbox(1, 25, 8, 6, !counting_up); | 2264 | rb->checkbox(1, 25, 8, 6, !counting_up); |
2257 | 2265 | ||
2258 | |||
2259 | /* draw a cursor */ | 2266 | /* draw a cursor */ |
2260 | switch(cursorpos) | 2267 | switch(cursorpos) |
2261 | { | 2268 | { |
@@ -2276,8 +2283,7 @@ void counter_options(void) | |||
2276 | /* button scan */ | 2283 | /* button scan */ |
2277 | switch(rb->button_get_w_tmo(HZ/4)) | 2284 | switch(rb->button_get_w_tmo(HZ/4)) |
2278 | { | 2285 | { |
2279 | case BUTTON_F2: /* exit screen */ | 2286 | case BUTTON_OFF: /* exit screen */ |
2280 | case BUTTON_OFF: | ||
2281 | current = counting_up; | 2287 | current = counting_up; |
2282 | if(current != original) | 2288 | if(current != original) |
2283 | counter = 0; | 2289 | counter = 0; |
@@ -2429,11 +2435,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2429 | { | 2435 | { |
2430 | rb->lcd_clear_display(); | 2436 | rb->lcd_clear_display(); |
2431 | 2437 | ||
2432 | /* flash counter if needed */ | 2438 | /* flash counter if needed |
2433 | if(!counting && displayed_value != 0) | 2439 | if(!counting && displayed_value != 0) |
2434 | display_counter = !display_counter; | 2440 | display_counter = !display_counter; |
2435 | else | 2441 | else |
2436 | display_counter = true; | 2442 | display_counter = true; */ |
2437 | 2443 | ||
2438 | /* and then print it */ | 2444 | /* and then print it */ |
2439 | show_counter(); | 2445 | show_counter(); |
@@ -2515,8 +2521,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2515 | rb->lcd_drawline((LCD_WIDTH/2)-1, (LCD_HEIGHT/2)-3, | 2521 | rb->lcd_drawline((LCD_WIDTH/2)-1, (LCD_HEIGHT/2)-3, |
2516 | (LCD_WIDTH/2)+1, (LCD_HEIGHT/2)-3); | 2522 | (LCD_WIDTH/2)+1, (LCD_HEIGHT/2)-3); |
2517 | rb->lcd_drawpixel(LCD_WIDTH/2, LCD_HEIGHT/2); | 2523 | rb->lcd_drawpixel(LCD_WIDTH/2, LCD_HEIGHT/2); |
2518 | |||
2519 | |||
2520 | } | 2524 | } |
2521 | /************** | 2525 | /************** |
2522 | * Digital mode | 2526 | * Digital mode |
@@ -2615,6 +2619,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2615 | } | 2619 | } |
2616 | } | 2620 | } |
2617 | 2621 | ||
2622 | if(settings.analog_time == 2 && temphour == 0) | ||
2623 | temphour = 12; | ||
2618 | if(settings.analog_time == 2 && temphour > 12) | 2624 | if(settings.analog_time == 2 && temphour > 12) |
2619 | temphour -= 12; | 2625 | temphour -= 12; |
2620 | 2626 | ||
@@ -2636,7 +2642,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2636 | /* restore set backlight timeout */ | 2642 | /* restore set backlight timeout */ |
2637 | rb->backlight_set_timeout( | 2643 | rb->backlight_set_timeout( |
2638 | rb->global_settings->backlight_timeout); | 2644 | rb->global_settings->backlight_timeout); |
2639 | 2645 | ||
2640 | return PLUGIN_OK; | 2646 | return PLUGIN_OK; |
2641 | 2647 | ||
2642 | case BUTTON_ON | BUTTON_REL: /* credit roll */ | 2648 | case BUTTON_ON | BUTTON_REL: /* credit roll */ |
@@ -2647,15 +2653,18 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2647 | counter_options(); | 2653 | counter_options(); |
2648 | break; | 2654 | break; |
2649 | 2655 | ||
2656 | case BUTTON_ON | BUTTON_F3: /* general settings */ | ||
2657 | general_settings(); | ||
2658 | break; | ||
2659 | |||
2650 | case BUTTON_F1 | BUTTON_REL: /* help */ | 2660 | case BUTTON_F1 | BUTTON_REL: /* help */ |
2651 | f1_screen(); | 2661 | f1_screen(); |
2652 | break; | 2662 | break; |
2653 | 2663 | ||
2654 | case BUTTON_F2 | BUTTON_REL: /* start/stop counter */ | 2664 | case BUTTON_F2 | BUTTON_REL: /* start/stop counter */ |
2655 | if(settings.clock != 5) | 2665 | if(display_counter) |
2656 | { | 2666 | { |
2657 | /* Ignore if the counter was reset */ | 2667 | if(!f2_held) /* Ignore if the counter was reset */ |
2658 | if(!f2_held) | ||
2659 | { | 2668 | { |
2660 | if(counting) | 2669 | if(counting) |
2661 | { | 2670 | { |
@@ -2673,9 +2682,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2673 | break; | 2682 | break; |
2674 | 2683 | ||
2675 | case BUTTON_F2 | BUTTON_REPEAT: /* reset counter */ | 2684 | case BUTTON_F2 | BUTTON_REPEAT: /* reset counter */ |
2676 | f2_held = true; /* Ignore the release event */ | 2685 | if(display_counter) |
2677 | counter = 0; | 2686 | { |
2678 | start_tick = *rb->current_tick; | 2687 | f2_held = true; /* Ignore the release event */ |
2688 | counter = 0; | ||
2689 | start_tick = *rb->current_tick; | ||
2690 | } | ||
2679 | break; | 2691 | break; |
2680 | 2692 | ||
2681 | case BUTTON_F3: /* options */ | 2693 | case BUTTON_F3: /* options */ |