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

Add rtevis rb89 #1083

Merged
merged 2 commits into from
Aug 7, 2024
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
77 changes: 68 additions & 9 deletions chirp/drivers/retevis_rt21.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
u8 channel_8[13]; // 0070-007C
u8 unknown_8; // 007D
u8 tail; // QT/DQT Tail(inverted) 007E
u8 tailmode; // QT/DQT Tail Mode 007F
} settings;

#seekto 0x01F0;
Expand Down Expand Up @@ -528,6 +529,7 @@
PFKEY28B_LIST = ["None", "Scan", "Warn", "TX Power", "Monitor"]
PFKEY86_LIST = ["None", "Monitor", "Lamp", "Warn", "VOX", "VOX Delay",
"Key Lock", "TX Power", "Scan"]
PFKEY89_LIST = PFKEY_LIST + ["Bluetooth ON/OFF"]
POT_LIST = ["Channel Type", "Volume Type"]
SAVE_LIST = ["Standard", "Super"]
SAVEM_LIST = ["1-5", "1-8", "1-10", "1-15"]
Expand Down Expand Up @@ -764,6 +766,7 @@ class RT21Radio(chirp_common.CloneModeRadio):
_ack_1st_block = True
_skipflags = True
_reserved = False
_mask = 0x2000 # bit mask to identify DTCS tone decoding is used
_gmrs = _frs = _pmr = False
_echo = False

Expand Down Expand Up @@ -842,7 +845,7 @@ def _get_dcs(val):
return code, pol

tpol = False
if _mem.tx_tone != 0xFFFF and _mem.tx_tone > 0x2000:
if _mem.tx_tone != 0xFFFF and _mem.tx_tone > self._mask:
tcode, tpol = _get_dcs(_mem.tx_tone)
mem.dtcs = tcode
txmode = "DTCS"
Expand All @@ -853,7 +856,7 @@ def _get_dcs(val):
txmode = ""

rpol = False
if _mem.rx_tone != 0xFFFF and _mem.rx_tone > 0x2000:
if _mem.rx_tone != 0xFFFF and _mem.rx_tone > self._mask:
rcode, rpol = _get_dcs(_mem.rx_tone)
mem.rx_dtcs = rcode
rxmode = "DTCS"
Expand Down Expand Up @@ -976,8 +979,10 @@ def get_memory(self, number):
mem.extra.append(rset)

if self.MODEL == "RB26" or self.MODEL == "RT76" \
or self.MODEL == "RB23" or self.MODEL == "AR-63":
if self.MODEL == "RB26" or self.MODEL == "RB23":
or self.MODEL == "RB23" or self.MODEL == "AR-63" \
or self.MODEL == "RB89":
if self.MODEL == "RB26" or self.MODEL == "RB23" \
or self.MODEL == "RB89":
rs = RadioSettingValueBoolean(_mem.bcl)
rset = RadioSetting("bcl", "Busy Channel Lockout", rs)
mem.extra.append(rset)
Expand Down Expand Up @@ -1121,7 +1126,7 @@ def get_memory(self, number):

def _set_tone(self, mem, _mem):
def _set_dcs(code, pol):
val = int("%i" % code, 8) + 0x2000
val = int("%i" % code, 8) + self._mask
if pol == "R":
val += 0x8000
return val
Expand Down Expand Up @@ -1408,8 +1413,10 @@ def apply_pfkey_listvalue(setting, obj):
"RT76",
"RT86",
"RT619",
"RB89",
]:
if self.MODEL == "RB26" or self.MODEL == "RB23":
if self.MODEL == "RB26" or self.MODEL == "RB23" \
or self.MODEL == "RB89":
_settings2 = self._memobj.settings2
_settings3 = self._memobj.settings3

Expand Down Expand Up @@ -1465,7 +1472,8 @@ def apply_pfkey_listvalue(setting, obj):
rset = RadioSetting("voice", "Voice Annumciation", rs)
basic.append(rset)

if self.MODEL == "RB26" or self.MODEL == "RB23":
if self.MODEL == "RB26" or self.MODEL == "RB23" \
or self.MODEL == "RB89":
rs = RadioSettingValueList(VOICE_LIST2,
VOICE_LIST2[_settings.voice])
rset = RadioSetting("voice", "Voice Annumciation", rs)
Expand All @@ -1476,7 +1484,7 @@ def apply_pfkey_listvalue(setting, obj):
rset = RadioSetting("chnumberd", "Channel Number Enable", rs)
basic.append(rset)

if self.MODEL == "RT86":
if self.MODEL == "RT86" or self.MODEL == "RB89":
rs = RadioSettingValueList(SPECIAL_LIST,
SPECIAL_LIST[_settings.tailmode])
rset = RadioSetting("tailmode", "QT/DQT Tail Mode", rs)
Expand All @@ -1493,6 +1501,7 @@ def apply_pfkey_listvalue(setting, obj):
if self.MODEL in ["RB23",
"RB26",
"RT86",
"RB89",
]:
rs = RadioSettingValueBoolean(not _settings.tail)
rset = RadioSetting("tail", "QT/DQT Tail", rs)
Expand Down Expand Up @@ -1536,7 +1545,8 @@ def apply_pfkey_listvalue(setting, obj):
rset = RadioSetting("voxd", "Vox Delay", rs)
basic.append(rset)

if self.MODEL == "RB26" or self.MODEL == "RB23":
if self.MODEL == "RB26" or self.MODEL == "RB23" \
or self.MODEL == "RB89":
rs = RadioSettingValueBoolean(_settings3.vox)
rset = RadioSetting("settings3.vox", "Vox Function", rs)
basic.append(rset)
Expand Down Expand Up @@ -1692,6 +1702,17 @@ def apply_pfkey_listvalue(setting, obj):
rset = RadioSetting("pf2", "PF2 Key Set", rs)
basic.append(rset)

if self.MODEL == "RB89":
rs = RadioSettingValueList(PFKEY89_LIST,
PFKEY89_LIST[_settings.pf1])
rset = RadioSetting("pf1", "PF1 Key Set", rs)
basic.append(rset)

rs = RadioSettingValueList(PFKEY89_LIST,
PFKEY89_LIST[_settings.pf2])
rset = RadioSetting("pf2", "PF2 Key Set", rs)
basic.append(rset)

if self.MODEL == "RB28B" or self.MODEL == "RB628B":
rs = RadioSettingValueInteger(0, 9, _settings.squelch)
rset = RadioSetting("squelch", "Squelch Level", rs)
Expand Down Expand Up @@ -1894,6 +1915,7 @@ class RB26Radio(RT21Radio):
_ack_1st_block = False
_skipflags = True
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_gmrs = True

