Anonymous avatar Anonymous committed 368f2cf Draft

Added more extensive commenting in timezones.c.

Comments (0)

Files changed (1)

timezones/src/timezones.c

 
 #define UUID { 0x48, 0x92, 0x55, 0xB6, 0x36, 0x8D, 0x48, 0xB9, 0xB8, 0x2E, 0x41, 0x17, 0x2C, 0x98, 0x50, 0x4F }
 
+//When adding the resources, menu_icon.png resource identifier is IMAGE_MENU_ICON
 PBL_APP_INFO(
 			 UUID,
-			 "TimezonesCT",
+			 "Timezones",
 			 "hutch",
 			 1, 0, // Version
 			 RESOURCE_ID_IMAGE_MENU_ICON,
 } timezone_t;
 
 
-// Local timezone GMT offset
+// Local timezone GMT offset. Change this to your local timezone. If you are frequently in different timezones,
+// You will have to make a different watchface for each one with the appropriate offsets. This is because the
+// Pebble can only read the current local time and is not location aware as to your current timezone.
 static const int gmt_offset = -6 * 60;
 
-#define NUM_TIMEZONES 4
-#define LAYER_HEIGHT (PEBBLE_SCREEN_HEIGHT / NUM_TIMEZONES)
 #define PEBBLE_SCREEN_WIDTH 144
 #define PEBBLE_SCREEN_HEIGHT 168
+#define NUM_TIMEZONES 4 //You can change this to whatever you want, but will have to change font sizes to make things fit
+#define LAYER_HEIGHT (PEBBLE_SCREEN_HEIGHT / NUM_TIMEZONES)
+
 #define container_of(ptr, type, member) ({ \
 char * __mptr = (char*)(uintptr_t) (ptr); \
 (type *)(__mptr - offsetof(type,member) ); \
 })
-
+// There need to be the same number of timezones as specified above. .offset is the GMT offset for the timezones you want.
+// DST will throw things off, so check the actual time in your locations and make sure they are correct. Adjust .offset
+// accordingly if the time is off.
 static timezone_t timezones[NUM_TIMEZONES] =
 {
 	{ .name = "Chicago", .offset = -6 * 60 },
 	{ .name = "Boston", .offset = -5 * 60 },
-	{ .name = "Uppsala", .offset = +1 * 60 },
-	{ .name = "Bangalore", .offset = +(4 * 60 + 30) },
+	{ .name = "Sweden", .offset = +1 * 60 },
+	{ .name = "India", .offset = +(4 * 60 + 30) },
 };
 
 
 					   &now
 					   );
 	
-	
+	//Swaps the background/foreground colors for night and day. Day=6 and later. Night=18 and later.
 	const int night_time = (now.tm_hour > 17 || now.tm_hour < 6);
 	now.tm_hour = orig_hour;
 	now.tm_min = orig_min;
 	
 	resource_init_current_app(&APP_RESOURCES);
 	
+	// If you change the number of timezones, you need to update the ttf resources and these names to the new font size
+	// The resource identifier for the fonts are defined here. e.g. "FONT_ARIAL_12"
 	font_thin = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_12));
 	font_thick = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_BLACK_20));
 	
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.