1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

Added additional windspeed units, km, and mph. Orginal windspeed moved to knots

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@107 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Joe Myre 2005-08-12 16:31:03 +00:00
parent 9bad91407a
commit 581222bf5b
3 changed files with 31 additions and 5 deletions

29
conky.c
View File

@ -3,7 +3,11 @@
*
* This program is licensed under BSD license, read COPYING
*
<<<<<<< conky.c
* $Id$
=======
* $Id$
>>>>>>> 1.58
*/
#include "conky.h"
@ -773,6 +777,8 @@ enum text_object_type {
OBJ_metar_dew_point,
OBJ_metar_rh,
OBJ_metar_windspeed,
OBJ_metar_windspeed_km,
OBJ_metar_windspeed_mph,
OBJ_metar_winddir,
OBJ_metar_swinddir,
OBJ_metar_cloud,
@ -1383,6 +1389,10 @@ int a = stippled_borders, b = 1;
END
OBJ(metar_windspeed, INFO_METAR)
END
OBJ(metar_windspeed_km, INFO_METAR)
END
OBJ(metar_windspeed_mph, INFO_METAR)
END
OBJ(metar_winddir, INFO_METAR)
END
OBJ(metar_swinddir, INFO_METAR)
@ -2492,8 +2502,23 @@ static void generate_text()
if (data.winData.windSpeed != INT_MAX
&& metar_worked)
snprintf(p, n, "%i",
knTokph(data.winData.
windSpeed));
data.winData.windSpeed);
else
snprintf(p, n, "-");
}
OBJ(metar_windspeed_km) {
if (data.winData.windSpeed != INT_MAX
&& metar_worked)
snprintf(p, n, "%'.2f",
(data.winData.windSpeed * 1.852));
else
snprintf(p, n, "-");
}
OBJ(metar_windspeed_mph) {
if (data.winData.windSpeed != INT_MAX
&& metar_worked)
snprintf(p, n, "%'.2f",
(data.winData.windSpeed * 1.151));
else
snprintf(p, n, "-");
}

View File

@ -28,18 +28,19 @@ int calculateRelativeHumidity(int temp, int dew)
int calculateWindChill(int temperatureC, int windKn)
{
double windKmh = knTokph(windKn);
double windKmh = windKn * 1.852;
return (int) (13.112 + 0.6215 * temperatureC -
11.37 * powf(windKmh,
.16) +
0.3965 * temperatureC * powf(windKmh, .16));
}
/*Should no longer be needed
int knTokph(int knSpeed)
{
return (knSpeed * 1.852);
}
*/
const char *calculateWindDirectionString(int degree)
{
if (degree < 22.5) {

View File

@ -12,7 +12,7 @@
int calculateRelativeHumidity(int, int);
int calculateWindChill(int, int);
int knTokph(int);
//int knTokph(int);
const char *calculateWindDirectionString(int);
const char *calculateShortWindDirectionString(int);