Commits

Trammell Hudson committed d326a91

big font looks better

Comments (0)

Files changed (1)

  */
 #include "pebble_os.h"
 #include "pebble_app.h"
+#include "pebble_fonts.h"
 #include "sha1.h"
 
 PBL_APP_INFO(
 
 
 static char time_buffer[32];
-static char otp_buffer[16];
+static char otp_buffer[32];
 static Window window;
 static TextLayer time_layer;
 static TextLayer otp_layer;
 {
 	(void) ctx;
 
-/*
 	string_format_time(
-		time_buffer,
-		sizeof(time_buffer),
-		"%I:%M:%s %p",
+		otp_buffer,
+		sizeof(otp_buffer),
+		"%H:%M:%S",
 		event->tick_time
 	);
 
-	text_layer_set_text(&time_layer, time_buffer);
-*/
+	unsigned offset = 8;
+	otp_buffer[offset++] = '\n';
+	otp_buffer[offset++] = '\n';
 
 	// Convert the time into a unix epoch time.
 	// this should be done in a library
 	const PblTm * const ptm = event->tick_time;
 
-/*
-	struct tm t = {
-		.tm_year = ptm->tm_year,
-		.tm_mon = ptm->tm_mon,
-		.tm_mday = ptm->tm_mday,
-		.tm_hour = ptm->tm_hour,
-		.tm_min = ptm->tm_min,
-		.tm_sec = ptm->tm_sec,
-	};
-	const uint32_t now = mktime(&t);
-*/
 	const uint32_t now = unix_epoch_time(ptm) + 3600 * GMT_OFFSET;
 	uint32_t auth = oauth_calc(now);
+	otp_buffer[offset + 5] = '0' + auth % 10; auth /= 10;
+	otp_buffer[offset + 4] = '0' + auth % 10; auth /= 10;
+	otp_buffer[offset + 3] = '0' + auth % 10; auth /= 10;
+	otp_buffer[offset + 2] = '0' + auth % 10; auth /= 10;
+	otp_buffer[offset + 1] = '0' + auth % 10; auth /= 10;
+	otp_buffer[offset + 0] = '0' + auth % 10; auth /= 10;
+	offset += 6;
+	otp_buffer[offset++] = '\n';
+	otp_buffer[offset++] = '\n';
+	otp_buffer[offset++] = '\0';
+
 	uint32_t rem = 30 - (now % 30);
-	otp_buffer[9] = 0;
-	otp_buffer[8] = '0' + rem % 10; rem /= 10;
-	otp_buffer[7] = '0' + rem % 10; rem /= 10;
-	otp_buffer[6] = ' ';
-	otp_buffer[5] = '0' + auth % 10; auth /= 10;
-	otp_buffer[4] = '0' + auth % 10; auth /= 10;
-	otp_buffer[3] = '0' + auth % 10; auth /= 10;
-	otp_buffer[2] = '0' + auth % 10; auth /= 10;
-	otp_buffer[1] = '0' + auth % 10; auth /= 10;
-	otp_buffer[0] = '0' + auth % 10; auth /= 10;
 
 	text_layer_set_text(&otp_layer, otp_buffer);
 }
 	//layer_add_child(&window.layer, &time_layer.layer);
 
 	text_layer_init(&otp_layer, window.layer.frame);
+	text_layer_set_font(&otp_layer, fonts_get_system_font(FONT_KEY_GOTHAM_30_BLACK));
 	otp_buffer[0] = '\0';
 	text_layer_set_text(&otp_layer, otp_buffer);
 	layer_add_child(&window.layer, &otp_layer.layer);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.