Commit cd160255 authored by Zachary Seguin's avatar Zachary Seguin

Updated weather icons

parent 41118fd0
......@@ -3,8 +3,8 @@
"shortName": "Zachary Seguin",
"longName": "Zachary Seguin - Watchface",
"companyName": "Zachary Seguin",
"versionCode": 1,
"versionLabel": "1.0.0",
"versionCode": 2,
"versionLabel": "2.0.0",
"watchapp": {
"watchface": true
},
......@@ -24,8 +24,8 @@
},
{
"type" : "font",
"name" : "ICONS_18",
"file" : "fonts/icomoon.ttf"
"name" : "WEATHER_22",
"file" : "fonts/weathericons-regular-webfont.ttf"
}
]
}
......
......@@ -38,7 +38,7 @@
#define BATTERY_ICON_POSITION_Y 4
#define BATTERY_ICON_POSITION BATTERY_ICON_POSITION_X, BATTERY_ICON_POSITION_Y
#define BATTERY_ICON_FONT icons12
#define BATTERY_ICON_FONT icons
#define BATTERY_ICON_ALIGNMENT GTextAlignmentCenter
#define BATTERY_ICON_BACKGROUND_COLOUR ZS_DEFAULT_BACKGROUND_COLOUR
#define BATTERY_ICON_FOREGROUND_COLOUR ZS_DEFAULT_FOREGROUND_COLOUR
......@@ -70,7 +70,7 @@
#define BLUETOOTH_POSITION_Y 4
#define BLUETOOTH_POSITION BLUETOOTH_POSITION_X, BLUETOOTH_POSITION_Y
#define BLUETOOTH_FONT icons12
#define BLUETOOTH_FONT icons
#define BLUETOOTH_ALIGNMENT GTextAlignmentCenter
#define BLUETOOTH_BACKGROUND_COLOUR ZS_DEFAULT_BACKGROUND_COLOUR
#define BLUETOOTH_FOREGROUND_COLOUR ZS_DEFAULT_FOREGROUND_COLOUR
......@@ -126,28 +126,28 @@
#define SEPERATOR_TEXT ""
// WEATHER_ICON
#define WEATHER_ICON_SIZE_WIDTH 30
#define WEATHER_ICON_SIZE_HEIGHT 40
#define WEATHER_ICON_SIZE_WIDTH 32
#define WEATHER_ICON_SIZE_HEIGHT 30
#define WEATHER_ICON_SIZE WEATHER_ICON_SIZE_WIDTH, WEATHER_ICON_SIZE_HEIGHT
#define WEATHER_ICON_POSITION_X 0
#define WEATHER_ICON_POSITION_Y 116
#define WEATHER_ICON_POSITION_Y 115
#define WEATHER_ICON_POSITION WEATHER_ICON_POSITION_X, WEATHER_ICON_POSITION_Y
#define WEATHER_ICON_FONT icons18
#define WEATHER_ICON_FONT weather
#define WEATHER_ICON_ALIGNMENT GTextAlignmentCenter
#define WEATHER_ICON_BACKGROUND_COLOUR ZS_DEFAULT_BACKGROUND_COLOUR
#define WEATHER_ICON_FOREGROUND_COLOUR ZS_DEFAULT_FOREGROUND_COLOUR
#define WEATHER_ICON_TEXT ICON_CANCEL_CIRCLE
#define WEATHER_ICON_TEXT "\uf055"
// WEATHER
#define WEATHER_SIZE_WIDTH bounds.size.w - WEATHER_ICON_SIZE_WIDTH - 4
#define WEATHER_SIZE_WIDTH bounds.size.w - WEATHER_ICON_SIZE_WIDTH - 8
#define WEATHER_SIZE_HEIGHT 25
#define WEATHER_SIZE WEATHER_SIZE_WIDTH, WEATHER_SIZE_HEIGHT
#define WEATHER_POSITION_X WEATHER_ICON_SIZE_WIDTH
#define WEATHER_POSITION_Y 113
#define WEATHER_POSITION_X WEATHER_ICON_SIZE_WIDTH + 4
#define WEATHER_POSITION_Y 115
#define WEATHER_POSITION WEATHER_POSITION_X, WEATHER_POSITION_Y
#define WEATHER_FONT fonts_get_system_font(FONT_KEY_GOTHIC_18)
......@@ -163,7 +163,7 @@
#define INFORMATION_SIZE INFORMATION_SIZE_WIDTH, INFORMATION_SIZE_HEIGHT
#define INFORMATION_POSITION_X 4
#define INFORMATION_POSITION_Y 135
#define INFORMATION_POSITION_Y 139
#define INFORMATION_POSITION INFORMATION_POSITION_X, INFORMATION_POSITION_Y
#define INFORMATION_FONT fonts_get_system_font(FONT_KEY_GOTHIC_18)
......@@ -200,8 +200,8 @@ TextLayer *weather_layer;
TextLayer *information_layer;
GFont icons12;
GFont icons18;
GFont icons;
GFont weather;
void get_weather_and_information()
{
......@@ -269,11 +269,11 @@ void handle_message_received(DictionaryIterator *received, void *context)
// Handle weather updates
if (weather_icon_tuple && conditions_tuple && temperature_tuple)
{
APP_LOG(APP_LOG_LEVEL_DEBUG, "Received weather icon: %d", weather_icon_tuple->value->int16);
// DO NOT LOG -- WILL CRASH LOG FEED: APP_LOG(APP_LOG_LEVEL_DEBUG, "Received weather icon: %s", weather_icon_tuple->value->cstring);
APP_LOG(APP_LOG_LEVEL_DEBUG, "Received weather conditions: %s", conditions_tuple->value->cstring);
APP_LOG(APP_LOG_LEVEL_DEBUG, "Received temperature: %d\370", temperature_tuple->value->int16);
display_weather(weather_icon_tuple->value->int16, conditions_tuple->value->cstring, temperature_tuple->value->int16, weather_icon_layer, weather_layer);
display_weather(weather_icon_tuple->value->cstring, conditions_tuple->value->cstring, temperature_tuple->value->int16, weather_icon_layer, weather_layer);
}// End of if
// Handle information
......@@ -419,8 +419,8 @@ static void deinit(void)
text_layer_destroy(information_layer);
fonts_unload_custom_font(icons12);
fonts_unload_custom_font(icons18);
fonts_unload_custom_font(icons);
fonts_unload_custom_font(weather);
APP_LOG(APP_LOG_LEVEL_DEBUG, "Done de-initializing");
}// End of deinit method
......@@ -434,8 +434,8 @@ int main(void)
APP_LOG(APP_LOG_LEVEL_DEBUG, "Launching watchface...");
// Load Font Awesome
icons12 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ICONS_12));
icons18 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ICONS_18));
icons = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ICONS_12));
weather = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_WEATHER_22));
init();
......
......@@ -84,42 +84,16 @@ static void display_bluetooth(bool connected, TextLayer *bluetooth_layer)
text_layer_set_text(bluetooth_layer, bluetooth_string);
}// End of display_bluetooth method
static void display_weather(const int icon, const char *conditions, const int temperature, TextLayer *weather_icon_layer, TextLayer *weather_layer)
static void display_weather(const char *icon, const char *conditions, const int temperature, TextLayer *weather_icon_layer, TextLayer *weather_layer)
{
APP_LOG(APP_LOG_LEVEL_DEBUG, "Updating weather...");
static char weather_icon[] = ICON_CANCEL_CIRCLE;
switch(icon)
{
case 1:
snprintf(weather_icon, sizeof(weather_icon), WEATHER_ICON_SUNNY);
break;
case 2:
snprintf(weather_icon, sizeof(weather_icon), WEATHER_ICON_PARTLY_SUNNY);
break;
case 3:
snprintf(weather_icon, sizeof(weather_icon), WEATHER_ICON_CLOUDY);
break;
case 4:
snprintf(weather_icon, sizeof(weather_icon), WEATHER_ICON_RAIN);
break;
case 5:
snprintf(weather_icon, sizeof(weather_icon), WEATHER_ICON_THUNDERSTORM);
break;
case 6:
snprintf(weather_icon, sizeof(weather_icon), WEATHER_ICON_SNOW);
break;
}// End of switch
static char weather_icon[] = "\uf055";
snprintf(weather_icon, sizeof(weather_icon), icon);
text_layer_set_text(weather_icon_layer, weather_icon);
static char weather_string[20];
snprintf(weather_string, sizeof(weather_string), "%d\u00B0 - %s", temperature, conditions);
snprintf(weather_string, sizeof(weather_string), "%d\u00B0 %s", temperature, conditions);
text_layer_set_text(weather_layer, weather_string);
}// End of display_weather method
......
......@@ -22,12 +22,4 @@
#define ICON_BLOCKED "\ue60d"
#define ICON_BRIGHTNESS "\ue60e"
#define ICON_HALF_BRIGHTNESS "\ue60f"
#define ICON_TWO_DOTS "\ue610"
/* WEATHER ICONS */
#define WEATHER_ICON_SUNNY ICON_BRIGHTNESS
#define WEATHER_ICON_PARTLY_SUNNY ICON_HALF_BRIGHTNESS
#define WEATHER_ICON_CLOUDY ICON_CLOUD
#define WEATHER_ICON_RAIN ICON_DROPLET
#define WEATHER_ICON_THUNDERSTORM ICON_LIGHTNING
#define WEATHER_ICON_SNOW ICON_TWO_DOTS
\ No newline at end of file
#define ICON_TWO_DOTS "\ue610"
\ No newline at end of file
......@@ -58,74 +58,84 @@ function loadInformation(success_callback, error_callback) {
function selectWeatherIcon(code) {
switch(code) {
case 113: // Sunny
return 1;
break;
case 113: // Sunny
return '\uf00d';
break;
case 116: // Partly Cloudy
return 2;
break;
case 116: // Partly Cloudy
return '\uf002';
break;
case 119: // Cloudy
case 122: // Overcase
case 248: // Fog
case 260: // Freezing Fog
return 3;
break;
case 119: // Cloudy
return '\uf013';
case 122: // Overcast
return '\uf00c';
break;
case 248: // Fog
case 260: // Freezing Fog
return '\uf003';
break;
case 143: // Mist
case 176: // Patchy rain
case 182: // Patchy sleet
case 185: // Patch freezing drizzle
case 263: // Patchy light drizzle
case 266: // Light drizzle
case 281: // Freezing drizzle
case 284: // Heavy freezing drizzle
case 293: // Patch light rain
case 296: // Light rain
case 299: // Moderate rain at times
case 302: // Moderate rain
case 305: // Heavy rain at times
case 308: // Heavy rain
case 353: // Light rain shower
case 356: // Moderate or heavy rain shower
case 359: // Torrential rain shower
return 4;
break;
case 143: // Mist
case 176: // Patchy rain
case 182: // Patchy sleet
case 185: // Patch freezing drizzle
case 263: // Patchy light drizzle
case 266: // Light drizzle
case 281: // Freezing drizzle
case 284: // Heavy freezing drizzle
return '\uf00b'
case 293: // Patch light rain
case 296: // Light rain
case 299: // Moderate rain at times
case 302: // Moderate rain
case 305: // Heavy rain at times
case 308: // Heavy rain
case 353: // Light rain shower
case 356: // Moderate or heavy rain shower
case 359: // Torrential rain shower
return '\uf009';
break;
case 200: // Thundery outbreak
case 386: // Patchy light rain with thunder
case 389: // Moderator or heavy rain with thunder
case 392: // Patchy light snow with thunder
case 395: // Moderator or heavy shown with thunder
return 5;
break;
case 200: // Thundery outbreak
case 386: // Patchy light rain with thunder
case 389: // Moderator or heavy rain with thunder
case 392: // Patchy light snow with thunder
case 395: // Moderate or heavy shown with thunder
return '\uf005';
break;
case 179: // Patch snow
case 227: // Blowing snow
case 230: // Blizzard
case 311: // Ligh freezing rain
case 314: // Moderate or heavy freezing rain
case 317: // Light sleet
case 320: // Moderate or heavy sleet
case 323: // Patchy light snow
case 326: // Light snow
case 329: // Patchy moderate snow
case 332: // Moderate snow
case 335: // Patchy heavy snow
case 338: // Heavy snow
case 350: // Ice pellets
case 362: // Light sleet showers
case 365: // Moderate or heavy sleet showers
case 368: // Light snow showers
case 371: // Moderate or heavy snow showers
case 374: // Light showers of ice pellets
case 377: // Moderate or heavy showers of ice pellets
return 6;
break;
case 179: // Patch snow
case 227: // Blowing snow
case 230: // Blizzard
case 311: // Ligh freezing rain
case 314: // Moderate or heavy freezing rain
case 317: // Light sleet
case 320: // Moderate or heavy sleet
case 323: // Patchy light snow
case 326: // Light snow
case 329: // Patchy moderate snow
case 332: // Moderate snow
case 335: // Patchy heavy snow
case 338: // Heavy snow
return '\uf001';
break;
case 350: // Ice pellets
case 362: // Light sleet showers
case 365: // Moderate or heavy sleet showers
case 368: // Light snow showers
case 371: // Moderate or heavy snow showers
case 374: // Light showers of ice pellets
case 377: // Moderate or heavy showers of ice pellets
return '\uf004';
break;
default:
return 3;
default:
return '\uf055';
}
}// End of selectWeatherIcon method
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment