uwwvb: Improve checking of marks & zeros.
Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
parent
54d0b4f0f2
commit
9f26e319da
1 changed files with 11 additions and 4 deletions
15
src/uwwvb.py
15
src/uwwvb.py
|
|
@ -99,10 +99,17 @@ def decode_wwvb(
|
|||
"""Convert a received minute of wwvb symbols to a WWVBMinute. Returns None if any error is detected."""
|
||||
if not t:
|
||||
return None
|
||||
if not all(t[i] == MARK for i in always_mark):
|
||||
return None
|
||||
if not all(t[i] == ZERO for i in always_zero):
|
||||
return None
|
||||
for i in range(len(t)):
|
||||
is_mark: bool = t[i] == MARK
|
||||
is_zero: bool = t[i] == ZERO
|
||||
expect_mark = i in always_mark or i == 60
|
||||
expect_zero = i in always_zero
|
||||
|
||||
if expect_mark != is_mark:
|
||||
return None
|
||||
if expect_zero and not is_zero:
|
||||
return None
|
||||
|
||||
# Checking redundant DUT1 sign bits
|
||||
if t[36] == t[37]:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in a new issue