kopia lustrzana https://github.com/sq5bpf/uvk5-reverse-engineering
move memory frequency validation to validate_memory where it belongs
rodzic
dfe60eb6d3
commit
351cf7fd6e
38
uvk5.py
38
uvk5.py
|
@ -710,6 +710,28 @@ class UVK5Radio(chirp_common.CloneModeRadio):
|
||||||
|
|
||||||
def validate_memory(self, mem):
|
def validate_memory(self, mem):
|
||||||
msgs = super().validate_memory(mem)
|
msgs = super().validate_memory(mem)
|
||||||
|
|
||||||
|
# find tx frequency
|
||||||
|
if mem.duplex == '-':
|
||||||
|
txfreq = mem.freq - mem.offset
|
||||||
|
elif mem.duplex == '+':
|
||||||
|
txfreq = mem.freq + mem.offset
|
||||||
|
else:
|
||||||
|
txfreq = mem.freq
|
||||||
|
|
||||||
|
# find band
|
||||||
|
band = _find_band(self, txfreq)
|
||||||
|
if band is False:
|
||||||
|
msg = "Transmit frequency %.4fMHz is not supported by this radio" \
|
||||||
|
% (txfreq/1000000.0)
|
||||||
|
msgs.append(chirp_common.ValidationWarning(msg))
|
||||||
|
|
||||||
|
band = _find_band(self, mem.freq)
|
||||||
|
if band is False:
|
||||||
|
msg = "The frequency %.4fMHz is not supported by this radio" \
|
||||||
|
% (mem.freq/1000000.0)
|
||||||
|
msgs.append(chirp_common.ValidationWarning(msg))
|
||||||
|
|
||||||
return msgs
|
return msgs
|
||||||
|
|
||||||
def _set_tone(self, mem, _mem):
|
def _set_tone(self, mem, _mem):
|
||||||
|
@ -1903,24 +1925,8 @@ class UVK5Radio(chirp_common.CloneModeRadio):
|
||||||
_mem4.channel_attributes[number].is_free = 1
|
_mem4.channel_attributes[number].is_free = 1
|
||||||
_mem4.channel_attributes[number].band = 0x7
|
_mem4.channel_attributes[number].band = 0x7
|
||||||
|
|
||||||
# find tx frequency
|
|
||||||
if mem.duplex == '-':
|
|
||||||
txfreq = mem.freq - mem.offset
|
|
||||||
elif mem.duplex == '+':
|
|
||||||
txfreq = mem.freq + mem.offset
|
|
||||||
else:
|
|
||||||
txfreq = mem.freq
|
|
||||||
|
|
||||||
# find band
|
# find band
|
||||||
band = _find_band(self, txfreq)
|
|
||||||
if band is False:
|
|
||||||
raise errors.RadioError(
|
|
||||||
"Transmit frequency %.4fMHz is not supported by this radio"
|
|
||||||
% txfreq/1000000.0)
|
|
||||||
|
|
||||||
band = _find_band(self, mem.freq)
|
band = _find_band(self, mem.freq)
|
||||||
if band is False:
|
|
||||||
return mem
|
|
||||||
|
|
||||||
# mode
|
# mode
|
||||||
if mem.mode == "NFM":
|
if mem.mode == "NFM":
|
||||||
|
|
Ładowanie…
Reference in New Issue