Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #388: only skip one field after something's been decoded already #701

Merged
merged 1 commit into from
Feb 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,7 @@ def __init__(
keepraw=True,
prevfield=None,
initphase=False,
fields_written=0,
readloc=0,
):
self.rawdata = decode["input"]
Expand All @@ -1447,6 +1448,7 @@ def __init__(
self.readloc = readloc

self.prevfield = prevfield
self.fields_written = fields_written

# XXX: need a better way to prevent memory leaks than this
# For now don't let a previous frame keep it's prev frame
Expand Down Expand Up @@ -2156,8 +2158,13 @@ def compute_linelocs(self):

self.rawpulses = self.getpulses()
if self.rawpulses is None or len(self.rawpulses) == 0:
logger.error("Unable to find any sync pulses, jumping one second")
return None, None, int(self.rf.freq_hz)
if self.fields_written:
logger.error("Unable to find any sync pulses, skipping one field")
return None, None, None
else:
logger.error("Unable to find any sync pulses, skipping one second")
return None, None, int(self.rf.freq_hz)


self.validpulses = validpulses = self.refinepulses()

Expand Down Expand Up @@ -3529,6 +3536,7 @@ def decodefield(self, initphase=False):
audio_offset=self.audio_offset,
prevfield=self.curfield,
initphase=initphase,
fields_written=self.fields_written,
readloc=self.rawdecode["startloc"],
)

Expand Down