From 1ec4fbf2a8a7cb8f7c2a431c9903a80aaab76ca7 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 5 Nov 2022 01:11:41 +0100 Subject: [PATCH 01/12] Use (:glance) scope for resources --- .../resources/drawables/drawables.xml | 38 +++++++++---------- .../resources/strings/strings.xml | 4 +- .../source/OpenWeatherGlanceView.mc | 9 +++-- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Open Weather Widget/resources/drawables/drawables.xml b/Open Weather Widget/resources/drawables/drawables.xml index e76ffbd..554eabd 100644 --- a/Open Weather Widget/resources/drawables/drawables.xml +++ b/Open Weather Widget/resources/drawables/drawables.xml @@ -1,24 +1,24 @@ - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/Open Weather Widget/resources/strings/strings.xml b/Open Weather Widget/resources/strings/strings.xml index 11355b2..e5efe1a 100644 --- a/Open Weather Widget/resources/strings/strings.xml +++ b/Open Weather Widget/resources/strings/strings.xml @@ -33,7 +33,9 @@ Waiting for data... Invalid OWM Data - Invalid OWM API key + No OWM API key + Invalid API key + No Location Invalid Location Suspended OWM\nAPI key OWM Error: diff --git a/Open Weather Widget/source/OpenWeatherGlanceView.mc b/Open Weather Widget/source/OpenWeatherGlanceView.mc index 6a9c3f3..19a7d39 100644 --- a/Open Weather Widget/source/OpenWeatherGlanceView.mc +++ b/Open Weather Widget/source/OpenWeatherGlanceView.mc @@ -29,6 +29,7 @@ class OpenWeatherGlanceView extends Ui.GlanceView { function onShow() as Void {} // Update the view + (:glance) function onUpdate(dc as Dc) as Void { GlanceView.onUpdate(dc); //p("Glance onUpdate"); @@ -37,16 +38,16 @@ class OpenWeatherGlanceView extends Ui.GlanceView { dc.setColor(G.COLOR_WHITE, -1); dc.setPenWidth(1); dc.drawLine(0, GH /2, GW, GH/2); - dc.drawText(0, GH/4, G.FONT_SYSTEM_TINY, "Open Weather", G.TEXT_JUSTIFY_LEFT | G.TEXT_JUSTIFY_VCENTER); + dc.drawText(55, GH/4, G.FONT_SYSTEM_TINY, "OWM", G.TEXT_JUSTIFY_LEFT | G.TEXT_JUSTIFY_VCENTER); // Retrieve weather data var weatherData = App.Storage.getValue("weather"); var str = "-"; var apiKey = App.Properties.getValue("api_key"); - if (apiKey == null || apiKey.length() == 0) {str = "No API key";} - else if (App.Storage.getValue("last_location") == null) {str = "No Location";} + if (apiKey == null || apiKey.length() == 0) {str = App.loadResource(Rez.Strings.NoKey);} + else if (App.Storage.getValue("last_location") == null) {str = App.loadResource(Rez.Strings.NoLocation);} - if (weatherData != null && weatherData[0] == 401) {str = "Invalid API key";} + if (weatherData != null && weatherData[0] == 401) {str = App.loadResource(Rez.Strings.InvalidKey);} if (weatherData != null && weatherData[0] == 200 && weatherData.size() > 16) { if (weatherData[10] == null) {weatherData[10] = 0;} From 1ecbfb867cb3b078235bc7901fc683db32411b56 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 5 Nov 2022 01:12:33 +0100 Subject: [PATCH 02/12] Fix import --- Open Weather Widget/source/MenuSettings.mc | 1 + 1 file changed, 1 insertion(+) diff --git a/Open Weather Widget/source/MenuSettings.mc b/Open Weather Widget/source/MenuSettings.mc index decf024..d5a3c47 100644 --- a/Open Weather Widget/source/MenuSettings.mc +++ b/Open Weather Widget/source/MenuSettings.mc @@ -2,6 +2,7 @@ using Toybox.Application as App; using Toybox.Activity; using Toybox.Graphics as G; using Toybox.WatchUi; +using Toybox.Attention; class MenuSettingsView extends WatchUi.Menu2 { From 7f4836d9ec4aa8a4fb24446b54f82851a230afbd Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 5 Nov 2022 01:13:46 +0100 Subject: [PATCH 03/12] Fix warning about LaunchIcon size on fenix6xpro (40x40) --- .../drawables/drawables.xml | 3 +++ .../drawables/launcher_icon.png | Bin 0 -> 11628 bytes 2 files changed, 3 insertions(+) create mode 100644 Open Weather Widget/resources-fenix6xpro/drawables/drawables.xml create mode 100644 Open Weather Widget/resources-fenix6xpro/drawables/launcher_icon.png diff --git a/Open Weather Widget/resources-fenix6xpro/drawables/drawables.xml b/Open Weather Widget/resources-fenix6xpro/drawables/drawables.xml new file mode 100644 index 0000000..9ab4336 --- /dev/null +++ b/Open Weather Widget/resources-fenix6xpro/drawables/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/Open Weather Widget/resources-fenix6xpro/drawables/launcher_icon.png b/Open Weather Widget/resources-fenix6xpro/drawables/launcher_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8973e9478132644bef62696b96f543bc5c2e99b5 GIT binary patch literal 11628 zcmeHsWmKEnwsvr*xJz&i65QRTK??;6Ap~~_Qd|oZmjVTfyA&_(v_PRivEou(+oDC< zOS|_uXYcXdKWB{Z{@clTllNWgna`Z_S#zzCl@$%qR>8xj!Ug~UcxtMOy7%Agzb;Jl z`_I@PElvOc#qCplBTrqZH_+AH#oEph4)pYOg#+O}cGduZ&q8sQjn{Hpa>P#(JtyW@?H&Q1O~eV@iZ-`v?yUfGbAFgs9g40)vVO>gFr<5ds&aunqH_0<8`bJ(0y(gYyzI_N&&-V!LrLKf2tw@SH z;jS+OH+%g74UrpJxdUT_Vu8zFSsH8QSqe@grOef_Wmo4q47PO4Sqk7PX$OhLMzx&s*tg-_e!V$O*r1BC_{dqQNQEQuN-uUZ z5GdCYf=`p-<8MEacK#}uW#eOXFNAWEP>8b^Zu9(dP>igeDDT6Bl#oDFu*NVi`W_53 z^OOE-jnlM^<9un~74(ECT{a?)O-Pg$PL9Q3#!xO1m)NwPDt~dRo|;h8w8s#CX|~5O z^57Hs=#rvj4UVS9j}B#ZB`+Pyo0=E0T#zO-L2o|VJ5+nu%!_&KEasp*r4I}zQ~@(3 zfcI?+AAYoXn`!+DK09x19vFcZSk*C7QCZ!!%$nx4WVd7Hwd{1MP?2MyExEU;r!94K zHeS{Vz1zBcP_VsH_MMu8)=0YWZF{kQb|02@vZZoQM|6A?c|>sdMNDQjkMipw4(n#D zgJhdTHGUIqLZ(nRiQM>`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`Ozxakl+hj)3NSfCU7Q1%sC zpWHA%=;P(%tQPL^{TaH78>}-}c`I{&j1)dD_f4e7`3c@S$L_)F^Yd;9KFizJR{O~3 zTR4_SUFsV=u*0YtnUKju)-KN3V>9$Q0*vZ4q)vkXat%j7k0QvgbJmRrgwhn{OI@ap z8~1KbWHc)8NmOr3nYQ4A=}diWQG)9>eDZVgIlSESTyaT<9F#8W6^0fze6>)Us!TiKb2oZW;bDCPqVw%%bF5p9xPwOo%xdNm_Lf8 z_DR*elNntEW`Ps=G0VH&R7VZDvYO{!t+nM1AFtV~%aXUN6AWQ>?9MlLy_;X)XxNA; z0Zenl$4*=T#gSlG-M4W> Date: Sat, 5 Nov 2022 01:21:31 +0100 Subject: [PATCH 04/12] Change presentation of wind and gusts --- Open Weather Widget/resources/strings/strings.xml | 2 ++ Open Weather Widget/source/OpenWeatherWidgetView.mc | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Open Weather Widget/resources/strings/strings.xml b/Open Weather Widget/resources/strings/strings.xml index e5efe1a..008f903 100644 --- a/Open Weather Widget/resources/strings/strings.xml +++ b/Open Weather Widget/resources/strings/strings.xml @@ -44,5 +44,7 @@ Request Weather refresh Get location from GPS App Version + + to diff --git a/Open Weather Widget/source/OpenWeatherWidgetView.mc b/Open Weather Widget/source/OpenWeatherWidgetView.mc index c031f98..2b442fb 100644 --- a/Open Weather Widget/source/OpenWeatherWidgetView.mc +++ b/Open Weather Widget/source/OpenWeatherWidgetView.mc @@ -334,7 +334,12 @@ class OpenWeatherWidgetView extends Ui.View { if (screenNum == 1) { // Wind - str = windSpeedConvert(weatherData[14]) + " " + speedUnits + ", g" + windSpeedConvert(weatherData[15]); + str = windSpeedConvert(weatherData[14]); // Average + if(weatherData[14] != weatherData[15]) { // If gusts + str+= " " + R(Rez.Strings.ToWind) + " " + + windSpeedConvert(weatherData[15]); // Add gusts ! + } + str+= " " + speedUnits; drawStr(dc, 50, 78, G.FONT_SYSTEM_SMALL, G.COLOR_WHITE, str, G.TEXT_JUSTIFY_CENTER | G.TEXT_JUSTIFY_VCENTER); drawStr(dc, 14, 78, iconsFont, G.COLOR_LT_GRAY, "\uF050", G.TEXT_JUSTIFY_CENTER | G.TEXT_JUSTIFY_VCENTER); From b0cfde720357d58dd095290c2185d402763a061b Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 5 Nov 2022 01:18:42 +0100 Subject: [PATCH 05/12] Add fre language --- Open Weather Widget/manifest.xml | 7 ++- .../resources-fre/strings/strings.xml | 50 +++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 Open Weather Widget/resources-fre/strings/strings.xml diff --git a/Open Weather Widget/manifest.xml b/Open Weather Widget/manifest.xml index 0a96352..bd97646 100644 --- a/Open Weather Widget/manifest.xml +++ b/Open Weather Widget/manifest.xml @@ -1,4 +1,6 @@ - + + + @@ -80,7 +82,8 @@ eng + fre - + \ No newline at end of file diff --git a/Open Weather Widget/resources-fre/strings/strings.xml b/Open Weather Widget/resources-fre/strings/strings.xml new file mode 100644 index 0000000..fd86206 --- /dev/null +++ b/Open Weather Widget/resources-fre/strings/strings.xml @@ -0,0 +1,50 @@ + + Open Weather + 12 + + Never, refresh on the app start only + 15 min + 30 min + 1 heure + 2 heures + 3 heures + 4 heures + + Clé API Open Weather Map + Intervale de mise à jour + Use phone location provided by Garmin Weather (if available) + Unité de vitesse + Unité de température + + Système (Allure/Vitesse) + km/h + MPH + nœuds + m/s + Beaufort + + Unité de pression + hPa + inHG + mmHG + + Pas de localisation.\nPresser le bouton MENU\npour utiliser le GNSS. + Attente du signal\n satellite. Merci\n de rester sur cette\nécran... + + Attente des données... + Données OWM invalides + Pas de clé d'API OWM + Clé d'API OWM invalide + Pas de localisation + Localisation invalide + Clé d'API OWM\nsuspendue + Erreur OWM : + Paramétrer\nla clé d'API\nOpen Weather. + + Mettre à jour la météo + Localiser avec le GNSS + Version + + à + + From af58a2cefa5c370d2904ed71dad3a59bd67b83b3 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 5 Nov 2022 01:20:39 +0100 Subject: [PATCH 06/12] Add weather icon in glance view --- Open Weather Widget/source/GlobalCode.mc | 34 +++++++++++++++++++ .../source/OpenWeatherGlanceView.mc | 4 +++ .../source/OpenWeatherWidgetApp.mc | 1 + .../source/OpenWeatherWidgetView.mc | 26 ++------------ 4 files changed, 41 insertions(+), 24 deletions(-) diff --git a/Open Weather Widget/source/GlobalCode.mc b/Open Weather Widget/source/GlobalCode.mc index a991c01..7e89928 100644 --- a/Open Weather Widget/source/GlobalCode.mc +++ b/Open Weather Widget/source/GlobalCode.mc @@ -1,5 +1,6 @@ using Toybox.Application as App; using Toybox.Time; +using Toybox.WatchUi as Ui; using Toybox.System as Sys; using Toybox.WatchUi; using Toybox.StringUtil; @@ -57,6 +58,39 @@ function windDegreeToName (windDegree) { return windName; } +(:glance) +function weatherToIcon(weatherData) { + var iconsDictionary = { + "01d" => Rez.Drawables.d01, + "01n" => Rez.Drawables.n01, + "02d" => Rez.Drawables.d02, + "02n" => Rez.Drawables.n02, + "03d" => Rez.Drawables.d03, + "03n" => Rez.Drawables.n03, + "04d" => Rez.Drawables.d04, + "04n" => Rez.Drawables.n04, + "09d" => Rez.Drawables.d09, + "09n" => Rez.Drawables.n09, + "10d" => Rez.Drawables.d10, + "10n" => Rez.Drawables.n10, + "11d" => Rez.Drawables.d11, + "11n" => Rez.Drawables.n11, + "13d" => Rez.Drawables.d13, + "13n" => Rez.Drawables.n13, + "50d" => Rez.Drawables.d50, + "50n" => Rez.Drawables.n50 + }; + + var weatherImage; + if (iconsDictionary[weatherData[4]] != null) { + weatherImage = App.loadResource(iconsDictionary[weatherData[4]]); + } else { + weatherImage = App.loadResource(Rez.Drawables.LauncherIcon); + } + + return weatherImage; +} + const DEGREE_SYMBOL = "\u00B0"; (:background) diff --git a/Open Weather Widget/source/OpenWeatherGlanceView.mc b/Open Weather Widget/source/OpenWeatherGlanceView.mc index 19a7d39..549be2f 100644 --- a/Open Weather Widget/source/OpenWeatherGlanceView.mc +++ b/Open Weather Widget/source/OpenWeatherGlanceView.mc @@ -55,6 +55,10 @@ class OpenWeatherGlanceView extends Ui.GlanceView { str = (tempCelsius ? weatherData[10].format("%.0f") : celsius2fahrenheit(weatherData[10]).format("%.0f")) + DEGREE_SYMBOL + (tempCelsius ? "C" : "F"); str += ": " + capitalize(weatherData[3]); } + if(weatherData != null && weatherData[0] != 401) { + var weatherImage = $.weatherToIcon(weatherData); + dc.drawBitmap(0, GH / 4 - weatherImage.getHeight() / 2, weatherImage); + } dc.drawText(0, GH*0.75, G.FONT_SYSTEM_TINY, str, G.TEXT_JUSTIFY_LEFT | G.TEXT_JUSTIFY_VCENTER); } diff --git a/Open Weather Widget/source/OpenWeatherWidgetApp.mc b/Open Weather Widget/source/OpenWeatherWidgetApp.mc index ca0ffef..272a46c 100644 --- a/Open Weather Widget/source/OpenWeatherWidgetApp.mc +++ b/Open Weather Widget/source/OpenWeatherWidgetApp.mc @@ -9,6 +9,7 @@ class OpenWeatherWidgetApp extends App.AppBase { var mainView = null; + (:glance) function initialize() { AppBase.initialize(); } diff --git a/Open Weather Widget/source/OpenWeatherWidgetView.mc b/Open Weather Widget/source/OpenWeatherWidgetView.mc index 2b442fb..164363e 100644 --- a/Open Weather Widget/source/OpenWeatherWidgetView.mc +++ b/Open Weather Widget/source/OpenWeatherWidgetView.mc @@ -28,26 +28,7 @@ class OpenWeatherWidgetView extends Ui.View { var owmRetryCount = 5; var owmTimer = new Timer.Timer(); - var iconsDictionary = { - "01d" => Rez.Drawables.d01, - "01n" => Rez.Drawables.n01, - "02d" => Rez.Drawables.d02, - "02n" => Rez.Drawables.n02, - "03d" => Rez.Drawables.d03, - "03n" => Rez.Drawables.n03, - "04d" => Rez.Drawables.d04, - "04n" => Rez.Drawables.n04, - "09d" => Rez.Drawables.d09, - "09n" => Rez.Drawables.n09, - "10d" => Rez.Drawables.d10, - "10n" => Rez.Drawables.n10, - "11d" => Rez.Drawables.d11, - "11n" => Rez.Drawables.n11, - "13d" => Rez.Drawables.d13, - "13n" => Rez.Drawables.n13, - "50d" => Rez.Drawables.d50, - "50n" => Rez.Drawables.n50 - }; + var speedUnitsCode = 1; // [4] var speedMultiplier = 3.6; // [0] @@ -253,11 +234,8 @@ class OpenWeatherWidgetView extends Ui.View { if (weatherData[15] == null) {weatherData[15] = weatherData[14];} if (weatherData[16] == null) {weatherData[16] = 0;} - var weatherImage; + var weatherImage = weatherToIcon(weatherData); var str = ""; - - if (iconsDictionary.get(weatherData[4]) != null) {weatherImage = Ui.loadResource(iconsDictionary.get(weatherData[4]));} - else {weatherImage = Ui.loadResource(Rez.Drawables.iq_icon);} // Temperature var convertedTemp = Math.round(tempCelsius ? weatherData[10] : celsius2fahrenheit(weatherData[10])); From 7bd5a50ec26aa0553f98b8a4d1defb48525d4d32 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 5 Nov 2022 01:24:05 +0100 Subject: [PATCH 07/12] Bump version to v15 --- Open Weather Widget/resources/strings/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Open Weather Widget/resources/strings/strings.xml b/Open Weather Widget/resources/strings/strings.xml index 008f903..253cca8 100644 --- a/Open Weather Widget/resources/strings/strings.xml +++ b/Open Weather Widget/resources/strings/strings.xml @@ -1,6 +1,6 @@ Open Weather - 12 + 15 Never, refresh on the app start only 15 min From 406df40b54e92ccb44eb883dd208cb70deda4c5f Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 5 Nov 2022 01:25:06 +0100 Subject: [PATCH 08/12] Use legal units --- Open Weather Widget/resources/strings/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Open Weather Widget/resources/strings/strings.xml b/Open Weather Widget/resources/strings/strings.xml index 253cca8..091fbe3 100644 --- a/Open Weather Widget/resources/strings/strings.xml +++ b/Open Weather Widget/resources/strings/strings.xml @@ -17,10 +17,10 @@ Temperature units System (Pace/Speed) - KM/H + km/h MPH Knots - Meters/Sec + m/s Beaufort Pressure Units From 0dd0c6e19da4693f7776cc83dc19853eadb09181 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sun, 6 Nov 2022 18:49:37 +0100 Subject: [PATCH 09/12] Factorize wind speed units --- .../source/OpenWeatherWidgetView.mc | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Open Weather Widget/source/OpenWeatherWidgetView.mc b/Open Weather Widget/source/OpenWeatherWidgetView.mc index 164363e..7e2ab05 100644 --- a/Open Weather Widget/source/OpenWeatherWidgetView.mc +++ b/Open Weather Widget/source/OpenWeatherWidgetView.mc @@ -8,6 +8,12 @@ using Toybox.Application as App; using Toybox.Position; using Toybox.Timer; +var kmh_cst = "km/h"; +var mph_cst = "mph"; +var kts_cst = "kts"; +var ms_cst = "m/s"; +var bft_cst = "bft"; + class OpenWeatherWidgetView extends Ui.View { var W; @@ -32,7 +38,7 @@ class OpenWeatherWidgetView extends Ui.View { var speedUnitsCode = 1; // [4] var speedMultiplier = 3.6; // [0] - var speedUnits = "kmh"; // [1] + var speedUnits = kmh_cst; // [1] var tempCelsius = true; // [2] var tempSymbol = $.DEGREE_SYMBOL; // [3] var pressureDivider = 1; @@ -56,28 +62,28 @@ class OpenWeatherWidgetView extends Ui.View { // Speed multiplier and units if (speedUnitsCode == 0) { speedMultiplier = KMH_IN_METERS_PER_SECOND; - speedUnits = "kmh"; + speedUnits = kmh_cst; speedUnitsCode = 1; if (deviceSettings.distanceUnits == Sys.UNIT_STATUTE) { speedMultiplier = MPH_IN_METERS_PER_SECOND; - speedUnits = "mph"; + speedUnits = mph_cst; speedUnitsCode = 2; } } else if (speedUnitsCode == 1) { speedMultiplier = KMH_IN_METERS_PER_SECOND; - speedUnits = "kmh"; + speedUnits = kmh_cst; } else if (speedUnitsCode == 2) { speedMultiplier = MPH_IN_METERS_PER_SECOND; - speedUnits = "mph"; + speedUnits = mph_cst; } else if (speedUnitsCode == 3) { speedMultiplier = KTS_IN_METERS_PER_SECOND; - speedUnits = "kts"; + speedUnits = kts_cst; } else if (speedUnitsCode == 4) { speedMultiplier = 1; - speedUnits = "mps"; + speedUnits = ms_cst; } else if (speedUnitsCode == 5) { speedMultiplier = 0; - speedUnits = "bft"; + speedUnits = bft_cst; } // Temperature in Celsius tempCelsius = !(deviceSettings.temperatureUnits == Sys.UNIT_STATUTE); From fb3919484fef2594a93c8d8bfc05bb12968c5f91 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Wed, 9 Nov 2022 10:13:24 +0100 Subject: [PATCH 10/12] Add an icon for last refresh time --- .../resources/fonts/owm_font.fnt | 3 ++- .../resources/fonts/owm_font_0.png | Bin 956 -> 10981 bytes .../source/OpenWeatherWidgetView.mc | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Open Weather Widget/resources/fonts/owm_font.fnt b/Open Weather Widget/resources/fonts/owm_font.fnt index 30bfb2f..bdb4f9c 100644 --- a/Open Weather Widget/resources/fonts/owm_font.fnt +++ b/Open Weather Widget/resources/fonts/owm_font.fnt @@ -5,5 +5,6 @@ chars count=5 char id=61520 x=0 y=30 width=33 height=16 xoffset=-1 yoffset=11 xadvance=31 page=0 chnl=15 char id=61521 x=34 y=0 width=34 height=25 xoffset=-1 yoffset=2 xadvance=32 page=0 chnl=15 char id=61522 x=0 y=0 width=33 height=29 xoffset=-1 yoffset=2 xadvance=32 page=0 chnl=15 +char id=61523 x=38 y=30 width=24 height=24 xoffset=-1 yoffset=12 xadvance=23 page=0 chnl=15 char id=61560 x=91 y=0 width=15 height=19 xoffset=-1 yoffset=7 xadvance=14 page=0 chnl=15 -char id=61561 x=69 y=0 width=21 height=23 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=15 +char id=61561 x=69 y=0 width=21 height=23 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=15 \ No newline at end of file diff --git a/Open Weather Widget/resources/fonts/owm_font_0.png b/Open Weather Widget/resources/fonts/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mJvjuhcyqZaeu;7y!&k1e z7}_yg9qY*I$TX^ce6vFXOF>K0o(FVL8PdSm*og^r)ec?P)%%wut3upo0wN=to7%U& zwIpCw%a%0>Dwo%_T>AB1S?#|`z&SN)dE?aGJ7qVjV!Sr|`*9&1e>XGQx2ubi#S}PYCPYwVtG5IKocS#z zUK*A_hG7_nVHk#C7=~dOhG7_nVHk#C7$AmW7=~dOhGCc<`2``)FAm?0< Date: Wed, 9 Nov 2022 15:13:24 +0100 Subject: [PATCH 11/12] Message about BLE unavailable when refreshing --- .../resources-fre/strings/strings.xml | 1 + Open Weather Widget/resources/strings/strings.xml | 1 + .../source/OpenWeatherWidgetView.mc | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Open Weather Widget/resources-fre/strings/strings.xml b/Open Weather Widget/resources-fre/strings/strings.xml index fd86206..2a76f01 100644 --- a/Open Weather Widget/resources-fre/strings/strings.xml +++ b/Open Weather Widget/resources-fre/strings/strings.xml @@ -40,6 +40,7 @@ Clé d'API OWM\nsuspendue Erreur OWM : Paramétrer\nla clé d'API\nOpen Weather. + Bluetooth \nnon disponible. Mettre à jour la météo Localiser avec le GNSS diff --git a/Open Weather Widget/resources/strings/strings.xml b/Open Weather Widget/resources/strings/strings.xml index 091fbe3..60b40cc 100644 --- a/Open Weather Widget/resources/strings/strings.xml +++ b/Open Weather Widget/resources/strings/strings.xml @@ -40,6 +40,7 @@ Suspended OWM\nAPI key OWM Error: Please set Open\nWeather API key in\nsettings. + Bluetooth is\nunavailable. Request Weather refresh Get location from GPS diff --git a/Open Weather Widget/source/OpenWeatherWidgetView.mc b/Open Weather Widget/source/OpenWeatherWidgetView.mc index d0111c1..c266816 100644 --- a/Open Weather Widget/source/OpenWeatherWidgetView.mc +++ b/Open Weather Widget/source/OpenWeatherWidgetView.mc @@ -29,6 +29,8 @@ class OpenWeatherWidgetView extends Ui.View { var updateTimer = new Timer.Timer(); var apiKeyPresent = false; var locationPresent = false; + var BlePresent = false; + var BleTimeout = false; var weatherData = null; var owmRetryCount = 5; @@ -145,6 +147,7 @@ class OpenWeatherWidgetView extends Ui.View { } function onTimerUpdate() { + BleTimeout=true; Ui.requestUpdate(); } @@ -181,6 +184,9 @@ class OpenWeatherWidgetView extends Ui.View { } else if (!locationPresent) { if (gpsRequested) {errorMessage = R(Rez.Strings.WaitForGPS);} else {errorMessage = R(Rez.Strings.NoLocation);} + } else if(!BlePresent && !BleTimeout) { + errorMessage = R(Rez.Strings.BLE_UNAVAILABLE); + updateTimer.start(method(:onTimerUpdate), 3000, false); } else if (weatherData == null) { errorMessage = R(Rez.Strings.NoData); } else if (weatherData[0] == 401) { @@ -314,7 +320,7 @@ class OpenWeatherWidgetView extends Ui.View { if (t < 120) {str = t.format("%.0f") + " mn, ";} else {str = (t / 60.0).format("%.0f") + " h, ";} str += weatherData[5]; - drawStr(dc, 20, 62, iconsFont, G.COLOR_LT_GRAY, "\uF053", G.TEXT_JUSTIFY_CENTER | G.TEXT_JUSTIFY_VCENTER); + drawStr(dc, 15, 62, iconsFont, G.COLOR_LT_GRAY, "\uF053", G.TEXT_JUSTIFY_CENTER | G.TEXT_JUSTIFY_VCENTER); drawStr(dc, 50, 62, G.FONT_SYSTEM_SMALL, G.COLOR_LT_GRAY, str.substring(0, 21), G.TEXT_JUSTIFY_CENTER | G.TEXT_JUSTIFY_VCENTER); if (screenNum == 1) { @@ -363,6 +369,7 @@ class OpenWeatherWidgetView extends Ui.View { function owmRequest() { owmRetryCount = 5; + BleTimeout=false; $.makeOWMwebRequest(method(:onReceiveOpenWeatherMap)); } @@ -399,11 +406,15 @@ class OpenWeatherWidgetView extends Ui.View { if (responseCode > 0) { weatherData = $.openWeatherMapData(responseCode, data); App.Storage.setValue("weather", weatherData); + BlePresent = true; Ui.requestUpdate(); } // Re-submit request if there is an error - if (owmRetryCount > 0 && responseCode <= 0) { + if(responseCode == Comms.BLE_CONNECTION_UNAVAILABLE) { + BlePresent = false; + } + else if (owmRetryCount > 0 && responseCode <= 0) { owmRetryCount -= 1; owmTimer = new Timer.Timer(); owmTimer.start(method(:owmRequest), 5000 - (owmRetryCount * 1000), false); From 39ef2bd7a9c65cd079fb4445f2f435687c8cf3f7 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Wed, 9 Nov 2022 15:59:09 +0100 Subject: [PATCH 12/12] Fix typo --- Open Weather Widget/resources-fre/strings/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Open Weather Widget/resources-fre/strings/strings.xml b/Open Weather Widget/resources-fre/strings/strings.xml index 2a76f01..79997d5 100644 --- a/Open Weather Widget/resources-fre/strings/strings.xml +++ b/Open Weather Widget/resources-fre/strings/strings.xml @@ -29,7 +29,7 @@ mmHG Pas de localisation.\nPresser le bouton MENU\npour utiliser le GNSS. - Attente du signal\n satellite. Merci\n de rester sur cette\nécran... + Attente du signal\n satellite. Merci\n de rester sur cet\nécran... Attente des données... Données OWM invalides