mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 20:22:53 +00:00
Merge pull request #551 from olexs/round-temps
Option to display temperatures rounded to nearest integer
This commit is contained in:
commit
96653170a2
@ -29,6 +29,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- Added option `address` to set bind address.
|
||||
- Added option `onlyTemp` for currentweather module to show show only current temperature and weather icon.
|
||||
- Added option `remoteFile` to compliments module to load compliment array from filesystem.
|
||||
- Added option `roundTemp` for currentweather and weatherforecast modules to display temperatures rounded to nearest integer.
|
||||
|
||||
### Updated
|
||||
- Modified translations for Frysk.
|
||||
|
@ -64,6 +64,13 @@ The following properties can be configured:
|
||||
<br><b>Default value:</b> <code>config.units</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>roundTemp</code></td>
|
||||
<td>Round temperature value to nearest integer.<br>
|
||||
<br><b>Possible values:</b> <code>true</code> (round to integer) or <code>false</code> (display exact value with decimal point)
|
||||
<br><b>Default value:</b> <code>false</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>updateInterval</code></td>
|
||||
<td>How often does the content needs to be fetched? (Milliseconds)<br>
|
||||
|
@ -36,7 +36,8 @@ Module.register("currentweather",{
|
||||
calendarClass: "calendar",
|
||||
|
||||
onlyTemp: false,
|
||||
|
||||
roundTemp: false,
|
||||
|
||||
iconTable: {
|
||||
"01d": "wi-day-sunny",
|
||||
"02d": "wi-day-cloudy",
|
||||
@ -385,14 +386,6 @@ Module.register("currentweather",{
|
||||
return 12;
|
||||
},
|
||||
|
||||
/* function(temperature)
|
||||
* Rounds a temperature to 1 decimal.
|
||||
*
|
||||
* argument temperature number - Temperature.
|
||||
*
|
||||
* return number - Rounded Temperature.
|
||||
*/
|
||||
|
||||
deg2Cardinal: function(deg) {
|
||||
if (deg>11.25 && deg<=33.75){
|
||||
return "NNE";
|
||||
@ -429,8 +422,15 @@ Module.register("currentweather",{
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* function(temperature)
|
||||
* Rounds a temperature to 1 decimal or integer (depending on config.roundTemp).
|
||||
*
|
||||
* argument temperature number - Temperature.
|
||||
*
|
||||
* return number - Rounded Temperature.
|
||||
*/
|
||||
roundValue: function(temperature) {
|
||||
return parseFloat(temperature).toFixed(1);
|
||||
var decimals = this.config.roundTemp ? 0 : 1;
|
||||
return parseFloat(temperature).toFixed(decimals);
|
||||
}
|
||||
});
|
||||
|
@ -64,6 +64,13 @@ The following properties can be configured:
|
||||
<br><b>Default value:</b> <code>config.units</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>roundTemp</code></td>
|
||||
<td>Round temperature values to nearest integer.<br>
|
||||
<br><b>Possible values:</b> <code>true</code> (round to integer) or <code>false</code> (display exact value with decimal point)
|
||||
<br><b>Default value:</b> <code>false</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>maxNumberOfDays</code></td>
|
||||
<td>How many days of forecast to return. Specified by config.js<br>
|
||||
|
@ -34,6 +34,8 @@ Module.register("weatherforecast",{
|
||||
appendLocationNameToHeader: true,
|
||||
calendarClass: "calendar",
|
||||
|
||||
roundTemp: false,
|
||||
|
||||
iconTable: {
|
||||
"01d": "wi-day-sunny",
|
||||
"02d": "wi-day-cloudy",
|
||||
@ -342,13 +344,15 @@ Module.register("weatherforecast",{
|
||||
},
|
||||
|
||||
/* function(temperature)
|
||||
* Rounds a temperature to 1 decimal.
|
||||
* Rounds a temperature to 1 decimal or integer (depending on config.roundTemp).
|
||||
*
|
||||
* argument temperature number - Temperature.
|
||||
*
|
||||
* return number - Rounded Temperature.
|
||||
*/
|
||||
roundValue: function(temperature) {
|
||||
return parseFloat(temperature).toFixed(1);
|
||||
var decimals = this.config.roundTemp ? 0 : 1;
|
||||
return parseFloat(temperature).toFixed(decimals);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user