-
Notifications
You must be signed in to change notification settings - Fork 1
/
gglobs.py
1563 lines (1280 loc) · 85 KB
/
gglobs.py
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
#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
gglobs.py - GeigerLog's Super-Global Variables; can be read and modified in all scripts
include in programs with:
import gglobs as g
"""
###############################################################################
# This file is part of GeigerLog.
#
# GeigerLog is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GeigerLog is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GeigerLog. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
__author__ = "ullix"
__copyright__ = "Copyright 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024"
__credits__ = [""]
__license__ = "GPL3"
__version__ = "1.5.0" # version of next GeigerLog
__version__ = "1.5.0" # final release
# constants
NAN = float('nan') # 'not-a-number'; used as 'missing value'
PINF = float('inf') # plus infinity
MINF = float('-inf') # minus infinity
PI = 3.141592653589793 # Pi (decimals limited to max number that Python can handle)
EUL = 2.718281828459045 # Euler's Number (taken from numpy.exp(1))
GiB = 2**30 # 1 Gibi Byte = 1 073 741 824 Byte
MiB = 2**20 # 1 Mebi Byte = 1 048 576 Byte
KiB = 2**10 # 1 Kibi Byte = 1 024 Byte
# convert µSv/hour to mSv/annum
ush2msa = 24 * 365.25 / 1000 # = 8.772 - conversion: 1 µSv/h * 8.772 => 8.772 mSv/a (NOTE: approx. Factor 10)
# Timezone, Time Zone
TimeZoneOffset = 0 # value in sec; ADD this to a UTC time as found by julianday()
# The UTC offsets range from UTC−12:00 to UTC+14:00 (https://en.wikipedia.org/wiki/Time_zone),
# equiv to -12*3600 ... +14*3600 sec = -43200 ... 50400 sec
# Germany winter: +1h, Summer: +2 h (+3600 sec ; +7200 sec)
# A Julian Day is the number of days since Nov 24, 4714 BC 12:00pm Greenwich time in the Gregorian calendar
JULIANUNIXZERO = 2440587.5 # julianday('1970-01-01 00:00:00') (UNIX time start) (in UTC)
# 2440587.5416666665 # in localtime (@DE 19.5.23) --- 1 h difference (looks like timezone difference)
JULIAN111 = 1721425.5 - 1 # julianday('0001-01-01 00:00:00') (matplotlib time start) in UTC
# Why this minus 1? strange but needed
# 1721425.5 # select julianday('0001-01-01 00:00:00'), res:(1721425.5,)
MPLDTIMECORRECTION = None # to be set in gsup_utils.py to -719163.0
GooColors = ('#ea4335', # Google color red (234, 67, 53)
'#fbbc05', # Google color yellow (251, 188, 5)
'#34a853', # Google color green ( 52, 168, 83)
'#4285f4', # Google color blue ( 66, 133, 244)
)
# IDs
geigerlog_pid = None # GeigerLog PID
# Computer hardware
CPU_Model = "Undefined" # like: Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz
CPU_Hardware = "Undefined" # like: BCM2835 for Raspi 4 (kein Wert bei Raspi 5)
CPU_Vendor = "Undefined" # like: GenuineIntel
# Logging
logging = False # flag for logging
LogCycle = 1 # time in seconds between calls in logging
LogThreadStartTime = None # time stamp of logging thread started
lasttime = 0
nexttime = 0 # the begin of the next log cycle (set in LogThreadTarget())
nextnexttime = 0 # the begin of the log cycle after the next onw (set in LogThreadTarget())
# counters
xprintcounter = 0 # the count of dprint, vprint, and wprint commands
LogReadings = 0 # number of readings since last logging start; prints as index in log
LogReadingsFail = 0 # number of FAILED readings since last logging start
# messages
python_version = "" # msg wrong Python version
startupProblems = "" # msg configuration file missing or incorrect, Python problems, ...
importProblem = "" # import problem (currently only with Telegram code)
configAlerts = "" # msg ALERTs when reading config
notePadSearchText = "" # last entered search text
SnapRecord = "" # record to be used in snapLogValue(self)
LogHeaderText = "" # The header for the LogPad: Time M S M1 S1 ...
versions = "undefined" # becomes a dict with versions of all modules and more
# data storage
FibonacciSpeed = None # holds the Fibonacci Speed calculation done at entry
HashSpeed = None # holds the Hash Speed calculation done at entry
GLBenchmark = None # holds the GeigerLog Benchmark (GLBM) value
LimitFileSize = 5e5 # if proglog file reaches this size then zip it to archive
writeDevelproglog = False # if true write a separate geigerlog.proglog.devel file, duplicating geigerlog.proglog; is set in gmain.py
DurUpdate = {} # duration of various update during logging
DurUpdate["MEM"] = NAN # - duration of a single memory update
DurUpdate["GRAPH"] = NAN # - duration of a single Graph update
# GeigerLog Manual
manual_filename = "auto" # name of the included GeigerLog Manual, like "GeigerLog-Manual-v1.5.pdf".
# Can also have a path, like: "/path/to/GeigerLog-Manual-v1.5.pdf".
# On 'auto' GL searches for a file with name beginning with 'GeigerLog-Manual'.
# It first searches in the GeigerLog "gmanual" directory, then online.
# pointers
app = None # points to app
exgg = None # points to ggeiger
notePad = None # points to print into notePad area
logPad = None # points to print into logPad area
btn = None # points to the cycle time OK button; for inactivation
plotAudioPointer = None # points to the dialog window of plotaudio
plotScatterPointer = None # points to the dialog window of plotscatter
plotScatterFigNo = None # points to the window number of plotscatter
iconGeigerLog = None # points to the QIcon pixmap for 'icon_geigerlog.png'
iconGeigerLogWeb = None # points to the 'icon_geigerlog.png' bin files for Web
bboxbtn = None # points to button box of GMC_popuo
monitorfig = None # points to the fig of Monitor
monitorax = None # points to the ax of Monitor
myarr = None # arrow of Monitor
monitorFigNo = None
LogThread = None # Thread handle logging
LogThreadRunFlag = False # flag to signal stop for logging
# LogThreadStartTime = None # time stamp of logging thread started
CheckThread = None # Thread handle checking
FigMainGraph = None # pointer to main graph fig
dispLastValsWinPtr = None # pointer to Display Last Vals Window
# sql database
currentConn = None # connection to CURRENT database
logConn = None # connection to LOGGING database
hisConn = None # connection to HISTORY database
# flags
debug = False # helpful for debugging, use via command line
debugIndent = "" # to indent printing by insering blanks
verbose = False # more detailed printing, use via command line
werbose = False # more verbose than verbose
devel = False # set some conditions for development CAREFUL !!!
traceback = False # to allow printout of Traceback under devel=True
CustomStyle = None # holder for any user-given Style (line Fusion, Windows,...)
# auto-start
autoLogFile = "default.logdb" # name of LogFile to be used
autoDevConnect = False # auto connect all activated devices
autoLogStart = False # auto start with current LogFile
autoLogLoad = False # auto load named LogFile
autoQuickStart = False # auto Quick Start
forcelw = True # True: line wrapping on lines longer than screen
stopPrinting = False # to stop long prints of data
LogClickSound = False # when true make a click sound on call to runLoggingCycle
startflag = False # for start by Web
stopflag = False # for stop by Web
quickflag = False # for quick starting from the web
plotIsBusy = False # makePlot is ongoing
savingPlotIsBusy = False # saving Plot is ongoing
needGraphUpdate = False # does the graph need update with new log data
MemDataQueue = None # becomes deque - the datalist to be saved to memory
SaveLogValuesQueue = None # becomes deque - the datalist to be saved to DB
LogPadQueue = None # becomes deque - the text to be shown on LogPad after a Log roll
qefprintMsgQueue = None # becomes deque - cannot fprint() from threads; so put msg in queue and do it from checkloop
SoundMsgQueue = None # becomes deque - likewise for sound
needDisplayUpdate = False # Flag to signal need to show display vars
logCycleBtnRequestOn = False # request switching cycle button to "On"
LogCycleStart = NAN # time the log cycle button was switched Off
durCheckActive = 0 # total time spend in runCheckCycle during 1 LogCycle
durCheckIdle = 0 # doing nothing in runCheckCycle during 1 LogCycle
countCheckActive = 0 # number of times the loop was passed idle
countCheckIdle = 0 # number of times the loop was passed active
runCheckIsBusy = False # flag to avoid restarting function when active
logCycleBtnTimeOn = NAN # time the log cycle button was switched On
LogFileAppendBlocked = False # if true, then block writing to log file
PoissCurveFit = True # when True will draw Histogram with Poisson curve and Residual
CumPoissCurveFit = True # when True will draw Histogram with cumulative Poisson curve
NormalPoissCurveFit = False # when True will draw Histogram with NORMAL curve with StdDev=sqr(mean)
NormalCurveFit = False # when True will draw Histogram with NORMAL curve with StdDev=from data
ProbDist = True # Probability Distribution
CumProbDist = False # Cumulative Probability Distribution
GraphFormula = False # Scaling for Graph, i.e. requiring arrays
scaleVname = "" # the variable name (vname) currently being used in scaling calculations
#special flags
testing = False # if true then some testing constructs will be activated CAREFUL !!!
graphbold = False # if true then line properties will be modified for demo emphasis
graphConnectDots = True # if true then dots will be connected with lines
GraphAction = True
timing = False # if true then allows info on timing to be written to Manu vars
lastLogLineClear = False # clears the last logpad line when true
# virtual enironment
VenvName = None # name of active venv (if there is one)
isSetVenv = False # flag showing venv is set
VenvMessage = "" # Either: "Yes, running from venv" or "No, NOT running from venv"
useVenvDirectory = False # flag to signal the use (True) or not-use (False) of any venv in use
# useVenvDirectory = True # flag to signal the use (True) or not-use (False) of any venv in use
# dir & file paths
dataDirectory = "data" # the data subdirectory to the program directory
configDirectory = "gconfig" # directory for config files
gresDirectory = "gres" # location of the icons and sounds
webDirectory = "gweb" # location of html and js files
toolsDirectory = "gtools" # location of tools
manualDirectory = "gmanual" # location of GeigerLog manual
progName = None # program name geigerlog (or geigerlog.py)
progDir = None # path to program geigerlog file
dataDir = None # path to data dir (created in GL main)
configDir = None # path to config dir (created in GL main)
resDir = None # path to icons and sounds dir
webDir = None # path to web fles html, js
proglogFile = None # path to program log file geigerlog.proglog
configFile = None # path to configuration file geigerlog.cfg
settingsFile = None # path to settings file geigerlog.settings
logFilePath = None # file path of the log CSV file
hisFilePath = None # file path of the his CSV file
logDBPath = None # file path of the log database file
hisDBPath = None # file path of the his database file
currentDBPath = None # file path of the current DB file for either log or his
binFilePath = None # file path of the bin file (GMC device)
datFilePath = None # file path of the bin file (Gamma Scout device)
AMFilePath = None # file path of the bin file (AmbioMon device, either *CAM or *.CPS file)
activeDataSource = None # can be 'Log' or 'His'
blockDBwriting = False # a flag to signal that DB writing is in progress
# Data arrays and values
logTime = None # array: Time data from total file
logTimeDiff = None # array: Time data as time diff to first record in days
logTimeFirst = None # value: Time of first record of total file
logTimeSlice = None # array: selected slice out of logTime
logTimeDiffSlice = None # array: selected slice out of logTimeDiff
logSliceMod = None
logDBData = None # 2dim numpy array with the log data
hisDBData = None # 2dim numpy array with the his data
currentDBData = None # 2dim numpy array with the currently plotted data
dataSlicerecmax = None # max record currently shown in plot
fileDialogDir = None # the default for the FileDialog starts
HistoryDataList = [] # where the DB data are stored by makeHist
HistoryParseList = [] # where the parse comments are stored by makeHist
HistoryCommentList = [] # where the DB comments are stored by makeHist
# Formula Interpreter
prevtimePointPara = 0 # used in PARA_POISSON
lasteventPara = -1 # used in PARA_POISSON
prevtimePointNopa = 0 # used in NOPA_POISSON
lasteventNopa = -1 # used in NOPA_POISSON
useGraphScaledData = True # used for calling Qualitytest functions: SuSt, Stats, etc
# GUI options
window_width = 1366 # the standard screen of 1366 x 768 (16:9),
window_height = 768 #
window_size = "auto" # 'auto' or 'maximized'
windowStyle = "auto" # may also be defined in config file
displayLastValsIsOn = False # On True the displayLastValuesWindow windows is shown
displayLastValsGeom = ("", "", "", "") # posX, posY, sizeX, sizeY of displayLastValuesWindow
hidpi = False # if true the AA_EnableHighDpiScaling will be applied
hipix = False # if true the AA_UseHighDpiPixmaps will be applied
hidpiActivation = True # The PyQt5 commands hidpi and hipix will be applied
hidpiScaleMPL = 100 # 100 is the default dpi for matplotlib
# GUI Layout settings
WinSettingsDefault = True # use the defaultsettings (if settingsfile could not be read)
SettingsNeedSaving = True # save the settings when they are different from the old ones
WinGeomDefault = [564, 27, 1366, 768]
WinGeom = WinGeomDefault
NewWinGeom = WinGeomDefault
WinSplitDefault = (321,125, 1310, 702) # split on the left side, and on the full window
WinSplit = WinSplitDefault
NewWinSplit = WinSplitDefault
InitSettings = None
InitSettingsOld = None
# History Options
keepFF = False # Flag in startup-options
# Keeps all hexadecimal FF (Decimal 255) values as a
# real value and not an 'Empty' one. See manual in chapter
# on parsing strategy
fullhist = False # On False break history recording when 8k FF is read
# On True always read the whole history from memory
# Graphic Options
allowGraphUpdate = True # to block updates on reading data
Xleft = None # time min if entered
Xright = None # time max if entered
Xunit = "Time" # time unit; can be Time, auto, second, minute, hour, day
XunitCurrent = Xunit # current time unit
Ymin = None # CPM min if entered
Ymax = None # CPM max if entered
Yunit = "CPM" # CPM unit; can be CPM, CPS, µSv/h
YunitCurrent = Yunit # current count unit
Y2min = None # Ambient min if entered
Y2max = None # Ambient max if entered
Y2unit = "Amb" # Ambient unit °C or °F
Y2unitCurrent = Yunit # current Ambient unit
avgChecked = False # Plot the lines Average, +/- 95% confidence, and Legend with average +/- StdDev value
mavChecked = False # Plot the Moving Average line, and Legend with MovAvg length ins seconds and data points
fitChecked = False # Plot a fit to the data of the selected variable
mav_initial = 600 # length of Moving Average period in seconds
mav = mav_initial # currently selected mav period
# Plotstyle # placeholder; don't change here - is set in config
linestyle = 'solid' # overwritten by VarsCopy
linecolor = 'blue' # overwritten by VarsCopy
linewidth = '1.0' # configurable in geigerlog.cfg
markersymbol = 'o' # configurable in geigerlog.cfg
markersize = '15' # configurable in geigerlog.cfg
#Graph Y-Limits # to calculate cursor position for left, right Y-axis
y1_limits = (0, 1) # (bottom, top) of y left
y2_limits = (0, 1) # (bottom, top) of y right
# Network
# SSID and Password length:
# from IEEE specification:
# "The length of an SSID should be a maximum of 32 characters (32 octets, normally ASCII
# letters and digits, though the standard itself doesn't exclude values). Some access
# point/router firmware versions use null-terminated strings and accept only 31 characters."
# NOTE: 1 octet = 1 byte of 8 bits = 1 ASCII character
# Example:
# WiFiSSID: max: 32 octets: 123456789:123456789:123456789:12
# WiFiPassword: max: 63 octets: pp3456789:pp3456789:pp3456789:pp3456789:pp3456789:pp3456789:pp3
WiFiSSID = None # WiFi SSID
WiFiPassword = None # WiFi Password
GeigerLogIP = None # IP of computer running GeigerLog
#
# WEB
#
# Monitor WebServer
MonServer = None # holds instance of (SSL-)http-server
MonServerAutostart = True # on True MonServer will be autostarted
MonServerIsActive = False # MonServer must first be activated
MonServerPorts = "auto" # list of Port numbers from which MonServer selects port to listen; auto defaults to one of 8080, ..., 8089
MonServerPort = None # the port number MonServer listens to
MonServerWebPage = None # the last web page displayed; for GL to return to
MonServerRefresh = [1, 10, 3] # the refresh timings for the web pages Monitor, Data, Graph in sec
MonServerThresholds = (0.9, 6.0) # Dose Rate Thresholds in µSv/h -- green-to-yellow and yellow-to-red
# For reasons to chose these levels see GeigerLog manual, chapter:
# "On what grounds do we set the radiation safety levels?"
MonServerColors = (GooColors[2], # Gauge color green - ok
GooColors[1], # Gauge color yellow - warning
GooColors[0], # Gauge color red - danger
)
MonServerThread = None # Monitor Threads
MonServerMsg = "" # any message created within Do_get()
# MonServerUTCcorr = "auto" # the correction to apply to compensate for UTC (Germany, summertime: -2*3600 sec)
MonServerSSL = False # using SSL (https://) or not (http://)
MonServerPlotLength = 10 # last X min of records to show in line plots
MonServerPlotTop = 0 # the variable number of the top plot (0=CPM, ..., 11=Xtra)
MonServerPlotBottom = 1 # the variable number of the bottom plot (0=CPM, ..., 11=Xtra)
MonServerPlotConfig = "auto" # combines Plot- Length, Top, Bottom
MonServerDataConfig = "auto" # combines Data table averageing periods in minutes
# Radiation World Map
RWMmapActivation = False # Radiation World Map Activation
RWMmapUpdateCycle = 60 # Radiation World Map Update Cycle in minutes
RWMmapVarSelected = "CPM" # name of the variable used to update Radiation world Map
RWMmapUpdate = False # on True an update of Radiation World Map is due
RWMmapLastUpdate = 0 # time of the last update of Radiation World Map
# gmcmap specific
gmcmapWebsite = "www.gmcmap.com"
gmcmapURL = "log2.asp"
gmcmapUserID = "anyUserId"
gmcmapCounterID = "anyCounterID"
##
## USB-To-Serial
##
# Python's pyserial enums
# import serial : NOT pyserial! But the module is pip-installed as 'pyserial'
#
# finding parameters supported by pyserial :
# myser = serial.Serial()
# print(myser.XYZ)
# myser : Serial<id=0x7f7a05b18d68, open=False>(port=None, baudrate=9600, bytesize=8, parity='N',
# stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
# myser.BAUDRATES : 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600,
# 19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, 921600,
# 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000
# myser.BYTESIZES : 5, 6, 7, 8
# myser.STOPBITS : 1, 1.5, 2
# myser.PARITIES : 'N', 'E', 'O', 'M', 'S'
# serial.PARITY_NONE = N
# serial.PARITY_EVEN = E
# serial.PARITY_ODD = O
# serial.PARITY_MARK = M
# serial.PARITY_SPACE = S
#
# Chips in use for USB-To-Serial:
#
# EmfDev:
# Yes we are using the CH340 chip so far with all GMC-300+ and 500+ devices.
# And just check with our latest one also has the VID:PID=0x1a86:0x7523
# from: http://www.gqelectronicsllc.com/forum/topic.asp?TOPIC_ID=9784
#
# gmc300E+ (von Jan 21) device: /dev/ttyUSB0 description: USB Serial vid: 0x1a86 pid: 0x7523
# gmc300E+ (von ??? ) device: /dev/ttyUSB0 description: USB2.0-Serial vid: 0x1a86 pid: 0x7523
# gmc500+ (2018?) device: /dev/ttyUSB0 description: USB2.0-Serial vid: 0x1a86 pid: 0x7523
# --> all 3 devices: chip = CH340C
# manufacturer: http://wch-ic.com/ http://wch-ic.com/products/CH340.html
# Nanjing Qinheng Microelectronics Co., Ltd.
# Main brand: WinChipHead (WCH)
# "Full speed USB device interface, USB 2.0 compatible."
# CH340 supports common baud rate: 50, 75, 100, 110, 134.5, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 9600, 14400, 19200,
# 28800, 33600, 38400, 56000, 57600, 76800, 115200, 128000, 153600, 230400, 460800, 921600, 1500000, 2000000 etc.
GMCbaudrates = [57600, 115200]
I2Cbaudrates = [115200]
GSbaudrates = [2400, 9600, 460800]
# Serial port for GMC devices
GMCser = None # GMC serial port pointer
GMC_usbport = "auto" # will be set in code
GMC_baudrate = "auto" # will be set in code
GMC_timeoutR = "auto" # will be set in code
GMC_timeoutW = "auto" # will be set in code
GMC_timeoutR_getData = "auto" # will be set in code; serial timeout for reading, used for getting values
GMC_ID = (None, None) # Model, SerialNumber of device
fSVStringSet = False # when true there was an error
# Serial port for I2C devices
# I2Cser = None # not used! I2C serial use is Dongle-specific
I2Cusbport = "auto" # will be overwritten in code
I2Cbaudrate = "auto" # is used as fixed value
I2CtimeoutR = "auto" # will be set in code
I2CtimeoutW = "auto" # will be set in code
I2C_ID = (None, None) # not in use!!! (Model, SerialNumber) of device
# Serial port for Gamma-Scout devices
GSser = None # Gamma-Scount serial port pointer
GSusbport = "auto" # will be set in code
GSbaudrate = "auto" # will be set in code
GStimeoutR = "auto" # will be set in code
GStimeoutW = "auto" # will be set in code
GS_ID = (None, None) # Model, SerialNumber of device
GSstopbits = "auto" # will be set in code # used only by GammaScout
GSbytesize = "auto" # will be set in code # used only by GammaScout
GSparity = "auto" # will be set in code # used only by GammaScout
##
## TUBE SENSITIVITY
##
###############################################################################
## Beginning with version GeigerLog 1.0 the 'Calibration' is replaced with
## 'Sensitivity', which is defined as the inverse of the previous definitions,
## i.e. 0.0065 µSv/h/CPM becomes 1/0.065 => 153.85 CPM/(µSv/h).
## This is rounded to 154 CPM/(µSv/h) to use no more than 3 valid digits.
## For reasons for this change see the GeigerLog manual, but in short a tube with
## a higher number for Sensitivity now does have a higher sensitivity!
###############################################################################
# GMC Specifics:
# The GMC factory default so-called calibration factor is linear, i.e. the same
# for all 3 calibration points defined in a GMC counter. For a M4011 tube the
# calibration factor implemented in firmware is 0.0065 µSv/h/CPM.
# For a LND-7317 tube (GMC-600+) the sensitivity is 154 CPM / (µSv/h).
#
# For the 2nd tube in a GMC500+ device, different factors were seen:
# E.g.: from a calibration point #3 setting of '25 CPM=4.85µSv/h' the calibration
# factor is 0.194 µSv/h/CPM (5.15 CPM/(µSv/h)). While a calibration point #3 setting
# of '25CPM=9.75µSv/h' results in 0.39 µSv/h/CPM (2.56 CPM/(µSv/h))!
#
# However, these are significantly different from calibration factors determined
# in my own experiments as reported here:
# http://www.gqelectronicsllc.com/forum/topic.asp?TOPIC_ID=5369, see Reply #10,
# Quote: “With Thorium = 0.468, and K40 = 0.494, I'd finally put the sensitivity
# of the 2nd tube, the SI3BG, to 0.48 µSv/h/CPM, which makes it 74 fold less
# sensitive than the M4011!”
#
# Others report even poorer values for the SI3BG:
# https://www.gqelectronicsllc.com/forum/topic.asp?TOPIC_ID=5554, Reply #17
# "The new correction factor for the primarily gamma tube is .881CPM/uSv/h or 1.135."
# This means sensitivity of that (2nd) tube = 1.135 µSv/h/CPM
# Tube changes in GMC counters:
# see: topic: Is my GMC 500+ genuine? http://www.gqelectronicsllc.com/forum/topic.asp?TOPIC_ID=10006
# "The SI3-BG tube has been replaced with something called J707"
# Default Sensitivity
# A total of 4 tubes are available. They are strictly associated with the variables. So when
# a variable XYZ is configured for any device, then the sensitivity for variable XYZ will be used.
# However, in GMC counters their meaning is special.
#
# Tube No used for variables Default Special associations in a GMC counter
# Sensitivity
# CPM/(µSv/h)
# --------------------------------------------------------------------------------------------
# Tube #0 CPM, CPS 154 Default tube in all GMC counters;
# In a GMC-500+ counter the counts are the sum of 1st and
# 2nd tube, which is a meaningless value.
#
# Tube #1 CPM1st, CPS1st 154 In all GMC counters exactly the same as tube #0, except: in a
# GMC-500+ counter this is the 1st or high-sensitivity tube.
#
# Tube #2 CPM2nd, CPS2nd 2.08 In all GMC counters exactly the same as tube #0, except: in a
# GMC-500+ counter this is the 2nd or low-sensitivity tube.
#
# Tube #3 CPM3rd, CPS3rd 154 not used in GMC counters.
#
# Final setting is done in 'switchAllDeviceConnections()'
#
DefaultTubeSens = [154, 154, 2.08, 154]
TubeSensitivity = ["auto"] * 4
Sensitivity = ["auto"] * 4
##########################################################################################
# DEVICES CONFIGURATION DETAILS
##########################################################################################
#
# GMC device
#
# details will be set once the version of the counter has been read from the device
GMC_DeviceName = None # to be detected in init; generic name like: "GMC Device"
GMC_DeviceDetected = "Undefined" # will be replaced after connection with full specific name as detected,
# like 'GMC-300Re 4.20'. Had been 14 chars fixed, can now be any length
GMC_Model = "Undefined" # derived from GMC_DeviceDetected in getGMC_DeviceProperties()
GMC_FWVersion = 0 # derived from GMC_DeviceDetected in getGMC_DeviceProperties()
GMC_Variables = "auto" # which variables are supported
GMC_HasGyroCommand = "auto" # does NOT support GETGYRO command
GMC_ClockIsDead = False # when True the History time will NOT be parsed (clock defect on my GMC-500+ counter)
# is set True only on Command Line with command 'clockisdead'
GMC_DatetimeMsg = "" # the message returned for datetime
GMC_getInfoFlag = 0 # flag to signal to get the GMC_info even when logging; 0: no flag, 1:extended=False, 2:extenden=True
GMC_CountCalibPoints = "auto" # Number of Calib.Points, 3 or 6
GMC_savedatatypes = "auto" # Saving every sec, min, h, - thresholds eliminate in GMC-300s, GMC-800
GMC_cfg = bytes(256) # Configuration bytes of the counter. 256 bytes in 300 series, 512 bytes in 500, 600 series
# GMC Bugs and Settings
GMC_memory = "auto" # Can be configured for 64kB or 1 MB in the config file
GMC_SPIRpage = "auto" # size of page to read the history from device
GMC_SPIRbugfix = "auto" # if True then reading SPIR gives one byte more than requested (True for GMC-300 series)
GMC_locationBug = "auto" # --> ["GMC-500+Re 1.18","GMC-500+Re 1.21"], see the FIRMWARE BUGS topic in the configuration file
GMC_endianness = "auto" # big- vs- little-endian for calibration value storage
GMC_configsize = "auto" # 256 bytes in 300 series, 512 bytes in 500/600 series
GMC_voltagebytes = "auto" # 1 byte in the 300 series, 5 bytes in the 500/600 series
GMC_Bytes = "auto" # the number of bytes ( 2 or 4) from the CPM and CPS calls, as well as the calls to 1st and 2nd tube
GMC_CfgHiIndex = "auto" # the index column in cfgKeyHi applicable for the current device
GMC_WiFiCapable = "auto" # does counter have WiFi?
GMC_WiFiIsON = "auto" # is WiFi switched ON at the counter (if the counter is wifi enabled)
GMC_WiFiPeriod = "auto" # min between WiFi uploads to gmcmap.com; default is 2 (min)
GMC_WiFiSwitch = "auto" # set the WiFi switch to ON | OFF
GMC_DualTube = "auto" # all are single tube, except 500, 500+, which ares double tube
GMC_FETenabled = "auto" # only 500 and 600 series seems enabled
GMC_FastEstTime = "auto" # if != 60 then false data will result (GMC: 3=dynamic, 5, 10, 15, 20, 30, 60=sec; firmware >= 2.28)
GMC_DeadTimeEnabled = "auto" # Dead time "Feature" in firmware 2.41 and later
GMC_TargetHVEnabled = "auto" # allows setting and reading of HV in firmware 2.41 and later
GMC_RTC_Offset = "auto" # the seconds to add to the clock every hour; value is from -59 to +59 seconds
GMC_HasRTC_Offset = "auto" # False or True to have RTC_OFFSET
GMC_savedatatype = "Unknown - will become known once the device is connected"
GMC_savedataindex = 1 # index to save every second, ... minute, etc (1 == every second)
GMC_calls = 0 # total number of calls to any CP* variable at GMC
GMC_callsTimeoutCPM = 0 # total number of calls to any CPM* variable at GMC which went into timeout
GMC_callsTimeoutCPS = 0 # total number of calls to any CPS* variable at GMC which went into timeout
GMC_callsException = 0 # total number of calls to any CP* variable at GMC which went into Exception
GMC_callsWrongbyteCount = 0 # total number of calls to any CP* variable at GMC which had WRONG bytecount
GMC_simul = False # when True a GMC counters is simulated; requires Simul_GMCcounter.py being run
GMC_NextCorrMin = -1 # the next minute value for setting the counter clock (0 ... 59)
GMC_GL_ClockCorrection = "auto" # the interval in minutes for setting the counter clock by GEIGERLOG
GMC_ThreadRun = False # flag to signal to keep running the thread
GMC_Thread = None # der GMC thread zum CP* calling
GMC_ThreadMessages = "" # messages created during getting values for variables. Only the last one remains
GMC_Value = {} # to keep the local vars
GMC_testing = False # set to True to activate certain testing in GMC code
GMC_callsExtrabyte = 0 # total number of calls to any CP* variable at GMC which had extrabyte in the pipeline
#
# AudioCounter device
#
AudioDevice = None # audiocard; to be set in init to (None, None) (could be USB, 9 and other)
AudioLatency = "auto" # to be set in init to (1.0, 1.0) sec latency
AudioPulseMax = None # +/- 32768 as maximum pulse height for 16bit signal
AudioPulseDir = None # False for negative; True for positive pulse
AudioThreshold = None # Percentage of pulse height to trigger a count
# 60% of +/- 32768 => approx 20000
AudioRate = None # becomes 44100: sampling rate audio; works for most sound cards
AudioChunk = None # becomes 32: samples per read
AudioChannels = None # becomes (1,1): 1= Mono, 2=Stereo
AudioFormat = None # becomes (int16, int16): signed 16 bit resolution
AudioLastCpm = 0 # audio clicks CPM
AudioLastCps = 0 # audio clicks CPS
AudioLast60CPS = None # np array storing last 60 sec of CPS values
AudioThreadStop = False # True to stop the audio thread
AudioMultiPulses = None # stores the concatenated audio data for plotting
AudioRecording = None # stores the Recording
AudioPlotData = None # stores the data to be plotted
AudioOei = None # the eia storage label
AudioVariables = "auto" # default is CPM3rd, CPS3rd
#
# IoT device
#
IoTBrokerIP = "auto" # MQTT server IP, to which RadMon sends the data
IoTBrokerPort = "auto" # Port of the MQTT server, defaults to 1883
IoTTimeout = 5 # waiting for "successful connection" confirmation
IoTUsername = "auto" # the IoT broker username when using authorization
IoTPassword = "auto" # the IoT broker password when using authorization
IoTBrokerFolder = "auto" # The MQTT folder as defined in the RadMon+ device
IoTClientDataGL = None # config for GeigerLog device
IoTClientTasmotaGL1 = None # Config for Tasmot Plug #1
IoTClientTasmotaGL2 = None # Config for Tasmot Plug #2
IoTClientTasmotaGL3 = None # Config for Tasmot Plug #3
IoTClientTasmotaGL4 = None # Config for Tasmot Plug #4
IoTVariables = "auto" # a list of the variables to log, like: CPM3rd, Temp, Press, Humid,
IoTCycleTime = 1 # cycle time of the RadMon device
IoTconnectionState = False
IoTconnectDuration = ""
iot_client = None # to be set in gdev_radmon.initRadMon
iot_cpm = None # temporary storage for CPM
iot_cps = None # temporary storage for CPS
iot_temp = None # temporary storage for Temperature
iot_press = None # temporary storage for Pressure
iot_hum = None # temporary storage for Humidity
iot_rssi = None # temporary storage for RSSI
iot_data = None # becomes {} with up to 12 vnames
iot_dataready = False
### testing
iot_threadstart = 0 # to get duration of MQTT handshake
###
#
# RadMon device
#
RMServerIP = "auto" # MQTT server IP, to which RadMon sends the data
RMServerPort = "auto" # Port of the MQTT server, defaults to 1883
RMServerFolder = "auto" # The MQTT folder as defined in the RadMon+ device
RMVariables = "auto" # a list of the variables to log, like: CPM3rd, Temp, Press, Humid,
RMTimeout = 5 # waiting for "successful connection" confirmation
RMCycleTime = 1 # cycle time of the RadMon device
RMconnect = (-99, "") # flag to signal connection
RMdisconnect = (-99, "") # flag to signal dis-connection
rm_client = None # to be set in gdev_radmon.initRadMon
rm_cpm = None # temporary storage for CPM
rm_temp = None # temporary storage for Temperature
rm_press = None # temporary storage for Pressure
rm_hum = None # temporary storage for Humidity
rm_rssi = None # temporary storage for RSSI
#
# AmbioMon device
#
AmbioServerIP = "auto" # server Domain name or IP to which AmbioMon connects
AmbioDataType = "auto" # "LAST" or "AVG" for lastdata or lastavg
AmbioTimeout = "auto" # waiting for successful connection
AmbioVariables = "auto" # a list of the variables to log
AmbioValues = {} # values received in a thread
AmbioThreadRun = False # flag to stop/run the thread
AmbioThread = None # to hold the AmbioMon thread
AmbioCPMpointer = 2 # pointer to the variable: CPM=2, CPM1st=4, CPM2nd=6, CPM3rd=nicht erlaubt!
AmbioCPSpointer = 3 # pointer to the variable: CPS=3, CPS1st=5, CPM2nd=7, CPS3rd=nicht erlaubt!
AmbioDataPage = "empty" # the return for reading lastData or lastAvg
AmbioCalibPage = "empty" # the return for reading calib
AmbioDevIDPage = "empty" # the return for reading devid
# settings for the remote AmbioMon device
AmbioCPUFrequency = 0 # read-only for the ESP32 CPU frequency
AmbioSelector = 3 # selector position from: 1,2,3 for A,B,C = Alpha, Beta, Gamma
AmbioVoltage = 444.44 # voltage of the GM tube in the AmbioMon
AmbioFrequency = 1500 # frequency of driving HV generator
AmbioPwm = 0.5 # Pulse Width Modulation of HV generator
#
# Gamma-Scout device
#
GS_DeviceDetected = None # to be set in GS init as: Old, Classic, Online
GSFirmware = None # to be set in GS init
GSSerialNumber = None # to be set in GS init
GSDateTime = None # to be set when setting DateTime
GSusedMemory = 0 # to be set when calling History
GSMemoryTotal = 65280 # max memory acc to manual, page 16, but when mem was 64450 (830 bytes free), interval was already 7d!
GSCalibData = None # the Gamma-Scout internal calibration data
GScurrentMode = None # "Normal", "PC", "Online"
GSVariables = "auto"
GS_simul = False # when True GS counters are simulated
#
# LabJack device
#
LabJackActivation = False # Not available if False
LJimportLJP = False # LabJackPython module was imported
LJimportU3 = False # LabJack' U3 module was imported
LJversionLJP = "not in use" # version of LabJackPython
LJversionU3 = "not in use" # version of U3
LJVariables = "auto" # a list of the variables to log; auto=Temp, Humid, Xtra
# EI1050 probe for Labjack
LJEI1050Activation = False # Not available if False
LJEI1050version = "not in use" # version of EI1050
LJimportEI1050 = False # LabJack' EI1050 module was imported
LJEI1050status = None # Status of probe EI1050
#
# MiniMon device
#
MiniMonActivation = False # Not available if False
MiniMonOS_Device = "auto" # OS device, like /dev/hidraw3
MiniMonInterval = "auto" # interval between forced savings
MiniMonVariables = "auto" # default is Temp, Xtra
#
# Formula device
#
FormulaActivation = False # Not available if False
FormulaVariables = "auto" # default is CPM3rd, CPS3rd
#
# Manu device
#
ManuActivation = False # Not available if False
ManuVariables = "auto" # default is "Temp, Press, Humid, Xtra"
ManuValue = {} # up to 12 manually entered values for variables
#
# WiFiServer device
#
WiFiServerActivation = False # Not available if False
WiFiServerList = [] # a max of 12 WiFiServers possible
WiFiServerTimeout = "auto" # waiting time for successful connection
WiFiServerVariables = "auto" # a list of the variables to log
#
# WiFiClient device
#
WiFiClientActivation = False # Not available if False
WiFiClientPort = "auto" # server port on which GL listens
WiFiClientType = "Generic" # options are "Generic" or "GMC"
WiFiClientVariables = "auto" # a list of the variables to log
WiFiClientVariablesGENERIC = "auto" # a list of the variables to log for a GENERIC device
WiFiClientVariablesGMC = "auto" # a list of the variables to log for a GMC device
WiFiClientVariablesMap = {} # a dict of the variables with mapping to the GMC device
WiFiClientMapping = {} # a str giving the mapping of counter vars to GeigerLog vars
WiFiClientServer = None # handle for the http webserver
WiFiClientThread = None # the thread
WiFiClientValues = None # the values read by WiFiClient
#
# I2C device - the Dongle
#
I2C_IOWDriverLoaded = False # Is the driver loaded? relevant only for IOW dongle
I2CDeviceDetected = "Undefined" # name like ELV..., IOW..., ISS...
I2CDongle = None # becomes instance of the I2C Dongle
I2CDongleCode = None # becomes name of the I2C Dongle, like ISS, ELV, IOW
I2CVariables = None # is set with the config of the sensors
I2CInfo = None # Info, to be set in init
I2CInfoExt = None # Info Extended, to be set in init
Sensors = None # is set by gedev_i2c
# I2C Sensors - connected via the Dongle
I2CSensor = {} # collector for sensors
I2CSensor["LM75"] = [False, 0x48, None] # Sensor LM75 (T) at addr 0x48
I2CSensor["BME280"] = [False, 0x76, None] # Sensor BME280 (T, P, H) at addr 0x76
I2CSensor["SCD30"] = [False, 0x61, None] # Sensor SCD30 (CO2 by NDIR) at addr 0x61
I2CSensor["SCD41"] = [False, 0x62, None] # Sensor SCD41 (CO2 by Photoacoustic) at addr 0x62
I2CSensor["TSL2591"] = [False, 0x29, None] # Sensor TSL2591(Light vis + IR) at addr 0x29
I2CSensor["BH1750"] = [False, 0x23, None] # Sensor BH1750 (Light vis) at addr 0x23
I2CSensor["GDK101"] = [False, 0x18, None] # Sensor GDK102 (CPM) at addr 0x18
#
# Raspi Computer
#
isRaspi = False # is a Raspi or not
RaspiVersion = 0 # version no 1, 2, 3, 4, 5, ... Not a Raspi if 0
RaspiModel = "Not a Raspi" # for Raspi 5: 'Raspberry Pi 5 Model B Rev 1.0'
RaspiGPIO_Info = "Not a Raspi" # GPIO.RPI_INFO = {'P1_REVISION': 3, 'REVISION': 'c04170', 'TYPE': 'Pi 5 Model B', 'MANUFACTURER': 'Sony UK', 'PROCESSOR': 'BCM2712', 'RAM': '4GB'}
RaspiGPIO_Version = "Not a Raspi" # GPIO.VERSION = 0.7.2 (for rpi-lgpio=0.4)
RaspiSmbus_Version = "Not a Raspi" # smbus.__version__ e.g. 'smbus2 0.4.3'
#
# RaspiI2C device
#
RaspiI2CActivation = False # Not available if False
RaspiI2CSmbusHandle = None # handle for smbus(smbus2) on Raspi
RaspiI2Cvarlist = None # a list of the variables to log
RaspiI2CVariables = "auto" # a string listing the variables to log
RaspiI2CCumDur = .1 # the longest duration of getting values from all I2C devices
RaspiI2CBMM150_device = None # handle for BMM150 Python module
# RaspiI2C Sensors - connectable to the Raspi
# LM75 : Temp
# BME280 : Temp, Press, Humid
# BH1750 : Light: vis
# TSL2591 : Light: vis + IR
# SCD30 : CO2 by NDIR, Temperature, Humidity
# SCD41 : CO2 by Photoacoustic, Temperature, Humidity
# GDK101 : CPM, CPM_10min_avg, CycleTime # ATTENTION: it does need a 5V supply, though signals are 3.3V
# VEML6075 : UV-A and UV-B, UV-A-corr, UV-B-corr, uvd: dark current, uvcomp1, uvcomp1)) # see rdataserver
# BMM150 : Magnetic Field X, Y, Z, Mafnitude (X,Y,Z), Heading
RaspiI2CSensor = {
# Sensor- Def.I2C Activation Connection Class Var- Vars Burn-in Averaging Data
# Name Address Status Status handle count list cycles cycles Function
# key 0 1 2 3 4 5 6 7 8
"LM75" : [ 0x48, False, False, None, 1, ["Temp", ], 2, 9, "T" ],
"BME280" : [ 0x76, False, False, None, 3, ["Temp", "Press", "Humid" ], 2, 3, "T,P,H" ],
"BH1750" : [ 0x23, False, False, None, 1, ["CPM3rd" ], 2, 2, "VIS" ],
"TSL2591" : [ 0x29, False, False, None, 2, ["CPM3rd", "CPS3rd" ], 2, 1, "VIS,IR" ],
"SCD30" : [ 0x61, False, False, None, 3, ["CPM2nd", "CPM3rd", "CPS3rd" ], 2, 1, "CO2,T,H" ],
"SCD41" : [ 0x62, False, False, None, 3, ["CPM", "CPM1st", "CPS1st" ], 2, 1, "CO2,T,H" ],
"GDK101" : [ 0x18, False, False, None, 3, ["CPM", "CPS", "Temp" ], 2, 1, "CPM,CPM,CTime" ],
"BMM150" : [ 0x13, False, False, None, 5, ["Temp", "Press", "Humid", "Xtra", "CPM" ], 2, 3, "MAG(X,Y,Z),M,H" ],
}
RaspiI2CDataStore = {}
#
# RaspiPulse device
#
RaspiPulseActivation = False # Not available if False
RaspiPulseMode = "auto" # numbering mode: BCM or board
RaspiPulsePin = "auto" # hardware pin for interrupt in BCM numbering
RaspiPulseEdge = "auto" # options are "GPIO.RISING" or "GPIO.FALLING"
RaspiPulsePullUpDown = "auto" # options are "GPIO.PUD_DOWN" or "GPIO.PUD_UP"
RaspiPulseVariables = "auto" # a list of the variables to log
RaspiPulseCPS = 0 # the cumulative 1 sec counts as CPS
RaspiPulseLast60CPS = NAN # becomes deque with len=60, space for 60 sec CPS data
RaspiPulseLastCPS = NAN # the last CPS value
RaspiPulseLastCPM = NAN # the last CPM value
# Raspi PWM settings
# a command 'pwm' on command line at start makes RaspiPulsePWM_Active =>True
RaspiPulsePWM_Active = False # to use PWM or not
RaspiPulsePWM_Handle = None # the handle for setting PWM: 'GPIO.PWM(g.RaspiPulsePWM_Pin, g.RaspiPulsePWM_Freq)'
RaspiPulsePWM_Pin = 13 # the GPIO pin in BCM mode used for generating PWM signal
RaspiPulsePWM_Freq = 10 # the PWM frequency; can be set via command line with '--pwmfreq=30'
RaspiPulsePWM_Period = 1 / 10 # sec - 100 ms the PWM period; calculated from frequency
RaspiPulsePWM_PulseLength = 150 * 1E-6 # sec - 150 µs the PWM pulse length
RaspiPulsePWM_DutyCycle = 99.8500 # % - duty cycle calculated from period and pulse length
#
# SerialPulse device
#
SerialPulseVariables = "auto" # default is CPM3rd, CPS3rd
SerialPulseUsbport = "auto" # to be defined in gdev_serialpulse.py
SerialPulseBaudrate = "auto" # to be defined in gdev_serialpulse.py
SerialPulseLastCPS = None # the last CPS value
SerialPulseLast60CPS = None # stores the last 60 CPS to allow creation of CPM
SerialPulseThreadRun = False # flag to signal to keep the thread running
SerialPulseThread = None # handle of the Pulse Thread
SerialPulseSerialConn = None # handle of the Pulse Serial connection
#
# RadPro device
#
RadProDevice = None
RadProVariables = "auto" # default is CPM3rd, CPS3rd
RadProPort = "auto" # to be defined in gdev_radpro.py
RadProBaud = 115200 #
RadProTimeoutR = 0.5 # serial timeout for Read
RadProTimeoutW = 0.5 # serial timeout for Write
RadProTimeoutRHist = 4.0 # serial timeout for Read when reading Hist
RadProLast60CPS = None # stores the last 60 CPS to allow creation of CPM
RadProLast60CPSclean = None # the last 60 CPS when ignoring any non-poissonians
RadProValues = {} # gets the RadPro values in Thread cycle
RadProThreadRun = False # Flag to signal running thread
RadProThread = None # handle of the RadPro Thread
RadProHardwareId = None
RadProSoftwareId = None
RadProDeviceId = None
RadProLastCPSTime = NAN
RadProLastCPSPulseCount = NAN
RadProSyncTime = "auto" # can be yes or no - to be defined in gdev_radpro.py
RadProClockCorrection = "auto" # to automatically set the clock of the RadPro Device
#GMC_NextCorrMin = -1 # the next minute value for setting the counter clock (0 ... 59)
RadProNextCorrMin = -1 # the next minute value for setting the counter clock (0 ... 59)
RadProClockDrift = 0 # difference ComputerTime minus DeviceTime
RadProClockDriftFrom = 0 # DateTime when RadProClockDrift had been measured
RadProClockDriftMsg = "" # Msg of faster, slower, ...
RadProSerialBlocking = False # Blocks serial when in use
RadProFrequency = 1250 # in Hz - PWM Frequency of the HV Generator
RadProDutyCycle = 30.0 # in % - PWM Duty cycle of the HV Generator
RadProDuties = [] # list of duties to check, like: [1, 10, 20, 30, 40, 50, 60, 70, 80, 90]
RadProDindex = 0 # index to duties
RadProPWM = False # use only for evaluation of RadProPWM; set by 'radpropwm' on command line
# used in Radpro analysis
Bluetoothdur = NAN
RadProGATT = NAN
BluepillDur = NAN # duration of calling Bluepill for data in ms
# Voltmeter
DMMvoltage = NAN # Voltage read from the DMM
DMMduration = NAN # duration between 2 notifications
peripheral = None # the Bluetooth address of the DMM
lasttime = None # the lst time a DMM nitifcation hab been received
#
#ESP32
#
ESP32Serial = None # for the ESP32
#
# Supported DEVICES and Attribs
#
# Detected Names : more specific names, like 'GMC-500+Re 1.22'
# Varnames : a Python list of varnames set for this device, like:
# ['CPM', 'CPS', 'Temp', 'Press', 'Humid', 'Xtra']
# Activation Status : True if set to active in config file