@@ -265,7 +265,8 @@ static char szForeStrings[] =
265
265
"Mostly clear and cooler.\0\0" ;
266
266
267
267
268
- static RTDATA rcd ; /* the one and only real time weather packet */
268
+ static RTDATA rcd ; /* the one and only v1 real time weather packet */
269
+ static RTDATA2 rcd2 ; /* the one and only v2 real time weather packet */
269
270
static HLDATA hld ; /* the one and only highs/lows packet */
270
271
271
272
/* local functions */
@@ -347,6 +348,17 @@ void GetRTData(char *szData)
347
348
348
349
349
350
351
+ /*--------------------------------------------------------------------------
352
+ GetRT2Data
353
+ Gets the real time weather data packet v2 to the static RTDATA2 struct.
354
+ ----------------------------------------------------------------------------*/
355
+ void GetRT2Data (char * szData )
356
+ {
357
+ memcpy ((char * )& rcd2 , szData , sizeof (RTDATA2 ));
358
+ }
359
+
360
+
361
+
350
362
351
363
/*--------------------------------------------------------------------------
352
364
GetHLData
@@ -359,14 +371,55 @@ void GetHLData(char *szData)
359
371
360
372
361
373
374
+
375
+ /*--------------------------------------------------------------------------
376
+ GetHLData
377
+ Gets the high/low weather data packet to the static HLDATA struct.
378
+ ----------------------------------------------------------------------------*/
379
+ char * getWindRose (uint8_t bearing ) {
380
+ if (bearing >= 347 && bearing < 12 ) /* compass rose version */
381
+ return "N" ;
382
+ else if (bearing >= 12 && bearing < 34 )
383
+ return "NNE" ;
384
+ else if (bearing >= 34 && bearing < 57 )
385
+ return "NE" ;
386
+ else if (bearing >= 57 && bearing < 79 )
387
+ return "ENE" ;
388
+ else if (bearing >= 79 && bearing < 102 )
389
+ return "E" ;
390
+ else if (bearing >= 102 && bearing < 124 )
391
+ return "ESE" ;
392
+ else if (bearing >= 124 && bearing < 147 )
393
+ return "SE" ;
394
+ else if (bearing >= 147 && bearing < 170 )
395
+ return "SSE" ;
396
+ else if (bearing >= 170 && bearing < 192 )
397
+ return "S" ;
398
+ else if (bearing >= 192 && bearing < 214 )
399
+ return "SSW" ;
400
+ else if (bearing >= 214 && bearing < 237 )
401
+ return "SW" ;
402
+ else if (bearing >= 237 && bearing < 259 )
403
+ return "WSW" ;
404
+ else if (bearing >= 259 && bearing < 280 )
405
+ return "W" ;
406
+ else if (bearing >= 280 && bearing < 303 )
407
+ return "WNW" ;
408
+ else if (bearing >= 303 && bearing < 347 )
409
+ return "NW" ;
410
+ else /* >326 <347 */
411
+ return "NNW" ;
412
+ }
413
+
362
414
/*--------------------------------------------------------------------------
363
415
PrintRTData
364
416
Dumps the real time weather data to stdout.
365
417
----------------------------------------------------------------------------*/
366
- void PrintRTData (void )
418
+ void PrintRTData (bool includeLoop2Data )
367
419
{
368
420
int16_t i ;
369
421
422
+ printf ("%s = 0x%04x\n" , _NEXT_RECORD , rcd .wNextRec );
370
423
/* 3-hour rolling baro trend */
371
424
i = rcd .cP ;
372
425
printf ("%s = " , _BARO_TREND );
@@ -392,42 +445,17 @@ void PrintRTData(void)
392
445
printf ("%s = %d\n" , _INSIDE_HUM , rcd .yInsideHum );
393
446
printf ("%s = %.1f\n" , _OUTSIDE_TEMP , ((int16_t )rcd .wOutsideTemp ) / 10.0 );
394
447
printf ("%s = %d\n" , _WIND_SPEED , rcd .yWindSpeed );
395
- printf ("%s = %d\n" , _WIND_AVG_SPEED , rcd .yAvgWindSpeed );
448
+ if (includeLoop2Data ) {
449
+ printf ("%s = %.1f\n" , _WIND_AVG_SPEED , (double )rcd2 .avgWindSpd10m / 10.0 );
450
+ } else {
451
+ printf ("%s = %d\n" , _WIND_AVG_SPEED , rcd .yAvgWindSpeed );
452
+ }
453
+ if (includeLoop2Data ) printf ("%s = %.1f\n" , _WIND_2M_AVG_SPEED , (double )rcd2 .avgWindSpd2m / 10.0 );
396
454
printf ("%s = %d\n" , _WIND_DIR , rcd .wWindDir );
397
- printf ("%s = " , _WIND_DIR_ROSE );
398
- if (rcd .wWindDir >= 347 && rcd .wWindDir < 12 ) /* compass rose version */
399
- printf ("N\n" );
400
- else if (rcd .wWindDir >= 12 && rcd .wWindDir < 34 )
401
- printf ("NNE\n" );
402
- else if (rcd .wWindDir >= 34 && rcd .wWindDir < 57 )
403
- printf ("NE\n" );
404
- else if (rcd .wWindDir >= 57 && rcd .wWindDir < 79 )
405
- printf ("ENE\n" );
406
- else if (rcd .wWindDir >= 79 && rcd .wWindDir < 102 )
407
- printf ("E\n" );
408
- else if (rcd .wWindDir >= 102 && rcd .wWindDir < 124 )
409
- printf ("ESE\n" );
410
- else if (rcd .wWindDir >= 124 && rcd .wWindDir < 147 )
411
- printf ("SE\n" );
412
- else if (rcd .wWindDir >= 147 && rcd .wWindDir < 170 )
413
- printf ("SSE\n" );
414
- else if (rcd .wWindDir >= 170 && rcd .wWindDir < 192 )
415
- printf ("S\n" );
416
- else if (rcd .wWindDir >= 192 && rcd .wWindDir < 214 )
417
- printf ("SSW\n" );
418
- else if (rcd .wWindDir >= 214 && rcd .wWindDir < 237 )
419
- printf ("SW\n" );
420
- else if (rcd .wWindDir >= 237 && rcd .wWindDir < 259 )
421
- printf ("WSW\n" );
422
- else if (rcd .wWindDir >= 259 && rcd .wWindDir < 280 )
423
- printf ("W\n" );
424
- else if (rcd .wWindDir >= 280 && rcd .wWindDir < 303 )
425
- printf ("WNW\n" );
426
- else if (rcd .wWindDir >= 303 && rcd .wWindDir < 347 )
427
- printf ("NW\n" );
428
- else /* >326 <347 */
429
- printf ("NNW\n" );
430
-
455
+ printf ("%s = %s\n" , _WIND_DIR_ROSE , getWindRose (rcd .wWindDir ) );
456
+ if (includeLoop2Data ) printf ("%s = %d\n" , _WIND_10M_GUST_SPEED , rcd2 .windGust10m );
457
+ if (includeLoop2Data ) printf ("%s = %d\n" , _WIND_10M_GUST_DIR , rcd2 .windGust10mDir );
458
+ if (includeLoop2Data ) printf ("%s = %s\n" , _WIND_10M_GUST_DIR_ROSE , getWindRose (rcd2 .windGust10mDir ) );
431
459
printf ("%s = %d\n" , _OUTSIDE_HUM , rcd .yOutsideHum );
432
460
printf ("%s = %.2f\n" , _RAIN_RATE , rcd .wRainRate / 100.0 );
433
461
printf ("%s = %s\n" , _IS_RAINING , rcd .wRainRate ? "yes" : "no" );
@@ -441,11 +469,16 @@ void PrintRTData(void)
441
469
printf ("n/a\n" );
442
470
else
443
471
printf ("%d\n" , rcd .wSolarRad );
472
+ if (includeLoop2Data ) printf ("%s = %d\n" , _HEAT_INDEX , rcd2 .heatIndex );
473
+ if (includeLoop2Data ) printf ("%s = %d\n" , _WIND_CHILL , rcd2 .windChill );
474
+ if (includeLoop2Data ) printf ("%s = %d\n" , _THSW_INDEX , rcd2 .thswIndex );
444
475
printf ("%s = %.2f\n" , _RAIN_STORM , rcd .wStormRain / 100.0 );
445
476
printf ("%s = " , _STORM_START_DATE );
446
477
PrintDate (rcd .wStormStart );
447
478
printf ("\n" );
448
479
480
+ if (includeLoop2Data ) printf ("%s = %.2f\n" , _RAIN_LAST_15M , rcd2 .last15mRain / 100.0 );
481
+ if (includeLoop2Data ) printf ("%s = %.2f\n" , _RAIN_LAST_HOUR , rcd2 .lastHourRain / 100.0 );
449
482
printf ("%s = %.2f\n" , _DAY_RAIN , rcd .wRainDay / 100.0 );
450
483
printf ("%s = %.2f\n" , _MONTH_RAIN , rcd .wRainMonth / 100.0 );
451
484
printf ("%s = %.2f\n" , _YEAR_RAIN , rcd .wRainYear / 100.0 );
0 commit comments