1
1
#include <pebble.h>
2
2
3
3
static Window * main_win ;
4
- static GFont * small_font ;
5
4
static BitmapLayer * box_blue ;
6
5
static BitmapLayer * box_batt ;
7
6
static BitmapLayer * box_apm ;
@@ -116,7 +115,7 @@ static void initialise_ui(void) {
116
115
text_layer_set_background_color (box_date , GColorWhite );
117
116
text_layer_set_text_color (box_date , GColorBlack );
118
117
text_layer_set_text_alignment (box_date , GTextAlignmentCenter );
119
- text_layer_set_font (box_date , small_font );
118
+ text_layer_set_font (box_date , fonts_get_system_font ( FONT_KEY_GOTHIC_14 ) );
120
119
layer_add_child (root_layer , (Layer * )box_date );
121
120
122
121
// am/pm bitmap
@@ -146,7 +145,7 @@ static void initialise_ui(void) {
146
145
text_layer_set_text_color (hour_text , GColorBlack );
147
146
text_layer_set_text (hour_text , "??" );
148
147
text_layer_set_text_alignment (hour_text , GTextAlignmentRight );
149
- text_layer_set_font (hour_text , small_font );
148
+ text_layer_set_font (hour_text , fonts_get_system_font ( FONT_KEY_GOTHIC_14 ) );
150
149
layer_add_child (root_layer , (Layer * )hour_text );
151
150
152
151
// Icon line
@@ -221,14 +220,6 @@ static void handle_window_unload(Window* window) {
221
220
}
222
221
}
223
222
224
- enum {
225
- POW_LINES ,
226
- POW_LOGO ,
227
- POW_NUMS ,
228
- POW_BOXES ,
229
- POW_PROGRESS
230
- };
231
-
232
223
// Macros to simplify these commands.
233
224
#define HIDE (lay ) layer_set_hidden((Layer *) lay, true)
234
225
#define SHOW (lay ) layer_set_hidden((Layer *) lay, false)
@@ -256,10 +247,12 @@ void powerdown() {
256
247
}
257
248
258
249
void powerup_lines (void * val ) {
250
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Powerup - Lines" );
259
251
SHOW (icon_line );
260
252
SHOW (secs_line );
261
253
}
262
254
void powerup_logo (void * val ) {
255
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Powerup - Logo" );
263
256
SHOW (ap_logo );
264
257
265
258
// Hide everything from powerup_nums to allow switching between them
@@ -269,12 +262,15 @@ void powerup_logo(void *val) {
269
262
HIDE (icon_bg );
270
263
}
271
264
void powerup_nums (void * val ) {
265
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Powerup - Nums" );
272
266
SHOW (min_dig_ten );
273
267
SHOW (min_dig_one );
274
268
SHOW (hour_text );
275
269
SHOW (icon_bg );
276
- }
270
+ }
271
+
277
272
void powerup_boxes (void * val ) {
273
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Powerup - Boxes" );
278
274
SHOW (box_blue );
279
275
SHOW (box_batt );
280
276
SHOW (box_apm );
@@ -287,6 +283,7 @@ void powerup_boxes(void *val) {
287
283
static bool playing_powerup = false;
288
284
289
285
void powerup_progress (void * val ) {
286
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Powerup - Complete" );
290
287
SHOW (secs_layer );
291
288
292
289
light_enable_interaction (); // Return light to normal
@@ -310,7 +307,6 @@ static void powerup() {
310
307
app_timer_register ( 800 , & powerup_logo , NULL );
311
308
app_timer_register ( 900 , & powerup_nums , NULL );
312
309
app_timer_register (1100 , & powerup_boxes , NULL );
313
- app_timer_register (1500 , & powerup_boxes , NULL );
314
310
app_timer_register (1800 , & powerup_progress , NULL );
315
311
}
316
312
@@ -325,15 +321,15 @@ static void draw_seconds(struct Layer *layer, GContext *ctx) {
325
321
time_t temp = time (NULL );
326
322
struct tm * cur_time = localtime (& temp );
327
323
graphics_context_set_stroke_color (ctx , GColorBlack );
328
- #ifdef PBL_COLOR
324
+ #ifdef PBL_COLOR
329
325
// On color Pebbles, draw 'off' bars in grey
330
326
for (int i = 2 ; i <= 60 * 2 ; i += 2 ) {
331
327
if ((cur_time -> tm_sec * 2 ) + 2 == i ) {
332
328
graphics_context_set_stroke_color (ctx , GColorLightGray );
333
329
}
334
- #else
330
+ #else
335
331
for (int i = 2 ; i <= (cur_time -> tm_sec * 2 ); i += 2 ) {
336
- #endif
332
+ #endif
337
333
graphics_draw_line (ctx , GPoint (i , 0 ), GPoint (i , 8 ));
338
334
}
339
335
}
@@ -535,8 +531,6 @@ static void init() {
535
531
res_bluetooth_on = gbitmap_create_with_resource (RESOURCE_ID_IMG_BLUE_ON );
536
532
res_bluetooth_off = gbitmap_create_with_resource (RESOURCE_ID_IMG_BLUE_OFF );
537
533
538
- small_font = fonts_get_system_font (FONT_KEY_GOTHIC_14 );
539
-
540
534
res_ap_logo = gbitmap_create_with_resource (RESOURCE_ID_IMG_AP_LOGO );
541
535
542
536
res_am = gbitmap_create_with_resource (RESOURCE_ID_TS_ICO_AM );
@@ -571,10 +565,15 @@ static void init() {
571
565
572
566
int main () {
573
567
srand (time (NULL ));
568
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Starting up" );
574
569
575
570
init ();
571
+
572
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "initialised" );
576
573
show_main_window ();
577
574
575
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Shown window" );
576
+
578
577
// Get a tm structure
579
578
time_t temp = time (NULL );
580
579
struct tm * cur_time = localtime (& temp );
@@ -583,6 +582,7 @@ int main() {
583
582
time_handler (cur_time , SECOND_UNIT | HOUR_UNIT | MINUTE_UNIT | DAY_UNIT );
584
583
bluetooth_check (bluetooth_connection_service_peek ());
585
584
battery_update (battery_state_service_peek ());
585
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Done checks" );
586
586
587
587
tick_timer_service_subscribe (SECOND_UNIT | HOUR_UNIT | MINUTE_UNIT | DAY_UNIT , time_handler );
588
588
@@ -591,6 +591,7 @@ int main() {
591
591
accel_tap_service_subscribe (shake_handler );
592
592
593
593
shuffle_icons (); // also starts the powerup animation
594
+ APP_LOG (APP_LOG_LEVEL_DEBUG , "Shuffled icons" );
594
595
595
596
app_event_loop ();
596
597
0 commit comments