_ranges = [
Expand Down Expand Up @@ -1924,6 +1946,7 @@ class RT76Radio(RT21Radio):
_ack_1st_block = False
_skipflags = False
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_gmrs = True

_ranges = [
Expand Down Expand Up @@ -2005,6 +2028,7 @@ class RB23Radio(RT21Radio):
_ack_1st_block = False
_skipflags = True
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_gmrs = True

_ranges = [
Expand Down Expand Up @@ -2037,6 +2061,7 @@ class RT19Radio(RT21Radio):
_ack_1st_block = False
_skipflags = False
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_frs = True

_ranges = [
Expand Down Expand Up @@ -2065,6 +2090,7 @@ class RT619Radio(RT19Radio):
0x100, # memory start
_upper # number of freqhops
)
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_frs = False
_pmr = True

Expand Down Expand Up @@ -2092,6 +2118,7 @@ class AR63Radio(RT21Radio):
_ack_1st_block = False
_skipflags = True
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_gmrs = False

_ranges = [
Expand Down Expand Up @@ -2125,6 +2152,7 @@ class RT40BRadio(RT21Radio):
_ack_1st_block = False
_skipflags = True
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_gmrs = True
_echo = True

Expand Down Expand Up @@ -2156,6 +2184,7 @@ class RB28BRadio(RT21Radio):
_ack_1st_block = False
_skipflags = False
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_frs = True

_ranges = [
Expand All @@ -2179,6 +2208,7 @@ class RB628BRadio(RB28BRadio):
_magic = b"PHOGR\x09\xB2"
_fingerprint = [b"P32073" + b"\x02\xFF", ]
_upper = 16
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used
_frs = False
_pmr = True

Expand All @@ -2203,6 +2233,7 @@ class RT86Radio(RT21Radio):
_ack_1st_block = False
_skipflags = True
_reserved = True
_mask = 0x2800 # bit mask to identify DTCS tone decoding is used

_ranges = [
(0x0000, 0x01A0),
Expand All @@ -2211,3 +2242,31 @@ class RT86Radio(RT21Radio):

def process_mmap(self):
self._memobj = bitwise.parse(MEM_FORMAT_RT86, self._mmap)


@directory.register
class RB89Radio(RT21Radio):
"""RETEVIS RB89"""
VENDOR = "Retevis"
MODEL = "RB89"
BLOCK_SIZE = 0x20
BLOCK_SIZE_UP = 0x10

POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00),
chirp_common.PowerLevel("Low", watts=0.50)]

_magic = b"PHOGR" + b"\x01" + b"0"
_fingerprint = [b"P32073" + b"\x01\xFF", ]
_upper = 30
_ack_1st_block = False
_skipflags = True
_reserved = True
_gmrs = False # sold as GMRS radio but supports full band TX/RX

_ranges = [
(0x0000, 0x0330),
]
_memsize = 0x0340

def process_mmap(self):
self._memobj = bitwise.parse(MEM_FORMAT_RB26, self._mmap)
7 changes: 4 additions & 3 deletions tests/Python3_Driver_Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
| <a name="Retevis_RB75"></a> Retevis_RB75 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.02% |
| <a name="Retevis_RB85"></a> Retevis_RB85 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.02% |
| <a name="Retevis_RB87"></a> Retevis_RB87 | [@KC9HI](https://github.com/KC9HI) | 10-Mar-2023 | Yes | |
| <a name="Retevis_RB89"></a> Retevis_RB89 | [@KC9HI](https://github.com/KC9HI) | 6-Aug-2024 | Yes | |
| <a name="Retevis_RT1"></a> Retevis_RT1 | [@KC9HI](https://github.com/KC9HI) | 11-Dec-2022 | Yes | 0.08% |
| <a name="Retevis_RT15"></a> Retevis_RT15 | [@KC9HI](https://github.com/KC9HI) | 18-Feb-2023 | Yes | 0.00% |
| <a name="Retevis_RT16"></a> Retevis_RT16 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.02% |
Expand Down Expand Up @@ -467,11 +468,11 @@
| <a name="Zastone_ZT-X6"></a> Zastone_ZT-X6 | [Implied by Retevis_RT22](#user-content-Retevis_RT22) | 9-Dec-2022 | Yes | 0.11% |
## Stats

**Drivers:** 464
**Drivers:** 465

**Tested:** 87% (406/58) (93% of usage stats)
**Tested:** 87% (407/58) (93% of usage stats)

**Byte clean:** 91% (425/39)
**Byte clean:** 91% (426/39)

## Meaning of this testing

Expand Down
Binary file added tests/images/Retevis_RB89.img
Binary file not shown.
1 change: 1 addition & 0 deletions tests/py3_driver_testers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ Retevis_RB629,@KC9HI,24-Dec-2022
Retevis_RB75,@KC9HI,28-Nov-2022
Retevis_RB85,@KC9HI,28-Nov-2022
Retevis_RB87,@KC9HI,10-Mar-2023
Retevis_RB89,@KC9HI,6-Aug-2024
Retevis_RT15,@KC9HI,18-Feb-2023
Retevis_RT16,@KC9HI,30-Nov-2022
Retevis_RT19,@KC9HI,30-Nov-2022
Expand Down
Loading