Edge Clock Weather - Imperial Vs. Metric

Posted on
  • Hello!
    I'm having a weird bit of trouble - I use the Edge Clock as my main clock, and the weather always shows up in Celsius. I have "en_US 2 - USA with YYYY-MM-DD date" set as my language in the Language app, and the weather shows up in Imperial format in the Weather app, but it always shows up as Metric in the Edge Clock app. I am in no way a programmer but - looking at the weather code for the Edge Clock, nothing jumps out at me as forcing the "weather" to be displayed in metric units:

      const drawWeather = function () {
        if (!settings.showWeather){
          return;
        }
    
        g.setFontCustom(font, 48, 10, 512 + 12); // double size (1<<9)
        g.setFontAlign(1, 1); // right bottom
        
        try{
          const weather = require('weather');
          const w = weather.get();
          let temp = parseInt(w.temp-273.15);
          temp = temp < 0 ? '\\' + String(temp*-1) : String(temp);
    
          g.drawString(temp, g.getWidth()-40, g.getHeight() - 1, true);
          
          // clear icon area in case weather condition changed
          g.clearRect(g.getWidth()-40, g.getHeight()-30, g.getWidth(), g.getHeight());
          weather.drawIcon(w, g.getWidth()-20, g.getHeight()-15, 14);
    
        } catch(e) {
          g.drawString("???", g.getWidth()-3, g.getHeight() - 1, true);
        }
      };
    

    Is there something else that might be affecting this?

    Thank you!

  • It looks like it's just displaying whatever temperature value it gets - ideally it'd be using locale: https://www.espruino.com/Bangle.js+LocalĀ­e

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Edge Clock Weather - Imperial Vs. Metric

Posted by Avatar for Markp @Markp

Actions