Skip to content

Commit

Permalink
rt470x: Enable proper AM mode handling
Browse files Browse the repository at this point in the history
Fixes: #11540
  • Loading branch information
kk7ds committed Sep 18, 2024
1 parent f708d2e commit 8496ae0
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions chirp/drivers/mml_jc8810.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,14 +1344,35 @@ class RT470XRadio(RT470LRadio):
]

_fingerprint = _fingerprint_pcb1 + _fingerprint_pcb2

RT470X_ORIG = False

VALID_BANDS = [(100000000, 136000000),
(136000000, 200000000),
(200000000, 300000000),
(300000000, 400000000),
(400000000, 560000000)]
_AIRBAND = (118000000, 136000000)

def get_features(self):
rf = super().get_features()
rf.valid_modes.append('AM')
return rf

def validate_memory(self, mem: chirp_common.Memory):
msgs = []
in_range = chirp_common.in_range
if in_range(mem.freq, [self._AIRBAND]) and not mem.mode == 'AM':
msgs.append(chirp_common.ValidationWarning(
_('Frequency in this range requires AM mode')))
if not in_range(mem.freq, [self._AIRBAND]) and mem.mode == 'AM':
msgs.append(chirp_common.ValidationWarning(
_('Frequency in this range must not be AM mode')))
return msgs + super().validate_memory(mem)

def get_memory(self, number):
mem = super().get_memory(number)
if chirp_common.in_range(mem.freq, [self._AIRBAND]):
mem.mode = 'AM'
return mem


@directory.register
Expand Down

0 comments on commit 8496ae0

Please sign in to comment.