# HG changeset patch
# User Nicolas Pike <nicolas.jon.pike@gmail.com>
# Date 1520710839 0
#      Sat Mar 10 19:40:39 2018 +0000
# Node ID c4b16f49912e6dcd75d7b96b2fba0eaf34f8b065
# Parent  bc008caf047165682aff19fc420a05b264ad1e5c
[FT-70D]  #5329 Improved bank support.
Banks working
Removed VFO FT1 bank code references and FT 1 VFO struct
Temp removal of AMS and Modes - until they work correctly

diff -r bc008caf0471 -r c4b16f49912e chirp/drivers/ft70.py
--- a/chirp/drivers/ft70.py	Thu Mar 08 20:23:39 2018 +0000
+++ b/chirp/drivers/ft70.py	Sat Mar 10 19:40:39 2018 +0000
@@ -201,6 +201,12 @@
     memory_scan_width:1,    // Placeholder as not found - 49 SCM.WTH Set the memory scan frequency range. ALL / BAND 
     unknown7:1,
     unknown8:1;
+    u8 unknown9[15];
+    u8 unknown10;
+    u8 unknown11;
+    u8 power;
+    u8 unknown19;
+    u8 unknown20;
     } scan_settings_1;
     
     #seekto 0x06B6;  
@@ -219,52 +225,8 @@
     struct {
     u8 unknown[48];
     u8 unknown1[16];
-    } vfo_backup_info_1;      
-       
-    #seekto 0x064a;         // Unknown (From FT1D) For reference only
-    struct {
-    u8 unknown0[4];
-    u8 frequency_band;
-    u8 unknown1:6,
-    manual_or_mr:2;
-    u8 unknown2:7,
-    mr_banks:1;
-    u8 unknown3;
-    u16 mr_index;
-    u16 bank_index;
-    u16 bank_enable;
-    u8 unknown4[5];
-    u8 unknown5:6,
-    power:2;                // 3 - High, 2 - Mid, 1 - Low
-    u8 unknown6:4,
-    tune_step:4;
-    u8 unknown7:6,
-    duplex:2;
-    u8 unknown8:6,
-    tone_mode:2;
-    u8 unknown9:2,
-    tone:6;
-    u8 unknown10;
-    u8 unknown11:6,
-    mode:2;
-    bbcd freq0[4];
-    bbcd offset_freq[4];
-    u8 unknown12[2];
-    char label[16];
-    u8 unknown13[6];
-    bbcd band_lower[4];
-    bbcd band_upper[4];
-    bbcd rx_freq[4];
-    u8 unknown14[22];
-    bbcd freq1[4];
-    u8 unknown15[11];
-    u8 unknown16:3,
-    volume:5;
-    u8 unknown17[18];
-    u8 active_menu_item;
-    u8 checksum;
-    } vfo_info[6];
-    
+    } vfo_backup_info_1;            
+        
     #seekto 0x047e;
     struct {
     u8 unknown1;
@@ -325,7 +287,7 @@
     u8 unknown6:7,
     vw_mode:1;                          // 16 DIG VW    Turn the VW mode selection ON or OFF
     u8 unknown7;
-    } digital_settings;
+    } digital_settings;   
     
     // ^^^ All above referenced U8's have been refactored to minimum number of bits.
     
@@ -428,7 +390,6 @@
         _bank = self._model._radio._memobj.bank_info[self.index]
         _bank.name = [ord(x) for x in name.ljust(6, chr(0xFF))[:6]]
 
-
 class FT70BankModel(chirp_common.BankModel):
     """A FT70 bank model"""
 
@@ -456,48 +417,6 @@
         _members = self._radio._memobj.bank_members[bank.index]
         return set([int(ch) + 1 for ch in _members.channel if ch != 0xFFFF])
 
