-
Notifications
You must be signed in to change notification settings - Fork 5
/
dhandler.c
1595 lines (1351 loc) · 60.5 KB
/
dhandler.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/****************************************************************************/
/* vproweather 1.1 */
/* A program for acquiring data from a Davis Vantage Pro Weather Station. */
/* */
/* Thanks to Paul Davis for his 'remserial' program, and Aaron Logue's */
/* 'weastat' program. */
/* */
/* (c)2004 Joe Jaworski email: jj@joejaworski.com */
/* VPROWEATHER is covered under the GNU general license. See the attached */
/* LICENSE file for details. */
/* */
/* This software is provided as-is, without any expressed or implied */
/* warranties, including, without limitation, the implied warranties of */
/* merchantibility and fitness for any particular purpose. */
/* */
/* */
/* dhandler.c - data handler functions */
/* tabs every 4 places */
/* */
/****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
#include <stdbool.h>
#include <memory.h>
#include "dhandler.h"
#include "main.h"
#include "names.h"
#include "byte.h"
/* CCITT table of CRC values */
static uint16_t crc_table [] = {
0x0, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
0x1231, 0x210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
0x2462, 0x3443, 0x420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
0x3653, 0x2672, 0x1611, 0x630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
0x48c4, 0x58e5, 0x6886, 0x78a7, 0x840, 0x1861, 0x2802, 0x3823,
0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0xa50, 0x3a33, 0x2a12,
0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0xc60, 0x1c41,
0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0xe70,
0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
0x1080, 0xa1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
0x2b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
0x34e2, 0x24c3, 0x14a0, 0x481, 0x7466, 0x6447, 0x5424, 0x4405,
0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
0x26d3, 0x36f2, 0x691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x8e1, 0x3882, 0x28a3,
0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0xaf1, 0x1ad0, 0x2ab3, 0x3a92,
0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0xcc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0xed1, 0x1ef0,
};
static char szForeStrings[] =
"Mostly clear and cooler.\0"
"Mostly clear with little temperature change.\0"
"Mostly clear for 12 hrs. with little temperature change.\0"
"Mostly clear for 12 to 24 hrs. and cooler.\0"
"Mostly clear with little temperature change.\0"
"Partly cloudy and cooler.\0"
"Partly cloudy with little temperature change.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear and warmer.\0"
"Partly cloudy with little temperature change.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 24 to 48 hrs.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds with little temperature change. Precipitation possible within 24 hrs.\0"
"Mostly clear with little temperature change.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds with little temperature change. Precipitation possible within 12 hrs.\0"
"Mostly clear with little temperature change.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 24 hrs.\0"
"Mostly clear and warmer. Increasing winds.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 hrs. Increasing winds.\0"
"Mostly clear and warmer. Increasing winds.\0"
"Increasing clouds and warmer.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 hrs. Increasing winds.\0"
"Mostly clear and warmer. Increasing winds.\0"
"Increasing clouds and warmer.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 hrs. Increasing winds.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly clear and warmer. Precipitation possible within 48 hrs.\0"
"Mostly clear and warmer.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds with little temperature change. Precipitation possible within 24 to 48 hrs.\0"
"Increasing clouds with little temperature change.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 to 24 hrs.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 to 24 hrs. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 to 24 hrs. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 6 to 12 hrs.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 6 to 12 hrs. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 to 24 hrs. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation possible within 12 hrs.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and warmer. Precipitation likely.\0"
"clearing and cooler. Precipitation ending within 6 hrs.\0"
"Partly cloudy with little temperature change.\0"
"clearing and cooler. Precipitation ending within 6 hrs.\0"
"Mostly clear with little temperature change.\0"
"Clearing and cooler. Precipitation ending within 6 hrs.\0"
"Partly cloudy and cooler.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear and cooler.\0"
"clearing and cooler. Precipitation ending within 6 hrs.\0"
"Mostly clear with little temperature change.\0"
"Clearing and cooler. Precipitation ending within 6 hrs.\0"
"Mostly clear and cooler.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds with little temperature change. Precipitation possible within 24 hrs.\0"
"Mostly cloudy and cooler. Precipitation continuing.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation likely.\0"
"Mostly cloudy with little temperature change. Precipitation continuing.\0"
"Mostly cloudy with little temperature change. Precipitation likely.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible and windy within 6 hrs.\0"
"Increasing clouds with little temperature change. Precipitation possible and windy within 6 hrs.\0"
"Mostly cloudy and cooler. Precipitation continuing. Increasing winds.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation likely. Increasing winds.\0"
"Mostly cloudy with little temperature change. Precipitation continuing. Increasing winds.\0"
"Mostly cloudy with little temperature change. Precipitation likely. Increasing winds.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible within 12 to 24 hrs. Possible wind shift to the W, NW, or N.\0"
"Increasing clouds with little temperature change. Precipitation possible within 12 to 24 hrs. Possible wind shift to the W, NW, or N.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible within 6 hrs. Possible wind shift to the W, NW, or N.\0"
"Increasing clouds with little temperature change. Precipitation possible within 6 hrs. Possible wind shift to the W, NW, or N.\0"
"Mostly cloudy and cooler. Precipitation ending within 12 hrs. Possible wind shift to the W, NW, or N.\0"
"Mostly cloudy and cooler. Possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation ending within 12 hrs. Possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Possible wind shift to the W, NW, or N.\0"
"Mostly cloudy and cooler. Precipitation ending within 12 hrs. Possible wind shift to the W, NW, or N.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation possible within 24 hrs. Possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation ending within 12 hrs. Possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation possible within 24 hrs. Possible wind shift to the W, NW, or N.\0"
"clearing, cooler and windy. Precipitation ending within 6 hrs.\0"
"clearing, cooler and windy.\0"
"Mostly cloudy and cooler. Precipitation ending within 6 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy and cooler. Windy with possible wind shift to the W, NW, or N.\0"
"clearing, cooler and windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy with little temperature change. Precipitation possible within 12 hrs. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible within 12 hrs., possibly heavy at times. Windy.\0"
"Mostly cloudy and cooler. Precipitation ending within 6 hrs. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation possible within 12 hrs. Windy.\0"
"Mostly cloudy and cooler. Precipitation ending in 12 to 24 hrs.\0"
"Mostly cloudy and cooler.\0"
"Mostly cloudy and cooler. Precipitation continuing, possible heavy at times. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation possible within 6 to 12 hrs. Windy.\0"
"Mostly cloudy with little temperature change. Precipitation continuing, possibly heavy at times. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy with little temperature change. Precipitation possible within 6 to 12 hrs. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds with little temperature change. Precipitation possible within 12 hrs., possibly heavy at times. Windy.\0"
"Mostly cloudy and cooler. Windy.\0"
"Mostly cloudy and cooler. Precipitation continuing, possibly heavy at times. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation likely, possibly heavy at times. Windy.\0"
"Mostly cloudy with little temperature change. Precipitation continuing, possibly heavy at times. Windy.\0"
"Mostly cloudy with little temperature change. Precipitation likely, possibly heavy at times. Windy.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible within 6 hrs. Windy.\0"
"Increasing clouds with little temperature change. Precipitation possible within 6 hrs. windy\0"
"Increasing clouds and cooler. Precipitation continuing. Windy with possible wind shift to the W, NW, or N.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation likely. Windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation continuing. Windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation likely. Windy with possible wind shift to the W, NW, or N.\0"
"Increasing clouds and cooler. Precipitation possible within 6 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible within 6 hrs. Possible wind shift to the W, NW, or N.\0"
"Increasing clouds with little temperature change. Precipitation possible within 6 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Increasing clouds with little temperature change. Precipitation possible within 6 hrs. Possible wind shift to the W, NW, or N.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible within 6 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Increasing clouds with little temperature change. Precipitation possible within 6 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Increasing clouds and cooler. Precipitation possible within 12 to 24 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Increasing clouds with little temperature change. Precipitation possible within 12 to 24 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy and cooler. Precipitation possibly heavy at times and ending within 12 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation possible within 6 to 12 hrs., possibly heavy at times. Windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation ending within 12 hrs. Windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation possible within 6 to 12 hrs., possibly heavy at times. Windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy and cooler. Precipitation continuing.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation likely, windy with possible wind shift to the W, NW, or N.\0"
"Mostly cloudy with little temperature change. Precipitation continuing.\0"
"Mostly cloudy with little temperature change. Precipitation likely.\0"
"Partly cloudy with little temperature change.\0"
"Mostly clear with little temperature change.\0"
"Mostly cloudy and cooler. Precipitation possible within 12 hours, possibly heavy at times. Windy.\0"
"FORECAST REQUIRES 3 HRS. OF RECENT DATA\0"
"Mostly clear and cooler.\0\0" ;
static RTDATA rcd; /* the one and only v1 real time weather packet */
static RTDATA2 rcd2; /* the one and only v2 real time weather packet */
static HLDATA hld; /* the one and only highs/lows packet */
static ARCHINFO arcInfo; /* archive download info packet */
static ARCHDOWNLOAD arcPacket;
/* local functions */
static char* TimeConvert(uint16_t wTime);
static void PrintTimeSet(uint8_t *pData, int nOffset, uint8_t yNext, int nSetSize);
static void PrintByteSet(uint8_t *pData, int nOffset, uint8_t yNext, int nSetSize);
static void PrintBarSet(uint8_t *pData, int nOffset, uint8_t yNext, int nSetSize);
static void PrintRainRateSet(uint8_t *pData, int nOffset, uint8_t yNext,
int nSetSize);
static void PrintDate(uint16_t wDate);
static void PrintTempSet24(uint8_t *pData, int nOffset, uint8_t yNext, int nSub);
static void PrintTempSet25(uint8_t *pData, int nOffset, uint8_t yNext, int nSub);
static void PrintDateSet(uint8_t *pData, int nOffset, uint8_t yNext, int nSetSize);
static void PrintTimeRef(void);
/**
* Verifies the crc against a passed buffer. Returns the non-zero CRC code
* if error, zero if the crc passed.
*
* @param nCnt Number of bytes to check CRC of
* @param pData Pointer to string containing data
*
* @returns Leftover checksum. Should be 0 for valid data
*/
int CheckCRC(int nCnt, char *pData)
{
int i;
uint16_t wCRC = 0; /* zero checksum to start */
uint8_t y;
for( i = 0; i < nCnt; i++) {
y = *(pData)++;
wCRC = crc_table[(wCRC >> 8) ^ y] ^ (wCRC << 8); /* CCITT std */
}
return wCRC; /* if zero, it passed */
}
/**
* Generate the two byte CRC string of a string to pass to the Vantage when
* sending data to it.
*
* @param nCnt Number of bytes to check CRC of
* @param pData Pointer to string containing data to generate the CRC for
* @param crc Pointer to string to put the generated CRC
*/
void GenerateCRC(int nCnt, char *pData, char *crc)
{
uint16_t value = CheckCRC(nCnt, pData);
crc[0] = HIBYTE(value);
crc[1] = LOBYTE(value);
crc[2] = 0;
}
/**
* Creates VantagePro date integer from the given time structure
*
* @param time Time struct to make date integer for
*
* @returns VantagePro date integer
*/
uint16_t MakeVangateDateInt(struct tm* time) {
return time->tm_mday + ((time->tm_mon + 1) * 32) + ((time->tm_year - 100) * 512);
}
/**
* Creates a Vantage Datetime uint16_t[2] from the given time struct
* [ day + month*32 + (year-2000)*512, 100*hours + minutes ]
*
* @param time Time to generate teh Datetime form
* @param datetimeString Pointer to string where to put the generated
* datetime string
*/
void MakeVantageDatetime(struct tm* time, char *datetimeString)
{
uint16_t value = 0;
if (time != NULL) {
// Calculate date portion
value = MakeVangateDateInt(time);
datetimeString[1] = HIBYTE(value);
datetimeString[0] = LOBYTE(value);
//Calculate time portion
value = time->tm_min + (100 * time->tm_hour);
datetimeString[3] = HIBYTE(value);
datetimeString[2] = LOBYTE(value);
datetimeString[4] = 0;
}
}
/**
* Prints the time data retrieved from the weather station.
*
* @param szData Pointer to string containing time data to convert to
* time string
*/
void PrintTime(char *szData)
{
struct tm stm;
time_t tt;
char szBuf[255];
time(&tt);
stm = *localtime(&tt); /* fill time struct */
stm.tm_sec = (int)szData[1]; /* copy in Davis values */
stm.tm_min = (int)szData[2];
stm.tm_hour = (int)szData[3];
stm.tm_mday = (int)szData[4];
stm.tm_mon = (int)(szData[5] - 1);
stm.tm_year = (int)szData[6];
tt = mktime(&stm);
stm = *localtime(&tt); /* correct bogus values */
/* change the following line if you don't like the time format */
strftime(szBuf, sizeof(szBuf), "%A, %B %d, %Y %I:%M %p\n" , &stm);
printf("DavisTime = %s", szBuf);
}
/**
* Copies the Archive download packet to the static ARCHDOWNLOAD struct.
*
* @param szData Pointer to string buffer containing archive packet
*/
void StoreArchPacket(char *szData)
{
memcpy((char*)&arcPacket, szData, sizeof(ARCHDOWNLOAD));
}
/**
* Copies the Archive download info to the static ARCHINFO struct.
*
* @param szData Pointer to string buffer containing archive download
* info packet
*/
void StoreDownloadInfo(char *szData)
{
memcpy((char*)&arcInfo, szData, sizeof(ARCHINFO));
}
/**
* Gets the real time weather data packet to the static RTDATA struct.
*
* @param szData Pointer to string buffer containing realtime data packet
*/
void GetRTData(char *szData)
{
memcpy((char*)&rcd, szData, sizeof(RTDATA));
}
/**
* Gets the real time weather data packet v2 to the static RTDATA2 struct.
*
* @param szData Pointer to string buffer containing realtime data packet
*/
void GetRT2Data(char *szData)
{
memcpy((char*)&rcd2, szData, sizeof(RTDATA2));
}
/**
* Gets the high/low weather data packet to the static HLDATA struct.
*
* @param szData Pointer to string buffer containing archive packet
*/
void GetHLData(char *szData)
{
memcpy((char*)&hld, szData, sizeof(HLDATA));
}
/**
* Returns the Rose (N,NE,E etc) string for the given bearing.
*
* @param bearing Bearing in degrees to return rose string for
*
* @returns Rose string
*/
char* getWindRose(uint8_t bearing) {
if(bearing >= 347 && bearing < 12) /* compass rose version */
return "N";
else if(bearing >= 12 && bearing < 34)
return "NNE";
else if(bearing >= 34 && bearing < 57)
return "NE";
else if(bearing >= 57 && bearing < 79)
return "ENE";
else if(bearing >= 79 && bearing < 102)
return "E";
else if(bearing >= 102 && bearing < 124)
return "ESE";
else if(bearing >= 124 && bearing < 147)
return "SE";
else if(bearing >= 147 && bearing < 170)
return "SSE";
else if(bearing >= 170 && bearing < 192)
return "S";
else if(bearing >= 192 && bearing < 214)
return "SSW";
else if(bearing >= 214 && bearing < 237)
return "SW";
else if(bearing >= 237 && bearing < 259)
return "WSW";
else if(bearing >= 259 && bearing < 280)
return "W";
else if(bearing >= 280 && bearing < 303)
return "WNW";
else if(bearing >= 303 && bearing < 347)
return "NW";
else /* >326 <347 */
return "NNW";
}
/**
* Dumps the real time weather data to stdout.
*
* @param includeLoop2Data Whether or not to include data from LOOP2 packet
*/
void PrintRTData(bool includeLoop2Data)
{
int16_t i;
printf("%s = 0x%04x\n", _NEXT_RECORD, rcd.wNextRec );
/* 3-hour rolling baro trend */
i = rcd.cP;
printf("%s = ", _BARO_TREND);
switch(i) {
case -60: printf("Falling Rapidly\n"); break;
case -20: printf("Falling Slowly\n"); break;
case 0: printf("Steady\n"); break;
case 20: printf("Rising Slowly\n"); break;
case 60: printf("Rising Rapidly\n"); break;
default: printf("n/a-%d\n", rcd.cP);
}
printf("%s = ", _BARO_TREND_IMG);
switch(i) {
case -60: printf("baro_fr\n"); break;
case -20: printf("baro_fs\n"); break;
case 0: printf("baro_s\n"); break;
case 20: printf("baro_rs\n"); break;
case 60: printf("baro_rr\n"); break;
default: printf("baro_none\n");
}
printf("%s = %2.2f\n", _BARO_CURR, rcd.wBarometer / 1000.0 );
printf("%s = %.1f\n", _INSIDE_TEMP, ((int16_t)rcd.wInsideTemp) / 10.0 );
printf("%s = %d\n", _INSIDE_HUM, rcd.yInsideHum );
printf("%s = %.1f\n", _OUTSIDE_TEMP, ((int16_t)rcd.wOutsideTemp) / 10.0 );
printf("%s = %d\n", _WIND_SPEED, rcd.yWindSpeed );
if (includeLoop2Data) {
printf("%s = %.1f\n", _WIND_AVG_SPEED, (double)rcd2.avgWindSpd10m / 10.0 );
} else {
printf("%s = %d\n", _WIND_AVG_SPEED, rcd.yAvgWindSpeed );
}
if (includeLoop2Data) printf("%s = %.1f\n", _WIND_2M_AVG_SPEED, (double)rcd2.avgWindSpd2m / 10.0 );
printf("%s = %d\n", _WIND_DIR, rcd.wWindDir );
printf("%s = %s\n", _WIND_DIR_ROSE, getWindRose(rcd.wWindDir) );
if (includeLoop2Data) printf("%s = %d\n", _WIND_10M_GUST_SPEED, rcd2.windGust10m );
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 = %d\n", _RAIN_RATE, rcd.wRainRate );
printf("%s = %s\n", _IS_RAINING, rcd.wRainRate ? "yes" : "no");
printf("%s = ", _UV_LEVEL);
if(rcd.yUVLevel == 0xff)
printf("n/a\n");
else
printf("%.1f\n", rcd.yUVLevel / 10.0 );
printf("%s = ", _SOLAR_RAD);
if(rcd.wSolarRad == 32767)
printf("n/a\n");
else
printf("%d\n", rcd.wSolarRad );
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 = ", _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 = %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);
printf("%s = %d\n", _FORE_RULE, rcd.yRule);
printf("%s = %s\n", _FORE_STRING, ForecastString(rcd.yRule));
printf("%s = %s\n", _SUNRISE, TimeConvert(rcd.wSunrise));
printf("%s = %s\n", _SUNSET, TimeConvert(rcd.wSunset));
}
/**
* Converts a BCD encoded time value to ascii human readable form. Returns
* a pointer to a static buffer containing the converted ascii string. The
* form is in the ISO 8601 format.
*
* @param wTime Time integer to convert
*
* @returns The static time string
*/
char* TimeConvert(uint16_t wTime)
{
static char szBuf[32]; /* static return buffer */
int nHours = wTime/100;
int nMinutes = wTime - ((wTime/100) * 100);
if ((unsigned)wTime == 0x7fff || (unsigned)wTime == 0xffff)
{
/* ignore missing data */
sprintf(szBuf, "n/a");
return szBuf;
}
sprintf(szBuf, "%02d:%02d", nHours, nMinutes);
return szBuf;
}
/**
* Prints an encoded date value in the ISO 8601 format.
*
* @param wDate Date integer to convert
*/
void PrintDate(uint16_t wDate)
{
uint16_t w;
if(wDate == 0xffff || wDate == 0) { /* ignore missing data */
printf("n/a");
return;
}
// Year
printf("20%02d-", (wDate & 0x003f) );
// Month
printf("%02d-", (wDate & 0xf000) >> 12); /* strip out month */
// Day
w = (wDate & 0x0f00) >> 7; /* get msb of date */
if(wDate & 0x0080)
++w; /* do crappy Davis format incr */
printf("%02d", w);
}
/**
* Prints time references for use in graph axis generations.
*/
void PrintTimeRef(void)
{
struct tm stm;
time_t tt;
int i;
/* 10min reference */
printf("%s = ", _TIME_REF_10MIN );
for(i = 23; i > -1; i--)
{
time(&tt);
stm = *localtime(&tt); /* get time now */
stm.tm_min = (stm.tm_min/10)*10; /* round to nearest 10min incr */
stm.tm_min -= (10 * i); /* back by 10 minutes */
tt = mktime(&stm);
stm = *localtime(&tt); /* get time again */
printf("%s", TimeConvert( (stm.tm_hour * 100)+stm.tm_min) );
if(i)
printf(",");
}
printf("\n");
/* 15min reference */
printf("%s = ", _TIME_REF_15MIN );
for(i = 23; i > -1; i--)
{
time(&tt);
stm = *localtime(&tt); /* get time now */
stm.tm_min = (stm.tm_min/15)*15; /* round to nearest 15min incr */
stm.tm_min -= (15 * i); /* back by 15 minutes */
tt = mktime(&stm);
stm = *localtime(&tt); /* get time again */
printf("%s", TimeConvert( (stm.tm_hour * 100)+stm.tm_min) );
if(i)
printf(",");
}
printf("\n");
/* hours reference */
printf("%s = ", _TIME_REF_HOURS );
for(i = 23; i > -1; i--)
{
time(&tt);
stm = *localtime(&tt); /* get time now */
stm.tm_hour -= i; /* back by hours */
tt = mktime(&stm);
stm = *localtime(&tt); /* get time again */
printf("%s", TimeConvert(stm.tm_hour * 100));
if(i)
printf(",");
}
printf("\n");
/* days reference */
printf("%s = ", _TIME_REF_DAYS);
for(i = 24; i; i--)
{
time(&tt);
stm = *localtime(&tt); /* get time now */
stm.tm_mday -= i; /* back by days */
tt = mktime(&stm);
stm = *localtime(&tt); /* get time again */
printf("%4d-%02d-%02d", stm.tm_year + 1900, stm.tm_mon+1, stm.tm_mday);
if(i > 1)
printf(",");
}
printf("\n");
/* months reference */
printf("%s = ", _TIME_REF_MONTHS);
time(&tt);
stm = *localtime(&tt); /* get time now */
for(i = 24; i; i--)
{
printf("%d", stm.tm_mon + 1);
stm.tm_mon++;
if (stm.tm_mon > 11) stm.tm_mon = 0;
if(i > 1)
printf(",");
}
printf("\n");
/* years reference */
printf("%s = ", _TIME_REF_YEARS);
for(i = 25; i; i--)
{
time(&tt);
stm = *localtime(&tt); /* get time now */
stm.tm_year -= i; /* back by years */
tt = mktime(&stm);
stm = *localtime(&tt); /* get time again */
printf("%04d", stm.tm_year + 1900);
if(i > 1)
printf(",");
}
printf("\n");
}
/**
* Dumps the highs/lows weather data to stdout.
*/
void PrintHLData(void)
{
printf("%s = %2.2f\n", _BARO_LO_DAY, hld.wBaroLoDay / 1000.0 );
printf("%s = %2.2f\n", _BARO_HI_DAY, hld.wBaroHiDay / 1000.0 );
printf("%s = %2.2f\n", _BARO_LO_MONTH, hld.wBaroLoMonth / 1000.0 );
printf("%s = %2.2f\n", _BARO_HI_MONTH, hld.wBaroHiMonth / 1000.0 );
printf("%s = %2.2f\n", _BARO_LO_YEAR, hld.wBaroLoYear / 1000.0 );
printf("%s = %2.2f\n", _BARO_HI_YEAR, hld.wBaroHiYear / 1000.0 );
printf("%s = %s\n", _BARO_LO_TIME, TimeConvert(hld.wBaroLoTime));
printf("%s = %s\n", _BARO_HI_TIME, TimeConvert(hld.wBaroHiTime));
printf("%s = %d\n", _WIND_HI_DAY, hld.yWindHiDay );
printf("%s = %s\n", _WIND_HI_TIME ,TimeConvert(hld.wWindHiTime));
printf("%s = %d\n", _WIND_HI_MONTH, hld.yWindHiMonth );
printf("%s = %d\n", _WIND_HI_YEAR, hld.yWindHiYear );
printf("%s = %.1f\n", _IN_TEMP_HI_DAY, hld.wInTempHiDay / 10.0 );
printf("%s = %.1f\n", _IN_TEMP_LO_DAY, hld.wInTempLoDay / 10.0 );
printf("%s = %s\n", _IN_TEMP_HI_TIME, TimeConvert(hld.wInTempHiTime));
printf("%s = %s\n", _IN_TEMP_LO_TIME, TimeConvert(hld.wInTempLoTime));
printf("%s = %.1f\n", _IN_TEMP_LO_MONTH, hld.wInTempLoMonth / 10.0 );
printf("%s = %.1f\n", _IN_TEMP_HI_MONTH, hld.wInTempHiMonth / 10.0 );
printf("%s = %.1f\n", _IN_TEMP_LO_YEAR, hld.wInTempLoYear / 10.0 );
printf("%s = %.1f\n", _IN_TEMP_HI_YEAR, hld.wInTempHiYear / 10.0 );
printf("%s = %d\n", _IN_HUM_HI_DAY, hld.yInHumHiDay );
printf("%s = %d\n", _IN_HUM_LO_DAY, hld.yInHumLoDay );
printf("%s = %s\n", _IN_HUM_HI_TIME, TimeConvert(hld.wInHumHiTime));
printf("%s = %s\n", _IN_HUM_LO_TIME, TimeConvert(hld.wInHumLoTime));
printf("%s = %d\n", _IN_HUM_HI_MONTH, hld.yInHumHiMonth );
printf("%s = %d\n", _IN_HUM_LO_MONTH, hld.yInHumLoMonth );
printf("%s = %d\n", _IN_HUM_HI_YEAR, hld.yInHumHiYear );
printf("%s = %d\n", _IN_HUM_LO_YEAR, hld.yInHumLoYear );
printf("%s = %.1f\n", _TEMP_HI_DAY, hld.wTempHiDay / 10.0 );
printf("%s = %.1f\n", _TEMP_LO_DAY, hld.wTempLoDay / 10.0 );
printf("%s = %s\n", _TEMP_HI_TIME, TimeConvert(hld.wTempHiTime));
printf("%s = %s\n", _TEMP_LO_TIME, TimeConvert(hld.wTempLoTime));
printf("%s = %.1f\n", _TEMP_LO_MONTH, hld.wTempLoMonth / 10.0 );
printf("%s = %.1f\n", _TEMP_HI_MONTH, hld.wTempHiMonth / 10.0 );
printf("%s = %.1f\n", _TEMP_HI_YEAR, hld.wTempHiYear / 10.0 );
printf("%s = %.1f\n", _TEMP_LO_YEAR, hld.wTempLoYear / 10.0 );
printf("%s = %d\n", _DEW_LO_DAY, hld.wDewLoDay);
printf("%s = %d\n", _DEW_HI_DAY, hld.wDewHiDay);
printf("%s = %s\n", _DEW_LO_TIME, TimeConvert(hld.wDewLoTime));
printf("%s = %s\n", _DEW_HI_TIME, TimeConvert(hld.wDewHiTime));
printf("%s = %d\n", _DEW_HI_MONTH, hld.wDewHiMonth);
printf("%s = %d\n", _DEW_LO_MONTH, hld.wDewLoMonth);
printf("%s = %d\n", _DEW_HI_YEAR, hld.wDewHiYear);
printf("%s = %d\n", _DEW_LO_YEAR, hld.wDewLoYear);
printf("%s = %d\n", _CHILL_LO_DAY, hld.wChillLoDay);
printf("%s = %s\n", _CHILL_LO_TIME, TimeConvert(hld.wChillLoTime));
printf("%s = %d\n", _CHILL_LO_MONTH, hld.wChillLoMonth);
printf("%s = %d\n", _CHILL_LO_YEAR, hld.wChillLoYear);
printf("%s = %d\n", _HEAT_HI_DAY, hld.wHeatHiDay);
printf("%s = %s\n", _HEAT_HI_TIME, TimeConvert(hld.wHeatHiTime));
printf("%s = %d\n", _HEAT_HI_MONTH, hld.wHeatHiMonth);
printf("%s = %d\n", _HEAT_HI_YEAR, hld.wHeatHiYear);
printf("%s = %.1f\n", _SOLAR_HI_DAY, hld.wSolarHiDay / 10.0 );
printf("%s = ", _SOLAR_HI_TIME );
if(hld.wSolarHiTime == 65535)
printf("n/a\n");
else
printf("%s\n", TimeConvert(hld.wSolarHiTime));
printf("%s = %.1f\n", _SOLAR_HI_MONTH, hld.wSolarHiMonth / 10.0 );
printf("%s = %.1f\n", _SOLAR_HI_YEAR, hld.wSolarHiYear / 10.0 );
printf("%s = %.1f\n", _UV_HI_DAY, hld.yUVHiDay / 10.0);
printf("%s = ", _UV_HI_TIME );
if(hld.wUVHiTime == 65535)
printf("n/a\n");
else
printf("%s\n", TimeConvert(hld.wUVHiTime));
printf("%s = %.1f\n", _UV_HI_MONTH, hld.yUVHiMonth / 10.0);
printf("%s = %.1f\n", _UV_HI_YEAR, hld.yUVHiYear / 10.0);
printf("%s = %.2f\n", _RAIN_RATE_HI_DAY, hld.wRainHiDay / 100.0);
printf("%s = ", _RAIN_RATE_HI_TIME );
if(hld.wRainHiTime == 65535)
printf("n/a\n");
else
printf("%s\n", TimeConvert(hld.wRainHiTime));
printf("%s = %.2f\n", _RAIN_RATE_HI_HOUR, hld.wRainHiHour / 100.0);
printf("%s = %.2f\n", _RAIN_RATE_HI_MONTH, hld.wRainHiMonth / 100.0);
printf("%s = %.2f\n", _RAIN_RATE_HI_YEAR, hld.wRainHiYear / 100.0);
}
/**
* Dumps the graphics sets to stdout.
*
* @param pData Pointer to string containing the data print print
*/
void PrintGDData(uint8_t * pData)
{
PrintTimeRef(); /* Print reference times */
/* inside temp by hour, last 24 */
printf("%s = ", _IN_TEMP_BY_HOURS);
PrintTempSet24(pData, TEMP_IN_HOUR, *(pData + NEXT_HOUR_PTR), 90);
/* inside temp highs by day, last 24 */
printf("%s = ", _IN_TEMP_HI_BY_DAYS);
PrintTempSet24(pData, TEMP_IN_DAY_HIGHS, *(pData + NEXT_DAY_PTR), 90);
/* inside temp highs by day, time, last 24 */
printf("%s = ", _IN_TEMP_HI_BY_DAYS_TIME);
PrintTimeSet(pData, TEMP_IN_DAY_HIGH_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* inside temp lows by day, last 24 */
printf("%s = ", _IN_TEMP_LO_BY_DAYS);
PrintTempSet24(pData, TEMP_IN_DAY_LOWS, *(pData + NEXT_DAY_PTR), 90);
/* inside temp lows by day by time, last 24 */
printf("%s = ", _IN_TEMP_LO_BY_DAYS_TIME);
PrintTimeSet(pData, TEMP_IN_DAY_LOW_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* inside temp highs by month, last 25 */
printf("%s = ", _IN_TEMP_HI_BY_MONTHS);
PrintTempSet25(pData, TEMP_IN_MONTH_HIGHS, *(pData + NEXT_MONTH_PTR), 90);
/* inside temp lows by month, last 25 */
printf("%s = ", _IN_TEMP_LO_BY_MONTHS);
PrintTempSet25(pData, TEMP_IN_MONTH_LOWS, *(pData + NEXT_MONTH_PTR), 90);
/* temp by hour, last 24 */
printf("%s = ", _TEMP_BY_HOURS);
PrintTempSet24(pData, TEMP_OUT_HOUR, *(pData + NEXT_HOUR_PTR), 90);
/* temp highs by day, last 24 */
printf("%s = ", _TEMP_HI_BY_DAYS);
PrintTempSet24(pData, TEMP_OUT_DAY_HIGHS, *(pData + NEXT_DAY_PTR), 90);
/* temp highs by day, time, last 24 */
printf("%s = ", _TEMP_HI_BY_DAYS_TIME);
PrintTimeSet(pData, TEMP_OUT_DAY_HIGH_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* temp lows by day, last 24 */
printf("%s = ", _TEMP_LO_BY_DAYS);
PrintTempSet24(pData, TEMP_OUT_DAY_LOWS, *(pData + NEXT_DAY_PTR), 90);
/* temp lows by day by time, last 24 */
printf("%s = ", _TEMP_LO_BY_DAYS_TIME);
PrintTimeSet(pData, TEMP_OUT_DAY_LOW_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* temp highs by month, last 24 */
printf("%s = ", _TEMP_HI_BY_MONTHS);
PrintTempSet25(pData, TEMP_OUT_MONTH_HIGHS, *(pData + NEXT_MONTH_PTR), 90);
/* temp lows by month, last 24 */
printf("%s = ", _TEMP_LO_BY_MONTHS);
PrintTempSet25(pData, TEMP_OUT_MONTH_LOWS, *(pData + NEXT_MONTH_PTR), 90);
/* dew point by hour, last 24 */
printf("%s = ", _DEW_BY_HOURS);
PrintTempSet24(pData, DEW_HOUR, *(pData + NEXT_HOUR_PTR), 120);
/* dew point highs by day, last 24 */
printf("%s = ", _DEW_HI_BY_DAYS);
PrintTempSet24(pData, DEW_DAY_HIGHS, *(pData + NEXT_DAY_PTR), 120);
/* dew point highs by day, time, last 24 */
printf("%s = ", _DEW_HI_BY_DAYS_TIME);
PrintTimeSet(pData, DEW_DAY_HIGH_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* dew point lows by day, last 24 */
printf("%s = ", _DEW_LO_BY_DAYS);
PrintTempSet24(pData, DEW_DAY_LOWS, *(pData + NEXT_DAY_PTR), 120);
/* dew point lows by day, time, last 24 */
printf("%s = ", _DEW_LO_BY_DAYS_TIME);
PrintTimeSet(pData, DEW_DAY_LOW_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* dew point highs by month, last 25 */
printf("%s = ", _DEW_HI_BY_MONTHS);
PrintTempSet25(pData, DEW_MONTH_HIGHS, *(pData + NEXT_MONTH_PTR), 120);
/* dew point lows by month, last 25 */
printf("%s = ", _DEW_LO_BY_MONTHS);
PrintTempSet25(pData, DEW_MONTH_LOWS, *(pData + NEXT_MONTH_PTR), 120);
/* wind chill by hour, last 24 */
printf("%s = ", _CHILL_LO_BY_HOURS);
PrintTempSet24(pData, CHILL_HOUR, *(pData + NEXT_HOUR_PTR), 120);
/* wind chill lows by day, last 24 */
printf("%s = ", _CHILL_LO_BY_DAYS);
PrintTempSet24(pData, CHILL_DAY_LOWS, *(pData + NEXT_DAY_PTR), 120);
/* wind chill lows by day, time, last 24 */
printf("%s = ", _CHILL_LO_BY_DAYS_TIME);
PrintTimeSet(pData, CHILL_DAY_LOW_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* wind chill lows by month, last 25 */
printf("%s = ", _CHILL_LO_BY_MONTHS);
PrintTempSet25(pData, CHILL_MONTH_LOWS, *(pData + NEXT_MONTH_PTR), 120);
/* heat index by hour, last 24 */
printf("%s = ", _HEAT_HI_BY_HOURS);
PrintTempSet24(pData, HEAT_HOUR, *(pData + NEXT_HOUR_PTR), 90);
/* heat index lows by day, last 24 */
printf("%s = ", _HEAT_HI_BY_DAYS);
PrintTempSet24(pData, HEAT_DAY_HIGHS, *(pData + NEXT_DAY_PTR), 90);
/* heat index highs by day, time, last 24 */
printf("%s = ", _HEAT_HI_BY_DAYS_TIME);
PrintTimeSet(pData, HEAT_DAY_HIGH_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* heat index by month, last 25 */
printf("%s = ", _HEAT_HI_BY_MONTHS);
PrintTempSet25(pData, HEAT_MONTH_HIGHS, *(pData + NEXT_MONTH_PTR), 90);
/* Inside Humidity by hour, last 24 */
printf("%s = ", _IN_HUM_BY_HOURS);
PrintByteSet(pData, HUM_IN_HOUR, *(pData + NEXT_HOUR_PTR), 24);
/* Inside Humidity highs by day, last 24 */
printf("%s = ", _IN_HUM_HI_BY_DAYS);
PrintByteSet(pData, HUM_IN_DAY_HIGHS, *(pData + NEXT_DAY_PTR), 24);
/* Inside Humidity highs by day, time, last 24 */
printf("%s = ", _IN_HUM_HI_BY_DAYS_TIME);
PrintTimeSet(pData, HUM_IN_DAY_HIGH_TIMES, *(pData + NEXT_DAY_PTR), 24);
/* Inside Humidity lows by day, last 24 */
printf("%s = ", _IN_HUM_LO_BY_DAYS);
PrintByteSet(pData, HUM_IN_DAY_LOWS, *(pData + NEXT_DAY_PTR), 24);
/* Inside Humidity lows by day, time, last 24 */
printf("%s = ", _IN_HUM_LO_BY_DAYS_TIME);
PrintTimeSet(pData, HUM_IN_DAY_LOW_TIMES, *(pData + NEXT_DAY_PTR), 24);