Commits

Trammell Hudson  committed 682c3e3

More direct code for which ones to light up, fix "A QUARTER"

  • Participants
  • Parent commits e7e7920

Comments (0)

Files changed (1)

File words/src/words.c

 #define LAYER_PAST	19
 #define LAYER_TO	20
 #define LAYER_OCLOCK	21
-#define LAYER_FILLER	22
+#define LAYER_A		22
+#define LAYER_FILLER	23
 
 static const word_t words[] = {
 	// Hours 1-12
 	// Minutes 13-
 	[LAYER_FIVE]	= {  2, 6, "FIVE", "five" }, // minute
 	[LAYER_TEN]	= {  3, 5, "TEN", "ten" }, // minute
+	[LAYER_A]	= {  1, 0, "A", "a" },
 	[LAYER_QUARTER]	= {  1, 2, "QUARTER", "quarter" },
 	[LAYER_HALF]	= {  3, 0, "HALF", "half" },
 	[LAYER_TWENTY]	= {  2, 0, "TWENTY", "twenty" },
 	[LAYER_IS]	= {  0, 3, "IS", "is" },
 
 	// Fillers
-	[LAYER_FILLER]	=
+	[LAYER_FILLER] =
 	{  0, 2, "L", "l" },
 	{  0, 5, "AATIME", "aatime" },
-	{  1, 0, "A", "a" },
 	{  1, 1, "T", "t" },
 	{  1, 9, "TH", "th" },
 	{  2, 10, "X", "x" },
 	int hour = ptm->tm_hour;
 	int min = ptm->tm_min;
 
-	// light up the next hour if we are half before
-	if (min > 30)
+	// mark all of the minutes as off,
+	// and then turn on the ones that count
+	layer_mark(LAYER_OCLOCK, 0);
+	layer_mark(LAYER_FIVE, 0);
+	layer_mark(LAYER_TEN, 0);
+	layer_mark(LAYER_A, 0);
+	layer_mark(LAYER_QUARTER, 0);
+	layer_mark(LAYER_TWENTY, 0);
+	layer_mark(LAYER_HALF, 0);
+	layer_mark(LAYER_PAST, 0);
+	layer_mark(LAYER_TO, 0);
+
+	
+	if (min < 5)
 	{
+		layer_mark(LAYER_OCLOCK, 1);
+	} else
+	if (min < 10)
+	{
+		layer_mark(LAYER_FIVE, 1);
+		layer_mark(LAYER_PAST, 1);
+	} else
+	if (min < 15)
+	{
+		layer_mark(LAYER_TEN, 1);
+		layer_mark(LAYER_PAST, 1);
+	} else
+	if (min < 20)
+	{
+		layer_mark(LAYER_A, 1);
+		layer_mark(LAYER_QUARTER, 1);
+		layer_mark(LAYER_PAST, 1);
+	} else
+	if (min < 25)
+	{
+		layer_mark(LAYER_TWENTY, 1);
+		layer_mark(LAYER_PAST, 1);
+	} else
+	if (min < 30)
+	{
+		layer_mark(LAYER_TWENTY, 1);
+		layer_mark(LAYER_FIVE, 1);
+		layer_mark(LAYER_PAST, 1);
+	} else
+	if (min < 35)
+	{
+		layer_mark(LAYER_HALF, 1);
+		layer_mark(LAYER_PAST, 1);
+	} else
+	if (min < 40)
+	{
+		layer_mark(LAYER_TWENTY, 1);
+		layer_mark(LAYER_FIVE, 1);
+		layer_mark(LAYER_TO, 1);
 		hour++;
-		min = 60 - min;
+	} else
+	if (min < 45)
+	{
+		layer_mark(LAYER_TWENTY, 1);
 		layer_mark(LAYER_TO, 1);
-		layer_mark(LAYER_PAST, 0);
+		hour++;
+	} else
+	if (min < 50)
+	{
+		layer_mark(LAYER_A, 1);
+		layer_mark(LAYER_QUARTER, 1);
+		layer_mark(LAYER_TO, 1);
+		hour++;
+	} else
+	if (min < 55)
+	{
+		layer_mark(LAYER_TEN, 1);
+		layer_mark(LAYER_TO, 1);
+		hour++;
 	} else {
-		layer_mark(LAYER_TO, 0);
-		layer_mark(LAYER_PAST, min >= 5);
+		layer_mark(LAYER_FIVE, 1);
+		layer_mark(LAYER_TO, 1);
+		hour++;
 	}
 
+
 	// Convert from 24-hour to 12-hour time
 	if (hour == 0)
 		hour = 12;
 	if (hour > 12)
 		hour -= 12;
 
+	// light up the one hour marker
 	for (int i = 1 ; i < 12 ; i++)
 		layer_mark(i, i == hour ? 1 : 0);
-
-	// mark all of the minutes as off,
-	// and then turn on the ones that count
-	layer_mark(LAYER_OCLOCK, 0);
-	layer_mark(LAYER_FIVE, 0);
-	layer_mark(LAYER_TEN, 0);
-	layer_mark(LAYER_QUARTER, 0);
-	layer_mark(LAYER_TWENTY, 0);
-	layer_mark(LAYER_HALF, 0);
-
-	if (min < 5)
-		layer_mark(LAYER_OCLOCK, 1);
-	else
-	if (min < 10)
-		layer_mark(LAYER_FIVE, 1);
-	else
-	if (min < 15)
-		layer_mark(LAYER_TEN, 1);
-	else
-	if (min < 20)
-		layer_mark(LAYER_QUARTER, 1);
-	else
-	if (min < 25)
-		layer_mark(LAYER_TWENTY, 1);
-	else
-	if (min < 30)
-	{
-		layer_mark(LAYER_TWENTY, 1);
-		layer_mark(LAYER_FIVE, 1);
-	} else
-	{
-		layer_mark(LAYER_HALF, 1);
-	}
-		
-/*
-	string_format_time(
-		time_buffer,
-		sizeof(time_buffer),
-		"%H:%M",
-		event->tick_time
-	);
-
-	text_layer_set_text(&ampm_layer, ampm_text);
-	text_layer_set_text(&hour_layer, hour_text);
-	text_layer_set_text(&rel_layer, rel_text);
-	text_layer_set_text(&min_layer, min_text);
-*/
 }
 
 
 	const word_t * const w = &words[which];
 
 	GRect frame = GRect(
-		w->col*FONT_W + 10,
+		w->col*FONT_W + 12,
 		w->row*FONT_H,
 		strlen(w->text_on)*(FONT_W+4),
 		FONT_H+5