Skip to content

Commit

Permalink
Fix minor bugs printing archive and live data
Browse files Browse the repository at this point in the history
- Archive printing doesn't handle dash values
- Storm rain amount is not divided for 100th of an "
- High Solar Radiation dash value is 32767, not 0 as in the spec
  • Loading branch information
bytesnz committed Oct 3, 2017
1 parent 321f792 commit 03c0e95
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
24 changes: 12 additions & 12 deletions dhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ void PrintRTData(bool includeLoop2Data)
if (includeLoop2Data) printf("%s = %d\n", _WIND_10M_GUST_DIR, rcd2.windGust10mDir );
if (includeLoop2Data) printf("%s = %s\n", _WIND_10M_GUST_DIR_ROSE, getWindRose(rcd2.windGust10mDir) );
printf("%s = %d\n", _OUTSIDE_HUM, rcd.yOutsideHum );
printf("%s = %.2f\n", _RAIN_RATE, rcd.wRainRate / 100.0 );
printf("%s = %d\n", _RAIN_RATE, rcd.wRainRate );
printf("%s = %s\n", _IS_RAINING, rcd.wRainRate ? "yes" : "no");
printf("%s = ", _UV_LEVEL);
if(rcd.yUVLevel == 0xff)
Expand All @@ -568,18 +568,18 @@ void PrintRTData(bool includeLoop2Data)
if (includeLoop2Data) printf("%s = %d\n", _HEAT_INDEX, rcd2.heatIndex );
if (includeLoop2Data) printf("%s = %d\n", _WIND_CHILL, rcd2.windChill );
if (includeLoop2Data) printf("%s = %d\n", _THSW_INDEX, rcd2.thswIndex );
printf("%s = %.2f\n", _RAIN_STORM, rcd.wStormRain / 100.0 );
printf("%s = %.2f\n", _RAIN_STORM, rcd.wStormRain / 100.0);
printf("%s = ", _STORM_START_DATE);
PrintDate(rcd.wStormStart);
printf("\n");

if (includeLoop2Data) printf("%s = %.2f\n", _RAIN_LAST_15M, rcd2.last15mRain / 100.0);
if (includeLoop2Data) printf("%s = %.2f\n", _RAIN_LAST_HOUR, rcd2.lastHourRain / 100.0);
printf("%s = %.2f\n", _DAY_RAIN, rcd.wRainDay / 100.0);
printf("%s = %.2f\n", _MONTH_RAIN, rcd.wRainMonth / 100.0);
printf("%s = %.2f\n", _YEAR_RAIN, rcd.wRainYear / 100.0);
printf("%s = %d\n", _DAY_ET, rcd.wETDay);
printf("%s = %d\n", _MONTH_ET, rcd.wETMonth);
printf("%s = %d\n", _DAY_RAIN, rcd.wRainDay);
printf("%s = %d\n", _MONTH_RAIN, rcd.wRainMonth);
printf("%s = %d\n", _YEAR_RAIN, rcd.wRainYear);
printf("%s = %0.3f\n", _DAY_ET, rcd.wETDay / 1000.0);
printf("%s = %0.2f\n", _MONTH_ET, rcd.wETMonth / 100.0);
printf("%st = %d\n", _XMIT_BATT, rcd.yXmitBatt);
printf("%s = %.1f\n", _BATT_VOLTAGE, ((rcd.wBattLevel * 300)/512)/100.0);
printf("%s = %d\n", _FORE_ICON, rcd.yForeIcon);
Expand Down Expand Up @@ -1503,10 +1503,10 @@ void PrintArchPacket(int maxArcRecords)
printf("%02d:%02d,", TIMESTAMP_HOUR(record->time), TIMESTAMP_MINUTE(record->time));

// Outside/Inside temperatures
PRINTDECIMAL(TEMP(record->outsideTemp), 32767, true);
PRINTDECIMAL(TEMP(record->outsideHighTemp), -32767, true);
PRINTDECIMAL(TEMP(record->outsideLowTemp), 32767, true);
PRINTDECIMAL(TEMP(record->insideTemp), 32767, true);
PRINTDECIMAL(DASH_TEMP(record->outsideTemp, 32767), 32767, true);
PRINTDECIMAL(DASH_TEMP(record->outsideHighTemp, -32768), -32768, true);
PRINTDECIMAL(DASH_TEMP(record->outsideLowTemp, 32767), 32767, true);
PRINTDECIMAL(DASH_TEMP(record->insideTemp, 32767), 32767, true);

// Extra temperatures (** dash value incorrectly set to 255 on VP2)
PRINTINT(record->extraTemps[0], 255, true);
Expand Down Expand Up @@ -1539,7 +1539,7 @@ void PrintArchPacket(int maxArcRecords)

// Radiation
PRINTINT(record->avgSolarRad, 32767, true);
PRINTINT(record->solarRadMax, 0, true);
PRINTINT(record->solarRadMax, 32676, true);
PRINTINT(record->avgUvIndex, 255, true);
PRINTDECIMAL(record->uvMax / 10.0, 0, true);
PRINTTHOUSANDTHS(record->etAccumulated / 1000.0, 0, true);
Expand Down
1 change: 1 addition & 0 deletions dhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ extern char* ForecastString(uint16_t wRule);
#define LOG_AVERAGE_TEMPS SAVE_HOUR+11 // MUST BE AT 4092

#define TEMP(t) (t / 10.0)
#define DASH_TEMP(t,d) (t != d ? (t / 10.0) : t)
#define ROUGH_TEMP(t) (t - 90)

#define DATESTAMP_DAY(d) (d & 0x001f)
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "dhandler.h"
#include "byte.h"

#define VERSION "1.3.2"
#define VERSION "1.3.3"

/* local Data */
static char szttyDevice[255]; /* Serial device string */
Expand Down

0 comments on commit 03c0e95

Please sign in to comment.