more logging improvements
This commit is contained in:
parent
ce662796e3
commit
fa08009c50
3
csdr.py
3
csdr.py
@ -499,6 +499,9 @@ class dsp(object):
|
|||||||
if pipe_path:
|
if pipe_path:
|
||||||
try:
|
try:
|
||||||
os.unlink(pipe_path)
|
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:
|
except Exception:
|
||||||
logger.exception("try_delete_pipes()")
|
logger.exception("try_delete_pipes()")
|
||||||
|
|
||||||
|
@ -14,8 +14,6 @@ class ServiceOutput(output):
|
|||||||
self.frequency = frequency
|
self.frequency = frequency
|
||||||
|
|
||||||
def add_output(self, t, read_fn):
|
def add_output(self, t, read_fn):
|
||||||
logger.debug("got output of type {0}".format(t))
|
|
||||||
|
|
||||||
if t == "wsjt_demod":
|
if t == "wsjt_demod":
|
||||||
parser = WsjtParser(WsjtHandler())
|
parser = WsjtParser(WsjtHandler())
|
||||||
parser.setDialFrequency(self.frequency)
|
parser.setDialFrequency(self.frequency)
|
||||||
@ -33,17 +31,16 @@ class ServiceHandler(object):
|
|||||||
self.source = source
|
self.source = source
|
||||||
self.source.addClient(self)
|
self.source.addClient(self)
|
||||||
self.source.getProps().collect("center_freq", "samp_rate").wire(self.onFrequencyChange)
|
self.source.getProps().collect("center_freq", "samp_rate").wire(self.onFrequencyChange)
|
||||||
self.onFrequencyChange("", "")
|
self.updateServices()
|
||||||
|
|
||||||
def onSdrAvailable(self):
|
def onSdrAvailable(self):
|
||||||
logger.debug("sdr {0} is available".format(self.source.getName()))
|
self.updateServices()
|
||||||
self.onFrequencyChange("", "")
|
|
||||||
|
|
||||||
def onSdrUnavailable(self):
|
def onSdrUnavailable(self):
|
||||||
logger.debug("sdr {0} is unavailable".format(self.source.getName()))
|
|
||||||
self.stopServices()
|
self.stopServices()
|
||||||
|
|
||||||
def isSupported(self, mode):
|
def isSupported(self, mode):
|
||||||
|
# TODO make configurable
|
||||||
return mode in ["ft8", "ft4", "wspr"]
|
return mode in ["ft8", "ft4", "wspr"]
|
||||||
|
|
||||||
def stopServices(self):
|
def stopServices(self):
|
||||||
@ -58,7 +55,10 @@ class ServiceHandler(object):
|
|||||||
def onFrequencyChange(self, key, value):
|
def onFrequencyChange(self, key, value):
|
||||||
if not self.source.isAvailable():
|
if not self.source.isAvailable():
|
||||||
return
|
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()
|
self.stopServices()
|
||||||
cf = self.source.getProps()["center_freq"]
|
cf = self.source.getProps()["center_freq"]
|
||||||
srh = self.source.getProps()["samp_rate"] / 2
|
srh = self.source.getProps()["samp_rate"] / 2
|
||||||
|
@ -84,11 +84,10 @@ class WsjtChopper(threading.Thread):
|
|||||||
break
|
break
|
||||||
self.outputWriter.send(line)
|
self.outputWriter.send(line)
|
||||||
rc = decoder.wait()
|
rc = decoder.wait()
|
||||||
logger.debug("decoder return code: %i", rc)
|
if rc != 0:
|
||||||
|
logger.warning("decoder return code: %i", rc)
|
||||||
os.unlink(file)
|
os.unlink(file)
|
||||||
|
|
||||||
self.decoder = decoder
|
|
||||||
|
|
||||||
if self.fileQueue:
|
if self.fileQueue:
|
||||||
file = self.fileQueue.pop()
|
file = self.fileQueue.pop()
|
||||||
logger.debug("processing file {0}".format(file))
|
logger.debug("processing file {0}".format(file))
|
||||||
@ -100,7 +99,6 @@ class WsjtChopper(threading.Thread):
|
|||||||
while self.doRun:
|
while self.doRun:
|
||||||
data = self.source.read(256)
|
data = self.source.read(256)
|
||||||
if data is None or (isinstance(data, bytes) and len(data) == 0):
|
if data is None or (isinstance(data, bytes) and len(data) == 0):
|
||||||
logger.warning("zero read on WSJT chopper")
|
|
||||||
self.doRun = False
|
self.doRun = False
|
||||||
else:
|
else:
|
||||||
self.switchingLock.acquire()
|
self.switchingLock.acquire()
|
||||||
|
Loading…
Reference in New Issue
Block a user