more logging improvements

This commit is contained in:
Jakob Ketterl 2019-07-28 12:11:22 +02:00
parent ce662796e3
commit fa08009c50
3 changed files with 12 additions and 11 deletions

View File

@ -499,6 +499,9 @@ class dsp(object):
if pipe_path:
try:
os.unlink(pipe_path)
except FileNotFoundError:
# it seems like we keep calling this twice. no idea why, but we don't need the resulting error.
pass
except Exception:
logger.exception("try_delete_pipes()")

View File

@ -14,8 +14,6 @@ class ServiceOutput(output):
self.frequency = frequency
def add_output(self, t, read_fn):
logger.debug("got output of type {0}".format(t))
if t == "wsjt_demod":
parser = WsjtParser(WsjtHandler())
parser.setDialFrequency(self.frequency)
@ -33,17 +31,16 @@ class ServiceHandler(object):
self.source = source
self.source.addClient(self)
self.source.getProps().collect("center_freq", "samp_rate").wire(self.onFrequencyChange)
self.onFrequencyChange("", "")
self.updateServices()
def onSdrAvailable(self):
logger.debug("sdr {0} is available".format(self.source.getName()))
self.onFrequencyChange("", "")
self.updateServices()
def onSdrUnavailable(self):
logger.debug("sdr {0} is unavailable".format(self.source.getName()))
self.stopServices()
def isSupported(self, mode):
# TODO make configurable
return mode in ["ft8", "ft4", "wspr"]
def stopServices(self):
@ -58,7 +55,10 @@ class ServiceHandler(object):
def onFrequencyChange(self, key, value):
if not self.source.isAvailable():
return
logger.debug("sdr {0} is changing frequency".format(self.source.getName()))
self.updateServices()
def updateServices(self):
logger.debug("re-scheduling services due to sdr changes")
self.stopServices()
cf = self.source.getProps()["center_freq"]
srh = self.source.getProps()["samp_rate"] / 2

View File

@ -84,11 +84,10 @@ class WsjtChopper(threading.Thread):
break
self.outputWriter.send(line)
rc = decoder.wait()
logger.debug("decoder return code: %i", rc)
if rc != 0:
logger.warning("decoder return code: %i", rc)
os.unlink(file)
self.decoder = decoder
if self.fileQueue:
file = self.fileQueue.pop()
logger.debug("processing file {0}".format(file))
@ -100,7 +99,6 @@ class WsjtChopper(threading.Thread):
while self.doRun:
data = self.source.read(256)
if data is None or (isinstance(data, bytes) and len(data) == 0):
logger.warning("zero read on WSJT chopper")
self.doRun = False
else:
self.switchingLock.acquire()