File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+ """Automaticly get data from ESP8266's Raw data output and calculating average time for zero, one and space"""
3+ #
4+ # Copyright 2024 Andrey Kravchenko (StellaLupus)
15import serial
26import serial .tools
37import serial .tools .list_ports
@@ -20,17 +24,17 @@ def get_port():
2024 return get_port ()
2125
2226
23- zero = 756
24- one = 2149
25- space = 752
26- interv = 0.25
27+ ZERO_T = 756
28+ ONE_T = 2149
29+ SPACE_T = 752
30+ PRECISION = 0.25
2731
2832
2933def get_bit_from_interv (value : int ):
3034 """Returning zero or one from value or 2 if not recognized"""
31- if value > zero - zero * interv and value < zero + zero * interv :
35+ if value > ZERO_T - ZERO_T * PRECISION and value < ZERO_T + ZERO_T * PRECISION :
3236 return 0
33- elif value > one - one * interv and value < one + one * interv :
37+ elif value > ONE_T - ONE_T * PRECISION and value < ONE_T + ONE_T * PRECISION :
3438 return 1
3539 else :
3640 return 2
You can’t perform that action at this time.
0 commit comments