[chirp_devel] Fwd: [PATCH 2 of 3] [BJ-318] Driver prep to make ready to support the Baojie BJ-318

Jim Unroe
Mon Apr 12 09:39:19 PDT 2021


---------- Forwarded message ---------
From: Jim Unroe <kc9hi at comcast.net>
Date: Mon, Apr 12, 2021 at 12:29 PM
Subject: [PATCH 2 of 3] [BJ-318] Driver prep to make ready to support
the Baojie BJ-318
To: <Rock.Unroe at gmail.com>


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1618189954 14400
#      Sun Apr 11 21:12:34 2021 -0400
# Node ID 60b475e41306144198481bc84d428ef0ca6adb5b
# Parent  9f38db094e0e56b31998f97abda4ca6f53572a0a
[BJ-318] Driver prep to make ready to support the Baojie BJ-318

This patch makes changes to the lt725uv.py driver to facilitate the addition
of support for the Baojie BJ-318.

The features and settings of the radio models that this driver currently
supports are not affected.


related to #6235

diff -r 9f38db094e0e -r 60b475e41306 chirp/drivers/lt725uv.py
--- a/chirp/drivers/lt725uv.py  Sun Apr 11 16:45:34 2021 -0400
+++ b/chirp/drivers/lt725uv.py  Sun Apr 11 21:12:34 2021 -0400
@@ -1,4 +1,4 @@
-# Copyright 2016:
+# Copyright 2016-2021:
 # * Jim Unroe KC9HI, <rock.unroe at gmail.com>
 # Modified for Baojie BJ-218: 2018 by Rick DeWitt (RJD), <aa0rd at yahoo.com>#
 # This program is free software: you can redistribute it and/or modify
@@ -173,9 +173,6 @@
 MEM_SIZE = 0x1C00
 BLOCK_SIZE = 0x40
 STIMEOUT = 2
-# Channel power: 2 levels
-POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=5.00),
-                chirp_common.PowerLevel("High", watts=30.00)]

 LIST_RECVMODE = ["QT/DQT", "QT/DQT + Signaling"]
 LIST_SIGNAL = ["Off"] + ["DTMF%s" % x for x in range(1, 9)] + \
@@ -428,6 +425,10 @@
     NAME_LENGTH = 7
     DTMF_CHARS = list("0123456789ABCD*#")

+    # Channel power: 2 levels
+    POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=5.00),
+                    chirp_common.PowerLevel("High", watts=30.00)]
+
     VALID_BANDS = [(136000000, 176000000),
                    (400000000, 480000000)]

@@ -499,7 +500,7 @@
             "->Tone",
             "DTCS->DTCS"]
         rf.valid_skips = []
-        rf.valid_power_levels = POWER_LEVELS
+        rf.valid_power_levels = self.POWER_LEVELS
         rf.valid_name_length = self.NAME_LENGTH
         rf.valid_dtcs_codes = self.DTCS_CODES
         rf.valid_bands = self.VALID_BANDS
@@ -624,7 +625,7 @@

         mem.mode = _mem.wide and "FM" or "NFM"

-        mem.power = POWER_LEVELS[_mem.power]
+        mem.power = self.POWER_LEVELS[_mem.power]

         # Extra
         mem.extra = RadioSettingGroup("extra", "Extra")
@@ -745,7 +746,7 @@
             _mem.txtone = self._set_dcs(mem.dtcs)

         _mem.wide = self.MODES.index(mem.mode)
-        _mem.power = mem.power == POWER_LEVELS[1]
+        _mem.power = mem.power == self.POWER_LEVELS[1]

         # Extra settings
         for setting in mem.extra:
@@ -1440,9 +1441,22 @@
     MODEL = "BJ-218"


+class Baojie218Upper(LT725UVUpper):
+    VENDOR = "Baojie"
+    MODEL = "BJ-218"
+
+
+class Baojie218Lower(LT725UVLower):
+    VENDOR = "Baojie"
+    MODEL = "BJ-218"
+
+
 @directory.register
 class Baojie218(LT725UV):
     """Baojie BJ-218"""
     VENDOR = "Baojie"
     MODEL = "BJ-218"
     ALIASES = [Zastone, Hesenate, ]
+
+    def get_sub_devices(self):
+        return [Baojie218Upper(self._mmap), Baojie218Lower(self._mmap)]



More information about the chirp_devel mailing list