[chirp_devel] [PATCH 4 of 7] Original Yaesu banks patch from Jon

Dan Smith
Tue Feb 7 20:08:30 PST 2012


# HG changeset patch
# User Jon K Hellan <hellan at acm.org>
# Date 1306516175 -7200
# Node ID 4688777e2c3a5a27df9240962fe26de3355df4f9
# Parent  d447fde6f900f53d8a0ec5e27e87c13a18a276c2
Original Yaesu banks patch from Jon

diff -r d447fde6f900 -r 4688777e2c3a chirp/ft7800.py
--- a/chirp/ft7800.py	Tue Feb 07 20:01:22 2012 -0800
+++ b/chirp/ft7800.py	Fri May 27 19:09:35 2011 +0200
@@ -51,6 +51,11 @@
      unknown2:7;
 } names[1000];
 
+#seekto 0x6c48;
+struct {
+   u32 bitmap[32];
+} bank_channels[20];
+
 #seekto 0x7648;
 struct {
   u8 skip0:2,
@@ -323,6 +328,17 @@
 
         self._set_mem_skip(mem, _mem)
 
+    # Return channels for a bank. Bank given as number
+    def get_bank_channels(self, bank):
+        channels = []
+        for i in range(1000):
+            _bitmap = self._memobj.bank_channels[bank].bitmap[i/32]
+            ishft = 31 - (i % 32)
+            if (_bitmap >> ishft) & 1 == 1: 
+                channels.append(i)
+
+        return channels
+
 
 class FT7900Radio(FT7800Radio):
     MODEL = "FT-7900"
diff -r d447fde6f900 -r 4688777e2c3a chirp/vx3.py
--- a/chirp/vx3.py	Tue Feb 07 20:01:22 2012 -0800
+++ b/chirp/vx3.py	Fri May 27 19:09:35 2011 +0200
@@ -27,6 +27,11 @@
 #seekto 0x7F4A;
 u8 checksum;
 
+#seekto 0x0B7A;
+struct {
+  u8 name[6];
+} bank_names[24];
+
 #seekto 0x20CA;
 struct {
   u8 even_pskip:1,
@@ -211,7 +216,16 @@
         if mem.name.strip(): _mem.name[0] |= 0x80
       
     def get_banks(self):
-        return []
+        _banks = self._memobj.bank_names
+
+        banks = []
+        for _bank in _banks:
+            name = ""
+            for i in _bank.name:
+                name += CHARSET[i & 0x7F]
+            banks.append(name.rstrip())
+
+        return banks
 
     def validate_memory(self, mem):
         msgs = yaesu_clone.YaesuCloneModeRadio.validate_memory(self, mem)
diff -r d447fde6f900 -r 4688777e2c3a chirp/vx6.py
--- a/chirp/vx6.py	Tue Feb 07 20:01:22 2012 -0800
+++ b/chirp/vx6.py	Fri May 27 19:09:35 2011 +0200
@@ -35,6 +35,19 @@
 #                      D Tone: Encodes DCS code, decodes tone
 # }
 mem_format = """
+#seekto 0x018A;
+u16 bank_sizes[24];
+
+#seekto 0x097A;
+struct {
+  u8 name[6];
+} bank_names[24];
+
+#seekto 0x0C0A;
+struct {
+  u16 channel[100];
+} bank_channels[24];
+
 #seekto 0x1ECA;
 struct {
   u8 even_pskip:1,
@@ -210,3 +223,29 @@
 
         if mem.name.strip():
             _mem.name[0] |= 0x80
+
+    def get_banks(self):
+        _banks = self._memobj.bank_names
+
+        banks = []
+        for bank in _banks:
+            name = ""
+            for i in bank.name:
+                name += CHARSET[i & 0x7F]
+            banks.append(name.rstrip())
+
+        return banks
+
+    # Return channels for a bank. Bank given as number
+    def get_bank_channels(self, bank):
+        nchannels = 0
+        size = self._memobj.bank_sizes[bank]
+        if size <= 198:
+            nchannels = 1 + size/2
+        _channels = self._memobj.bank_channels[bank]
+        channels = []
+        for i in range(0, nchannels):
+            channels.append(int(_channels.channel[i]))
+
+        return channels
+
diff -r d447fde6f900 -r 4688777e2c3a chirp/vx8.py
--- a/chirp/vx8.py	Tue Feb 07 20:01:22 2012 -0800
+++ b/chirp/vx8.py	Fri May 27 19:09:35 2011 +0200
@@ -17,6 +17,22 @@
 from chirp import bitwise
 
 mem_format = """
+#seekto 0x54a;
+struct {
+    u16 in_use;
+} bank_used[24];
+
+#seekto 0x135A;
+struct {
+  u8 unknown[2];
+  u8 name[16];
+} bank_info[24];
+
+#seekto 0x198a;
+struct {
+    u16 channel[100];
+} bank_members[24];
+
 #seekto 0x2C4A;
 struct {
   u8 flag;
@@ -176,7 +192,29 @@
         flag.flag |= skipbits
 
     def get_banks(self):
-        return []
+        _banks = self._memobj.bank_info
+
+        banks = []
+        for _bank in _banks:
+            name = ""
+            for i in _bank.name:
+                if i == 0xFF:
+                    break
+                name += CHARSET[i & 0x7F]
+            banks.append(name.rstrip())
+
+        return banks
+
+    # Return channels for a bank. Bank given as number
+    def get_bank_channels(self, bank):
+        _members = self._memobj.bank_members[bank]
+        channels = []
+        for channel in _members.channel:
+            if channel == 0xffff:
+                break
+            channels.append(int(channel))
+
+        return channels
 
 class VX8DRadio(VX8Radio):
     _model = "AH29D"



More information about the chirp_devel mailing list