diff --git a/monkey.jungle b/monkey.jungle index ec73dc4..ac5fe5a 100644 --- a/monkey.jungle +++ b/monkey.jungle @@ -27,10 +27,15 @@ fenix5xplus.sourcePath = source;settings-lowmemory # enduro.sourcePath = source;settings-mediummemory # Exclude square hashmark logic for most models. -base.excludeAnnotations = square +base.excludeAnnotations = square;lowColors;noTempo +fr55.excludeAnnotations = square;allColors;noTempo +# Exclude square hashmark and weather functions for watchs that do not support it +fenix5plus.excludeAnnotations = square;lowColors;tempo +fenix5splus.excludeAnnotations = square;lowColors;tempo +fenix5xplus.excludeAnnotations = square;lowColors;tempo # Exclude round hashmark logic for square models (to save memory and improve performance). -venusq.excludeAnnotations = round -venusqm.excludeAnnotations = round +venusq.excludeAnnotations = round;lowColors;noTempo +venusqm.excludeAnnotations = round;lowColors;noTempo # venusq2.excludeAnnotations = round # venusq2m.excludeAnnotations = round diff --git a/resources-descentmk351mm/images/MoveToBeActive.png b/resources-descentmk351mm/images/MoveToBeActive.png new file mode 100644 index 0000000..dbf141f Binary files /dev/null and b/resources-descentmk351mm/images/MoveToBeActive.png differ diff --git a/resources-epix2pro51mm/images/MoveToBeActive.png b/resources-epix2pro51mm/images/MoveToBeActive.png new file mode 100644 index 0000000..dbf141f Binary files /dev/null and b/resources-epix2pro51mm/images/MoveToBeActive.png differ diff --git a/resources-fenix843mm/images/MoveToBeActive.png b/resources-fenix843mm/images/MoveToBeActive.png new file mode 100644 index 0000000..dbf141f Binary files /dev/null and b/resources-fenix843mm/images/MoveToBeActive.png differ diff --git a/resources-fenixe/images/MoveToBeActive.png b/resources-fenixe/images/MoveToBeActive.png new file mode 100644 index 0000000..dbf141f Binary files /dev/null and b/resources-fenixe/images/MoveToBeActive.png differ diff --git a/resources-fr265/images/MoveToBeActive.png b/resources-fr265/images/MoveToBeActive.png new file mode 100644 index 0000000..dbf141f Binary files /dev/null and b/resources-fr265/images/MoveToBeActive.png differ diff --git a/resources-fr265s/images/MoveToBeActive.png b/resources-fr265s/images/MoveToBeActive.png new file mode 100644 index 0000000..dbf141f Binary files /dev/null and b/resources-fr265s/images/MoveToBeActive.png differ diff --git a/resources-round-208x208/bitmaps.xml b/resources-round-208x208/bitmaps.xml new file mode 100644 index 0000000..b92290d --- /dev/null +++ b/resources-round-208x208/bitmaps.xml @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/resources-round-208x208/fonts/mtba-icons-small.fnt b/resources-round-208x208/fonts/mtba-icons-small.fnt new file mode 100644 index 0000000..77bcd22 --- /dev/null +++ b/resources-round-208x208/fonts/mtba-icons-small.fnt @@ -0,0 +1,34 @@ +info face="MtbA Icons" size=-20 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0 +common lineHeight=20 base=20 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=0 greenChnl=0 blueChnl=0 +page id=0 file="mtba-icons-small.png" +chars count=23 +char id=48 x=0 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=49 x=21 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=50 x=47 y=0 width=15 height=20 xoffset=0 yoffset=0 xadvance=15 page=0 chnl=15 +char id=51 x=63 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=52 x=84 y=0 width=24 height=20 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=15 +char id=53 x=109 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=54 x=130 y=0 width=12 height=20 xoffset=4 yoffset=0 xadvance=20 page=0 chnl=15 +char id=55 x=143 y=0 width=18 height=20 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15 +char id=56 x=162 y=0 width=15 height=20 xoffset=0 yoffset=0 xadvance=15 page=0 chnl=15 +char id=57 x=178 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=58 x=199 y=0 width=18 height=20 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15 +char id=59 x=218 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=46 x=239 y=0 width=10 height=20 xoffset=5 yoffset=0 xadvance=20 page=0 chnl=15 +char id=61 x=250 y=0 width=6 height=6 xoffset=0 yoffset=7 xadvance=6 page=0 chnl=15 +char id=62 x=0 y=21 width=23 height=20 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=63 x=24 y=21 width=23 height=20 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=64 x=48 y=21 width=17 height=20 xoffset=0 yoffset=0 xadvance=17 page=0 chnl=15 +char id=65 x=66 y=21 width=14 height=20 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=15 +char id=66 x=42 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=80 x=102 y=21 width=26 height=22 xoffset=2 yoffset=0 xadvance=26 page=0 chnl=15 +char id=81 x=81 y=21 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=82 x=129 y=21 width=20 height=21 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=15 +char id=83 x=150 y=21 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=15 + +char id=84 x=165 y=21 width=17 height=18 xoffset=0 yoffset=0 xadvance=17 page=0 chnl=15 +char id=85 x=183 y=21 width=9 height=20 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=15 +char id=86 x=193 y=21 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=87 x=214 y=21 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=88 x=235 y=21 width=21 height=20 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=89 x=0 y=44 width=17 height=20 xoffset=0 yoffset=0 xadvance=17 page=0 chnl=15 \ No newline at end of file diff --git a/resources-round-208x208/fonts/mtba-icons-small.png b/resources-round-208x208/fonts/mtba-icons-small.png new file mode 100644 index 0000000..dbead1d Binary files /dev/null and b/resources-round-208x208/fonts/mtba-icons-small.png differ diff --git a/resources-round-208x208/fonts/weather-icons-20.fnt b/resources-round-208x208/fonts/weather-icons-20.fnt new file mode 100644 index 0000000..684de0b --- /dev/null +++ b/resources-round-208x208/fonts/weather-icons-20.fnt @@ -0,0 +1,21 @@ +info face="Weather Icons" size=-17 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=2 padding=0,0,0,0 spacing=1,1 outline=0 +common lineHeight=25 base=19 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=1 redChnl=0 greenChnl=0 blueChnl=0 +page id=0 file="weather-icons-20_0.png" +chars count=17 +char id=65 x=100 y=0 width=26 height=22 xoffset=0 yoffset=0 xadvance=26 page=0 chnl=15 +char id=66 x=0 y=26 width=24 height=19 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=15 +char id=67 x=0 y=0 width=24 height=25 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=15 +char id=68 x=25 y=0 width=24 height=24 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=15 +char id=69 x=50 y=0 width=24 height=24 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=15 +char id=70 x=75 y=0 width=24 height=24 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=15 +char id=71 x=127 y=0 width=21 height=20 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=72 x=212 y=0 width=19 height=20 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=15 +char id=73 x=69 y=25 width=20 height=14 xoffset=0 yoffset=5 xadvance=19 page=0 chnl=15 +char id=97 x=25 y=25 width=23 height=18 xoffset=0 yoffset=4 xadvance=22 page=0 chnl=15 +char id=98 x=232 y=0 width=20 height=19 xoffset=0 yoffset=4 xadvance=19 page=0 chnl=15 +char id=99 x=149 y=0 width=20 height=20 xoffset=0 yoffset=4 xadvance=19 page=0 chnl=15 +char id=100 x=170 y=0 width=20 height=20 xoffset=0 yoffset=4 xadvance=19 page=0 chnl=15 +char id=101 x=191 y=0 width=20 height=20 xoffset=0 yoffset=4 xadvance=19 page=0 chnl=15 +char id=102 x=105 y=23 width=13 height=14 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=15 +char id=103 x=90 y=25 width=14 height=14 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=15 +char id=104 x=49 y=25 width=19 height=15 xoffset=0 yoffset=4 xadvance=19 page=0 chnl=15 diff --git a/resources-round-208x208/fonts/weather-icons-20_0.png b/resources-round-208x208/fonts/weather-icons-20_0.png new file mode 100644 index 0000000..caf8ea8 Binary files /dev/null and b/resources-round-208x208/fonts/weather-icons-20_0.png differ diff --git a/resources-round-208x208/images/MoveToBeActive.png b/resources-round-208x208/images/MoveToBeActive.png new file mode 100644 index 0000000..9d834fe Binary files /dev/null and b/resources-round-208x208/images/MoveToBeActive.png differ diff --git a/resources-round-208x208/images/garmin-logo-tiny.png b/resources-round-208x208/images/garmin-logo-tiny.png new file mode 100644 index 0000000..f10ed92 Binary files /dev/null and b/resources-round-208x208/images/garmin-logo-tiny.png differ diff --git a/resources-round-208x208/images/garmin5.png b/resources-round-208x208/images/garmin5.png new file mode 100644 index 0000000..077364f Binary files /dev/null and b/resources-round-208x208/images/garmin5.png differ diff --git a/resources-round-208x208/jsonData.xml b/resources-round-208x208/jsonData.xml new file mode 100644 index 0000000..c7945ab --- /dev/null +++ b/resources-round-208x208/jsonData.xml @@ -0,0 +1,31 @@ + + + + [98, 58, 84, 129, 57, 30, 144, 136, 140, 72, 150, 72, 42, 52, 111, 110, 91.5, 91, 98, 98, 128, 100, 138, 126] + + \ No newline at end of file diff --git a/resources-round-208x208/resources.xml b/resources-round-208x208/resources.xml new file mode 100644 index 0000000..d05b37b --- /dev/null +++ b/resources-round-208x208/resources.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/settings-lowmemory/AnalogSettingsView.mc b/settings-lowmemory/AnalogSettingsView.mc index e9e4865..f5329d1 100644 --- a/settings-lowmemory/AnalogSettingsView.mc +++ b/settings-lowmemory/AnalogSettingsView.mc @@ -17,43 +17,7 @@ class AnalogSettingsViewTest extends WatchUi.Menu2 { function initialize() { Menu2.initialize(null); -/* - var currentVersion=512; - if (Storage.getValue(23)==null or Storage.getValue(23)"Accent", :disabled=>"Default"}, 18, Storage.getValue(18), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); if (Toybox has :Weather and Toybox.Weather has :getCurrentConditions){ // has weather, doesn't show these for Fenix 5 Plus series iconMenu.addItem(new WatchUi.ToggleMenuItem("Weather Condition", {:enabled=>"ON", :disabled=>"OFF"}, 25, Storage.getValue(25), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); - iconMenu.addItem(new WatchUi.ToggleMenuItem(Toybox.Weather.getCurrentConditions().observationLocationName!=null?"Location Name":"Condition Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, Storage.getValue(7), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); + iconMenu.addItem(new WatchUi.ToggleMenuItem("Condition Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, Storage.getValue(7), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); //iconMenu.addItem(new WatchUi.ToggleMenuItem("Location Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, Storage.getValue(7), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); } @@ -241,9 +205,9 @@ class DrawableMenuTitle extends WatchUi.Drawable { //System.println(labelWidth); var mColors; if (Storage.getValue(32) == null or Storage.getValue(32) == false){ - mColors = Application.loadResource(Rez.JsonData.mColors); + mColors = Application.loadResource(Rez.JsonData.mColors) as Array; } else { - mColors = Application.loadResource(Rez.JsonData.mColorsWhite); + mColors = Application.loadResource(Rez.JsonData.mColorsWhite) as Array; } dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK); @@ -301,9 +265,9 @@ class CustomAccent extends WatchUi.Drawable { var mColorStrings; //if (Storage.getValue(32) == null or Storage.getValue(32) == false){ if (Storage.getValue(32) == true){ - mColorStrings = Application.loadResource(Rez.JsonData.mColorStringsWhite); + mColorStrings = Application.loadResource(Rez.JsonData.mColorStringsWhite) as Array; } else { - mColorStrings = Application.loadResource(Rez.JsonData.mColorStrings); + mColorStrings = Application.loadResource(Rez.JsonData.mColorStrings) as Array; } return mColorStrings[mIndex]; @@ -315,9 +279,9 @@ class CustomAccent extends WatchUi.Drawable { var mColors; if (Storage.getValue(32) == true){ - mColors = Application.loadResource(Rez.JsonData.mColorsWhite); + mColors = Application.loadResource(Rez.JsonData.mColorsWhite) as Array; } else { - mColors = Application.loadResource(Rez.JsonData.mColors); + mColors = Application.loadResource(Rez.JsonData.mColors) as Array; } mIndex++; @@ -336,9 +300,9 @@ class CustomAccent extends WatchUi.Drawable { public function draw(dc) { var mColors; if (Storage.getValue(32) == true){ - mColors = Application.loadResource(Rez.JsonData.mColorsWhite); + mColors = Application.loadResource(Rez.JsonData.mColorsWhite) as Array; } else { - mColors = Application.loadResource(Rez.JsonData.mColors); + mColors = Application.loadResource(Rez.JsonData.mColors) as Array; } var color = mColors[mIndex]; dc.setColor(color, color); @@ -374,9 +338,9 @@ class CustomDataPoint extends WatchUi.Drawable { var mIconStrings; if (size==2){ // Data field locations with length limitation = "small" - mIconStrings = ["Steps", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Humidity":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Precipitation":"Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available" , "Heart Rate", "Notifications", (System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", ((Toybox has :Weather) && (Weather has :getSunset and Weather has :getSunrise))?"Next Sun Event":"Not Available", "Battery %/day", "None"]; + mIconStrings = ["Steps", "Not Available", "Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available" , "Heart Rate", "Notifications", (System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", "Not Available", "Battery %/day", "Not Available", "None"]; } else { // No limitations on data field length - mIconStrings = ["Steps", "Distance", "Elevation", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Wind Speed":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Min/Max Temp.":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Humidity":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Precipitation":"Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available", "Heart Rate", "Notifications",(System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", ((Toybox has :Weather) && (Weather has :getSunset and Weather has :getSunrise))?"Next Sun Event":"Not Available", "Battery %/day", "None"]; + mIconStrings = ["Steps", "Distance", "Elevation", "Not Available", "Not Available", "Not Available", "Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available", "Heart Rate", "Notifications",(System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", "Not Available", "Battery %/day", "Not Available", "None"]; } if (id!=-1){ // -1 means to return only the name, while any other value means to skip to next step @@ -395,9 +359,9 @@ class CustomDataPoint extends WatchUi.Drawable { function draw(dc) { var mIcons; if (type==2) { - mIcons = Application.loadResource(Rez.JsonData.mIcons9); + mIcons = Application.loadResource(Rez.JsonData.mIcons9) as Array; } else { - mIcons = Application.loadResource(Rez.JsonData.mIcons12); + mIcons = Application.loadResource(Rez.JsonData.mIcons12) as Array; } var iColor=0x55FF00; diff --git a/settings/AnalogSettingsView.mc b/settings/AnalogSettingsView.mc index 89bdceb..821039e 100644 --- a/settings/AnalogSettingsView.mc +++ b/settings/AnalogSettingsView.mc @@ -98,9 +98,8 @@ class Menu2TestMenu2Delegate extends WatchUi.Menu2InputDelegate { // Sub-menu De iconMenu.addItem(new WatchUi.ToggleMenuItem("Tickmark Color", {:enabled=>"Accent", :disabled=>"Default"}, 18, Storage.getValue(18), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); if (Toybox has :Weather and Toybox.Weather has :getCurrentConditions){ // has weather, doesn't show these for Fenix 5 Plus series iconMenu.addItem(new WatchUi.ToggleMenuItem("Weather Condition", {:enabled=>"ON", :disabled=>"OFF"}, 25, Storage.getValue(25), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); - iconMenu.addItem(new WatchUi.ToggleMenuItem(Toybox.Weather.getCurrentConditions().observationLocationName!=null?"Location Name":"Condition Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, Storage.getValue(7), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); - //iconMenu.addItem(new WatchUi.ToggleMenuItem("Location Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, Storage.getValue(7), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); - + iconMenu.addItem(new WatchUi.ToggleMenuItem("Condition Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, Storage.getValue(7), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); + //iconMenu.addItem(new WatchUi.ToggleMenuItem("Location Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, Storage.getValue(7), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); } // allow these extra features only for LCD and AMOLED devices if(System.getDeviceSettings().requiresBurnInProtection){ @@ -128,7 +127,7 @@ class Menu2TestMenu2Delegate extends WatchUi.Menu2InputDelegate { // Sub-menu De dataMenu.addItem(new WatchUi.IconMenuItem("Right Top", drawable6.nextState(-1,2/*small*/), 17, drawable6, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); dataMenu.addItem(new WatchUi.IconMenuItem("Right Bottom", drawable5.nextState(-1,2/*small*/), 12, drawable5, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); if (System.SCREEN_SHAPE_ROUND == System.getDeviceSettings().screenShape) { //check if rounded display - dataMenu.addItem(new WatchUi.ToggleMenuItem("Font Size", {:enabled=>"Bigger", :disabled=>"Standard"}, 14, Storage.getValue(14), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); + dataMenu.addItem(new WatchUi.ToggleMenuItem("Font Size", {:enabled=>"Bigger", :disabled=>"Standard"}, 14, Storage.getValue(14), {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT})); } //WatchUi.pushView(dataMenu, new AnalogSettingsViewTest(), WatchUi.SLIDE_BLINK ); WatchUi.pushView(dataMenu, new Menu2TestMenu2Delegate(), WatchUi.SLIDE_UP ); @@ -209,9 +208,9 @@ class DrawableMenuTitle extends WatchUi.Drawable { //System.println(labelWidth); var mColors; if (Storage.getValue(32) == null or Storage.getValue(32) == false){ - mColors = Application.loadResource(Rez.JsonData.mColors); + mColors = Application.loadResource(Rez.JsonData.mColors) as Array; } else { - mColors = Application.loadResource(Rez.JsonData.mColorsWhite); + mColors = Application.loadResource(Rez.JsonData.mColorsWhite) as Array; } dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK); @@ -269,9 +268,9 @@ class CustomAccent extends WatchUi.Drawable { var mColorStrings; //if (Storage.getValue(32) == null or Storage.getValue(32) == false){ if (Storage.getValue(32) == true){ - mColorStrings = Application.loadResource(Rez.JsonData.mColorStringsWhite); + mColorStrings = Application.loadResource(Rez.JsonData.mColorStringsWhite) as Array; } else { - mColorStrings = Application.loadResource(Rez.JsonData.mColorStrings); + mColorStrings = Application.loadResource(Rez.JsonData.mColorStrings) as Array; } return mColorStrings[mIndex]; @@ -283,9 +282,9 @@ class CustomAccent extends WatchUi.Drawable { var mColors; if (Storage.getValue(32) == true){ - mColors = Application.loadResource(Rez.JsonData.mColorsWhite); + mColors = Application.loadResource(Rez.JsonData.mColorsWhite) as Array; } else { - mColors = Application.loadResource(Rez.JsonData.mColors); + mColors = Application.loadResource(Rez.JsonData.mColors) as Array; } mIndex++; @@ -304,9 +303,9 @@ class CustomAccent extends WatchUi.Drawable { public function draw(dc) { var mColors; if (Storage.getValue(32) == true){ - mColors = Application.loadResource(Rez.JsonData.mColorsWhite); + mColors = Application.loadResource(Rez.JsonData.mColorsWhite) as Array; } else { - mColors = Application.loadResource(Rez.JsonData.mColors); + mColors = Application.loadResource(Rez.JsonData.mColors) as Array; } var color = mColors[mIndex]; dc.setColor(color, color); @@ -342,9 +341,9 @@ class CustomDataPoint extends WatchUi.Drawable { var mIconStrings; if (size==2){ // Data field locations with length limitation = "small" - mIconStrings = ["Steps", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Humidity":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Precipitation":"Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available" , "Heart Rate", "Notifications", (System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", ((Toybox has :Weather) && (Weather has :getSunset and Weather has :getSunrise))?"Next Sun Event":"Not Available", "Battery %/day", "None"]; + mIconStrings = ["Steps", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Humidity":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Precipitation":"Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available" , "Heart Rate", "Notifications", (System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", ((Toybox has :Weather) && (Weather has :getSunset and Weather has :getSunrise))?"Next Sun Event":"Not Available", "Battery %/day", (Toybox has :Weather and Toybox.Weather has :getHourlyForecast)?"2h Forecast":"Not Available", "None"]; } else { // No limitations on data field length - mIconStrings = ["Steps", "Distance", "Elevation", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Wind Speed":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Min/Max Temp.":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Humidity":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Precipitation":"Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available", "Heart Rate", "Notifications",(System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", ((Toybox has :Weather) && (Weather has :getSunset and Weather has :getSunrise))?"Next Sun Event":"Not Available", "Battery %/day", "None"]; + mIconStrings = ["Steps", "Distance", "Elevation", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Wind Speed":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Min/Max Temp.":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Humidity":"Not Available", (Toybox has :Weather and Toybox.Weather has :getCurrentConditions)?"Precipitation":"Not Available", (Activity.getActivityInfo() has :rawAmbientPressure) ? "Atm. Pressure" : "Not available", "Calories Total", "Calories Active", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available", "Heart Rate", "Notifications",(System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "Seconds", "Digital Clock", "Intensity Min.", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory))?"Body Battery":"Not Available", ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getStressHistory))?"Stress":"Not Available", (ActivityMonitor.getInfo() has :respirationRate)?"Respiration Rate":"Not Available", (ActivityMonitor.getInfo() has :timeToRecovery)?"Recovery Time":"Not Available", (UserProfile.getProfile() has :vo2maxRunning)?"VO2 Max Run":"Not Available", (UserProfile.getProfile() has :vo2maxCycling)?"VO2 Max Cycle":"Not Available", ((Toybox has :Weather) && (Weather has :getSunset and Weather has :getSunrise))?"Next Sun Event":"Not Available", "Battery %/day", (Toybox has :Weather and Toybox.Weather has :getHourlyForecast)?"3h Forecast":"Not Available", "None"]; } if (id!=-1){ // -1 means to return only the name, while any other value means to skip to next step @@ -363,9 +362,9 @@ class CustomDataPoint extends WatchUi.Drawable { function draw(dc) { var mIcons; if (type==2) { - mIcons = Application.loadResource(Rez.JsonData.mIcons9); + mIcons = Application.loadResource(Rez.JsonData.mIcons9) as Array; } else { - mIcons = Application.loadResource(Rez.JsonData.mIcons12); + mIcons = Application.loadResource(Rez.JsonData.mIcons12) as Array; } var iColor=0x55FF00; diff --git a/source/AnalogApp.mc b/source/AnalogApp.mc index d6bd540..2622fa0 100644 --- a/source/AnalogApp.mc +++ b/source/AnalogApp.mc @@ -10,6 +10,7 @@ import Toybox.Lang; import Toybox.WatchUi; //import Toybox.Complications; //using Toybox.Communications; +using Toybox.Application.Properties as Properties; // This is the primary entry point of the application. class AnalogWatch extends Application.AppBase diff --git a/source/AnalogView.mc b/source/AnalogView.mc index 3294819..aaa87cc 100644 --- a/source/AnalogView.mc +++ b/source/AnalogView.mc @@ -26,11 +26,12 @@ class AnalogView extends WatchUi.WatchFace //var fullScreenRefresh; //var accentColor; - //var MtbA = null; - var inLowPower=false; + var inLowPower as Boolean = false; //var canBurnIn=false; var upTop=true; var MtbA = new MtbA_functions(); + // 0=accent color , 1=accent index , 2=tickmark color , 3=Dark/Light theme , 4=garmin logo , 5=hour labels , 6=Weather condition, 7=Temperature type, 8=Location name , 9=Battery Icon , 10=Font size , 11=Alarm toggle ,12=Bluetooth toggle, 13=Hands Thickness , 14=Right bottom DF , 15=Right top DF , 16=Left top DF , 17=Left middle DF , 18=Left bottom DF , 19=Batt. Est. flag , 20=AOD color minute , 21=Date Format , 22=temperature unit, 23=Hour Labels ,24=Gray Battery Icon + var config as Array = [Storage.getValue(1),Storage.getValue(2),Storage.getValue(18),Storage.getValue(32),Storage.getValue(3),Storage.getValue(5),Storage.getValue(25),Storage.getValue(6),Storage.getValue(7),Storage.getValue(26),Storage.getValue(14),Storage.getValue(8),Storage.getValue(4),Storage.getValue(13),Storage.getValue(12),Storage.getValue(17),Storage.getValue(9),Storage.getValue(10),Storage.getValue(11),Storage.getValue(19),Storage.getValue(22),Storage.getValue(24),Storage.getValue(16),Storage.getValue(27),Storage.getValue(28)]; // Initialize variables for this view function initialize() { @@ -39,57 +40,59 @@ class AnalogView extends WatchUi.WatchFace //_fullScreenRefresh = true; //_partialUpdatesAllowed = (WatchUi.WatchFace has :onPartialUpdate); - if (Storage.getValue(1) == null or Storage.getValue(2) == null) { + if (config[0] == null or config[1] == null) { // 0=accent color , 1=accent index if (System.getDeviceSettings().screenWidth >= 360){ // AMOLED -// accentColor = 0xAAFF00; Storage.setValue(2, 1); + config[1]=1; Storage.setValue(1, 0xAAFF00); // Vivomove Green + config[0]=0xAAFF00; } else { -// accentColor = 0x55FF00; Storage.setValue(2, 0); + config[1]=0; Storage.setValue(1, 0x55FF00); // Bright Green + config[0]=0x55FF00; } } - var currentVersion=515; + var currentVersion=522; - if (Storage.getValue(23)==null or Storage.getValue(23)dc.getWidth(), @@ -117,6 +120,31 @@ class AnalogView extends WatchUi.WatchFace } } + // Configure the layout of the watchface for this device +(:lowColors) public function onLayout(dc as Dc) as Void { + + var offscreenBufferOptions = { + :width=>dc.getWidth(), + :height=>dc.getHeight(), + :palette=> [ + Graphics.COLOR_BLACK, + Graphics.COLOR_WHITE + ] + }; + + if (Graphics has :createBufferedBitmap) { + // get() used to return resource as Graphics.BufferedBitmap + _offscreenBuffer = Graphics.createBufferedBitmap(offscreenBufferOptions).get() as BufferedBitmap; + + } else if (Graphics has :BufferedBitmap) { // If this device supports BufferedBitmap, allocate the buffers we use for drawing + // Allocate a full screen size buffer with a palette of only 4 colors to draw + // the background image of the watchface. This is used to facilitate blanking + // the second hand during partial updates of the display + _offscreenBuffer = new Graphics.BufferedBitmap(offscreenBufferOptions); + } else { + _offscreenBuffer = null; + } + } // Handle the update event public function onUpdate(dc as Dc) as Void { @@ -124,7 +152,9 @@ class AnalogView extends WatchUi.WatchFace //var MtbA = new MtbA_functions(); //var check = Storage.getValue(21); var canBurnIn=System.getDeviceSettings().requiresBurnInProtection; + //var accentColor = config[0]; var accentColor = Storage.getValue(1); + var tickmarkColor = config[2]; // We always want to refresh the full screen when we get a regular onUpdate call. //_fullScreenRefresh = true; @@ -155,11 +185,11 @@ class AnalogView extends WatchUi.WatchFace targetDc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK); // removing the background color and all the data points from the background, leaving just the hour hands and hashmarks targetDc.fillRectangle(0, 0, dc.getWidth(), dc.getHeight()); //width & height? - if(Storage.getValue(18)){ //tickmark color toggle + if(tickmarkColor){ //tickmark color toggle drawBackground(dc); - MtbA.drawHashMarks(dc, accentColor, width, height, inLowPower and canBurnIn, Storage.getValue(18)); //dc + MtbA.drawHashMarks(dc, accentColor, width, inLowPower and canBurnIn, tickmarkColor, config[1], config[5], config[20]); //dc } else { - MtbA.drawHashMarks(targetDc, accentColor, width, height, inLowPower and canBurnIn, Storage.getValue(18)); //dc + MtbA.drawHashMarks(targetDc, accentColor, width, inLowPower and canBurnIn, tickmarkColor, config[1], config[5], config[20]); //dc drawBackground(dc); } @@ -170,7 +200,7 @@ class AnalogView extends WatchUi.WatchFace } else { // Fill the entire background - if (Storage.getValue(32) == true){ // Light Theme + if (config[3]){ // Light Theme targetDc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_WHITE); } else { // Dark Theme targetDc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK); @@ -182,7 +212,7 @@ class AnalogView extends WatchUi.WatchFace // Draw the tick marks around the edges of the screen if(width>=360){ // No need for anti-alias on hashmarks of AMOLED screens - MtbA.drawHashMarks(dc, accentColor, width, height, inLowPower and canBurnIn, Storage.getValue(18)); //dc + MtbA.drawHashMarks(dc, accentColor, width, inLowPower and canBurnIn, tickmarkColor, config[1], config[5], config[20]); //dc } if (dc has :setAntiAlias) { @@ -191,64 +221,64 @@ class AnalogView extends WatchUi.WatchFace // Draw the tick marks around the edges of the screen if(width<360){ // With anti-alias for MIP displays - MtbA.drawHashMarks(dc, accentColor, width, height, inLowPower and canBurnIn, Storage.getValue(18)); //dc + MtbA.drawHashMarks(dc, accentColor, width, inLowPower and canBurnIn, tickmarkColor, config[1], config[5], config[20]); //dc } // Garmin Logo check - var logo=Storage.getValue(3); - var position = Application.loadResource(Rez.JsonData.mPosition); + var logo=config[4]; + var position = Application.loadResource(Rez.JsonData.mPosition) as Array; if (logo == null or logo == true) { - MtbA.drawGarminLogo(dc, position[4], position[5]); + MtbA.drawGarminLogo(dc, position[4], position[5], config[3]); } // Draw the 3, 6, 9, and 12 hour labels. - if (System.SCREEN_SHAPE_ROUND == System.getDeviceSettings().screenShape and Storage.getValue(5) != false) { - MtbA.drawHourLabels(dc, width, height, accentColor); + if (System.SCREEN_SHAPE_ROUND == System.getDeviceSettings().screenShape and config[5] != false) { + MtbA.drawHourLabels(dc, width, height, accentColor, config[23]); } //Draw Weather Icon (dc, x, y, x2, width) //if (Toybox has :Weather and Weather has :getCurrentConditions) { if (Toybox has :Weather and Toybox.Weather has :getCurrentConditions) { - if(Toybox.Weather.getCurrentConditions() != null) { + if(Weather.getCurrentConditions() != null) { //var cond = Toybox.Weather.getCurrentConditions(); if (logo==false){ // Hide Garmin Logo - if (Storage.getValue(25)!=false){ // Show current weather condition and temperature + if (config[6]!=false){ // Show current weather condition and temperature //if (cond.condition!=null and cond.condition instanceof Number){ - MtbA.drawWeatherIcon(dc, position[18], position[22], position[19], width); + MtbA.drawWeatherIcon(dc, position[18], position[22], position[19], width, Weather.getCurrentConditions().condition, System.getClockTime().hour); //} //Draw Temperature Text - MtbA.drawTemperature(dc, position[21], position[7], Storage.getValue(6), width); + MtbA.drawTemperature(dc, position[21], position[7], config[7], width, config[22]); } - //if (cond.observationLocationName!=null){ + if (width!=208){ //Draw Location Name - MtbA.drawLocation(dc, width/2, position[6], width*0.60, dc.getFontHeight(Graphics.FONT_TINY), Storage.getValue(7)); - //} + MtbA.drawLocation(dc, width/2, position[6], config[8], config[4]); + } } else { // Show Garmin Logo - if (Storage.getValue(25)!=false){ // Show current weather condition and temperature + if (config[6]!=false){ // Show current weather condition and temperature //if (cond.condition!=null and cond.condition instanceof Number){ - MtbA.drawWeatherIcon(dc, position[18], position[20], position[19], width); + MtbA.drawWeatherIcon(dc, position[18], position[20], position[19], width, Weather.getCurrentConditions().condition, System.getClockTime().hour); //} //Draw Temperature Text - MtbA.drawTemperature(dc, position[21], (System.SCREEN_SHAPE_ROUND == System.getDeviceSettings().screenShape)?position[15]:position[20], Storage.getValue(6), width); + MtbA.drawTemperature(dc, position[21], (System.SCREEN_SHAPE_ROUND==System.getDeviceSettings().screenShape)? (width==208 ? position[23] : position[15]) : position[20], config[7], width, config[22]); } - //if (cond.observationLocationName!=null){ + if (width!=208){ //Draw Location Name //System.println(dc.getFontHeight(Graphics.FONT_TINY)); - MtbA.drawLocation(dc, width/2, position[23], width*0.60, dc.getFontHeight(Graphics.FONT_TINY), Storage.getValue(7)); - //} + MtbA.drawLocation(dc, width/2, position[23], config[8], config[4]); + } } } } // Draw Battery - if (Storage.getValue(26)!=false){ // Show Battery Icon - MtbA.drawBatteryIcon(dc, width*0.69, height / 2.11, width*0.82, height / 2.06+(width==218 ? 1 : 0), width, height, accentColor); - MtbA.drawBatteryText(dc, width*0.76, height / 2.14 - 1, width, System.getSystemStats() has :batteryInDays); + if (config[9]!=false){ // Show Battery Icon + MtbA.drawBatteryIcon(dc, width*0.69, height / 2.11, width*0.82, height / 2.06+(width==218 ? 1 : 0), width, accentColor, config[24]); + MtbA.drawBatteryText(dc, width*0.76, height / 2.14 - 1, width, config[19]); } //Data Points var FontAdj=0; - if (Storage.getValue(14)==true){ // fontSize height adjustment + if (config[10]){ // fontSize height adjustment if (width==260 and dc.getFontHeight(Graphics.FONT_TINY)==29) { //Fenix 6 FontAdj=6; } else if (width==260 and dc.getFontHeight(Graphics.FONT_TINY)==27) { // Vivoactive 4 @@ -277,22 +307,22 @@ class AnalogView extends WatchUi.WatchFace } // (dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset, dataPoint) - var dataPoint = Storage.getValue(12); //right bottom + var dataPoint = config[14]; //right bottom MtbA.drawPoints(dc, position[8], position[14], position[10], position[15]-FontAdj, accentColor, width, dataPoint, 4); //MtbA.drawRightPoints(dc, position[8], position[14], position[10], position[15], accentColor, width, 0, dataPoint); - dataPoint = Storage.getValue(17); //right top + dataPoint = config[15]; //right top MtbA.drawPoints(dc, position[8], position[9], position[10], position[11]-FontAdj, accentColor, width, dataPoint, 4); //(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset) - dataPoint = Storage.getValue(9); // left top + dataPoint = config[16]; // left top MtbA.drawPoints(dc, position[12], position[9], position[13], position[11]-FontAdj, accentColor, width, dataPoint, 1); - dataPoint = Storage.getValue(10); // left middle + dataPoint = config[17]; // left middle MtbA.drawPoints(dc, position[12], position[16], position[13], position[17]-FontAdj, accentColor, width, dataPoint, 2); //MtbA.drawLeftMiddle(dc, position[12], position[16], position[13], position[17], accentColor, width, dataPoint); - dataPoint = Storage.getValue(11); // left bottom + dataPoint = config[18]; // left bottom MtbA.drawPoints(dc, position[12], position[14], position[13], position[15]-FontAdj, accentColor, width, dataPoint, 3); var iconSize = 0; @@ -312,7 +342,7 @@ class AnalogView extends WatchUi.WatchFace } // Bluetooth, Alarm and Dnd Icons - var alarm = Storage.getValue(8), blue = Storage.getValue(4); + var alarm = config[11], blue = config[12]; if (System.getDeviceSettings() has :doNotDisturb and System.getDeviceSettings().doNotDisturb) { // Dnd exists and is turned on if ((alarm == true and blue == true) or (alarm == null and blue == null)){ // all 3 icons // Draw the Do Not Disturb Icon in the middle @@ -351,20 +381,20 @@ class AnalogView extends WatchUi.WatchFace //Draw the date string if (logo == null or logo == true) { // Garmin Logo check - MtbA.drawDateString( dc, width / 2, position[6] ); + MtbA.drawDateString( dc, width / 2, position[6], config[21]); } else { // No Garmin Logo - MtbA.drawDateString( dc, width / 2, position[5] + (width<=240 ? 5 : 0 ) + (width==218 ? 3 : 0 )); // offsets needed because of size of Garmin Logo compared to Date Font + MtbA.drawDateString( dc, width / 2, position[5] + (width<=240 ? 5 : 0 ) + (width==218 ? 3 : 0 ), config[21]); // offsets needed because of size of Garmin Logo compared to Date Font } } //Draw Hour and Minute hands - if (Storage.getValue(13) == 1){ // thicker - MtbA.drawHands(dc, width, height, accentColor, 1, inLowPower, upTop); - } else if (Storage.getValue(13) == 0) { // standard //or Storage.getValue(13) == null - MtbA.drawHands(dc, width, height, accentColor, 0, inLowPower, upTop); + if (config[13] == 1){ // thicker + MtbA.drawHands(dc, width, height, accentColor, 1, inLowPower, upTop, config[20]); + } else if (config[13] == 0) { // standard //or Storage.getValue(13) == null + MtbA.drawHands(dc, width, height, accentColor, 0, inLowPower, upTop, config[20]); } else { // thinner - MtbA.drawHands(dc, width, height, accentColor, 2, inLowPower, upTop); + MtbA.drawHands(dc, width.toFloat(), height, accentColor, 2, inLowPower, upTop, config[20]); } /* @@ -407,7 +437,7 @@ class AnalogView extends WatchUi.WatchFace // If we have an offscreen buffer that has been written to // draw it to the screen. if (null != _offscreenBuffer) { - dc.drawBitmap(0, 0, _offscreenBuffer); + dc.drawBitmap(0 as Number, 0 as Number, _offscreenBuffer); } } @@ -418,20 +448,21 @@ class AnalogView extends WatchUi.WatchFace function onHide() as Void { } -//! This method is called when the device re-enters sleep mode. + //! This method is called when the device re-enters sleep mode. //! Set the isAwake flag to let onUpdate know it should stop rendering the second hand. public function onEnterSleep() as Void { //_isAwake = false; - inLowPower=true; + inLowPower=true; + MtbA.enterSleep(); WatchUi.requestUpdate(); } - //! This method is called when the device exits sleep mode. //! Set the isAwake flag to let onUpdate know it should render the second hand. public function onExitSleep() as Void { //_isAwake = true; inLowPower=false; + MtbA.exitSleep(); //WatchUi.requestUpdate(); } diff --git a/source/MtbA_functions.mc b/source/MtbA_functions.mc index 48ebf70..0074381 100644 --- a/source/MtbA_functions.mc +++ b/source/MtbA_functions.mc @@ -17,7 +17,22 @@ class MtbA_functions { const screenShape = System.getDeviceSettings().screenShape; var fontSize = (Storage.getValue(14) == true ? 1 : 0); var fontColor = (Storage.getValue(32) == true ? Graphics.COLOR_BLACK : Graphics.COLOR_WHITE); - //var check=Storage.getValue(21); + var condName as String = ""; + var lowPower as Boolean = false; + + public function enterSleep() as Void { + lowPower=true; + //WatchUi.requestUpdate(); + } + + + //! This method is called when the device exits sleep mode. + //! Set the isAwake flag to let onUpdate know it should render the second hand. + public function exitSleep() as Void { + //_isAwake = true; + lowPower=false; + //WatchUi.requestUpdate(); + } // This function is used to generate the coordinates of the 4 corners of the polygon // used to draw a watch hand. The coordinates are generated with specified length, @@ -44,24 +59,24 @@ class MtbA_functions { /* ------------------------ */ // Draws the clock tick marks around the outside edges of the screen. -(:round) function drawHashMarks(dc, accentColor, width, height, aod, colorFlag) { +(:round) function drawHashMarks(dc, accentColor, width, aod, colorFlag, accIndex, showBoolean, AODColor) { // 2, 5 var sX, sY; var eX, eY; var outerRad = width / 2; var innerRad = outerRad - 10; - var showBoolean = Storage.getValue(5); + //var showBoolean = hourLabel; if (fontColor == Graphics.COLOR_WHITE){ // Dark Theme - var mColors = Application.loadResource(Rez.JsonData.mColors); - if(mColors[Storage.getValue(2)] != accentColor){ - Storage.setValue(1, mColors[Storage.getValue(2)]); - accentColor = mColors[Storage.getValue(2)]; + var mColors = Application.loadResource(Rez.JsonData.mColors) as Array; + if(mColors[accIndex] != accentColor){ + Storage.setValue(1, mColors[accIndex]); + accentColor = mColors[accIndex]; } } else { // Light Theme - var mColors = Application.loadResource(Rez.JsonData.mColorsWhite); - if(mColors[Storage.getValue(2)] != accentColor){ - Storage.setValue(1, mColors[Storage.getValue(2)]); - accentColor = mColors[Storage.getValue(2)]; + var mColors = Application.loadResource(Rez.JsonData.mColorsWhite) as Array; + if(mColors[accIndex] != accentColor){ + Storage.setValue(1, mColors[accIndex]); + accentColor = mColors[accIndex]; } } @@ -74,7 +89,7 @@ class MtbA_functions { var angle = i * Math.PI / 30; if (aod==true) { // AOD mode is ON if (i % 5 == 0){ - if (colorFlag == true and Storage.getValue(22)==true){ // Tickmark color is ON and AOD Colors is ON + if (colorFlag == true and AODColor){ // Tickmark color is ON and AOD Colors is ON dc.setColor(accentColor, Graphics.COLOR_TRANSPARENT); } else if (i == 15 or i == 45) { //dc.setColor(accentColor, Graphics.COLOR_BLACK); @@ -85,7 +100,7 @@ class MtbA_functions { dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT); } } - } else{ // AOD mode is OFF + } else{ // AOD mode is OFF or MIP if ((i == 15) or (i == 45)) { dc.setColor(accentColor, accentColor); } else { @@ -157,18 +172,19 @@ class MtbA_functions { } -(:square) function drawHashMarks(dc, accentColor, width, height, aod, colorFlag) { +(:square) function drawHashMarks(dc, accentColor, width, aod, colorFlag, accIndex, showBoolean, AODColor) { var sX, sY; var eX, eY; var outerRad = width / 2; //var innerRad = outerRad - 10; var innerRad = outerRad - 10; //var showBoolean = Storage.getValue(5); + var height = dc.getHeight(); // Draw hashmarks differently depending on screen geometry. if (System.SCREEN_SHAPE_ROUND != screenShape) { //check if square display var coords = [0, width / 4, (3 * width) / 4, width]; - if(aod==true and Storage.getValue(22)!=true) { // AOD ON and AOD colors OFF + if(aod==true and AODColor!=true) { // AOD ON and AOD colors OFF dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT); } else { // AOD OFF or (AOD ON and AOD colors ON) if (colorFlag == true){ @@ -218,7 +234,7 @@ class MtbA_functions { for (var i = 0; i <= 59; i += 15) { //draw the middle hashmarks (each 15 min) var angle = i * Math.PI / 30; - if(aod==true and Storage.getValue(22)!=true) { // AOD ON and AOD colors OFF + if(aod==true and AODColor!=true) { // AOD ON and AOD colors OFF if ((i == 15) or (i == 45)) { dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); } else { @@ -261,11 +277,11 @@ class MtbA_functions { /* ------------------------ */ // Draw the date string into the provided buffer at the specified location - function drawDateString(dc, x as Number, y as Number) as Void { + function drawDateString(dc, x as Number, y as Number, format as Boolean) as Void { var info = Time.Gregorian.info(Time.now(), Time.FORMAT_LONG); var dateStr; - if (Storage.getValue(24)==true){ + if (format){ dateStr = Lang.format("$1$, $3$ $2$", [info.day_of_week, info.month, info.day]); } else { dateStr = Lang.format("$1$, $2$ $3$", [info.day_of_week, info.month, info.day]); @@ -322,7 +338,11 @@ class MtbA_functions { if (settings>0) { dc.setColor(accentColor, Graphics.COLOR_TRANSPARENT); } else { - dc.setColor((fontColor==Graphics.COLOR_WHITE ? Graphics.COLOR_DK_GRAY : Graphics.COLOR_LT_GRAY), Graphics.COLOR_TRANSPARENT); + if (width!=208){ + dc.setColor((fontColor==Graphics.COLOR_WHITE ? Graphics.COLOR_DK_GRAY : Graphics.COLOR_LT_GRAY), Graphics.COLOR_TRANSPARENT); + } else { // Fr55 + dc.setColor(fontColor, Graphics.COLOR_TRANSPARENT); + } } dc.drawText( x - offset - LEDoffset, y - offset, IconsFont, ":", Graphics.TEXT_JUSTIFY_CENTER); } @@ -330,11 +350,11 @@ class MtbA_functions { /* ------------------------ */ // Draw the 3, 6, 9, and 12 hour labels. - function drawHourLabels(dc, width, height, accent) { + function drawHourLabels(dc, width, height, accent, hourLabel) { // Load the custom fonts: used for drawing the 3, 6, 9, and 12 on the watchface var font = Application.loadResource(Rez.Fonts.id_font_black_diamond); - if (Storage.getValue(27)==true) { + if (hourLabel) { dc.setColor(accent, Graphics.COLOR_TRANSPARENT); } else if (width < 360){ // Using lighter tone for MIP displays dc.setColor((fontColor==Graphics.COLOR_WHITE ? Graphics.COLOR_LT_GRAY : Graphics.COLOR_DK_GRAY), Graphics.COLOR_TRANSPARENT); @@ -342,29 +362,33 @@ class MtbA_functions { dc.setColor(Graphics.COLOR_DK_GRAY, Graphics.COLOR_TRANSPARENT); } - dc.drawText((width / 2), 14, font, "12", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(width - 13, (height / 2) - 15, font, "3", Graphics.TEXT_JUSTIFY_RIGHT); - dc.drawText(width / 2, height - 41, font, "6", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(13, (height / 2) - 15, font, "9", Graphics.TEXT_JUSTIFY_LEFT); + dc.drawText((width / 2), 14 + (width==208 ? -1 : 0), font, "12", Graphics.TEXT_JUSTIFY_CENTER); + dc.drawText(width - 13 + (width==208 ? 1 : 0), (height / 2) - 15, font, "3", Graphics.TEXT_JUSTIFY_RIGHT); + dc.drawText(width / 2, height - 41 + (width==208 ? 1 : 0), font, "6", Graphics.TEXT_JUSTIFY_CENTER); + dc.drawText(13 + (width==208 ? -1 : 0), (height / 2) - 15, font, "9", Graphics.TEXT_JUSTIFY_LEFT); } /* ------------------------ */ - function drawWeatherIcon(dc, x, y, x2, width) { + function drawWeatherIcon(dc, x, y, x2, width, cond, clockTime) { - var cond = Toybox.Weather.getCurrentConditions().condition; + //var cond = Toybox.Weather.getCurrentConditions().condition; var sunset, sunrise; if (cond!=null and cond instanceof Number){ - - var clockTime = System.getClockTime().hour; + //System.println(clockTime); + //var clockTime = System.getClockTime().hour; +// clockTime = clockTime.hour; var WeatherFont = Application.loadResource(Rez.Fonts.WeatherFont); // gets the correct symbol (sun/moon) depending on actual sun events - if (Toybox has :Weather and Weather has :getSunset and Weather has :getSunrise) { - var position = Toybox.Weather.getCurrentConditions().observationLocationPosition; // or Activity.Info.currentLocation if observation is null? - var today = Toybox.Weather.getCurrentConditions().observationTime; // or new Time.Moment(Time.now().value()); ? - if (position!=null and today!=null){ + if (Toybox has :Weather and Weather has :getSunset and Weather has :getSunrise and Toybox.Weather has :getCurrentConditions) { + var position=null, today=null; + if (Toybox.Weather.getCurrentConditions() has :observationLocationPosition and Toybox.Weather.getCurrentConditions() has :observationTime){ //trying to address errors found on ERA viewer when watch can't get position + position = Toybox.Weather.getCurrentConditions().observationLocationPosition; // or Activity.Info.currentLocation if observation is null? + today = Toybox.Weather.getCurrentConditions().observationTime; // or new Time.Moment(Time.now().value()); ? + } + if ((position!=null and position instanceof Position.Location) and (today!=null and today instanceof Moment)){ if (Weather.getSunset(position, today)!=null) { sunset = Time.Gregorian.info(Weather.getSunset(position, today), Time.FORMAT_SHORT); sunset = sunset.hour; @@ -400,49 +424,50 @@ class MtbA_functions { if (cond == 20) { // Cloudy dc.drawText(x2-1, y-1, WeatherFont, "I", Graphics.TEXT_JUSTIFY_RIGHT); // Cloudy if (clockTime >= sunset or clockTime < sunrise) { - Storage.setValue(34, "Cloudy Night"); + condName="Cloudy Night"; } else { - Storage.setValue(34, "Cloudy Day"); + condName="Cloudy Day"; } } else if (cond == 0 or cond == 5) { // Clear or Windy if (clockTime >= sunset or clockTime < sunrise) { dc.drawText(x2-2, y-1, WeatherFont, "f", Graphics.TEXT_JUSTIFY_RIGHT); // Clear Night - Storage.setValue(34, "Starry Night"); + condName="Starry Night"; } else { dc.drawText(x2, y-2, WeatherFont, "H", Graphics.TEXT_JUSTIFY_RIGHT); // Clear Day - Storage.setValue(34, "Sunny Day"); + condName="Sunny Day"; } } else if (cond == 1 or cond == 23 or cond == 40 or cond == 52) { // Partly Cloudy or Mostly Clear or fair or thin clouds if (clockTime >= sunset or clockTime < sunrise) { dc.drawText(x2-1, y-2, WeatherFont, "g", Graphics.TEXT_JUSTIFY_RIGHT); // Partly Cloudy Night - Storage.setValue(34, "Partly Cloudy"); + condName="Partly Cloudy"; } else { dc.drawText(x2, y-2, WeatherFont, "G", Graphics.TEXT_JUSTIFY_RIGHT); // Partly Cloudy Day - Storage.setValue(34, "Mostly Sunny"); + //Storage.setValue(34, "Mostly Sunny"); + condName="Mostly Sunny"; } } else if (cond == 2 or cond == 22) { // Mostly Cloudy or Partly Clear if (clockTime >= sunset or clockTime < sunrise) { dc.drawText(x2, y, WeatherFont, "h", Graphics.TEXT_JUSTIFY_RIGHT); // Mostly Cloudy Night - Storage.setValue(34, "Overcast Night"); + condName="Overcast Night"; } else { dc.drawText(x, y, WeatherFont, "B", Graphics.TEXT_JUSTIFY_RIGHT); // Mostly Cloudy Day - Storage.setValue(34, "Mostly Cloudy"); + condName="Mostly Cloudy"; } } else if (cond == 3 or cond == 14 or cond == 15 or cond == 11 or cond == 13 or cond == 24 or cond == 25 or cond == 26 or cond == 27 or cond == 45) { // Rain or Light Rain or heavy rain or showers or unkown or chance if (clockTime >= sunset or clockTime < sunrise) { dc.drawText(x2, y, WeatherFont, "c", Graphics.TEXT_JUSTIFY_RIGHT); // Rain Night - Storage.setValue(34, "Rainy Night"); + condName="Rainy Night"; } else { dc.drawText(x, y, WeatherFont, "D", Graphics.TEXT_JUSTIFY_RIGHT); // Rain Day - Storage.setValue(34, "Rainy Day"); + condName="Rainy Day"; } } else if (cond == 4 or cond == 10 or cond == 16 or cond == 17 or cond == 34 or cond == 43 or cond == 46 or cond == 48 or cond == 51) { // Snow or Hail or light or heavy snow or ice or chance or cloudy chance or flurries or ice snow if (clockTime >= sunset or clockTime < sunrise) { dc.drawText(x2, y, WeatherFont, "e", Graphics.TEXT_JUSTIFY_RIGHT); // Snow Night - Storage.setValue(34, "Snowy Night"); + condName="Snowy Night"; } else { dc.drawText(x, y, WeatherFont, "F", Graphics.TEXT_JUSTIFY_RIGHT); // Snow Day - Storage.setValue(34, "Snowy Day"); + condName="Snowy Day"; } } else if (cond == 6 or cond == 12 or cond == 28 or cond == 32 or cond == 36 or cond == 41 or cond == 42) { // Thunder or scattered or chance or tornado or squall or hurricane or tropical storm if (clockTime >= sunset or clockTime < sunrise) { @@ -450,22 +475,22 @@ class MtbA_functions { } else { dc.drawText(x, y, WeatherFont, "C", Graphics.TEXT_JUSTIFY_RIGHT); // Thunder Day } - Storage.setValue(34, "Thunderstorms"); + condName="Thunderstorms"; } else if (cond == 7 or cond == 18 or cond == 19 or cond == 21 or cond == 44 or cond == 47 or cond == 49 or cond == 50) { // Wintry Mix (Snow and Rain) or chance or cloudy chance or freezing rain or sleet if (clockTime >= sunset or clockTime < sunrise) { dc.drawText(x2, y, WeatherFont, "d", Graphics.TEXT_JUSTIFY_RIGHT); // Snow+Rain Night - Storage.setValue(34, "Wintry Mix Night"); + condName="Wintry Mix Night"; } else { dc.drawText(x, y, WeatherFont, "E", Graphics.TEXT_JUSTIFY_RIGHT); // Snow+Rain Day - Storage.setValue(34, "Wintry Mix Day"); + condName="Wintry Mix Day"; } } else if (cond == 8 or cond == 9 or cond == 29 or cond == 30 or cond == 31 or cond == 33 or cond == 35 or cond == 37 or cond == 38 or cond == 39) { // Fog or Hazy or Mist or Dust or Drizzle or Smoke or Sand or sandstorm or ash or haze if (clockTime >= sunset or clockTime < sunrise) { dc.drawText(x2, y, WeatherFont, "a", Graphics.TEXT_JUSTIFY_RIGHT); // Fog Night - Storage.setValue(34, "Foggy Night"); + condName="Foggy Night"; } else { dc.drawText(x, y, WeatherFont, "A", Graphics.TEXT_JUSTIFY_RIGHT); // Fog Day - Storage.setValue(34, "Foggy Day"); + condName="Foggy Day"; } } return true; @@ -476,7 +501,7 @@ class MtbA_functions { /* ------------------------ */ - function drawTemperature(dc, x, y, showBoolean, width) { + function drawTemperature(dc, x, y, showBoolean, width, unit) { var TempMetric = System.getDeviceSettings().temperatureUnits; var temp=null, units = "", minTemp=null, maxTemp=null; @@ -494,7 +519,7 @@ class MtbA_functions { } if (showBoolean == false and weather!=null and (weather.feelsLikeTemperature!=null)) { //feels like ; and weather.feelsLikeTemperature instanceof Number - if (TempMetric == System.UNIT_METRIC or Storage.getValue(16)==true) { //Celsius + if (TempMetric == System.UNIT_METRIC or unit) { //Celsius units = "°C"; temp = weather.feelsLikeTemperature; } else { @@ -507,7 +532,7 @@ class MtbA_functions { units = "°F"; } } else if(weather!=null and (weather.temperature!=null)) { // real temperature ; and weather.temperature instanceof Number - if (TempMetric == System.UNIT_METRIC or Storage.getValue(16)==true) { //Celsius + if (TempMetric == System.UNIT_METRIC or unit) { //Celsius units = "°C"; temp = weather.temperature; } else { @@ -551,56 +576,15 @@ class MtbA_functions { /* ------------------------ */ // Weather Location Name - function drawLocation(dc, x, y, wMax, hMax, showBoolean) { - - var cond = Toybox.Weather.getCurrentConditions(); - var location; - - if (showBoolean != false) { // Show Location Name - //System.println(cond.precipitationChance); - if(cond!=null and cond.observationLocationName!=null) { - location = cond.observationLocationName; - if (location.length()>15 and location.find(",")!=null){ - location = location.substring(0,location.find(",")); - } - if (location.find("ocation[")!=null){ - location="null"; - } - if (location.find("null")!=null and location.find(",")!=null) { - var location2 = location.substring(0,location.find(",")); - if (location2.find("null")!=null) { - location2 = location.substring(location.find(",")+2,location.length()); - if (location2.find("null")!=null){ - location2 = ""; - } - } - location = location2; - } - else if (location.find("null")!=null) { - location = ""; - } - - } - else { // Dealing with an error when currentConditions exist but location name still returns null - Also deals with new firmwares where the location name has been deprecated - var desc=Storage.getValue(34); - if (desc!=null) { - location = desc; - } else { - location = ""; - } - } + function drawLocation(dc, x, y, showBoolean, logo) { - if(x*2==260 and Storage.getValue(3)==false){ + if(x*2==260 and logo){ y = y+6; } dc.setColor((fontColor==Graphics.COLOR_WHITE ? Graphics.COLOR_LT_GRAY : Graphics.COLOR_DK_GRAY), Graphics.COLOR_TRANSPARENT); //dc.fitTextToArea(text, font, width, height, truncate) - dc.drawText(x, y, Graphics.FONT_XTINY, dc.fitTextToArea(location, Graphics.FONT_XTINY, wMax, hMax, true), Graphics.TEXT_JUSTIFY_CENTER); - return true; - } else { - return false; - } + dc.drawText(x, y, Graphics.FONT_XTINY, showBoolean != false ? condName : "", Graphics.TEXT_JUSTIFY_CENTER); } /* ------------------------ */ @@ -626,7 +610,7 @@ class MtbA_functions { if(width==280 or width==240){ //Fenix 6X & Enduro yIcon=yIcon-5; - if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ //Fenix 5 Plus + if (width==240 and dc.getFontHeight(0)>=26){ //Fenix 5 Plus yIcon=yIcon-0.5; } } else if (width==260){ @@ -779,15 +763,18 @@ class MtbA_functions { hrIconY = hrIconY + 1; xIcon = xIcon - 1; offset = 4; - } else if(dc.getTextDimensions("100",0)[1]>=26){ // Fenix 5 Plus + } else if(dc.getFontHeight(0)>=26){ // Fenix 5 Plus xIcon = xIcon - 1; offset = 4; } } else if(width==218){ // VA4s xText = xText-1.5; hrIconY = hrIconY - 2; + } else if(width==208){ // FR55 + offset = 1; } + var FontAdj= 0; if (fontSize==1){ //big if (width==260 and dc.getFontHeight(Graphics.FONT_TINY)==29) { //Fenix 6 @@ -821,15 +808,16 @@ class MtbA_functions { /* ------------------------ */ // Draw Battery Icon and Text - function drawBatteryIcon(dc, xBattery, yBattery, xContact, yContact, width, height, accentColor) { + function drawBatteryIcon(dc, xBattery, yBattery, xContact, yContact, width, accentColor, greyIcon) { var battery = Math.ceil(System.getSystemStats().battery); var batteryIconColour; + var height=dc.getHeight(); // Choose the colour of the battery based on it's state if (fontColor == Graphics.COLOR_WHITE){ // Dark Theme batteryIconColour = Graphics.COLOR_LT_GRAY; - if (Storage.getValue(28)!=false){ // Show battery colors + if (greyIcon!=false){ // Show battery colors if (battery <= 20) { batteryIconColour = 0xFF5555 /* pastel red */; } else if (battery <= 40) { @@ -844,7 +832,7 @@ class MtbA_functions { } } else { // Light Theme batteryIconColour = Graphics.COLOR_DK_GRAY; - if (Storage.getValue(28)!=false){ // Show battery colors + if (greyIcon!=false){ // Show battery colors if (battery <= 20) { batteryIconColour = 0xAA0000; /* red */ } else if (battery <= 40) { @@ -871,28 +859,34 @@ class MtbA_functions { yBattery = yBattery - 3; xContact = xContact + 14; yContact = yContact - 2; - } else if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ //text height in pixels (Fenix 5 Plus) + } else if (width==240 and dc.getFontHeight(0)>=26){ //text height in pixels (Fenix 5 Plus) xBattery = xBattery - 5; offsetLED = -3; offset = -1; xContact = xContact + 7; yContact = yContact + 1; - } + } else if (width==208){ + offsetLED = -2; + offset = -1; + yBattery = yBattery - 1; + } dc.setColor(batteryIconColour, Graphics.COLOR_TRANSPARENT); //dc.fillRoundedRectangle(x, y, width, height, radius) - dc.fillRoundedRectangle(xBattery, yBattery , width*0.135 + (System.SCREEN_SHAPE_ROUND != screenShape ? 14 : 0) + (width==240 and dc.getTextDimensions("100",0)[1]>=26 and System.SCREEN_SHAPE_ROUND == screenShape ? 12 : 0), height*0.0625 - offsetLED, 2); + dc.fillRoundedRectangle(xBattery, yBattery , width*0.135 + (System.SCREEN_SHAPE_ROUND != screenShape ? 14 : 0) + (width==240 and dc.getFontHeight(0)>=26 and System.SCREEN_SHAPE_ROUND == screenShape ? 12 : 0), height*0.0625 - offsetLED, 2); dc.fillRoundedRectangle(xContact, yContact , width*0.018, height*0.039 - offset, 2); } - // Draw Battery Text (separate because of "too many arguments" error) - function drawBatteryText(dc, xText, yText, width, check) { + // Draw Battery Text (separate because of "too many arguments" error) + function drawBatteryText(dc, xText, yText, width, estimateFlag) { - var estimateFlag = Storage.getValue(19); + //var estimateFlag = Storage.getValue(19); var battery = Math.ceil(System.getSystemStats().battery); var today = Time.Gregorian.info(Time.now(), Time.FORMAT_SHORT); + var maxCharge = Storage.getValue(30); + var check = dc.getFontHeight(0); - if (System.getSystemStats().charging==true or (Storage.getValue(30)!=null and battery>Storage.getValue(30) or (battery==Storage.getValue(30) and battery==100))){ + if (System.getSystemStats().charging==true or (maxCharge!=null and battery>maxCharge or (battery==maxCharge and battery==100))){ var test = [ today.hour, today.min, @@ -907,7 +901,7 @@ class MtbA_functions { //Storage.setValue(22, null); // reset last hourDiff calculation } - if (estimateFlag == true and check == true){ // user requested and watch supports + if (estimateFlag == true and System.getSystemStats() has :batteryInDays){ // user requested and watch supports if (System.getSystemStats().batteryInDays!=null and System.getSystemStats().batteryInDays!=0){ //trying to make sure that we don't get an error if batteryInDays not supported by watch battery = System.getSystemStats().batteryInDays; } @@ -925,22 +919,24 @@ class MtbA_functions { var offset = 0, offsetLED = 0; if (width==390) { // Venu & D2 Air - if (dc.getTextDimensions("100",0)[1]>=33){ // Venu, D2 Air & Approach S70 42mm (33) + if (check>=33){ // Venu, D2 Air & Approach S70 42mm (33) offset = -2; - } else if (dc.getTextDimensions("100",0)[1]==30){ // FR165 (30) + } else if (check==30){ // FR165 (30) offset = 0; } else { // epix Pro Gen 2 42mm & MARQ Gen 2 offset = -1; } } else if (width==280) { // Enduro & Fenix 6X Pro offset = 0.75; - } else if (width==218 or width==240) { // Vivoactive 4S & Fenix 6S & Vivoactive 3 Music - if (width==218 and dc.getFontHeight(Graphics.FONT_TINY)==23) { // FR255s + } else if (width<=218 or width==240) { // Vivoactive 4S & Fenix 6S & Vivoactive 3 Music + if (width==218 and dc.getFontHeight(1)==23) { // FR255s offset = 0; } else if (System.SCREEN_SHAPE_ROUND == screenShape) { offset = -0.5; - if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ //Fenix 5 Plus + if (width==240 and check>=26){ //Fenix 5 Plus or FR55 offset = -2.5; + } else if (width==208){ + offset = -3; } } else { // Venu sq offset = -4.5; @@ -949,7 +945,7 @@ class MtbA_functions { } else if (width==360) { // Venu 2 & 2s offset = -1; } else if (width>=416) { - if (width==454 and dc.getTextDimensions("100",0)[1]==35){ // Venu 3 + if (width==454 and check==35){ // Venu 3 offset = 1; } offsetLED = -1; @@ -958,7 +954,11 @@ class MtbA_functions { if (fontColor == Graphics.COLOR_WHITE){ // Dark Theme dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT); } else { // Light Theme - dc.setColor(((battery <= 40 and battery > 20) ? Graphics.COLOR_BLACK : Graphics.COLOR_WHITE), Graphics.COLOR_TRANSPARENT); + if (width==208 and battery > 40){ + dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT); + } else { + dc.setColor(((battery <= 40 and battery > 20) ? Graphics.COLOR_BLACK : Graphics.COLOR_WHITE), Graphics.COLOR_TRANSPARENT); + } //dc.setColor((Graphics.COLOR_BLACK), Graphics.COLOR_TRANSPARENT); } @@ -969,7 +969,7 @@ class MtbA_functions { /* ------------------------ */ function calcHourDiff(today) { // calculate hourDiff - var lastCharge=Storage.getValue(29); + var lastCharge=Storage.getValue(29) as Array; var hourDiff = 0; hourDiff = (((today.hour - lastCharge[0])*60 + ((today.min - lastCharge[1])))/60d); @@ -1015,14 +1015,15 @@ class MtbA_functions { var battery = Math.ceil(System.getSystemStats().battery); var today = Time.Gregorian.info(Time.now(), Time.FORMAT_SHORT); var text = null; + var maxCharge = Storage.getValue(30); if (System.getSystemStats().charging==true){ text = "chrng."; - } else if (System.getSystemStats().charging==false and today.sec % 30 == 0){ // 3 times per minute // or every 15 minutes -> and today.sec==0 and (today.min % 15 == 0) - if (Storage.getValue(30)==null){ // need to charge for the first time + } else if (System.getSystemStats().charging==false and ((width >=360 and today.sec % 30 == 0) or (width <360 and today.sec == 0))){ // 3 times per minute for AMOLED and 1 time per minute for MIP // or every 15 minutes -> and today.sec==0 and (today.min % 15 == 0) + if (maxCharge==null){ // need to charge for the first time text = "charge"; // show percentage? Storage.setValue(31, "charge"); - } else if (battery==Storage.getValue(30) or Storage.getValue(30)-battery<=1){ // still waiting for battery percentage to drop in order to calculate estimation + } else if (battery==maxCharge or maxCharge-battery<=1){ // still waiting for battery percentage to drop in order to calculate estimation text = "estim."; //text = "calc"; // show percentage? Storage.setValue(31, "estim."); } else{ // battery has dropped, so estimate is going to be calculated here @@ -1030,12 +1031,12 @@ class MtbA_functions { var hourDiff; hourDiff = calcHourDiff(today); //calculate hourDiff - if(hourDiff==0){ //error, not expected + if(hourDiff==0){ //error, not expected on a real watch return false; } //Lang.format("$1$", [stepDistance.format("%.1f")] ); - text = ((Storage.getValue(30)-battery)/hourDiff)*24; //text = battery*(hourdiff)/(battDiff) + text = ((maxCharge-battery)/hourDiff)*24; //text = battery*(hourdiff)/(battDiff) if (text<1){ text = text.format("%.1f") ; // + "%/d" } else if (text>=100){ @@ -1048,7 +1049,9 @@ class MtbA_functions { } } else { text = Storage.getValue(31); - if (text == null){ + if (text == null and maxCharge == null){ + text = "charge"; // never charged + } else if (text == null and maxCharge != null) { text = "estim."; // not able to calculate yet } } @@ -1110,7 +1113,12 @@ class MtbA_functions { offsetX = 2; } - dc.setColor((fontColor==Graphics.COLOR_WHITE ? Graphics.COLOR_LT_GRAY : Graphics.COLOR_DK_GRAY), Graphics.COLOR_TRANSPARENT); + if (width!=208){ + dc.setColor((fontColor==Graphics.COLOR_WHITE ? Graphics.COLOR_LT_GRAY : Graphics.COLOR_DK_GRAY), Graphics.COLOR_TRANSPARENT); + } else { // FR55 + dc.setColor(fontColor, Graphics.COLOR_TRANSPARENT); + } + dc.drawText( x + offsetX, y + offsetY , IconsFont, "Y", Graphics.TEXT_JUSTIFY_LEFT); return true; } else { @@ -1298,7 +1306,7 @@ class MtbA_functions { offsetY = 7; } else if (System.SCREEN_SHAPE_ROUND != screenShape) { // Venu sq offsetY = -2; - } else if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ // Fenix 5 Plus + } else if (width==240 and dc.getFontHeight(0)>=26){ // Fenix 5 Plus offsetY = -1; } @@ -1325,7 +1333,7 @@ class MtbA_functions { /* ------------------------ */ // Draw Hour and Minute Hands - function drawHands(dc, width, height, accentColor, thickInd, aod, upTop) { + function drawHands(dc, width, height, accentColor, thickInd, aod, upTop, AODColor) { var clockTime = System.getClockTime(); var screenCenterPoint = [width/2, height/2]; @@ -1344,7 +1352,7 @@ class MtbA_functions { // thickInd = 1 --> Thicker // thickInd = 2 --> Thinner - var handWidth = width; + var handWidth = width as Float; if (handWidth==260){ handWidth=10; offsetOuterCircle=-1; @@ -1408,7 +1416,7 @@ class MtbA_functions { var borderColor=Graphics.COLOR_BLACK, arborColor=Graphics.COLOR_LT_GRAY; // colors for not AOD mode var BurnIn = System.getDeviceSettings().requiresBurnInProtection; - if (aod==true and BurnIn==true and Storage.getValue(22) != true) { //AOD mode ON + if (aod==true and BurnIn==true and AODColor != true) { //AOD mode ON accentColor=Graphics.COLOR_LT_GRAY; //arborColor=Graphics.COLOR_LT_GRAY; //borderColor=Graphics.COLOR_BLACK; @@ -1422,7 +1430,7 @@ class MtbA_functions { dc.setColor(borderColor, Graphics.COLOR_TRANSPARENT); //(centerPoint, angle, handLength, tailLength, width, triangle) dc.fillPolygon(generateHandCoordinates(screenCenterPoint, hourHandAngle, width / 3.485, 0, Math.ceil(handWidth+(width*0.01)), triangle)); // hour hand border - dc.setColor(((aod==true and BurnIn==true and Storage.getValue(22) != true) or (fontColor == Graphics.COLOR_BLACK)) ? arborColor : Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); // Light gray if AOD mode ON, White if not (or MIP display) + dc.setColor(((aod==true and BurnIn==true and AODColor != true) or (fontColor == Graphics.COLOR_BLACK)) ? arborColor : Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); // Light gray if AOD mode ON, White if not (or MIP display) dc.fillPolygon(generateHandCoordinates(screenCenterPoint, hourHandAngle, width / 3.54 , 0, handWidth, triangle-0.01)); // hour hand // Draw the minute hand. @@ -1465,7 +1473,7 @@ class MtbA_functions { dc.setColor(borderColor,Graphics.COLOR_BLACK); dc.fillPolygon(generateHandCoordinates(screenCenterPoint, secondHandAngle, width / 2.055, -(width/2.25), Math.ceil(handWidth+(width*0.0255))/2.75, 1.0)); //rectangle } - dc.setColor(((aod==true and BurnIn==true and Storage.getValue(22) != true) or (accentColor == Graphics.COLOR_WHITE)) ? arborColor : Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); // Light gray if AOD mode ON, White if not (or MIP display) + dc.setColor(((aod==true and BurnIn==true and AODColor != true) or (accentColor == Graphics.COLOR_WHITE)) ? arborColor : Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); // Light gray if AOD mode ON, White if not (or MIP display) dc.fillPolygon(generateHandCoordinates(screenCenterPoint, secondHandAngle, width / 2.075, -(width/2.23), Math.ceil(handWidth-(width*0.0035))/2.75, 1.0)); //rectangle } @@ -1474,10 +1482,10 @@ class MtbA_functions { /* ------------------------ */ // Draw Garmin Logo - function drawGarminLogo(dc, x, y) { + function drawGarminLogo(dc, x as Number, y as Number, theme) { var garminIcon = null; - if (Storage.getValue(32) == true){ // light theme + if (theme){ // light theme garminIcon = Application.loadResource(Rez.Drawables.GarminLogoWhite); } else { // dark theme garminIcon = Application.loadResource(Rez.Drawables.GarminLogo); @@ -1520,7 +1528,7 @@ class MtbA_functions { offset = 7; } else if (System.SCREEN_SHAPE_ROUND != screenShape) { // Venu sq offset = -2; - } else if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ //Fenix 5 Plus + } else if (width==240 and dc.getFontHeight(0)>=26){ //Fenix 5 Plus offset = -1; } @@ -1561,7 +1569,7 @@ class MtbA_functions { offsetY = 7; // } else if (System.SCREEN_SHAPE_ROUND != screenShape){ // Venu sq // offsetY = -1; - } else if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ // Fenix 5 Plus + } else if (width==240 and dc.getFontHeight(0)>=26){ // Fenix 5 Plus offsetY = -1; } @@ -1623,7 +1631,7 @@ class MtbA_functions { //elevation = Activity.getActivityInfo().altitude; if(Activity.getActivityInfo().rawAmbientPressure!=null){ pressure = Activity.getActivityInfo().rawAmbientPressure; - } else if (Activity.getActivityInfo().ambientPressure!=null){ + } else if (Activity.getActivityInfo() has :AmbientPressure and Activity.getActivityInfo().ambientPressure!=null){ pressure = Activity.getActivityInfo().ambientPressure; } } @@ -1638,7 +1646,7 @@ class MtbA_functions { dc.setColor((fontColor==Graphics.COLOR_WHITE ? Graphics.COLOR_LT_GRAY : Graphics.COLOR_DK_GRAY), Graphics.COLOR_TRANSPARENT); - if (pressure!=null){ + if (pressure!=null and pressure instanceof Float){ if (fontColor == Graphics.COLOR_WHITE){ // Dark Theme if(pressure<100914.4) { dc.setColor(0xFFAA00, Graphics.COLOR_TRANSPARENT); @@ -1652,11 +1660,11 @@ class MtbA_functions { dc.setColor(0x0055AA, Graphics.COLOR_TRANSPARENT); } } - } - dc.drawText( xIcon, yIcon + offset , IconsFont, "@", Graphics.TEXT_JUSTIFY_CENTER); // Using Font + + dc.drawText( xIcon, yIcon + offset , IconsFont, "@", Graphics.TEXT_JUSTIFY_CENTER); // Using Font // Pressure Text - if (pressure != null) { +// if (pressure != null and pressure instanceof Float) { if (System.getDeviceSettings().temperatureUnits == System.UNIT_METRIC or Storage.getValue(16)==true) { // Always Celsius pressure = pressure / 100; pressure = pressure.format("%.0f"); @@ -1679,7 +1687,7 @@ class MtbA_functions { /* ------------------------ */ // Draw Precipitation Percentage - function drawPrecipitation(dc, xIcon, yIcon, xText, yText, width) { +(:tempo) function drawPrecipitation(dc, xIcon, yIcon, xText, yText, width) { //var IconsFont = Application.loadResource(Rez.Fonts.HumidityFont); var precipitation=0; @@ -1747,7 +1755,7 @@ class MtbA_functions { /* ------------------------ */ // Draw Min and Max Temperatures - function drawMinMaxTemp(dc, xIcon, yIcon, xText, yText, width) { +(:tempo) function drawMinMaxTemp(dc, xIcon, yIcon, xText, yText, width) { //var IconsFont = Application.loadResource(Rez.Fonts.IconsFont); var minTemp, maxTemp; @@ -1781,7 +1789,7 @@ class MtbA_functions { offset = 7; } else if (System.SCREEN_SHAPE_ROUND != screenShape) { // Venu sq offset = -2; - } else if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ //Fenix 5 Plus + } else if (width==240 and dc.getFontHeight(0)>=26){ //Fenix 5 Plus offset = -1; } @@ -1815,7 +1823,7 @@ class MtbA_functions { /* ------------------------ */ // Draw Humidity Percentage - function drawHumidity(dc, xIcon, yIcon, xText, yText, width, accentColor) { +(:tempo) function drawHumidity(dc, xIcon, yIcon, xText, yText, width, accentColor) { //var IconsFont = Application.loadResource(Rez.Fonts.IconsFont); var humidity=0; @@ -1875,10 +1883,36 @@ class MtbA_functions { return true; } + /* ------------------------ */ + +(:tempo) function drawForecast(dc, xIcon, yIcon, width, size) { + //var today = Time.Gregorian.info(Time.now(), Time.FORMAT_SHORT); + + if (Toybox has :Weather and Toybox.Weather has :getHourlyForecast) { + var forecast = null; +// if ((width >=360 and today.sec % 30 == 0) or (width <360 and today.sec == 0)){ // 3 times per minute for AMOLED and 1 time per minute for MIP + if(Weather.getHourlyForecast() != null) { + forecast = Weather.getHourlyForecast(); + //forecast[-1].condition; + if (forecast[0].forecastTime != null){ // Trying to fix an error when weather data is not available + var info = Gregorian.info(forecast[0].forecastTime, Time.FORMAT_SHORT); + var x2Icon = xIcon + 1; + drawWeatherIcon(dc, xIcon, yIcon, x2Icon, width, forecast[0].condition, info.hour); + var adj = xIcon + dc.getTextWidthInPixels("000", 0) + 1; + drawWeatherIcon(dc, adj, yIcon, adj, width, forecast[1].condition, info.hour+1); + if (size==3 and width>208) { // don't go in if FR55 (not enough space/resolution for 3 hour forecast) + adj = adj + dc.getTextWidthInPixels("000", 0) + 1; + drawWeatherIcon(dc, adj, yIcon, adj, width, forecast[2].condition, info.hour+2); + } + } + } + } + // } + } /* ------------------------ */ // Draw Wind Speed - function drawWindSpeed(dc, xIcon, yIcon, xText, yText, width) { +(:tempo) function drawWindSpeed(dc, xIcon, yIcon, xText, yText, width) { var WindMetric = System.getDeviceSettings().paceUnits; var windSpeed=null; @@ -1968,7 +2002,7 @@ class MtbA_functions { } else { letter = "P"; } - if (letter.length()==2 and (width>260 or System.SCREEN_SHAPE_ROUND != screenShape)) { + if (letter.length()==2 and (width>260 or System.SCREEN_SHAPE_ROUND != screenShape or width==240)) { xIcon = xIcon - 2; } } @@ -1986,6 +2020,9 @@ class MtbA_functions { } else { yIcon = yIcon - 6; } + } else if (width==208) { // FR55 + yIcon = yIcon - 1; + xIcon = xIcon - 1; } if (letter != null){ @@ -2106,13 +2143,13 @@ class MtbA_functions { } seconds = clockTime.hour.format("%2d") + ":" + clockTime.min.format("%02d"); if (clockTime.hour < 10 and clockTime.hour > 0 and width>=240){ - xText=xText-(dc.getTextDimensions(clockTime.hour.format("%2d"),fontSize)[0])/2; + xText=xText-(dc.getTextWidthInPixels(clockTime.hour.format("%2d"),fontSize))/2; } else { - xText=xText-(dc.getTextDimensions("1",fontSize)[0])/2; + xText=xText-(dc.getTextWidthInPixels("1",fontSize))/2; } } - // placeholder for implementation of Partial Update + // placeholder for future implementation of Partial Update /* dc.setClip( mSecondsClipRectX + mSecondsClipXAdjust, @@ -2133,7 +2170,7 @@ class MtbA_functions { if (width==240 and System.SCREEN_SHAPE_ROUND == screenShape){ yIcon = yIcon - 1.5; - if (dc.getTextDimensions("100",0)[1]>=26){ + if (dc.getFontHeight(0)>=26){ yIcon = yIcon + 1; } } else if (width==218){ @@ -2143,7 +2180,9 @@ class MtbA_functions { dc.drawText( xIcon, yIcon, IconsFont, "2", Graphics.TEXT_JUSTIFY_CENTER); // Using Font dc.setColor(fontColor, Graphics.COLOR_TRANSPARENT); - dc.drawText(xText, yText, fontSize, seconds, Graphics.TEXT_JUSTIFY_LEFT); + if (lowPower==false) { + dc.drawText(xText, yText, fontSize, seconds, Graphics.TEXT_JUSTIFY_LEFT); + } if (type==2){ //digital clock //dc.drawText(xText + dc.getTextWidthInPixels(seconds,fontSize), yText + fontSize*((dc.getFontHeight(Graphics.FONT_TINY)-dc.getFontHeight(Graphics.FONT_XTINY))*0.9 - (width>=360 ? 1 : 0)), 0, am_pm, Graphics.TEXT_JUSTIFY_LEFT); @@ -2176,7 +2215,7 @@ class MtbA_functions { if (width==240 and System.SCREEN_SHAPE_ROUND == screenShape){ yIcon = yIcon - 1; - if (dc.getTextDimensions("100",0)[1]>=26){ + if (dc.getFontHeight(0)>=26){ yIcon = yIcon - 1; } } else if (width==218){ @@ -2200,7 +2239,7 @@ class MtbA_functions { offset = 7; } else if (System.SCREEN_SHAPE_ROUND != screenShape) { // Venu sq offset = -2; - } else if (width==240 and dc.getTextDimensions("100",0)[1]>=26){ //Fenix 5 Plus + } else if (width==240 and dc.getFontHeight(0)>=26){ //Fenix 5 Plus offset = -1; } @@ -2447,7 +2486,7 @@ class MtbA_functions { // Draw next Sun Event time //(:memory) - function drawSunriseSunset(dc, xIcon, yIcon, xText, yText, width) { +(:tempo) function drawSunriseSunset(dc, xIcon, yIcon, xText, yText, width) { // placeholder for SDK 5 var myTime = System.getClockTime(); @@ -2536,8 +2575,8 @@ class MtbA_functions { /* ------------------------ */ - // Draw Right Data Points - function drawPoints(dc, xIcon, yIcon, xText, yText, accentColor, width, dataPoint, side) { // exclude for Fenix 5 plus + // Draw Data Fields +(:tempo) function drawPoints(dc, xIcon, yIcon, xText, yText, accentColor, width, dataPoint, side) { // exclude for Fenix 5 plus // side 1 = left top // side 2 = left middle // side 3 = left bottom @@ -2598,6 +2637,8 @@ class MtbA_functions { } else if ((side>2 and dataPoint == 21) or (side<=2 and dataPoint == 25)) { // Notification(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset) //drawBatteryConsumption(dc, xIcon-(xIcon*0.002), yIcon+(xIcon*0.035)-offset390, xText, yText, width); drawBatteryConsumption(dc, xIcon-(xIcon*0.002), yIcon+(width*0.025)-offset390, xText, yText, width); + } else if (side>2 and dataPoint == 22){ + drawForecast(dc, xIcon+(width*0.06), yIcon+(width*0.01), width, 2); } else if (side<=2 and dataPoint == 1) { drawDistance(dc, xIcon-offset390, yIcon, xText+(xText*0.015)-offset390, yText, width, accentColor); } else if (side<=2 and dataPoint == 2) { // elevationIcon(dc, xIcon, yIcon, xText, yText, width) @@ -2606,7 +2647,74 @@ class MtbA_functions { drawWindSpeed(dc, xIcon-offset390, yIcon+(xIcon*0.01)-offset390, xText, yText, width); } else if (side<=2 and dataPoint == 4) { // drawMinMaxTemp(dc, xIcon, yIcon, xText, yText, width) drawMinMaxTemp(dc, xIcon+(offset390*2), yIcon, xText+(xText*0.01), yText, width); + } else if (side<=2 and dataPoint == 26){ + drawForecast(dc, xIcon+(width*0.06), yIcon+(width*0.01), width, 3); + } + } + + /* ------------------------ */ + + // Draw Data Fields +(:noTempo) function drawPoints(dc, xIcon, yIcon, xText, yText, accentColor, width, dataPoint, side) { // exclude for Fenix 5 plus + // side 1 = left top + // side 2 = left middle + // side 3 = left bottom + // side 4 = right top and bottom + + var offset390=0; + + if (width>=390) { // Venu 1 & 2 + offset390=1; + } else if (System.SCREEN_SHAPE_ROUND != screenShape) { //check if rectangle display + offset390=1; + } + + if (dataPoint == 0) { //Steps + drawSteps(dc, xIcon-(xIcon*0.002), yIcon, xText, yText, width, accentColor); + } else if ((side>2 and dataPoint == 3) or (side<=2 and dataPoint == 7)) { // elevationIcon(dc, xIcon, yIcon, xText, yText, width) + drawPressure(dc, xIcon, yIcon, xText+(xText*0.01)-offset390, yText, width); + } else if ((side>2 and dataPoint == 4) or (side<=2 and dataPoint == 8)) { // Calories Total + drawCalories(dc, xIcon+(offset390*2), yIcon, xText, yText, width, 1); + } else if ((side>2 and dataPoint == 5) or (side<=2 and dataPoint == 9)) { // Calories Active + drawCalories(dc, xIcon+(offset390*2), yIcon, xText, yText, width, 2); + } else if ((side>2 and dataPoint == 6) or (side<=2 and dataPoint == 10)) { // FloorsClimbed(dc, xIcon, yIcon, xText, yText, width, accentColor) + drawFloorsClimbed(dc, xIcon-(xIcon*0.002), yIcon-(xIcon*0.001), xText, yText, width, accentColor); + } else if ((side>2 and dataPoint == 7) or (side<=2 and dataPoint == 11)) { // PulseOx(dc, xIcon, yIcon, xText, yText, width, accentColor) + drawPulseOx(dc, xIcon, yIcon, xText-offset390, yText, width, accentColor); + } else if ((side>2 and dataPoint == 8) or (side<=2 and dataPoint == 12)) { // HeartRate(dc, xIcon, hrIconY, xText, width, Xoffset, accentColor) + //drawHeartRate(dc, xIcon-(xIcon*0.005), yIcon+(xIcon*0.03)-offset390, xText, width, accentColor); + drawHeartRate(dc, xIcon-(xIcon*0.005), yIcon+(width*0.017)-offset390, xText, width, accentColor); + } else if ((side>2 and dataPoint == 9) or (side<=2 and dataPoint == 13)) { // Notification(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset) + drawNotification(dc, xIcon-(xIcon*0.002), yIcon+(xIcon*0.03)-offset390, xText, yText, accentColor, width); + } else if ((side>2 and dataPoint == 10) or (side<=2 and dataPoint == 14)) { // SolarIntensity (dc, xIcon, yIcon, xText, yText, width, accentColor) + drawSolarIntensity(dc, xIcon, yIcon, xText, yText, width, accentColor); + } else if ((side>2 and dataPoint == 11) or (side<=2 and dataPoint == 15)) { // Seconds + drawSeconds(dc, xIcon, yIcon+(width*0.02)-(offset390*2), xText, yText, width, 1); + } else if ((side>2 and dataPoint == 12) or (side<=2 and dataPoint == 16)) { // Digital Clock + drawSeconds(dc, xIcon, yIcon+(width*0.02)-(offset390*2), xText, yText, width, 2); + } else if ((side>2 and dataPoint == 13) or (side<=2 and dataPoint == 17)) { // Intensity Minutes + drawIntensityMin(dc, xIcon-(xIcon*0.002), yIcon+(xIcon*0.025)-(offset390*2), xText, yText, width, accentColor); + } else if ((side>2 and dataPoint == 14) or (side<=2 and dataPoint == 18)) { // SolarIntensity (dc, xIcon, yIcon, xText, yText, width, accentColor) + drawBodyBattery(dc, xIcon+2, yIcon-1, xText+(xText*0.01), yText, width); + } else if ((side>2 and dataPoint == 15) or (side<=2 and dataPoint == 19)) { // Calories(dc, xIcon, yIcon, xText, yText, width) + drawStress(dc, xIcon-(xIcon*0.002), yIcon+4, xText, yText, width); + } else if ((side>2 and dataPoint == 16) or (side<=2 and dataPoint == 20)) { // Respiration Rate(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset) + drawRespiration(dc, xIcon-(xIcon*0.002), yIcon+(xIcon*0.03)-offset390, xText, yText, accentColor, width); + } else if ((side>2 and dataPoint == 17) or (side<=2 and dataPoint == 21)) { // Recovery Time(dc, xIcon, yIcon, xText, yText, width, accentColor) + drawRecoveryTime(dc, xIcon, yIcon+(xIcon*0.002), xText-offset390, yText, width); + } else if ((side>2 and dataPoint == 18) or (side<=2 and dataPoint == 22)) { // Vo2 Max Run(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset) + drawVO2Max(dc, xIcon-(xIcon*0.002), yIcon+(xIcon*0.03)-offset390, xText, yText, width, false); // run + } else if ((side>2 and dataPoint == 19) or (side<=2 and dataPoint == 23)) { // Vo2 Max Cycling(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset) + drawVO2Max(dc, xIcon-(xIcon*0.002), yIcon+(xIcon*0.03)-offset390, xText, yText, width, true); //cycling + } else if ((side>2 and dataPoint == 21) or (side<=2 and dataPoint == 25)) { // Notification(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset) + //drawBatteryConsumption(dc, xIcon-(xIcon*0.002), yIcon+(xIcon*0.035)-offset390, xText, yText, width); + drawBatteryConsumption(dc, xIcon-(xIcon*0.002), yIcon+(width*0.025)-offset390, xText, yText, width); + } else if (side<=2 and dataPoint == 1) { + drawDistance(dc, xIcon-offset390, yIcon, xText+(xText*0.015)-offset390, yText, width, accentColor); + } else if (side<=2 and dataPoint == 2) { // elevationIcon(dc, xIcon, yIcon, xText, yText, width) + drawElevation(dc, xIcon-(xIcon*0.015), yIcon-(xIcon*0.01), xText+(xText*0.015)-offset390, yText, width); } } + } \ No newline at end of file