netstar pushed a commit to branch master.

http://git.enlightenment.org/enlightenment/modules/forecasts.git/commit/?id=75fe933d4d9a156ed61248b834c4cc1f5b2e03f7

commit 75fe933d4d9a156ed61248b834c4cc1f5b2e03f7
Author: Alastair Poole <nets...@gmail.com>
Date:   Tue May 11 18:29:27 2021 +0100

    chill: calculation is invalid above 10C.
---
 src/e_mod_main.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index cf8a670..fc34062 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -64,6 +64,7 @@ struct _Instance
       struct
       {
          int chill, direction, speed;
+         Eina_Bool can_chill;
       } wind;
 
       struct
@@ -708,10 +709,14 @@ _forecasts_parse(void *data)
              v *= 3.6;
              inst->details.wind.speed = v;
 
-             double t, vpow;
-             t = inst->condition.temp;
-             vpow = pow(inst->details.wind.speed, 0.16);
-             inst->details.wind.chill = (13.12 + (0.6215 * t)) - (11.37 * 
(vpow)) + ((0.3965 * t) * (vpow));
+             if (inst->condition.temp <= 10.0)
+               {
+                  double t, vpow;
+                  t = inst->condition.temp;
+                  vpow = pow(inst->details.wind.speed, 0.16);
+                  inst->details.wind.chill = (13.12 + (0.6215 * t)) - (11.37 * 
(vpow)) + ((0.3965 * t) * (vpow));
+                  inst->details.wind.can_chill = 1;
+               }
 
              json_object *o_next = json_object_object_get(o_data, 
"next_1_hours");
              json_object *o_summary = json_object_object_get(o_next, 
"summary");
@@ -987,7 +992,10 @@ _forecasts_popup_content_create(Instance *inst)
 
    lb = _lb_add(base, D_("Wind Chill"));
    elm_table_pack(tb, lb, 0, row, 1, 1);
-   snprintf(buf, sizeof(buf), "%d°%c", inst->details.wind.chill, 
inst->units.temp);
+   if (inst->details.wind.can_chill)
+     snprintf(buf, sizeof(buf), "%d°%c", inst->details.wind.chill, 
inst->units.temp);
+   else
+     snprintf(buf, sizeof(buf), "N/A");
    lb = _lb_add(base, buf);
    elm_table_pack(tb, lb, 1, row++, 1, 1);
 

-- 


Reply via email to