Skip to content

Commit

Permalink
v16.0
Browse files Browse the repository at this point in the history
 - MarSoft mod 1 included, which means AM and PM support for the sun rise and sun set times in 12h mode and unobstructed area support with fading. 
 - Changed red color at 20% battery on Diorite to white on black.
 - added some commented code for heart rate support, but this will not work yet. I don't know if I will add this support at any time.

For Aplite watches (first Pebble and Pebble Steel) no changes were made.
  • Loading branch information
cfg1 committed Dec 11, 2017
1 parent 818a074 commit 29289ae
Show file tree
Hide file tree
Showing 9 changed files with 5,049 additions and 2,462 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"author": "fg",
"dependencies": {},
"keywords": [],
"name": "m7s_wf_15_7",
"name": "m7s_wf_16_0",
"pebble": {
"capabilities": [
"location",
"configurable",
"health"
],
"displayName": "M7S_wf_15_7",
"displayName": "M7S_16_0",
"enableMultiJS": true,
"messageKeys": {
"KEY_BTY_LAST_CHARGED": 13,
Expand Down Expand Up @@ -89,23 +89,23 @@
"type": "bitmap"
},
{
"file": "fonts/Climacons.ttf",
"name": "FONT_CLIMACONS_32",
"file": "fonts/moon_phases.ttf",
"name": "FONT_MOON_PHASES_SUBSET_30",
"type": "font"
},
{
"file": "fonts/moon_phases.ttf",
"name": "FONT_MOON_PHASES_SUBSET_24",
"name": "FONT_MOON_PHASES_SUBSET_28",
"type": "font"
},
{
"file": "fonts/moon_phases.ttf",
"name": "FONT_MOON_PHASES_SUBSET_28",
"name": "FONT_MOON_PHASES_SUBSET_24",
"type": "font"
},
{
"file": "fonts/moon_phases.ttf",
"name": "FONT_MOON_PHASES_SUBSET_30",
"file": "fonts/Climacons.ttf",
"name": "FONT_CLIMACONS_32",
"type": "font"
}
]
Expand All @@ -117,10 +117,10 @@
"chalk",
"diorite"
],
"uuid": "03adc57a-569b-4669-9a80-b505eaea314d",
"uuid": "03adc57a-569b-4669-9a80-b505eaea314e",
"watchapp": {
"watchface": true
}
},
"version": "15.7.0"
"version": "16.0.0"
}
13 changes: 7 additions & 6 deletions src/c/effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,19 @@ void effect_lens(GContext* ctx, GRect position, void* param){
float focal = (int32_t)param >>8 & 0xFF;// focal point of lens
float obj_dis = (int32_t)param & 0xFF;//distance of object from focal point.

for (int y = r; y >= 0; --y)
for (int x = r; x >= 0; --x)
if (x*x+y*y < r*r)
{
for (int y = r; y >= 0; --y) {
for (int x = r; x >= 0; --x) {
if (x*x+y*y < r*r) {
int Y1= my_tan(my_asin(y/focal))*obj_dis;
int X1= my_tan(my_asin(x/focal))*obj_dis;
set_pixel(bd,bpr, yCn +y, xCn +x, get_pixel(bd,bpr, yCn +Y1, xCn +X1));
set_pixel(bd,bpr, yCn +y, xCn -x, get_pixel(bd,bpr, yCn +Y1, xCn -X1));
set_pixel(bd,bpr, yCn -y, xCn +x, get_pixel(bd,bpr, yCn -Y1, xCn +X1));
set_pixel(bd,bpr, yCn -y, xCn -x, get_pixel(bd,bpr, yCn -Y1, xCn -X1));
}
graphics_release_frame_buffer(ctx, fb);
}
}
graphics_release_frame_buffer(ctx, fb);
//Todo: Change to lock-up arcsin table in the future. (Currently using floating point math library that is relatively big & slow)
}

Expand Down Expand Up @@ -374,7 +375,7 @@ void effect_mask(GContext* ctx, GRect position, void* param) {

void effect_fps(GContext* ctx, GRect position, void* param) {
static GFont font = NULL;
static char buff[16];
static char buff[18];
time_t tt;
uint16_t ms;

Expand Down
178 changes: 178 additions & 0 deletions src/c/inc_main_load_aplite.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@

background_paint_layer = layer_create(GRect(0, 0, 144, 168));
layer_set_update_proc(background_paint_layer, layer_update_callback_background);
layer_add_child(main_window_layer, background_paint_layer);

s_image_layer_hour_1 = layer_create(GRect(4, 94, 26, 41));
layer_set_update_proc(s_image_layer_hour_1, layer_update_callback_hour_1);
layer_add_child(main_window_layer, s_image_layer_hour_1);
s_image_layer_hour_2 = layer_create(GRect(37, 94, 26, 41));
layer_set_update_proc(s_image_layer_hour_2, layer_update_callback_hour_2);
layer_add_child(main_window_layer, s_image_layer_hour_2);

s_image_layer_minute_1 = layer_create(GRect(80, 94, 26, 41));
layer_set_update_proc(s_image_layer_minute_1, layer_update_callback_minute_1);
layer_add_child(main_window_layer, s_image_layer_minute_1);
s_image_layer_minute_2 = layer_create(GRect(111, 94, 26, 41));
layer_set_update_proc(s_image_layer_minute_2, layer_update_callback_minute_2);
layer_add_child(main_window_layer, s_image_layer_minute_2);

#ifdef COMPILE_WITH_SECONDS
s_image_layer_second_1 = layer_create(GRect(113, 137, 10, 15));
layer_set_update_proc(s_image_layer_second_1, layer_update_callback_second_1);
layer_add_child(main_window_layer, s_image_layer_second_1);
s_image_layer_second_2 = layer_create(GRect(126, 137, 10, 15));
layer_set_update_proc(s_image_layer_second_2, layer_update_callback_second_2);
layer_add_child(main_window_layer, s_image_layer_second_2);
#endif


GColor textcolor = GColorWhite;

// Sunrise Text
text_sunrise_layer = text_layer_create(GRect(7, 152, 50 /* width */, 30 /* height */));
text_layer_set_text_color(text_sunrise_layer, textcolor);
text_layer_set_background_color(text_sunrise_layer, GColorClear );
text_layer_set_font(text_sunrise_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
layer_add_child(main_window_layer, text_layer_get_layer(text_sunrise_layer));

// Sunset Text
text_sunset_layer = text_layer_create(GRect(110, 152, 50 /* width */, 30 /* height */));
text_layer_set_text_color(text_sunset_layer, textcolor);
text_layer_set_background_color(text_sunset_layer, GColorClear );
text_layer_set_font(text_sunset_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
layer_add_child(main_window_layer, text_layer_get_layer(text_sunset_layer));

// Connection
connection_layer = text_layer_create(GRect(47, 152, 50, 34));
text_layer_set_text_color(connection_layer, textcolor);
text_layer_set_background_color(connection_layer, GColorClear);
text_layer_set_font(connection_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
text_layer_set_text_alignment(connection_layer, GTextAlignmentCenter);
text_layer_set_text(connection_layer, "----");
layer_add_child(main_window_layer, text_layer_get_layer(connection_layer));

// Battery state / runtime:
battery_runtime_layer = text_layer_create(GRect(2, 15+2, 45, 15+20));
text_layer_set_text_color(battery_runtime_layer, textcolor);
text_layer_set_background_color(battery_runtime_layer, GColorClear);
text_layer_set_font(battery_runtime_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
text_layer_set_text_alignment(battery_runtime_layer, GTextAlignmentCenter);
text_layer_set_text(battery_runtime_layer, "100%\n0:00 d");
layer_add_child(main_window_layer, text_layer_get_layer(battery_runtime_layer));

#ifdef PBL_PLATFORM_APLITE
//fill battery with an InverterLayer
s_battery_layer_fill = inverter_layer_create(GRect(3, 21, 38, 11));
layer_set_hidden(inverter_layer_get_layer(s_battery_layer_fill), true);
layer_add_child(main_window_layer, inverter_layer_get_layer(s_battery_layer_fill));
#else //else use effect layer on basalt
s_battery_layer_fill = effect_layer_create(GRect(3, 21, 38, 11));
effect_layer_add_effect(s_battery_layer_fill, effect_invert_color, (void *)0b00000000); //use global inverter color
layer_set_hidden(effect_layer_get_layer(s_battery_layer_fill), true);
layer_add_child(main_window_layer, effect_layer_get_layer(s_battery_layer_fill));
#endif



// Date text
Date_Layer = text_layer_create(GRect(5, 63, 134 /* width */, 30 /* height */));
text_layer_set_text_color(Date_Layer, textcolor);
text_layer_set_background_color(Date_Layer, GColorClear );
text_layer_set_font(Date_Layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
text_layer_set_text_alignment(Date_Layer, GTextAlignmentCenter);
layer_add_child(main_window_layer, text_layer_get_layer(Date_Layer));

// Calendar Week
cwLayer = text_layer_create(GRect(72, 135, 64, 20)); //64 = label_width = 144-72-2*4 = display_width - display_width/2 - 2*Space
text_layer_set_text_color(cwLayer, textcolor);
text_layer_set_background_color(cwLayer, GColorClear );
text_layer_set_font(cwLayer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
text_layer_set_text_alignment(cwLayer, GTextAlignmentLeft);
layer_add_child(main_window_layer, text_layer_get_layer(cwLayer));
set_cwLayer_size();

// Moon phase
moonLayer_IMG = text_layer_create(GRect(51, 18, 33, 33));
text_layer_set_text_color(moonLayer_IMG, textcolor);
text_layer_set_background_color(moonLayer_IMG, GColorClear);
text_layer_set_font(moonLayer_IMG, pFontMoon);
text_layer_set_text_alignment(moonLayer_IMG, GTextAlignmentCenter);
layer_add_child(main_window_layer, text_layer_get_layer(moonLayer_IMG));

// --- Weather Layers: ---

// Create temperature Layer
weather_layer_1_temp = text_layer_create(GRect(50, 10, 94, 30));
text_layer_set_background_color(weather_layer_1_temp, GColorClear);
text_layer_set_text_color(weather_layer_1_temp, textcolor);
text_layer_set_text_alignment(weather_layer_1_temp, GTextAlignmentRight);
text_layer_set_text(weather_layer_1_temp, "---");
text_layer_set_font(weather_layer_1_temp, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); //FONT_KEY_BITHAM_30_BLACK
layer_add_child(main_window_layer, text_layer_get_layer(weather_layer_1_temp));

// Create location name Layer
weather_layer_3_location = text_layer_create(GRect(0, -1, 110, 17));
text_layer_set_background_color(weather_layer_3_location, GColorClear);
text_layer_set_text_color(weather_layer_3_location, textcolor);
text_layer_set_text_alignment(weather_layer_3_location, GTextAlignmentCenter);
text_layer_set_text(weather_layer_3_location, "---" /*"Loading Weather ..."*/);
text_layer_set_font(weather_layer_3_location, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD));
layer_add_child(main_window_layer, text_layer_get_layer(weather_layer_3_location));

// Create last updated Layer
weather_layer_4_last_update = text_layer_create(GRect(111, -1, 33, 17));
text_layer_set_background_color(weather_layer_4_last_update, GColorClear);
text_layer_set_text_color(weather_layer_4_last_update, textcolor);
text_layer_set_text_alignment(weather_layer_4_last_update, GTextAlignmentCenter);
text_layer_set_text(weather_layer_4_last_update, "---");
text_layer_set_font(weather_layer_4_last_update, fonts_get_system_font(FONT_KEY_GOTHIC_14));
layer_add_child(main_window_layer, text_layer_get_layer(weather_layer_4_last_update));

// Create String_1 Layer
weather_layer_7_string_1 = text_layer_create(GRect(86, 54-15, 144-86-2, 30)); //TODO
text_layer_set_background_color(weather_layer_7_string_1, GColorClear);
text_layer_set_text_color(weather_layer_7_string_1, textcolor);
text_layer_set_text_alignment(weather_layer_7_string_1, GTextAlignmentCenter);
text_layer_set_text(weather_layer_7_string_1, "---\n---");
text_layer_set_font(weather_layer_7_string_1, fonts_get_system_font(FONT_KEY_GOTHIC_14));
layer_add_child(main_window_layer, text_layer_get_layer(weather_layer_7_string_1));

// Create String_2 Layer
weather_layer_7_string_2 = text_layer_create(GRect(0, 50, 84, 17)); //TODO
text_layer_set_background_color(weather_layer_7_string_2, GColorClear);
text_layer_set_text_color(weather_layer_7_string_2, textcolor);
text_layer_set_text_alignment(weather_layer_7_string_2, GTextAlignmentCenter);
text_layer_set_text(weather_layer_7_string_2, "--- / ---");
text_layer_set_font(weather_layer_7_string_2, fonts_get_system_font(FONT_KEY_GOTHIC_14));
layer_add_child(main_window_layer, text_layer_get_layer(weather_layer_7_string_2));

// Create TimeZone Layer
text_TimeZone_layer = text_layer_create(GRect(5, 132, 100, 20)); //TODO
text_layer_set_background_color(text_TimeZone_layer, GColorClear);
text_layer_set_text_color(text_TimeZone_layer, textcolor);
text_layer_set_text_alignment(text_TimeZone_layer, GTextAlignmentLeft);
text_layer_set_text(text_TimeZone_layer, " ");
text_layer_set_font(text_TimeZone_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));
layer_add_child(main_window_layer, text_layer_get_layer(text_TimeZone_layer));

// Create Health_BMP Layer:
#ifndef PBL_PLATFORM_APLITE
s_health_bmp_layer = bitmap_layer_create(GRect(0,137,15,14));
bitmap_layer_set_alignment(s_health_bmp_layer, GAlignBottomLeft);
layer_add_child(main_window_layer, bitmap_layer_get_layer(s_health_bmp_layer));

text_layer_health = text_layer_create(GRect(14+10, 132, 100, 20)); //TODO
text_layer_set_background_color(text_layer_health, GColorClear);
text_layer_set_text_color(text_layer_health, textcolor);
text_layer_set_text_alignment(text_layer_health, GTextAlignmentLeft);
text_layer_set_text(text_layer_health, " ");
text_layer_set_font(text_layer_health, fonts_get_system_font(FONT_KEY_GOTHIC_18));
layer_add_child(main_window_layer, text_layer_get_layer(text_layer_health));

s_layer_health_up_down = layer_create(GRect(14, 140, 10, 10));
layer_set_update_proc(s_layer_health_up_down, layer_update_callback_health_up_down);
layer_add_child(main_window_layer, s_layer_health_up_down);
#endif

// --- END ---
Loading

0 comments on commit 29289ae

Please sign in to comment.