Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retevis RB27: support full band TX/RX - fixes #10686 #693

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions chirp/drivers/bf_t8.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,38 +875,17 @@ class RetevisRB27B(BFT8Radio):
class RetevisRB27(RetevisRB27B):
VENDOR = "Retevis"
MODEL = "RB27"
DUPLEXES = ["", "+", "off"]
DUPLEXES = ['', '-', '+', 'off']
POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00),
chirp_common.PowerLevel("Low", watts=0.50)]
VALID_BANDS = [(136000000, 174000000),
(400000000, 520000000)]
ODD_SPLIT = False

_upper = 99
_gmrs = True
_gmrs = False # sold as GMRS radio but supports full band TX/RX
_frs = _murs = _pmr = False

def validate_memory(self, mem):
msgs = super().validate_memory(mem)

_msg_duplex = 'Duplex must be "off" for this frequency'
_msg_offset = 'Only simplex or +5MHz offset allowed on GMRS'

if mem.freq not in GMRS_FREQS:
if mem.duplex != "off":
msgs.append(chirp_common.ValidationWarning(_msg_duplex))
if mem.freq in FRS_FREQS3:
if mem.duplex and mem.offset != 5000000:
msgs.append(chirp_common.ValidationWarning(_msg_offset))
if mem.duplex and mem.duplex != "+":
msgs.append(chirp_common.ValidationWarning(_msg_offset))

return msgs

def check_set_memory_immutable_policy(self, existing, new):
existing.immutable = []
super().check_set_memory_immutable_policy(existing, new)


@directory.register
class RetevisRB27V(RetevisRB27B):
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_chirp_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,7 @@ class TestOverrideRules(base.BaseTest):
'Radioddity_DB25-G',
'Retevis_RA85',
'Retevis_RA685',
'Retevis_RB17P',
'Retevis_RB27',
'Retevis_RB17P'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change this, but if you always make these end with a trailing comma, you can add and remove items from the list with only one line of change. It's an OCD thing :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. The only reason I removed it was because you told not to do it on something else. Must have been in a different context. I agree, I find the trailing comma handy in this case.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably on a function call. It's technically allowed there too, but very unconventional. Something like:

some_thing(foo, bar,)

or on single-line lists:

foo = [1, 2, ]

is not generally done. But multi-line lists it's better to keep the trailing comma, just because each one is a line, and you end up having to make less change to add/remove things.

But as you can see, its importance is pretty microscopic :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I recall, I believe that you are exactly right. Got it. Thanks!

]

def _test_radio_override_immutable_policy(self, rclass):
Expand Down