[chirp_devel] [PATCH] [BF-A58S] Add Support for Baofeng UV-82III
Jim Unroe
Sat Oct 19 10:54:55 PDT 2019
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1571504725 14400
# Node ID 2ccc8e4771555f24c1cdf4c6af3536c3e5b2bdaf
# Parent 7dba74b4fa431f7850e6de176249ba2e6cfb0037
[BF-A58S] Add Support for Baofeng UV-82III
This patch only cleans up driver style issues prior to adding support
for new models. There are no changes in functionality.
Add baofeng_wp970i.py driver to cpep8.manifest
Clean up driver style issues (correct indentation, remove whitespace,
add/remove blank lines, etc)
related to #7163
diff -r 7dba74b4fa43 -r 2ccc8e477155 chirp/drivers/baofeng_wp970i.py
--- a/chirp/drivers/baofeng_wp970i.py Thu Oct 17 18:42:12 2019 -0700
+++ b/chirp/drivers/baofeng_wp970i.py Sat Oct 19 13:05:25 2019 -0400
@@ -19,8 +19,6 @@
import logging
import re
-LOG = logging.getLogger(__name__)
-
from chirp.drivers import baofeng_common
from chirp import chirp_common, directory, memmap
from chirp import bitwise, errors, util
@@ -31,7 +29,9 @@
InvalidValueError
from textwrap import dedent
-##### MAGICS #########################################################
+LOG = logging.getLogger(__name__)
+
+# #### MAGICS #########################################################
# Baofeng WP970I magic string
MSTRING_WP970I = "\x50\xBB\xFF\x20\x14\x04\x13"
@@ -64,6 +64,7 @@
LIST_VOICE = ["Off", "English", "Chinese"]
LIST_WORKMODE = ["Frequency", "Channel"]
+
def model_match(cls, data):
"""Match the opened/downloaded image to the correct version"""
@@ -112,7 +113,6 @@
PTTID_LIST = LIST_PTTID
SCODE_LIST = LIST_SCODE
-
MEM_FORMAT = """
#seekto 0x0000;
struct {
@@ -141,19 +141,19 @@
u8 code[5];
u8 unused[11];
} pttid[15];
-
+
#seekto 0x0CAA;
struct {
- u8 code[5];
- u8 unused1:6,
- aniid:2;
- u8 unknown[2];
- u8 dtmfon;
- u8 dtmfoff;
- } ani;
+ u8 code[5];
+ u8 unused1:6,
+ aniid:2;
+ u8 unknown[2];
+ u8 dtmfon;
+ u8 dtmfoff;
+ } ani;
- #seekto 0x0E20;
- struct {
+ #seekto 0x0E20;
+ struct {
u8 squelch;
u8 step;
u8 unknown1;
@@ -206,17 +206,17 @@
u8 keylock;
} settings;
- #seekto 0x0E76;
- struct {
- u8 unused1:1,
- mrcha:7;
- u8 unused2:1,
- mrchb:7;
- } wmchannel;
-
- struct vfo {
- u8 unknown0[8];
- u8 freq[8];
+ #seekto 0x0E76;
+ struct {
+ u8 unused1:1,
+ mrcha:7;
+ u8 unused2:1,
+ mrchb:7;
+ } wmchannel;
+
+ struct vfo {
+ u8 unknown0[8];
+ u8 freq[8];
u8 offset[6];
ul16 rxtone;
ul16 txtone;
@@ -224,45 +224,45 @@
band:1;
u8 unknown3;
u8 unused2:2,
- sftd:2,
+ sftd:2,
scode:4;
- u8 unknown4;
+ u8 unknown4;
u8 unused3:1
- step:3,
- unused4:4;
+ step:3,
+ unused4:4;
u8 unused5:1,
widenarr:1,
- unused6:4,
- txpower3:2;
- };
-
- #seekto 0x0F00;
- struct {
+ unused6:4,
+ txpower3:2;
+ };
+
+ #seekto 0x0F00;
+ struct {
struct vfo a;
struct vfo b;
} vfo;
-
+
#seekto 0x0F4E;
u16 fm_presets;
-
+
#seekto 0x1000;
struct {
char name[7];
u8 unknown1[9];
} names[128];
-
+
#seekto 0x1ED0;
struct {
char line1[7];
char line2[7];
} sixpoweron_msg;
-
+
#seekto 0x1EE0;
struct {
char line1[7];
char line2[7];
} poweron_msg;
-
+
#seekto 0x1EF0;
struct {
char line1[7];
@@ -281,7 +281,7 @@
u8 sql8;
u8 sql9;
};
-
+
#seekto 0x1F60;
struct {
struct squelch vhf;
@@ -395,7 +395,7 @@
basic.append(rs)
rs = RadioSetting("settings.beep", "Beep",
- RadioSettingValueBoolean(_mem.settings.beep))
+ RadioSettingValueBoolean(_mem.settings.beep))
basic.append(rs)
if _mem.settings.timeout > 0x27:
@@ -497,7 +497,7 @@
val = _mem.settings.rpste
rs = RadioSetting("settings.rpste",
"Squelch Tail Eliminate (repeater)",
- RadioSettingValueList(
+ RadioSettingValueList(
LIST_RPSTE, LIST_RPSTE[val]))
basic.append(rs)
@@ -619,12 +619,12 @@
rs = RadioSetting("wmchannel.mrcha", "MR A Channel",
RadioSettingValueInteger(0, 127,
- _mem.wmchannel.mrcha))
+ _mem.wmchannel.mrcha))
work.append(rs)
rs = RadioSetting("wmchannel.mrchb", "MR B Channel",
RadioSettingValueInteger(0, 127,
- _mem.wmchannel.mrchb))
+ _mem.wmchannel.mrchb))
work.append(rs)
def convert_bytes_to_freq(bytes):
@@ -819,7 +819,8 @@
elif band == "uhf":
_obj = self._memobj.squelch.uhf
val = RadioSettingValueInteger(0, 123,
- getattr(_obj, "sql%i" % (index)))
+ getattr(
+ _obj, "sql%i" % (index)))
if index == 0:
val.set_mutable(False)
name = "%s Squelch %i" % (band.upper(), index)
@@ -845,10 +846,12 @@
else:
return False
+
class RH5XAlias(chirp_common.Alias):
VENDOR = "Rugged"
MODEL = "RH5X"
+
@directory.register
class BFA58(WP970I):
"""Baofeng BF-A58"""
@@ -858,18 +861,21 @@
_fileid = ["BFT515 ", "BFT517 "]
+
@directory.register
class UV82WP(WP970I):
"""Baofeng UV82-WP"""
VENDOR = "Baofeng"
MODEL = "UV-82WP"
+
@directory.register
class GT3WP(WP970I):
"""Baofeng GT-3WP"""
VENDOR = "Baofeng"
MODEL = "GT-3WP"
+
@directory.register
class RT6(WP970I):
"""Retevis RT6"""
diff -r 7dba74b4fa43 -r 2ccc8e477155 tools/cpep8.manifest
--- a/tools/cpep8.manifest Thu Oct 17 18:42:12 2019 -0700
+++ b/tools/cpep8.manifest Sat Oct 19 13:05:25 2019 -0400
@@ -15,6 +15,7 @@
./chirp/drivers/anytone.py
./chirp/drivers/ap510.py
./chirp/drivers/baofeng_uv3r.py
+./chirp/drivers/baofeng_wp970i.py
./chirp/drivers/bjuv55.py
./chirp/drivers/btech.py
./chirp/drivers/ft1802.py
More information about the chirp_devel
mailing list