[chirp_devel] [PATCH] [VX-3] fix bank_used issue #1203

Ray Cielencki
Fri Apr 28 16:04:41 PDT 2017


# HG changeset patch
# User Ray Cielencki <rayslinky at gmail.com>
# Date 1493420374 14400
#      Fri Apr 28 18:59:34 2017 -0400
# Node ID 269ddc3236ca0971cbdc704ec52f193ef9092fb7
# Parent  7fe5f7b14be57479d4d37c9e204caf6a076b5d18
[VX-3] fix bank_used issue #1203

This patch works around #1203 -- where banks are not properly marked as
used. Additionally, it corrects how bank_used values are calculated.

diff -r 7fe5f7b14be5 -r 269ddc3236ca chirp/drivers/vx3.py
--- a/chirp/drivers/vx3.py	Thu Apr 13 17:31:54 2017 -0700
+++ b/chirp/drivers/vx3.py	Fri Apr 28 18:59:34 2017 -0400
@@ -141,11 +141,18 @@
 u8  banks_unk1;
 
 #seekto 0x0356;
-u32 banks_unk2;
+struct {
+    u32 unmask;
+} banks_unmask1;
 
 #seekto 0x0409;
 u8  banks_unk3;
 
+#seekto 0x0416;
+struct {
+    u32 unmask;
+} banks_unmask2;
+
 #seekto 0x04CA;
 struct {
     u8    memory[16];
@@ -300,7 +307,11 @@
         channels_in_bank.add(memory.number)
         self._update_bank_with_channel_numbers(bank, channels_in_bank)
         _bank_used = self._radio._memobj.bank_used[bank.index]
-        _bank_used.in_use = 0x0000
+        _bank_used.in_use = ((len(channels_in_bank) - 1) * 2)
+        _banks_unmask1 = self._radio._memobj.banks_unmask1
+        _banks_unmask2 = self._radio._memobj.banks_unmask2
+        _banks_unmask1.unmask = 0x0017FFFF
+        _banks_unmask2.unmask = 0x0017FFFF
 
     def remove_memory_from_mapping(self, memory, bank):
         channels_in_bank = self._get_channel_numbers_in_bank(bank)
@@ -311,8 +322,10 @@
                             (memory.number, bank))
         self._update_bank_with_channel_numbers(bank, channels_in_bank)
 
-        if not channels_in_bank:
-            _bank_used = self._radio._memobj.bank_used[bank.index]
+        _bank_used = self._radio._memobj.bank_used[bank.index]
+        if channels_in_bank:
+            _bank_used.in_use = ((len(channels_in_bank) - 1) * 2)
+        else:
             _bank_used.in_use = 0xFFFF
 
     def get_mapping_memories(self, bank):



More information about the chirp_devel mailing list