avoid using tuples, they don't work in json (future config system)
This commit is contained in:
parent
a083042002
commit
3a1e5ee73c
@ -318,8 +318,8 @@ fst4_enabled_intervals = [15, 30]
|
|||||||
fst4w_enabled_intervals = [120, 300]
|
fst4w_enabled_intervals = [120, 300]
|
||||||
|
|
||||||
# Q65 allows many combinations of intervals and submodes. This setting determines which combinations will be decoded.
|
# Q65 allows many combinations of intervals and submodes. This setting determines which combinations will be decoded.
|
||||||
# Please use python tuples of (interval: int, mode: str) to specify the combinations. For example:
|
# Please use the mode letter followed by the decode interval in seconds to specify the combinations. For example:
|
||||||
q65_enabled_combinations = [(30, "A"), (120, "E"), (60, "C")]
|
q65_enabled_combinations = ["A30", "E120", "C60"]
|
||||||
|
|
||||||
# JS8 comes in different speeds: normal, slow, fast, turbo. This setting controls which ones are enabled.
|
# JS8 comes in different speeds: normal, slow, fast, turbo. This setting controls which ones are enabled.
|
||||||
js8_enabled_profiles = ["normal", "slow"]
|
js8_enabled_profiles = ["normal", "slow"]
|
||||||
|
17
owrx/wsjt.py
17
owrx/wsjt.py
@ -171,7 +171,18 @@ class Q65Profile(WsjtProfile):
|
|||||||
def getEnabledProfiles():
|
def getEnabledProfiles():
|
||||||
config = Config.get()
|
config = Config.get()
|
||||||
profiles = config["q65_enabled_combinations"] if "q65_enabled_combinations" in config else []
|
profiles = config["q65_enabled_combinations"] if "q65_enabled_combinations" in config else []
|
||||||
return [Q65Profile(i, Q65Mode[m]) for i, m in profiles if i in Fst4wProfile.availableIntervals]
|
|
||||||
|
def buildProfile(modestring):
|
||||||
|
mode = Q65Mode[modestring[0]]
|
||||||
|
interval = int(modestring[1:])
|
||||||
|
if interval not in Q65Profile.availableIntervals:
|
||||||
|
logger.warning("%i is not a valid Q65 interval; ignoring mode \"%s\"", interval, modestring)
|
||||||
|
return None
|
||||||
|
return Q65Profile(interval, mode)
|
||||||
|
|
||||||
|
mapped = [buildProfile(m) for m in profiles]
|
||||||
|
logger.debug(mapped)
|
||||||
|
return [p for p in mapped if p is not None]
|
||||||
|
|
||||||
|
|
||||||
class WsjtParser(Parser):
|
class WsjtParser(Parser):
|
||||||
@ -241,9 +252,9 @@ class Decoder(ABC):
|
|||||||
|
|
||||||
def parse_timestamp(self, instring):
|
def parse_timestamp(self, instring):
|
||||||
dateformat = self.profile.getTimestampFormat()
|
dateformat = self.profile.getTimestampFormat()
|
||||||
remain = instring[len(dateformat) + 1:]
|
remain = instring[len(dateformat) + 1 :]
|
||||||
try:
|
try:
|
||||||
ts = datetime.strptime(instring[0: len(dateformat)], dateformat)
|
ts = datetime.strptime(instring[0 : len(dateformat)], dateformat)
|
||||||
return remain, int(
|
return remain, int(
|
||||||
datetime.combine(datetime.utcnow().date(), ts.time()).replace(tzinfo=timezone.utc).timestamp() * 1000
|
datetime.combine(datetime.utcnow().date(), ts.time()).replace(tzinfo=timezone.utc).timestamp() * 1000
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user