Page 1 of 1

Temperature only displaying to one decimal point

Posted: Wed 18 Mar 2020 12:14 pm
by stevei
Good morning all

I had a few problems last year and you were very helpful in sorting it out.

My station has been down for some time due to a fault and is now back up with a replacement display unit thanks to eBay. All is working well except that the "rainfall today", "this month" and "seasonal totals" only displays to one decimal point. When I initially open the web site they shown two, but when it updates it switches to one. Can anyone help?

My site is at www.steveianson.co.uk

Re: Temperature only displaying to one decimal point

Posted: Wed 18 Mar 2020 4:05 pm
by saratogaWX
In Settings.php, you have selected units

Code: Select all

$SITE['uomTemp'] = '°C';  // ='°C', ='°F'
$SITE['uomBaro'] = ' mb';    // =' hPa', =' mb', =' inHg'
$SITE['uomWind'] = ' mph';   // =' km/h', =' kts', =' m/s', =' mph'
$SITE['uomRain'] = ' in';     // =' mm', =' in'
In ajaxCUwx.js you have

Code: Select all

var useunits = 'M';         // 'E'=USA(English) or 'M'=Metric
.. change that to

Code: Select all

var useunits = 'E';         // 'E'=USA(English) or 'M'=Metric
Then later in that script where it says

Code: Select all

var uomTemp = '°F';
var uomWind = ' mph';
var uomBaro = ' inHg';
var uomRain = ' in';
var uomHeight = ' ft';
var dpBaro = 2;
var dpBaroNoU = 3; // for trends display
var dpRain = 2;
var dpWind = 1;
// later updated by the ajax fetch
var rTempUOM = 'F';
var rWindUOM = 'mph';
var rBaroUOM = 'inHg';
var rRainUOM = 'in';
var rHeightUOM = 'ft';
change that to be

Code: Select all

var uomTemp = '°C';
var uomWind = ' mph';
var uomBaro = ' mb';
var uomRain = ' in';
var uomHeight = ' ft';
var dpBaro = 1;
var dpBaroNoU = 3; // for trends display
var dpRain = 2;
var dpWind = 1;
// later updated by the ajax fetch
var rTempUOM = 'C';
var rWindUOM = 'mph';
var rBaroUOM = 'mb';
var rRainUOM = 'in';
var rHeightUOM = 'ft';
That should correct the AJAX update display.

Re: Temperature only displaying to one decimal point

Posted: Wed 18 Mar 2020 5:56 pm
by stevei
Thanks for the info. I have made the changes but still, have one decimal in the same places.

Re: Temperature only displaying to one decimal point

Posted: Wed 18 Mar 2020 6:19 pm
by Herbaldew
Try clearing your cache - it is working properly for me now.

Re: Temperature only displaying to one decimal point

Posted: Wed 18 Mar 2020 6:28 pm
by saratogaWX
Another change in ajaxCUwx.js due to your settings .. change

Code: Select all

function convertTemp ( inrawtemp ) {
	// function expects temperature in C
	var rawtemp = cTempToC(inrawtemp);
	if (useunits == 'E') { // convert C to F
to

Code: Select all

function convertTemp ( inrawtemp ) {
	// function expects temperature in C
	var rawtemp = cTempToC(inrawtemp);
	if (rTempUOM == 'F') { // convert C to F
to fix the issue with a units conversion for the AJAX.

Re: Temperature only displaying to one decimal point

Posted: Thu 19 Mar 2020 8:44 am
by stevei
Fantastic....Nearly there..... After all the changes suggested and clearing the cache the only anomaly is that the "feels like" temp is in deg. F

Re: Temperature only displaying to one decimal point

Posted: Thu 19 Mar 2020 5:25 pm
by saratogaWX
Another change to ajaxCUwx.js .. find

Code: Select all

function convertTempC ( rawtemp ) {
	// function expects temperature in C
	if (useunits == 'E') { // convert C to F
		return( (1.8 * rawtemp) + 32.0 );
and change to

Code: Select all

function convertTempC ( rawtemp ) {
	// function expects temperature in C
	if (rTempUOM == 'F') { // convert C to F
		return( (1.8 * rawtemp) + 32.0 );

Re: Temperature only displaying to one decimal point

Posted: Thu 19 Mar 2020 5:44 pm
by stevei
Spot on, thanks!