-    def update_vfo(self):
-        chosen_bank = [None, None]
-        chosen_mr = [None, None]
-
-        flags = self._radio._memobj.flag
-
-        # Find a suitable bank and MR for VFO A and B.  # From FT1D for ref only
-        for bank in self.get_mappings():
-            for channel in self._channel_numbers_in_bank(bank):
-                chosen_bank[0] = bank.index
-                chosen_mr[0] = channel
-                if not flags[channel].nosubvfo:
-                    chosen_bank[1] = bank.index
-                    chosen_mr[1] = channel
-                    break
-            if chosen_bank[1]:
-                break
-
-        for vfo_index in (0, 1):        # From FT1D for ref only
-            # 3 VFO info structs are stored as 3 pairs of (master, backup)
-            vfo = self._radio._memobj.vfo_info[vfo_index * 2]
-            vfo_bak = self._radio._memobj.vfo_info[(vfo_index * 2) + 1]
-
-            if vfo.checksum != vfo_bak.checksum:
-                LOG.warn("VFO settings are inconsistent with backup")
-            else:
-                if ((chosen_bank[vfo_index] is None) and (vfo.bank_index !=
-                                                          0xFFFF)):
-                    LOG.info("Disabling banks for VFO %d" % vfo_index)
-                    vfo.bank_index = 0xFFFF
-                    vfo.mr_index = 0xFFFF
-                    vfo.bank_enable = 0xFFFF
-                elif ((chosen_bank[vfo_index] is not None) and
-                      (vfo.bank_index == 0xFFFF)):
-                    LOG.info("Enabling banks for VFO %d" % vfo_index)
-                    vfo.bank_index = chosen_bank[vfo_index]
-                    vfo.mr_index = chosen_mr[vfo_index]
-                    vfo.bank_enable = 0x0000
-                vfo_bak.bank_index = vfo.bank_index
-                vfo_bak.mr_index = vfo.mr_index
-                vfo_bak.bank_enable = vfo.bank_enable
-
     def _update_bank_with_channel_numbers(self, bank, channels_in_bank):
         _members = self._radio._memobj.bank_members[bank.index]
         if len(channels_in_bank) > len(_members.channel):
@@ -518,8 +437,6 @@
         _bank_used = self._radio._memobj.bank_used[bank.index]
         _bank_used.in_use = 0x06
 
-        self.update_vfo()
-
     def remove_memory_from_mapping(self, memory, bank):
         channels_in_bank = self._channel_numbers_in_bank(bank)
         try:
@@ -533,8 +450,6 @@
             _bank_used = self._radio._memobj.bank_used[bank.index]
             _bank_used.in_use = 0xFFFF
 
-        self.update_vfo()
-
     def get_mapping_memories(self, bank):
         memories = []
         for channel in self._channel_numbers_in_bank(bank):
@@ -704,15 +619,15 @@
         mem.skip = flag.pskip and "P" or flag.skip and "S" or ""
         mem.name = self._decode_label(_mem)
 
-        mem.extra = RadioSettingGroup("extra", "Extra Settings")
-
-        rs = RadioSetting("display_tag", "Display Name/Frequency",
-                          RadioSettingValueBoolean(_mem.display_tag))
-        mem.extra.append(rs)
-
-        rs = RadioSetting("ams", "AMS",
-                          RadioSettingValueBoolean(_mem.ams))
-        mem.extra.append(rs)
+        # mem.extra = RadioSettingGroup("extra", "Extra Settings")
+        #
+        # rs = RadioSetting("display_tag", "Display Name/Frequency",
+        #                   RadioSettingValueBoolean(_mem.display_tag))
+        # mem.extra.append(rs)
+        #
+        # rs = RadioSetting("ams", "AMS",
+        #                   RadioSettingValueBoolean(_mem.ams))
+        # mem.extra.append(rs)
 
         return mem
 
@@ -1089,13 +1004,6 @@
 
         # Power Level   F key, TX PO, Dial to adjust power level
 
-        # scan_settings_2 = self._memobj.scan_settings_2
-        # val = RadioSettingValueList(
-        #     self._VOLUME,
-        #     self._VOLUME[scan_settings_2.volume])
-        # rs = RadioSetting("scan_settings_2.volume", "Volume", val)
-        # menu.append(rs)
-
         return menu
 
     def _get_digital_settings(self):
