-
Notifications
You must be signed in to change notification settings - Fork 1
/
heather.ch
5438 lines (4691 loc) · 203 KB
/
heather.ch
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
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include <math.h>
#ifdef __MACH__ // Mac OS X (aka macOS)
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#ifdef __GNUC__
// gcc compiler...
// If you are using gcc on a Windows box, you need to undefine PENGUIN
// to use the proper file name format and maybe the SWITCH_CHAR
// command line option switch flag
#define GCC
#ifndef USE_SDL
#define USE_X11
#endif
#endif
#ifdef __GNUG__
// g++ compiler...
// If you are using gcc on a Windows box, you need to undefine PENGUIN
// to use the proper file name format and maybe the SWITCH_CHAR
// command line option switch flag
#define GCC
#ifndef USE_SDL
#define USE_X11
#endif
#endif
#ifdef GCC
#define stricmp strcasecmp // case insensitive string comparison
#define strnicmp strncasecmp
void strupr(char *);
void strlwr(char *);
#endif
#ifdef __MACH__ // Mac OS X
#include <mach/clock.h>
#include <mach/mach.h>
#include <mach-o/dyld.h>
#ifndef USE_SDL
#define USE_X11
#endif
#endif
#ifdef _MSC_VER
#define WINDOWS // #define this for WIN32 environment
#endif
#define VERSION "6.14.1 Beta"
//
// "Magic" numbers (mostly used as function args and returns)
//
#define BIG_NUM 1.0E29 // a large number
#define BROADCAST_5A ((res_t == RES_T) ? 0x01 : 0x00) // TSIP_RCVR: 0x01=broadcast packet 5A, 0x00=poll for packet 5A
#define DOPPLER_SMOOTH 0x02 // TSIP_RCVR: 0x02=doppler smoothed code phase 0x00=raw code phase
#define DATA_LOSS_REINIT 1 // com port data lost, OK to re-init receiver
#define DATA_LOSS_NO_INIT 2 // com port data lost, don't try to re-init receiver
#define RESET_ADEV_Q 0x01 // queue idenyifiers (for resetting queues)
#define RESET_PLOT_Q 0x02
#define RESET_MTIE_Q 0x04
#define RESET_ALL_QUEUES (RESET_PLOT_Q | RESET_ADEV_Q | RESET_MTIE_Q)
EXTERN int dont_reset_queues; // used in TICC autotune mode
EXTERN int dont_reset_phase; // used when reloading adev queue data
#define TRIM_Q_START 0x01 // use by trim_plot_queue
#define TRIM_Q_END 0x02
#define STOP_AT_Q_END 0 // stop searching queue at last saved point
#define STOP_AT_PLOT_END 1 // stop seaching plot queue at last displayed point
#define REVIEW_QUIET 0 // disable beeps in plot review mode
#define REVIEW_BEEP 1 // allow beeps in plot review mode
#define NO_REFRESH 0 // don't refresh screen when plot updates NO_REFRESH MUST be 0
#define REFRESH_SCREEN 1 // refresh screen when plot updates
#define FULL_ERASE_OK (-1) // erase the full screen plot area disabled
#define ERASE_GRAPH_AREA (0) // erase only the graph area
#define ERASE_PLOT_AREA (1) // erase the whole plot area (up to any shared plot)
#define LOG_HEX_STREAM 0x01 // log receiver data as formatted ascii hex packets
#define LOG_PACKET_ID 0x02 // log TSIP packet names
#define LOG_PACKET_START 0x04 // log TSIP packet starts
#define LOG_RAW_STREAM 0x08 // log receiver data as raw binary
#define LOG_SENT_DATA 0x10 // log packets sent
#define ECHO_RCVR_DATA 0x100 // echo receiver data to an external device
#define ECHO_TICC_DATA 0x200 // echo TICC data to an external device
#define ZOOM_SLEEP 100 // msecs to sleep after each line in ZH zoom mode
// Values less than 0x10000 originate from TSIP receiver messages, don't change them
// If you add any alarm values, update write_log_changes() in heathmsc.cpp
#define CRIT_ROM 0x0001 // critcal_alarms
#define CRIT_RAM 0x0002
#define CRIT_PWR 0x0004
#define CRIT_FPGA 0x0008
#define CRIT_GPS 0x0008
#define CRIT_OCXO 0x0010
#define CRIT_RTC 0x0010
#define CRIT_ALL 0xFFFF
#define MINOR_OSC_AGE 0x0001 // minor_alarms
#define MINOR_ANT_OPEN 0x0002
#define MINOR_ANT_SHORT 0x0004
#define MINOR_ANT_NO_PWR (MINOR_ANT_OPEN | MINOR_ANT_SHORT)
#define MINOR_NO_TRACK 0x0008
#define MINOR_OSC_CTRL 0x0010
#define MINOR_SURVEY 0x0020
#define MINOR_NO_POSN 0x0040
#define MINOR_LEAP_PEND 0x0080
#define MINOR_TEST_MODE 0x0100
#define MINOR_BAD_POSN 0x0200
#define MINOR_EEPROM 0x0400
#define MINOR_ALMANAC 0x0800
#define MINOR_PPS_SKIPPED 0x1000
#define MINOR_UNKNOWN 0xE000
#define MINOR_ALL 0xFFFF
// Additional alarm flags
#define MINOR_JL_PHASE 0x10000
#define MINOR_JL_RUNTIME 0x20000
#define MINOR_JL_HOLD 0x40000
#define MINOR_JL_FREQ 0x80000
#define MINOR_JL_CHANGE 0x100000
#define MINOR_DISCIPLINE 0x200000
#define MINOR_WARMUP 0x400000
#define MINOR_INACTIVE 0x800000
#define MINOR_HOLDOVER 0x1000000
#define MINOR_PLL 0x2000000
#define MINOR_JAMMING 0x4000000
#define GPS_FIXES 0x00 // gps_status
#define GPS_NO_TIME 0x01
#define GPS_NO_FIXES 0x02
#define GPS_PDOP_HIGH 0x03
#define GPS_NO_SATS 0x08
#define GPS_ONE_SAT 0x09
#define GPS_TWO_SATS 0x0A
#define GPS_THREE_SATS 0x0B
#define GPS_SAT_UNAVAIL 0x0C
#define GPS_TRAIM_ERR 0x10
#define GPS_UNK_STATUS 0xFF
#define DIS_LOCKED 0 // discipline (TSIP receiver status variable)
#define DIS_WARMING 1
#define DIS_FLOCK 2
#define DIS_PLACING 3
#define DIS_FINIT 4
#define DIS_COMP 5
#define DIS_OFF 6
#define DIS_RECOVERY 8
#define TFLAGS_NULL 0x0000 // time_flags - bit values match TSIP message values - don't change!
#define TFLAGS_UTC 0x0001
#define TFLAGS_INVALID 0x0004
#define TFLAGS_NO_UTC_OFS 0x0008
#define TFLAGS_USER_TIME 0x0010
#define TFLAGS_GLONASS 0x0010
#define TFLAGS_BEIDOU 0x0020
#define TFLAGS_GALILEO 0x0030
#define TFLAGS_GNSS_MASK 0x0030
#define TFLAGS_RTC 0x0100
#define TFLAGS_BAD_TIME (TFLAGS_INVALID | TFLAGS_NO_UTC_OFS)
#define TMODE_GPS 0x00 // timing_mode
#define TMODE_UTC 0x03
#define TMODE_GLONASS 0x08 // ACU_360 ACU_GG
#define TMODE_SU 0x80 // eSIP only
#define RATE_1PPS 2 // pps_rate and set_pps_mode()
#define RATE_100PPS 0x82
#define RATE_PP2S 0x82
#define RATE_NO_TOD 0x82
#define RATE_1000PPS 0x83
#define RATE_10000PPS 0x83
#define RATE_USER 0
#define RATE_SKIP_PPS 0x80 // (res_t PP2S mode bit mask)
#define ALARM_DATE 0x01 // sound alarm at a specific date and time
#define ALARM_TIME 0x02 // sound alarm at a specific time
#define ALARM_TIMER 0x04 // sound countdown timer alarm
#define ALARM_LUXOR 0x10 // sound luxor fault alarm
#define ALARM_SET 0x80 // used for maintaining alarm at a time (without a date)
#define HOLD_SEEN_HOLD 0x01 // holdover mode seen
#define HOLD_SEEN_REC 0x02 // recovery mode seen
#define GPS_EPOCH 2444244.5 // GPS time reference epoch (julian date)
#define LINUX_EPOCH 2440587.5 // Linux time reference epoch (julian date)
#define JD2000 2451545.0 // Jan 1, 2000 at noon
#define JD_MJD 2400000.5 // convert JD to MJD
#define ROLLOVER_YEAR 2018 // if GPS year is less than this, assume it's a GPS week rollover fault
#define DEBUG_TEMP_CONTROL // define to enable debug messages
#define DEBUG_OSC_CONTROL
#define DEBUG_PLOTS
//
// Note: these are legacy defines left over from the days of tiny memory
// footprints. Undefining an option may cause compile errors due
// to unhandled dependencies, etc.
#define ADEV_STUFF // define this to enable ADEV calculation and plotting
#define PRECISE_STUFF // define this to enable precise lat/lon/alt code
#define DIGITAL_CLOCK // define this to enable the big digital clock display
#define ANALOG_CLOCK // define this to enable the analog clock display
#define AZEL_STUFF // define this to enable azel map drawing
#define SAT_TRAILS // define this to plot sat trails in the az/el map
#define GIF_FILES // define this to enable GIF screen dumps
#define FFT_STUFF // define this to enable FFT calculations
#define GREET_STUFF // define this to show holiday greetings
#define TEMP_CONTROL // define this to enable unit temperature control
#define OSC_CONTROL // define this to enable unit oscillator control
// #define PLM // define this for power line monitoring (doesn't work)
#ifdef AZEL_STUFF
#define AZEL_OK 1
#else
#define AZEL_OK 0
#endif
#define HT_SIZE (1<<13) // 13 bit GIF hash table size
#define PI (3.1415926535897932384626433832795)
#define E_VALUE (2.7182818284590)
#define RAD_TO_DEG (180.0/PI)
#define DEG_TO_RAD (PI/180.0)
#define SECS_PER_DAY (24 * 60 * 60)
#define SQRT3 (1.732050808)
#define FEET_PER_METER 3.280839895
#define LG_PER_METER 7.1429 // linguini per meter
#define FLICKS_PER_SEC 705600000 // a flick is a unit of time used in video editing, etc
#define LIGHTSPEED (299792.458) /* speed of light, km/s */
#define ABS_ZERO (-237.15)
#define KB (1.380649e-23) // Boltzmann's constant
#define KH (6.62607015e-34) // Plank's constant
// WGS84 ellipsoid constants
#define WGS84_A 6378137.0
#define WGS84_E 0.08181919084296430236105472696748
#define eccSquared (WGS84_E * WGS84_E)
#define eccPrimeSquared (eccSquared / (1.0 - eccSquared))
#define dScaleFactor 0.9996
#define IABS(x) (((x)<0)?(0-(x)):(x))
#define ABS(x) (((x)<0.0F)?(0.0F-(x)):(x))
#define DABS(x) (((x)<0.0)?(0.0-(x)):(x))
#define ROUND(x,to) ((((x)+(to)-1)/(to))*to)
#define DEBUGSTR(x) vidstr(MOUSE_ROW-2,MOUSE_COL, RED, x)
#define DEBUGSTR2(x) vidstr(MOUSE_ROW-3,MOUSE_COL, RED, x)
#define DEBUGSTR3(x) vidstr(MOUSE_ROW-4,MOUSE_COL, RED, x)
#define IDLE_SLEEP 25 // default idle sleep time in msecs
#define DOUBLE_DATA // define this for double precsion data queue entries
#ifdef DOUBLE_DATA
#define DATA_SIZE double // double precision data queue entries
#define OFS_SIZE double
#else
#define DATA_SIZE float // single precision data queue entries
#define OFS_SIZE double
#endif
//#define PLUS_MINUS 0xF1
#define PLUS_MINUS 0x1F
#define SQUARED 0xFD
#define DEG_CODE 0x01 // internal char code for degrees symbol
#define PROGMEM // (used by original Atmel AVR vector char drawing routines)
#define VCHAR_W 8 // elemental width and height of vector character patterns
#define VCHAR_H 8
#define DOT_CHARS 0 // if 1, draw characters dot-by-dot using win_vfx font definitions
// to disable sun and moon displays #define SUN_PRN 0, MOON_PRN 0, SUN_MOON_PRN MAX_PRN
#define MAX_PRN 999 // max number of sat PRNs to use
#define SUN_PRN (MAX_PRN+1)
#define MOON_PRN (MAX_PRN+2)
#define SUN_MOON_PRN MOON_PRN // max PRN to display: treat moon as a satellite
//#define SUN_MOON_PRN SUN_PRN // max PRN to display: don't treat moon as a satellite
EXTERN int no_sun_moon; // flags to control drawing sun/moon in maps and watch
EXTERN int sun_moon_shown;
#define GPS 0x0001 // bit mask positions match Venus receivers
#define GLONASS 0x0002
#define GALILEO 0x0004
#define BEIDOU 0x0008
#define IRNSS 0x0010
#define IMES 0x2000
#define QZSS 0x4000
#define SBAS 0x8000
#define MIXED (GPS | GLONASS | GALILEO | BEIDOU | SBAS | QZSS)
EXTERN int system_mask; // used to filter messages for GNSS system type
EXTERN int gnss_mask;
EXTERN int have_gnss_mask;
EXTERN int default_gnss;
EXTERN int gnss_sat;
EXTERN char *unit_file_name; // base name of files to write (based upon receiver type)
#ifdef WINDOWS
#include <assert.h>
#include <conio.h>
#define WIN32_LEAN_AND_MEAN
#ifdef PLM
#define _WIN32_WINNT 0x0500 // needed for high-res timer
#endif
#define WINCON // printf() goes to TTY console if compiled with JM's modified windows.h, no effect otherwise, please leave in place
#include <windows.h>
#include <winbase.h>
#include <windowsx.h>
#include <commdlg.h>
#include <mmsystem.h>
#include <shellapi.h>
#include <shlobj.h>
#include <winsock2.h> // TCP/IP
#include <ws2tcpip.h>
#include <mswsock.h>
#include "typedefs.h"
#define KBHIT win_kbhit
#define GETCH win_getch
#define SERIAL_DATA_AVAILABLE(port) (check_incoming_data(port))
#include "sal.h"
#include "winvfx.h"
#include "resource.h"
#define unlink(s) _unlink(s)
#define strupr(s) _strupr(s)
#define strlwr(s) _strlwr(s)
#define strnicmp(a,b,c) _strnicmp((a),(b),(c))
#define outp(a,b) _outp((a),(b))
#define COORD int
#define u08 unsigned char
#define s08 char
#define u16 unsigned short
#define s16 short
#define u32 unsigned int
#define s32 int
#define u48 unsigned long long
#define u64 unsigned long long
#define s64 long long
#define FP80 long double
#define DEGREES DEG_CODE // special chars
#define UP_ARROW 24
#define DOWN_ARROW 25
#define LEFT_ARROW 27
#define RIGHT_ARROW 26
#define UP_DOWN_CHAR 18
#define CHIME_CHAR 13 // char to signal cuckoo clock on
#define SONG_CHAR 14 // char to signal singing clock on
#define ALARM_CHAR 15 // char to signal alarm or egg timer set
#define DUMP_CHAR 19 // char to signal screen dump timer set
#define TEXT_X_MARGIN (TEXT_WIDTH*2)
#define TEXT_Y_MARGIN (TEXT_HEIGHT*1)
EXTERN HINSTANCE hInstance;
EXTERN HWND hWnd;
EXTERN char root[MAX_PATH+1];
EXTERN char heather_path[MAX_PATH+1];
EXTERN char heather_cfg_path[MAX_PATH+1];
EXTERN int root_len;
extern PANE *stage;
EXTERN u08 VFX_io_done;
EXTERN U32 palette[16];
EXTERN u08 downsized; // flag set if screen has been windowed to show help dialog
EXTERN u08 sal_ok; // flag set once hardware has been setup
unsigned char get_serial_char(unsigned port);
void add_kbd(int key);
void flush_kbd(void);
int win_kbhit(void);
int win_getch(void);
void refresh_page(void);
void do_fullscreen(void);
void do_windowed(void);
#define TCP_IP // enable TCP/IP networking
#define WIN_VFX // use VFX for screen I/O
// #define SIN_TABLES // use sin/cos tables for drawing circles
#define SIG_LEVELS // track sig levels vs azimuth
#define BUFFER_LLA // save lla x/y plot data in a buffer for screen redraws
#else // __linux__ __MACH__ __FreeBSD__
#include <stdint.h>
#include <unistd.h>
#ifdef USE_SDL
#include <SDL2/SDL.h>
#include <SDL2/SDL_types.h>
#include <SDL2/SDL_endian.h>
#include <SDL2/SDL_keyboard.h>
#include "SDL_gfxPrimitives.h"
#else
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/keysymdef.h>
#include <X11/cursorfont.h>
#endif
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <libgen.h>
#ifndef USE_SDL
#define USE_X11
#endif
#define SIMPLE_HELP
#define MAX_PATH 256+1
#define COORD int
#define u08 unsigned char
#define s08 char
#define u16 uint16_t
#define s16 int16_t
#define u32 uint32_t
#define s32 int32_t
#define DWORD int32_t
#define S32 int32_t
#define u48 uint64_t
#define u64 uint64_t
#define s64 int64_t
#define FP80 long double
#ifdef USE_SDL
EXTERN SDL_Surface *display;
EXTERN SDL_Window * ne_window;
EXTERN SDL_Texture * ne_texture;
EXTERN SDL_Renderer * ne_renderer;
EXTERN u32 sdl_texture_width;
EXTERN u32 sdl_texture_height;
EXTERN u32 sdl_window_width;
EXTERN u32 sdl_window_height;
EXTERN u08 sdl_scaling;
#define KBHIT sdl_kbhit
#define GETCH sdl_getch
#define SERIAL_DATA_AVAILABLE(port) (check_incoming_data(port))
#define TCP_IP // enable TCP/IP networking
EXTERN void kill_screen(void);
EXTERN int sdl_getch(void);
EXTERN int sdl_kbhit(void);
EXTERN u32 get_sdl_color(u08 color);
EXTERN void set_sdl_color(u08 color);
EXTERN int get_sdl_event();
#else
#define KBHIT x11_kbhit
#define GETCH x11_getch
#define SERIAL_DATA_AVAILABLE(port) (check_incoming_data(port))
#define TCP_IP // enable TCP/IP networking
#define X11_sleep 100 // msecs to sleep when X11 is started / shutdown / resized
#endif
#define TRUE 1
#define FALSE 0
#define DEGREES DEG_CODE // special chars
#define UP_ARROW 24
#define DOWN_ARROW 25
#define LEFT_ARROW 27
#define RIGHT_ARROW 26
#define UP_DOWN_CHAR 18
#define CHIME_CHAR 13 // char to signal cuckoo clock on
#define SONG_CHAR 14 // char to signal singing clock on
#define ALARM_CHAR 15 // char to signal alarm or egg timer set
#define DUMP_CHAR 19 // char to signal screen dump timer set
#define TEXT_X_MARGIN (TEXT_WIDTH*2)
#define TEXT_Y_MARGIN (TEXT_HEIGHT*1)
// #define SIN_TABLES // use sin/cos tables for drawing circles
#define SIG_LEVELS // track sig levels vs azimuth
#define BUFFER_LLA // save lla x/y plot data in a buffer for screen redraws
EXTERN char heather_path[MAX_PATH+1];
EXTERN char root[MAX_PATH+1];
EXTERN int root_len;
EXTERN char x11_io_done;
EXTERN u08 downsized; // flag set if screen has been windowed to show help dialog
#define RESTORE_MAXED_WINDOW 1 // if true, attempt to restore maximized window to its original size
EXTERN int have_root_info; // flag set if screen size is known
EXTERN int have_restore_size; // used to restore window from maximized state
EXTERN int restore_width,restore_height; // screen size in use before maximization
EXTERN int x11_maxed; // flag set if window is maximized
#ifdef USE_X11
EXTERN Display *display; // the X11 display to use
EXTERN Window screen; // the X11 window to display
EXTERN Pixmap pix_map; // drawing pixmap (used to double buffer the drawing)
EXTERN Pixmap icon_map; // pixmap for window manager (minimized) icon hint
#define win pix_map // win is the drawing surface - either screen (direct drawing) or pix_map (for double buffering)
EXTERN GC gc; // X11 graphics context
EXTERN int screen_num;
EXTERN char *appname;
EXTERN int x11_left; // screen window top left corner
EXTERN int x11_top;
#endif
EXTERN struct termios oldtio,newtio; // serial port config structures
EXTERN u32 palette[16]; // our color palette
unsigned char get_serial_char(unsigned port); // forward ref'd functions
void add_kbd(int key);
void flush_kbd(void);
int x11_kbhit(void);
int x11_getch(void);
void refresh_page(void);
void do_fullscreen(void);
void do_windowed(void);
void Sleep(int t);
void outp(unsigned port, unsigned val);
void set_x11_color(u08 c);
int get_x11_event(void);
void flush_x11(void);
u32 RGB_NATIVE(int r, int g, int b);
#endif // __linux__ (and OSX)
#ifdef SIN_TABLES // if memory is available use tables to speed up circle drawing
#define sin360(x) sin_table[((int)((x)+360))%360]
#define cos360(x) cos_table[((int)((x)+360))%360]
EXTERN float sin_table[360+1];
EXTERN float cos_table[360+1];
#else // to save memory, DOS does not use tables to draw circles
#define sin360(x) ((float)sin((fmod((double)(x),360.0))/RAD_TO_DEG))
#define cos360(x) ((float)cos((fmod((double)(x),360.0))/RAD_TO_DEG))
#endif
#define SLEN 250 // standard string length
#ifdef GREET_STUFF
// EXTERN char *moons[12+1][31+2];
EXTERN char *moons[31+2];
#endif
#ifdef SIG_LEVELS
#define MAX_AVG_COUNT 0.0F // max number of az or el readings to average
// if <0.0, don't freshen signal averages
// if 0.0, freshen signal averages once a day
// if >0.0, freshen signal averages every n readings
EXTERN int max_sat_prn; // largest sat PRN seen
EXTERN int min_el[360+1]; // minimum sat elevation seen at each azimuth
EXTERN int max_el[360+1]; // maximum sat elevation seen at each azimuth
EXTERN float db_az_sum[360+1];
EXTERN float db_weighted_az_sum[360+1];
EXTERN float db_az_count[360+1];
EXTERN float db_el_sum[90+1];
EXTERN float db_el_count[90+1];
EXTERN float db_3d_sum[360+1][90+1];
EXTERN float db_3d_count[360+1][90+1];
EXTERN float max_sat_db[MAX_PRN+2+1]; // +2 is for sun/moon
EXTERN float max_sig_level;
EXTERN float min_sig_level;
EXTERN double sig_level_sum; // calculates average sat signal level
EXTERN double sig_level_count;
EXTERN int min_sig_db; // used to label signal level map
EXTERN int sig_level_step;
#endif // SIG_LEVELS
#define MAX_LLA_SIZE 640 //500 // max size of LLA scattergram plot
#ifdef BUFFER_LLA
EXTERN u08 lla_data[MAX_LLA_SIZE+1][MAX_LLA_SIZE+1];
#endif
// define the second to perform certain tasks at...
// ... so a bunch of stuff does not all happen at the same time
#define REINIT_SECOND 54 // when to re-init the X11 display
#define MOON_STUFF 48 // update moon info at 48 seconds
#define AZEL_UPDATE_SECOND 42 // update azel plot at 42 seconds
#define SCPI_STATUS_SECOND 32 // request SCPI receiver status at 32 seconds
#define SUN_SECOND 26 // update sun rise/set values
#define TRAIL_UPDATE_SECOND 22 // update azel trails at 22 seconds
#define MOON_SECOND 18 // update moon rise/set values
#define LEAP_SECOND 04 // time to play the leap second song
#define CUCKOO_SECOND 00 // cuckoo clock at 00 seconds
#define SYNC_SECOND 06 // sync cpu time to gps time at 06 seconds
#define SYNC_MINUTE 05 // ... 05 minutes
#define SYNC_HOUR 04 // ... 04 hours
#define GREET_SECOND 12 // update greetings at 00:00:12
#define GREET_MINUTE 00
#define GREET_HOUR 00
#define DELTAT_SECOND 16 // update delta_t at 00:00:16
#define DELTAT_MINUTE 00
#define DELTAT_HOUR 00
#define REINIT_INTERVAL 1.0 // re-init X11 displays every 1.0 days
#define REINIT_IDLE_TIME 10.0 // only do screen re-inits if kbd idle for 10 minutes
// ... set to 0 to disable keyboard idle lockout
/* screen attributes for output messages */
#define BLACK 0
#define DIM_BLUE 1
#define DIM_GREEN 2
#define DIM_CYAN 3
#define DIM_RED 4
#define DIM_MAGENTA 5
#define BROWN 6
#define DIM_WHITE 7
#define GREY 8
#define BLUE 9
#define GREEN 10
#define CYAN 11
#define RED 12
#define MAGENTA 13
#define YELLOW 14
#define WHITE 15
#define BMP_YELLOW 16
#define PPS_ADEV_COLOR BLUE // graph colors
#define OSC_ADEV_COLOR BROWN
#define CHC_ADEV_COLOR CYAN
#define CHD_ADEV_COLOR WHITE
#define ADEV_LABEL_COLOR GREEN // adev plot label color
#define PPS_COLOR MAGENTA
#define OSC_COLOR WHITE
#define DAC_COLOR GREEN
#define TEMP_COLOR YELLOW
#define ONE_COLOR CYAN // extra and DEBUG_PLOTS
#define TWO_COLOR DIM_WHITE //BROWN
#define THREE_COLOR BLUE
#define FOUR_COLOR RED //BROWN
#define FIVE_COLOR DIM_BLUE
#define SIX_COLOR DIM_RED
#define SEVEN_COLOR DIM_GREEN
#define EIGHT_COLOR BROWN // DIM_RED
#define NINE_COLOR DIM_MAGENTA // DIM_WHITE
#define TEN_COLOR WHITE // DIM_MAGENTA
#define ELEVEN_COLOR DIM_CYAN
#define TWELVE_COLOR DIM_GREEN
#define THIRTEEN_COLOR DIM_BLUE
#define FOURTEEN_COLOR GREY // DIM_WHITE // DIM_MAGENTA
#define FIFTEEN_COLOR CYAN
#define COUNT_COLOR CYAN
#define CONST_COLOR CYAN
#define SKIP_COLOR RED // timestamp error markers
#define HOLDOVER_COLOR RED // holdover/temp spike markers
#define MOUSE_COLOR CYAN // DOS mouse cursor
#define HELP_COLOR WHITE // help text
#define PROMPT_COLOR CYAN // string editing
#define STD_TIME_COLOR BLUE // time while in standard time
#define DST_TIME_COLOR CYAN // time while in daylight savings time
#define MARKER_COLOR CYAN // plot marker numbers
#define ALARM_COLOR RED // alarm clock color
#define TIMER_COLOR YELLOW // egg timer marker color
#define DOP_COLOR WHITE // dilution of precision info
#define OSC_PID_COLOR CYAN // external oscillator disciplining status
#define TITLE_COLOR WHITE // plot title color
#define LEVEL_COLOR BLUE // avg signal level vs azimuth
#define KBD_GRID_COLOR YELLOW // touch screen keyboard color scheme
#define KBD_FG_COLOR WHITE
#define KBD_BG_COLOR BLACK
#define KBD_TITLE_COLOR CYAN
#define KBD_FLASH_TIME 70 // msecs to flash pressed key for
#define HIGHLIGHT_REF 1 // put > < ticks on plot center reference line
// Where to place the various information onto the screen.
// These are in character coordinates.
#define TIME_ROW 0 // time stuff
#define TIME_COL 0
#define VAL_ROW 0 // oscillator values stuff
#define VAL_COL 15
EXTERN int VER_ROW; // version stuff
EXTERN int VER_COL;
#define VER_LEN (INFO_COL-VER_COL-1)
#define ADEV_ROW 0 // adev text tables
#define ADEV_COL 79
#define INFO_ROW 16 // status info
EXTERN int INFO_COL;
#define CRIT_ROW 0 // critical alarms
#define CRIT_COL INFO_COL // ... show_satinfo() assumes CRIT_stuff is next to SAT_stuff
#define MINOR_ROW 6 // minor alarms
#define MINOR_COL INFO_COL
#define POSN_ROW 6 // lat/lon/alt info
#define POSN_COL 0
#define SURVEY_ROW 6 // self survey info / osc params
#define SURVEY_COL 22
#define DIS_ROW 6 // oscillator disciplining info
#define DIS_COL 40
#define SAT_ROW 10 // sat info (gets shifted down 2 more rows unless Ebolt at 800x600)
#define SAT_COL 0
EXTERN int FILTER_ROW; // where to put the filter mode info
EXTERN int FILTER_COL;
EXTERN int MOUSE_ROW; // where to put the data at the mouse cursor
EXTERN int MOUSE_COL;
#define ALL_ROW (TIME_ROW+7) // for showing all adevs
#ifdef WINDOWS
#define HELP_COL (PLOT_LEFT/TEXT_WIDTH)
#define HELP_ROW (PLOT_TEXT_ROW+1)
#else // __linux__ __MACH__ __FreeBSD__
#define HELP_COL (PLOT_LEFT/TEXT_WIDTH)
#define HELP_ROW (PLOT_TEXT_ROW+1)
#endif
EXTERN u08 showing_help; // flag set when keyboard help message is on screen
EXTERN int all_adev_row; // screen row to draw the adev tables at in all_adev mode
EXTERN int adev_bottom_row; // last row of adev tables
EXTERN int adev_page_size; // max number of adev bins shown on screen
EXTERN int adev_table_rows; // max number of adev bins shown on screen
EXTERN int adev_decades_shown; // number of decades in the plot
EXTERN int left_adev_col;
EXTERN int view_row; // the text row number just above the view info
EXTERN int queue_row;
//
// Screen / video mode stuff
//
EXTERN u08 ENDIAN; // 0=INTEL byte order, 1=MOTOROLA byte order
EXTERN int text_mode; // flag set when screen is showing just text
EXTERN S32 initial_window_mode; // Windows version initial screen mode
EXTERN int go_fullscreen; // if flag set, init screen in fullscreen mode
EXTERN int user_set_full_screen; // if flag set, user specified /fu
EXTERN int need_screen_init; // flag set if user did a /V command from the keyboard
EXTERN int jpl_clock; // JPL wall clock display
EXTERN int calendar_entries; // how many entries are in the greetings structure
EXTERN int greet_on; // flag set if OK to calculate greetings
#define X11_MARGIN 6 // X11 left/right window decoration margin allowance
//#define NARROW_SCREEN (800-X11_MARGIN) // widths below this are a narrow screen
#define NARROW_SCREEN ((800-X11_MARGIN) * vc_font_scale / 100) // widths below this are a narrow screen piss
#define SHORT_SCREEN 600 // heights below this are a short screen
#define WIDE_SCREEN (SCREEN_WIDTH >= 1680) // screen is wide enough for watch and (azel or lla)
#define SMALL_SCREEN ((SCREEN_WIDTH < NARROW_SCREEN) || (SCREEN_HEIGHT < SHORT_SCREEN))
//#define SMALL_SCREEN ((SCREEN_WIDTH < NARROW_SCREEN) || (SCREEN_HEIGHT < (SHORT_SCREEN-30))
#define ADEV_AZEL_THRESH 1280 // screen is wide enough to always show adevs and azel map
#define AZEL_LABEL_THRESH 160 // screen is wide enough label the azel plots values
#define AZEL_TITLE_THRESH 832 // screen is tall enough label the azel plots title
#define TINY_TINY_HEIGHT 400 // experimental ultra-small screen
#define TINY_TINY_WIDTH 450 // experimental ultra-small screen
#define TINY_HEIGHT 480 // screen heights less than this are rather restrictive in what they can show
#define MEDIUM_WIDTH (1000-X11_MARGIN) // (1024-X11_MARGIN) // 1024
#define MEDIUM_HEIGHT 710 // 768
#define WIDE_WIDTH (1280-X11_MARGIN) // 1280
#define BIG_WIDTH (1440-X11_MARGIN) // 1440
#define PLOT_TOP 480
#define MIN_HEIGHT 320 // 400
#define MIN_WIDTH 320 // 640
#define MAX_WIDTH 4096
#define MAX_AZEL 320 // max size of azel type displays on the main screen
#define FONT_SCALE 1 // vc_font_scale/100 // Note: be careful using... no parens around it
#define CORNER_SIZE (100*vc_font_scale/100) // left/right upper screen corner hot spot size
EXTERN unsigned display_width, display_height; // screen size
EXTERN int SCREEN_WIDTH; // screen window size in pixels
EXTERN int SCREEN_HEIGHT;
EXTERN int TEXT_COLS; // screen size in text chars
EXTERN int TEXT_ROWS;
EXTERN int TEXT_WIDTH; // char size in pixels
EXTERN int TEXT_HEIGHT;
EXTERN int custom_width; // custom screen size
EXTERN int custom_height;
EXTERN int vfx_fullscreen; // set flag to enable WIN_VFX full screen mode
EXTERN int kill_deco; // set flag to kill window decorations and allow full screen under X11
EXTERN int rotate_screen; // set flag to rotate screen drawing
#define SWAP(a,b) if(rotate_screen) { swap_temp=b; b=a; a=swap_temp; }
#define SWAPXY(a,b) if(rotate_screen) { swap_temp=b; b=a; a=swap_temp; a=(SCREEN_HEIGHT-1)-a; }
EXTERN int swap_temp;
EXTERN u08 big_plot; // flag set if plot area is large
EXTERN u08 screen_type; // 's', 'm', 'l' = small, medium, large, etc.
EXTERN int invert_dump; // swap black and white in screen dumps
EXTERN int force_dump; // if flag set, force a screen dump
EXTERN int invert_display; // swap black and white on screen
EXTERN int top_line; // selects screen dump or plot area only
EXTERN int need_redraw; // info for screen config update
EXTERN int no_redraw; // set flag for config_screen() to not do a redraw
EXTERN int need_resize;
EXTERN int new_width; // requested new screen size (from mouse dragging)
EXTERN int new_height;
EXTERN u08 user_font_size; // set to size of font to use
EXTERN u08 small_font; // set flag if font is < 8x16
// 1=proportional windows font 2=8x8 DOS font
EXTERN u08 no_x_margin; // used to override windows screen margins
EXTERN u08 no_y_margin;
EXTERN char *print_using; // used to print columns with VARIABLE_FONT
EXTERN u08 graphics_coords; // set flag to pass graphics screen coords to vidstr
// ... (which normally uses character coords)
EXTERN int VERT_MAJOR; // the graph axes tick mark spacing (in pixels)
EXTERN int VERT_MINOR; // VERT_MAJOR/VERT_MINOR should be 5
EXTERN int HORIZ_MAJOR;
EXTERN int HORIZ_MINOR;
#define PLOT_LEFT 0 // left margin of plot area - should be 0 or PLOT_COL
EXTERN int PLOT_ROW; // where the plotting area is on the screen
EXTERN int PLOT_COL;
EXTERN int PLOT_WIDTH; // size of the plot window
EXTERN int PLOT_HEIGHT;
EXTERN int PLOT_TEXT_COL; // PLOT_COL/TEXT_WIDTH
EXTERN int PLOT_TEXT_ROW; // PLOT_ROW/TEXT_HEIGHT
EXTERN int PLOT_CENTER; // center line of the plot window
EXTERN int PLOT_SCROLL; // when graph fills, scroll it left this many pixels
EXTERN int day_plot; // flag set to scale plot to 12/24 hours
EXTERN int day_size; // the number of hours long the day_plot is
EXTERN int last_count_y;
EXTERN int COUNT_SCALE; // used to scale the satellite count plot
EXTERN DATA_SIZE lux_scale; // light sensor scale factor (lux/footcancles/candlepower)
EXTERN DATA_SIZE lum_scale; // light sensor lumen scale factor
EXTERN u08 show_lux;
EXTERN u08 show_fc;
EXTERN u08 show_cp;
EXTERN u08 show_lumens;
EXTERN u08 show_debug_info;
EXTERN int exit_flag; // flag set if /? seen on the command line
#define WWVB_LAT 40.677722 // lat/lon of WWVB antennas in Ft Collins
#define WWVB_LON -105.047153
// NEW_RCVR
#define TSIP_RCVR 0x0001ULL
#define NMEA_RCVR 0x0002ULL
#define UBX_RCVR 0x0004ULL
#define UCCM_RCVR 0x0008ULL // mutant SCPI receiver
#define SCPI_RCVR 0x0010ULL
#define MOTO_RCVR 0x0020ULL
#define SIRF_RCVR 0x0040ULL
#define VENUS_RCVR 0x0080ULL
#define ZODIAC_RCVR 0x0100ULL
#define GPSD_RCVR 0x0200ULL
#define NO_RCVR 0x0400ULL
#define NVS_RCVR 0x0800ULL
#define STAR_RCVR 0x1000ULL // Oscilloquartz STAR 4
#define LUXOR_RCVR 0x2000ULL // luxor LED / power analyzer
#define ACRON_RCVR 0x4000ULL // Acron Zeit WWVB receiver
#define TAIP_RCVR 0x8000ULL // Trimble TAIP protocol
#define TICC_RCVR 0x10000ULL // TAPR TICC
#define CS_RCVR 0x20000ULL // HP-5071A Cesium
#define BRANDY_RCVR 0x40000ULL // Brandywine GPS-4
#define THERMO_RCVR 0x80000ULL // environmental sensors
#define ZYFER_RCVR 0x100000ULL // Zyfer Nanosync 380
#define TRUE_RCVR 0x200000ULL // TruePosition GPSDO
#define RFTG_RCVR 0x400000ULL // Lucent RFTG-m GPSDO
#define TIDE_RCVR 0x800000ULL // system clock with plot display
#define PRS_RCVR 0x1000000ULL // PRS-10 rubidium
#define X72_RCVR 0x2000000ULL // X72 rubidium
#define TERM_RCVR 0x4000000ULL // terminal emulator
#define SRO_RCVR 0x8000000ULL // Spectratime SRO100
#define LPFRS_RCVR 0x10000000ULL // Spectratime LPFRS
#define FURUNO_RCVR 0x20000000ULL // Furuno GPS
#define TSERVE_RCVR 0x40000000ULL // TymSync 2000
#define ESIP_RCVR 0x80000000ULL // Furuno eSIP devices
#define Z12_RCVR 0x100000000ULL // Ashtech Z12
#define RT17_RCVR 0x200000000ULL // Trimble RT17 (NETRS)
#define TM4_RCVR 0x400000000ULL // Spectrum TM4 GPSDO
#define SS_RCVR 0x800000000ULL // Novatel Superstar II GPS
#define SA35_RCVR 0x1000000000ULL // Symmetricom SA.35m rubidium
EXTERN u64 rcvr_type; // GPS receiver message format
EXTERN u64 last_rcvr_type; // the previous receiver type
EXTERN int calc_rcvr; // set flag for calculator only mode
#define ASCII_RCVR (rcvr_type & (ACRON_RCVR | BRANDY_RCVR | CS_RCVR | ESIP_RCVR | FURUNO_RCVR | GPSD_RCVR | LPFRS_RCVR | NMEA_RCVR | PRS_RCVR | SCPI_RCVR | SRO_RCVR | STAR_RCVR | THERMO_RCVR | TICC_RCVR | TM4_RCVR | TRUE_RCVR | TSERVE_RCVR | UCCM_RCVR | X72_RCVR | Z12_RCVR | ZYFER_RCVR))
#define POLLED_RCVR (rcvr_type & (ACRON_RCVR | BRANDY_RCVR | CS_RCVR | LPFRS_RCVR | PRS_RCVR | SA35_RCVR | SCPI_RCVR | SRO_RCVR | STAR_RCVR | THERMO_RCVR | UCCM_RCVR | X72_RCVR))
#define TIMING_RCVR (res_t || ACU_GG || ACU_360 || ACUTIME || PALISADE || (rcvr_type & (ESIP_RCVR | MOTO_RCVR | NVS_RCVR | SIRF_RCVR | UBX_RCVR | VENUS_RCVR | ZODIAC_RCVR)))
#define GPSDO (((rcvr_type == TSIP_RCVR) && !res_t && !PALISADE && !ACUTIME && !SV6_FAMILY) || (rcvr_type & (BRANDY_RCVR | RFTG_RCVR | SCPI_RCVR | STAR_RCVR | TM4_RCVR | TRUE_RCVR | ZYFER_RCVR)) || lte_lite || saw_icm || saw_gpsdo)
#define TICC_USED ((rcvr_type == TICC_RCVR) || ticc_port_open()) // aaattt
#define NO_ADEV_INFO (ACU_GG || ACU_360 || ACUTIME || (rcvr_type & (TIDE_RCVR | ACRON_RCVR | ESIP_RCVR | MOTO_RCVR | NMEA_RCVR | NO_RCVR | SS_RCVR | STAR_RCVR | TAIP_RCVR | TM4_RCVR | TRUE_RCVR | TSERVE_RCVR | VENUS_RCVR))) // receivers that dont have any (bogo) ADEVable info
#define NO_EEPROM_CMDS ((rcvr_type & (TIDE_RCVR | CS_RCVR | NO_RCVR | RFTG_RCVR | SS_RCVR | THERMO_RCVR | TICC_RCVR | TM4_RCVR | TSERVE_RCVR))) // receivers that dont support eeprom/nvram saving
#define NO_PPS_INFO (((rcvr_type & (ACRON_RCVR | TIDE_RCVR | GPSD_RCVR | NMEA_RCVR | NO_RCVR | TAIP_RCVR | TRUE_RCVR | TSERVE_RCVR | ZYFER_RCVR))) || lte_lite) // receivers that dont have any PPS state info
#define NO_SATS ((rcvr_type & (TIDE_RCVR | CS_RCVR | LPFRS_RCVR | NO_RCVR | PRS_RCVR | SA35_RCVR | SRO_RCVR | THERMO_RCVR | TICC_RCVR | TSERVE_RCVR | X72_RCVR)) || (lte_lite && (have_sawtooth == 0)) || ((rcvr_type == RFTG_RCVR) && (rftg_unit == 0)) ) // receivers that dont use satellites
#define GPSDO_TUNE_OK (((rcvr_type == TSIP_RCVR) && !res_t && !ACU_GG && !ACU_360 && !ACUTIME) || saw_icm)
#define TSIP_FMT_RCVR ((rcvr_type & (NVS_RCVR | RFTG_RCVR | TSIP_RCVR))) // receivers that use TSIP formatted packets
#define USES_PLOT_THREE ((rcvr_type & (CS_RCVR | LPFRS_RCVR | PRS_RCVR | SA35_RCVR | SRO_RCVR | THERMO_RCVR | TICC_RCVR | X72_RCVR | ZYFER_RCVR))) // receivers that use plot[THREE} for non-lla purposes
#define RAW_SAT_DATA ((rcvr_type & (ESIP_RCVR | RT17_RCVR | NVS_RCVR | UBX_RCVR | Z12_RCVR))) // receivers that can output raw sat observation data
#define LLA_RCVR ((rcvr_type & (BRANDY_RCVR | RFTG_RCVR | SCPI_RCVR | TM4_RCVR | TRUE_RCVR | UCCM_RCVR))) // receivers that can plot lat/lon/alt
//#define TOW_AND_WEEK ((rcvr_type & (ACRON_RCVR | ESIP_RCVR | NMEA_RCVR | NO_RCVR | STAR_RCVR | THERMO_RCVR | TICC_RCVR | TIDE_RCVR | TM4_RCVR | TRUE_RCVR | VENUS_RCVR | Z12_RCVR)) || ((rcvr_type == MOTO_RCVR) && (have_moto_Hr == 0))) // fake the GPS week and tow
#define TOW_AND_WEEK ((have_week == 0) || (have_week == 999)) // fake the GPS week and tow
#define HEX_PACKET_IDS ((rcvr_type & (BRANDY_RCVR | LPFRS_RCVR | MOTO_RCVR | RT17_RCVR | NMEA_RCVR | PRS_RCVR | RFTG_RCVR | SA35_RCVR | SCPI_RCVR | SIRF_RCVR | SRO_RCVR | SS_RCVR | STAR_RCVR | \
TRUE_RCVR | TSIP_RCVR | UBX_RCVR | UCCM_RCVR | VENUS_RCVR | ZODIAC_RCVR | ZYFER_RCVR | Z12_RCVR))) // packet names are shown in hex log files
#define USES_JIT_PLOTS (luxor | (rcvr_type & (CS_RCVR | PRS_RCVR | SRO_RCVR | X72_RCVR))) // receivers that use plots NINE and TEN for non-jitter measurements
#define NO_SURVEY_INFO ((rcvr_type & (GPSD_RCVR | RT17_RCVR | NMEA_RCVR | RFTG_RCVR | SIRF_RCVR | THERMO_RCVR | TICC_RCVR | TRUE_RCVR | TSERVE_RCVR | Z12_RCVR))) // receivers that dont have any survey state info
#define SURVEY_PROGRESS ((rcvr_type & (BRANDY_RCVR | SCPI_RCVR | UCCM_RCVR | TRUE_RCVR | TSIP_RCVR | UBX_RCVR | VENUS_RCVR | ZYFER_RCVR))) // receivers that have survey progrss as a percentage
#define STOPABLE_SURVEY (rcvr_type & (ESIP_RCVR | FURUNO_RCVR | MOTO_RCVR | NVS_RCVR | SCPI_RCVR | TRUE_RCVR | TSIP_RCVR | UBX_RCVR | UCCM_RCVR | VENUS_RCVR | ZODIAC_RCVR | ZYFER_RCVR))
#define LOW_BYTE_FIRST (rcvr_type & (NVS_RCVR | RFTG_RCVR | UBX_RCVR | ZODIAC_RCVR)) // little endian (Intel) message byte order
#define SER_AVAIL_RCVR (rcvr_type & (ACRON_RCVR | BRANDY_RCVR | CS_RCVR | SA35_RCVR | LPFRS_RCVR | PRS_RCVR | RFTG_RCVR | SRO_RCVR | STAR_RCVR | X72_RCVR)) // polled receivers that have no non-polled messages
#define STATUS_RCVR (rcvr_type & (ACRON_RCVR | BRANDY_RCVR | SCPI_RCVR | STAR_RCVR | UCCM_RCVR)) // receivers that have long pauses processing some messages (like SYST:STAT?)
#define DAC_PCT ((rcvr_type & (BRANDY_RCVR | SCPI_RCVR | UCCM_RCVR | ZYFER_RCVR)) || lte_lite) // receivers with DAC volatge in percent
#define CRLF_RCVR (rcvr_type & (BRANDY_RCVR | CS_RCVR | LPFRS_RCVR | PRS_RCVR | SA35_RCVR | SCPI_RCVR | SRO_RCVR | STAR_RCVR | THERMO_RCVR | TICC_RCVR | TM4_RCVR | X72_RCVR | Z12_RCVR)) // receivers that have cr/lf terminated message that mess up terminal mode output formatting
/// polled devices that can't allow get_pending_gps() to loop
#define NO_PEND_LOOP (((rcvr_type == STAR_RCVR) && (star_type == NEC_TYPE)) || (rcvr_type == ACRON_RCVR) || (rcvr_type == BRANDY_RCVR))
// receivers that supply some kind of ID information and use update_gps_screen() to drive the screen
#define RCVR_SENDS_ID (rcvr_type & (CS_RCVR | ESIP_RCVR | FURUNO_RCVR | GPSD_RCVR | LPFRS_RCVR | MOTO_RCVR | NVS_RCVR | PRS_RCVR | RFTG_RCVR | SA35_RCVR | SCPI_RCVR | SIRF_RCVR | SRO_RCVR | SS_RCVR | \
STAR_RCVR | TAIP_RCVR | THERMO_RCVR | TICC_RCVR | TRUE_RCVR | UBX_RCVR | UCCM_RCVR | VENUS_RCVR | X72_RCVR | Z12_RCVR | ZODIAC_RCVR | ZYFER_RCVR))
#define HIGH_TS_THRESH ((rcvr_type & (NO_RCVR | LPFRS_RCVR | PRS_RCVR | SA35_RCVR | SRO_RCVR | THERMO_RCVR | TIDE_RCVR | X72_RCVR))) // receivers that should not check for small time stamp skips
#define TS_CHECK_THRESHOLD 750.0 // number of msecs of time stamp error allowed for LOW_TS_CHECK devices
#define TICC_RATE (adev_period*1.0E9) // expected time interval (in nanoseconds) of TICC data // aaaaaapppppp
#define HP_TYPE '8' // SCPI_RCVR and UCCM_RCVR sub-types
#define HP_TYPE2 '9'
#define LUCENT_TYPE 'K'
#define SAMSUNG_TYPE 'S'
#define NORTEL_TYPE 'N'
#define UCCM_TYPE 'U'