Skip to content

Commit

Permalink
Merge pull request #286 from roxasvalor/v2-beta
Browse files Browse the repository at this point in the history
Added option for using the Beaufort scale or raw wind speed
  • Loading branch information
MichMich committed May 4, 2016
2 parents 8bec828 + 07ad1b1 commit 3761bfd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions modules/default/currentweather/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ The following properties can be configured:
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>useBeaufort</code></td>
<td>Pick between using the Beaufort scale for wind speed or using the default units.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>lang</code></td>
<td>The language of the days.<br>
Expand Down
10 changes: 9 additions & 1 deletion modules/default/currentweather/currentweather.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Module.register("currentweather",{
showPeriod: true,
showPeriodUpper: false,
showWindDirection: false,
useBeaufort: true,
lang: config.language,

initialLoadDelay: 0, // 0 seconds delay
Expand Down Expand Up @@ -204,7 +205,14 @@ Module.register("currentweather",{
*/
processWeather: function(data) {
this.temperature = this.roundValue(data.main.temp);
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));

if (this.config.useBeaufort){
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));
}else {
this.windSpeed = parseFloat(data.wind.speed).toFixed(0);
}


this.windDirection = this.deg2Cardinal(data.wind.deg);
this.weatherType = this.config.iconTable[data.weather[0].icon];

Expand Down

0 comments on commit 3761bfd

Please sign in to comment.