Project

General

Profile

Bug #10274 » ft2900.py

Updated module - Dan Smith, 01/15/2023 03:48 AM

 
1
# Copyright 2011 Dan Smith <dsmith@danplanet.com>
2
#
3
# FT-2900-specific modifications by Richard Cochran, <ag6qr@sonic.net>
4
# Initial work on settings by Chris Fosnight, <chris.fosnight@gmail.com>
5
#
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18

    
19
import time
20
import os
21
import logging
22

    
23
from chirp import util, memmap, chirp_common, bitwise, directory, errors
24
from chirp.drivers.yaesu_clone import YaesuCloneModeRadio
25
from chirp.settings import RadioSetting, RadioSettingGroup, \
26
    RadioSettingValueList, RadioSettingValueString, RadioSettings
27

    
28
from textwrap import dedent
29

    
30
LOG = logging.getLogger(__name__)
31

    
32

    
33
def _send(s, data):
34
    s.write(data)
35
    echo = s.read(len(data))
36
    if data != echo:
37
        raise Exception("Failed to read echo")
38
    LOG.debug("got echo\n%s\n" % util.hexprint(echo))
39

    
40
ACK = b"\x06"
41
INITIAL_CHECKSUM = 0
42

    
43

    
44
def _download(radio):
45

    
46
    blankChunk = b""
47
    for _i in range(0, 32):
48
        blankChunk += b"\xff"
49

    
50
    LOG.debug("in _download\n")
51

    
52
    data = b""
53
    for _i in range(0, 20):
54
        data = radio.pipe.read(20)
55
        LOG.debug("Header:\n%s" % util.hexprint(data))
56
        LOG.debug("len(header) = %s\n" % len(data))
57

    
58
        if data == radio.IDBLOCK:
59
            break
60

    
61
    if data != radio.IDBLOCK:
62
        raise Exception("Failed to read header")
63

    
64
    _send(radio.pipe, ACK)
65

    
66
    # initialize data, the big var that holds all memory
67
    data = b""
68

    
69
    _blockNum = 0
70

    
71
    while len(data) < radio._block_sizes[1]:
72
        _blockNum += 1
73
        time.sleep(0.03)
74
        chunk = radio.pipe.read(32)
75
        LOG.debug("Block %i " % (_blockNum))
76
        if chunk == blankChunk:
77
            LOG.debug("blank chunk\n")
78
        else:
79
            LOG.debug("Got: %i:\n%s" % (len(chunk), util.hexprint(chunk)))
80
        if len(chunk) != 32:
81
            LOG.debug("len chunk is %i\n" % (len(chunk)))
82
            raise Exception("Failed to get full data block")
83
            break
84
        else:
85
            data += chunk
86

    
87
        if radio.status_fn:
88
            status = chirp_common.Status()
89
            status.max = radio._block_sizes[1]
90
            status.cur = len(data)
91
            status.msg = "Cloning from radio"
92
            radio.status_fn(status)
93

    
94
    LOG.debug("Total: %i" % len(data))
95

    
96
    # radio should send us one final termination byte, containing
97
    # checksum
98
    chunk = radio.pipe.read(32)
99
    if len(chunk) != 1:
100
        LOG.debug("len(chunk) is %i\n" % len(chunk))
101
        raise Exception("radio sent extra unknown data")
102
    LOG.debug("Got: %i:\n%s" % (len(chunk), util.hexprint(chunk)))
103

    
104
    # compute checksum
105
    cs = INITIAL_CHECKSUM
106
    for byte in radio.IDBLOCK:
107
        cs += byte
108
    for byte in data:
109
        cs += byte
110
    LOG.debug("calculated checksum is %x\n" % (cs & 0xff))
111
    LOG.debug("Radio sent checksum is %x\n" % chunk[0])
112

    
113
    if (cs & 0xff) != chunk[0]:
114
        raise Exception("Failed checksum on read.")
115

    
116
    # for debugging purposes, dump the channels, in hex.
117
    for _i in range(0, 200):
118
        _startData = 1892 + 20 * _i
119
        chunk = data[_startData:_startData + 20]
120
        LOG.debug("channel %i:\n%s" % (_i, util.hexprint(chunk)))
121

    
122
    return memmap.MemoryMapBytes(data)
123

    
124

    
125
def _upload(radio):
126
    for _i in range(0, 10):
127
        data = radio.pipe.read(256)
128
        if not data:
129
            break
130
        LOG.debug("What is this garbage?\n%s" % util.hexprint(data))
131
        raise Exception("Radio sent unrecognized data")
132

    
133
    _send(radio.pipe, radio.IDBLOCK)
134
    time.sleep(.2)
135
    ack = radio.pipe.read(300)
136
    LOG.debug("Ack was (%i):\n%s" % (len(ack), util.hexprint(ack)))
137
    if ack != ACK:
138
        raise Exception("Radio did not ack ID. Check cable, verify"
139
                        " radio is not locked.\n"
140
                        " (press & Hold red \"*L\" button to unlock"
141
                        " radio if needed)")
142

    
143
    block = 0
144
    cs = INITIAL_CHECKSUM
145
    for byte in radio.IDBLOCK:
146
        cs += byte
147

    
148
    while block < (radio.get_memsize() // 32):
149
        data = radio.get_mmap()[block * 32:(block + 1) * 32]
150

    
151
        LOG.debug("Writing block %i:\n%s" % (block, util.hexprint(data)))
152

    
153
        _send(radio.pipe, data)
154
        time.sleep(0.03)
155

    
156
        for byte in data:
157
            cs += byte
158

    
159
        if radio.status_fn:
160
            status = chirp_common.Status()
161
            status.max = radio._block_sizes[1]
162
            status.cur = block * 32
163
            status.msg = "Cloning to radio"
164
            radio.status_fn(status)
165
        block += 1
166

    
167
    _send(radio.pipe, bytes([cs & 0xFF]))
168

    
169
MEM_FORMAT = """
170
#seekto 0x0080;
171
struct {
172
    u8  apo;
173
    u8  arts_beep;
174
    u8  bell;
175
    u8  dimmer;
176
    u8  cw_id_string[16];
177
    u8  cw_trng;
178
    u8  x95;
179
    u8  x96;
180
    u8  x97;
181
    u8  int_cd;
182
    u8  int_set;
183
    u8  x9A;
184
    u8  x9B;
185
    u8  lock;
186
    u8  x9D;
187
    u8  mic_gain;
188
    u8  open_msg;
189
    u8  openMsg_Text[6];
190
    u8  rf_sql;
191
    u8  unk:6,
192
        pag_abk:1,
193
        unk:1;
194
    u8  pag_cdr_1;
195
    u8  pag_cdr_2;
196
    u8  pag_cdt_1;
197
    u8  pag_cdt_2;
198
    u8  prog_p1;
199
    u8  xAD;
200
    u8  prog_p2;
201
    u8  xAF;
202
    u8  prog_p3;
203
    u8  xB1;
204
    u8  prog_p4;
205
    u8  xB3;
206
    u8  resume;
207
    u8  tot;
208
    u8  unk:1,
209
        cw_id:1,
210
        unk:1,
211
        ts_speed:1,
212
        ars:1,
213
        unk:2,
214
        dtmf_mode:1;
215
    u8  unk:1,
216
        ts_mut:1
217
        wires_auto:1,
218
        busy_lockout:1,
219
        edge_beep:1,
220
        unk:3;
221
    u8  unk:2,
222
        s_search:1,
223
        unk:2,
224
        cw_trng_units:1,
225
        unk:2;
226
    u8  dtmf_speed:1,
227
        unk:2,
228
        arts_interval:1,
229
        unk:1,
230
        inverted_dcs:1,
231
        unk:1,
232
        mw_mode:1;
233
    u8  unk:2,
234
        wires_mode:1,
235
        wx_alert:1,
236
        unk:1,
237
        wx_vol_max:1,
238
        revert:1,
239
        unk:1;
240
    u8  vfo_scan;
241
    u8  scan_mode;
242
    u8  dtmf_delay;
243
    u8  beep;
244
    u8  xBF;
245
} settings;
246

    
247
#seekto 0x00d0;
248
    u8  passwd[4];
249
    u8  mbs;
250

    
251
#seekto 0x00c0;
252
struct {
253
  u16 in_use;
254
} bank_used[8];
255

    
256
#seekto 0x00ef;
257
  u8 currentTone;
258

    
259
#seekto 0x00f0;
260
  u8 curChannelMem[20];
261

    
262
#seekto 0x1e0;
263
struct {
264
  u8 dtmf_string[16];
265
} dtmf_strings[10];
266

    
267
#seekto 0x0127;
268
  u8 curChannelNum;
269

    
270
#seekto 0x012a;
271
  u8 banksoff1;
272

    
273
#seekto 0x15f;
274
  u8 checksum1;
275

    
276
#seekto 0x16f;
277
  u8 curentTone2;
278

    
279
#seekto 0x1aa;
280
  u16 banksoff2;
281

    
282
#seekto 0x1df;
283
  u8 checksum2;
284

    
285
#seekto 0x0360;
286
struct{
287
  u8 name[6];
288
} bank_names[8];
289

    
290

    
291
#seekto 0x03c4;
292
struct{
293
  u16 channels[50];
294
} banks[8];
295

    
296
#seekto 0x06e4;
297
struct {
298
  u8 even_pskip:1,
299
     even_skip:1,
300
     even_valid:1,
301
     even_masked:1,
302
     odd_pskip:1,
303
     odd_skip:1,
304
     odd_valid:1,
305
     odd_masked:1;
306
} flags[225];
307

    
308
#seekto 0x0764;
309
struct {
310
  u8 unknown0:2,
311
     isnarrow:1,
312
     unknown1:5;
313
  u8 unknown2:2,
314
     duplex:2,
315
     unknown3:1,
316
     step:3;
317
  bbcd freq[3];
318
  u8 power:2,
319
     unknown4:3,
320
     tmode:3;
321
  u8 name[6];
322
  bbcd offset[3];
323
  u8 ctonesplitflag:1,
324
     ctone:7;
325
  u8 rx_dtcssplitflag:1,
326
     rx_dtcs:7;
327
  u8 unknown5;
328
  u8 rtonesplitflag:1,
329
     rtone:7;
330
  u8 dtcssplitflag:1,
331
     dtcs:7;
332
} memory[200];
333

    
334
"""
335

    
336
MODES = ["FM", "NFM"]
337
TMODES = ["", "Tone", "TSQL", "DTCS", "TSQL-R", "Cross"]
338
CROSS_MODES = ["DTCS->", "Tone->DTCS", "DTCS->Tone",
339
               "Tone->Tone", "DTCS->DTCS"]
340
DUPLEX = ["", "-", "+", "split"]
341
POWER_LEVELS = [chirp_common.PowerLevel("Hi", watts=75),
342
                chirp_common.PowerLevel("Low3", watts=30),
343
                chirp_common.PowerLevel("Low2", watts=10),
344
                chirp_common.PowerLevel("Low1", watts=5),
345
                ]
346

    
347
CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ +-/?C[] _"
348
STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0, 100.0]
349

    
350

    
351
def _decode_tone(radiotone):
352
    try:
353
        chirptone = chirp_common.TONES[radiotone]
354
    except IndexError:
355
        chirptone = 100
356
        LOG.debug("found invalid radio tone: %i\n" % radiotone)
357
    return chirptone
358

    
359

    
360
def _decode_dtcs(radiodtcs):
361
    try:
362
        chirpdtcs = chirp_common.DTCS_CODES[radiodtcs]
363
    except IndexError:
364
        chirpdtcs = 23
365
        LOG.debug("found invalid radio dtcs code: %i\n" % radiodtcs)
366
    return chirpdtcs
367

    
368

    
369
def _decode_name(mem):
370
    name = ""
371
    for i in mem:
372
        if (i & 0x7F) == 0x7F:
373
            break
374
        try:
375
            name += CHARSET[i & 0x7F]
376
        except IndexError:
377
            LOG.debug("Unknown char index: %x " % (i))
378
    name = name.strip()
379
    return name
380

    
381

    
382
def _encode_name(mem):
383
    if(mem.strip() == ""):
384
        return [0xff] * 6
385

    
386
    name = [None] * 6
387
    for i in range(0, 6):
388
        try:
389
            name[i] = CHARSET.index(mem[i])
390
        except IndexError:
391
            name[i] = CHARSET.index(" ")
392

    
393
    name[0] = name[0] | 0x80
394
    return name
395

    
396

    
397
def _wipe_memory(mem):
398
    mem.set_raw(b"\xff" * (mem.size() // 8))
399

    
400

    
401
class FT2900Bank(chirp_common.NamedBank):
402

    
403
    def get_name(self):
404
        _bank = self._model._radio._memobj.bank_names[self.index]
405
        name = ""
406
        for i in _bank.name:
407
            if i == 0xff:
408
                break
409
            name += CHARSET[i & 0x7f]
410

    
411
        return name.rstrip()
412

    
413
    def set_name(self, name):
414
        name = name.upper().ljust(6)[:6]
415
        _bank = self._model._radio._memobj.bank_names[self.index]
416
        _bank.name = [CHARSET.index(x) for x in name.ljust(6)[:6]]
417

    
418

    
419
class FT2900BankModel(chirp_common.BankModel):
420

    
421
    def get_num_mappings(self):
422
        return 8
423

    
424
    def get_mappings(self):
425
        banks = self._radio._memobj.banks
426
        bank_mappings = []
427
        for index, _bank in enumerate(banks):
428
            bank = FT2900Bank(self, "%i" % index, "b%i" % (index + 1))
429
            bank.index = index
430
            bank_mappings.append(bank)
431

    
432
        return bank_mappings
433

    
434
    def _get_channel_numbers_in_bank(self, bank):
435
        _bank_used = self._radio._memobj.bank_used[bank.index]
436
        if _bank_used.in_use == 0xffff:
437
            return set()
438

    
439
        _members = self._radio._memobj.banks[bank.index]
440
        return set([int(ch) for ch in _members.channels if ch != 0xffff])
441

    
442
    def _update_bank_with_channel_numbers(self, bank, channels_in_bank):
443
        _members = self._radio._memobj.banks[bank.index]
444
        if len(channels_in_bank) > len(_members.channels):
445
            raise Exception("More than %i entries in bank %d" %
446
                            (len(_members.channels), bank.index))
447

    
448
        empty = 0
449
        for index, channel_number in enumerate(sorted(channels_in_bank)):
450
            _members.channels[index] = channel_number
451
            empty = index + 1
452
        for index in range(empty, len(_members.channels)):
453
            _members.channels[index] = 0xffff
454

    
455
        _bank_used = self._radio._memobj.bank_used[bank.index]
456
        if empty == 0:
457
            _bank_used.in_use = 0xffff
458
        else:
459
            _bank_used.in_use = empty - 1
460

    
461
    def add_memory_to_mapping(self, memory, bank):
462
        channels_in_bank = self._get_channel_numbers_in_bank(bank)
463
        channels_in_bank.add(memory.number)
464
        self._update_bank_with_channel_numbers(bank, channels_in_bank)
465

    
466
        # tells radio that banks are active
467
        self._radio._memobj.banksoff1 = bank.index
468
        self._radio._memobj.banksoff2 = bank.index
469

    
470
    def remove_memory_from_mapping(self, memory, bank):
471
        channels_in_bank = self._get_channel_numbers_in_bank(bank)
472
        try:
473
            channels_in_bank.remove(memory.number)
474
        except KeyError:
475
            raise Exception("Memory %i is not in bank %s. Cannot remove" %
476
                            (memory.number, bank))
477
        self._update_bank_with_channel_numbers(bank, channels_in_bank)
478

    
479
    def get_mapping_memories(self, bank):
480
        memories = []
481
        for channel in self._get_channel_numbers_in_bank(bank):
482
            memories.append(self._radio.get_memory(channel))
483

    
484
        return memories
485

    
486
    def get_memory_mappings(self, memory):
487
        banks = []
488
        for bank in self.get_mappings():
489
            if memory.number in self._get_channel_numbers_in_bank(bank):
490
                banks.append(bank)
491

    
492
        return banks
493

    
494

    
495
@directory.register
496
class FT2900Radio(YaesuCloneModeRadio):
497

    
498
    """Yaesu FT-2900"""
499
    VENDOR = "Yaesu"
500
    MODEL = "FT-2900R/1900R"
501
    IDBLOCK = b"\x56\x43\x32\x33\x00\x02\x46\x01\x01\x01"
502
    BAUD_RATE = 19200
503

    
504
    _memsize = 8000
505
    _block_sizes = [8, 8000]
506

    
507
    def get_features(self):
508
        rf = chirp_common.RadioFeatures()
509

    
510
        rf.memory_bounds = (0, 199)
511

    
512
        rf.can_odd_split = True
513
        rf.has_ctone = True
514
        rf.has_rx_dtcs = True
515
        rf.has_cross = True
516
        rf.has_dtcs_polarity = False
517
        rf.has_bank = True
518
        rf.has_bank_names = True
519
        rf.has_settings = True
520

    
521
        rf.valid_tuning_steps = STEPS
522
        rf.valid_modes = MODES
523
        rf.valid_tmodes = TMODES
524
        rf.valid_cross_modes = CROSS_MODES
525
        rf.valid_bands = [(136000000, 174000000)]
526
        rf.valid_power_levels = POWER_LEVELS
527
        rf.valid_duplexes = DUPLEX
528
        rf.valid_skips = ["", "S", "P"]
529
        rf.valid_name_length = 6
530
        rf.valid_characters = CHARSET
531

    
532
        return rf
533

    
534
    def sync_in(self):
535
        start = time.time()
536
        try:
537
            self._mmap = _download(self)
538
        except errors.RadioError:
539
            raise
540
        except Exception as e:
541
            raise errors.RadioError("Failed to communicate with radio: %s" % e)
542
        LOG.info("Downloaded in %.2f sec" % (time.time() - start))
543
        self.process_mmap()
544

    
545
    def sync_out(self):
546
        self.pipe.timeout = 1
547
        start = time.time()
548
        try:
549
            _upload(self)
550
        except errors.RadioError:
551
            raise
552
        except Exception as e:
553
            raise errors.RadioError("Failed to communicate with radio: %s" % e)
554
        LOG.info("Uploaded in %.2f sec" % (time.time() - start))
555

    
556
    def process_mmap(self):
557
        self._memobj = bitwise.parse(MEM_FORMAT, self._mmap)
558

    
559
    def get_raw_memory(self, number):
560
        return repr(self._memobj.memory[number])
561

    
562
    def get_memory(self, number):
563
        _mem = self._memobj.memory[number]
564
        _flag = self._memobj.flags[(number) / 2]
565

    
566
        nibble = ((number) % 2) and "even" or "odd"
567
        used = _flag["%s_masked" % nibble]
568
        valid = _flag["%s_valid" % nibble]
569
        pskip = _flag["%s_pskip" % nibble]
570
        skip = _flag["%s_skip" % nibble]
571

    
572
        mem = chirp_common.Memory()
573

    
574
        mem.number = number
575

    
576
        if _mem.get_raw()[0] == "\xFF" or not valid or not used:
577
            mem.empty = True
578
            return mem
579

    
580
        mem.tuning_step = STEPS[_mem.step]
581
        mem.freq = int(_mem.freq) * 1000
582

    
583
        # compensate for 12.5 kHz tuning steps, add 500 Hz if needed
584
        if(mem.tuning_step == 12.5):
585
            lastdigit = int(_mem.freq) % 10
586
            if (lastdigit == 2 or lastdigit == 7):
587
                mem.freq += 500
588

    
589
        mem.offset = chirp_common.fix_rounded_step(int(_mem.offset) * 1000)
590
        mem.duplex = DUPLEX[_mem.duplex]
591
        if _mem.tmode < TMODES.index("Cross"):
592
            mem.tmode = TMODES[_mem.tmode]
593
            mem.cross_mode = CROSS_MODES[0]
594
        else:
595
            mem.tmode = "Cross"
596
            mem.cross_mode = CROSS_MODES[_mem.tmode - TMODES.index("Cross")]
597

    
598
        mem.rtone = _decode_tone(_mem.rtone)
599
        mem.ctone = _decode_tone(_mem.ctone)
600

    
601
        # check for unequal ctone/rtone in TSQL mode.  map it as a
602
        # cross tone mode
603
        if mem.rtone != mem.ctone and (mem.tmode == "TSQL" or
604
                                       mem.tmode == "Tone"):
605
            mem.tmode = "Cross"
606
            mem.cross_mode = "Tone->Tone"
607

    
608
        mem.dtcs = _decode_dtcs(_mem.dtcs)
609
        mem.rx_dtcs = _decode_dtcs(_mem.rx_dtcs)
610

    
611
        # check for unequal dtcs/rx_dtcs in DTCS mode.  map it as a
612
        # cross tone mode
613
        if mem.dtcs != mem.rx_dtcs and mem.tmode == "DTCS":
614
            mem.tmode = "Cross"
615
            mem.cross_mode = "DTCS->DTCS"
616

    
617
        if (int(_mem.name[0]) & 0x80) != 0:
618
            mem.name = _decode_name(_mem.name)
619

    
620
        mem.mode = _mem.isnarrow and "NFM" or "FM"
621
        mem.skip = pskip and "P" or skip and "S" or ""
622
        mem.power = POWER_LEVELS[3 - _mem.power]
623

    
624
        return mem
625

    
626
    def set_memory(self, mem):
627
        _mem = self._memobj.memory[mem.number]
628
        _flag = self._memobj.flags[(mem.number) / 2]
629

    
630
        nibble = ((mem.number) % 2) and "even" or "odd"
631

    
632
        valid = _flag["%s_valid" % nibble]
633
        used = _flag["%s_masked" % nibble]
634

    
635
        if not valid:
636
            _wipe_memory(_mem)
637

    
638
        if mem.empty and valid and not used:
639
            _flag["%s_valid" % nibble] = False
640
            return
641

    
642
        _flag["%s_masked" % nibble] = not mem.empty
643

    
644
        if mem.empty:
645
            return
646

    
647
        _flag["%s_valid" % nibble] = True
648

    
649
        _mem.freq = mem.freq / 1000
650
        _mem.offset = mem.offset / 1000
651
        _mem.duplex = DUPLEX.index(mem.duplex)
652

    
653
        # clear all the split tone flags -- we'll set them as needed below
654
        _mem.ctonesplitflag = 0
655
        _mem.rx_dtcssplitflag = 0
656
        _mem.rtonesplitflag = 0
657
        _mem.dtcssplitflag = 0
658

    
659
        if mem.tmode != "Cross":
660
            _mem.tmode = TMODES.index(mem.tmode)
661
            # for the non-cross modes, use ONE tone for both send
662
            # and receive but figure out where to get it from.
663
            if mem.tmode == "TSQL" or mem.tmode == "TSQL-R":
664
                _mem.rtone = chirp_common.TONES.index(mem.ctone)
665
                _mem.ctone = chirp_common.TONES.index(mem.ctone)
666
            else:
667
                _mem.rtone = chirp_common.TONES.index(mem.rtone)
668
                _mem.ctone = chirp_common.TONES.index(mem.rtone)
669

    
670
            # and one tone for dtcs, but this is always the sending one
671
            _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
672
            _mem.rx_dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
673

    
674
        else:
675
            _mem.rtone = chirp_common.TONES.index(mem.rtone)
676
            _mem.ctone = chirp_common.TONES.index(mem.ctone)
677
            _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
678
            _mem.rx_dtcs = chirp_common.DTCS_CODES.index(mem.rx_dtcs)
679
            if mem.cross_mode == "Tone->Tone":
680
                # tone->tone cross mode is treated as
681
                # TSQL, but with separate tones for
682
                # send and receive
683
                _mem.tmode = TMODES.index("TSQL")
684
                _mem.rtonesplitflag = 1
685
            elif mem.cross_mode == "DTCS->DTCS":
686
                # DTCS->DTCS cross mode is treated as
687
                # DTCS, but with separate codes for
688
                # send and receive
689
                _mem.tmode = TMODES.index("DTCS")
690
                _mem.dtcssplitflag = 1
691
            else:
692
                _mem.tmode = TMODES.index("Cross") + \
693
                    CROSS_MODES.index(mem.cross_mode)
694

    
695
        _mem.isnarrow = MODES.index(mem.mode)
696
        _mem.step = STEPS.index(mem.tuning_step)
697
        _flag["%s_pskip" % nibble] = mem.skip == "P"
698
        _flag["%s_skip" % nibble] = mem.skip == "S"
699
        if mem.power:
700
            _mem.power = 3 - POWER_LEVELS.index(mem.power)
701
        else:
702
            _mem.power = 3
703

    
704
        _mem.name = _encode_name(mem.name)
705

    
706
        # set all unknown areas of the memory map to 0
707
        _mem.unknown0 = 0
708
        _mem.unknown1 = 0
709
        _mem.unknown2 = 0
710
        _mem.unknown3 = 0
711
        _mem.unknown4 = 0
712
        _mem.unknown5 = 0
713

    
714
        LOG.debug("encoded mem\n%s\n" % (util.hexprint(_mem.get_raw()[0:20])))
715

    
716
    def get_settings(self):
717
        _settings = self._memobj.settings
718
        _dtmf_strings = self._memobj.dtmf_strings
719
        _passwd = self._memobj.passwd
720

    
721
        repeater = RadioSettingGroup("repeater", "Repeater Settings")
722
        ctcss = RadioSettingGroup("ctcss", "CTCSS/DCS/EPCS Settings")
723
        arts = RadioSettingGroup("arts", "ARTS Settings")
724
        mbls = RadioSettingGroup("banks", "Memory Settings")
725
        scan = RadioSettingGroup("scan", "Scan Settings")
726
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
727
        wires = RadioSettingGroup("wires", "WiRES(tm) Settings")
728
        switch = RadioSettingGroup("switch", "Switch/Knob Settings")
729
        disp = RadioSettingGroup("disp", "Display Settings")
730
        misc = RadioSettingGroup("misc", "Miscellaneous Settings")
731

    
732
        setmode = RadioSettings(repeater, ctcss, arts, mbls, scan,
733
                                dtmf, wires, switch, disp, misc)
734

    
735
        # numbers and names of settings refer to the way they're
736
        # presented in the set menu, as well as the list starting on
737
        # page 74 of the manual
738

    
739
        # 1 APO
740
        opts = ["Off", "30 Min", "1 Hour", "3 Hour", "5 Hour", "8 Hour"]
741
        misc.append(
742
            RadioSetting(
743
                "apo", "Automatic Power Off",
744
                RadioSettingValueList(opts, opts[_settings.apo])))
745

    
746
        # 2 AR.BEP
747
        opts = ["Off", "In Range", "Always"]
748
        arts.append(
749
            RadioSetting(
750
                "arts_beep", "ARTS Beep",
751
                RadioSettingValueList(opts, opts[_settings.arts_beep])))
752

    
753
        # 3 AR.INT
754
        opts = ["15 Sec", "25 Sec"]
755
        arts.append(
756
            RadioSetting(
757
                "arts_interval", "ARTS Polling Interval",
758
                RadioSettingValueList(opts, opts[_settings.arts_interval])))
759

    
760
        # 4 ARS
761
        opts = ["Off", "On"]
762
        repeater.append(
763
            RadioSetting(
764
                "ars", "Automatic Repeater Shift",
765
                RadioSettingValueList(opts, opts[_settings.ars])))
766

    
767
        # 5 BCLO
768
        opts = ["Off", "On"]
769
        misc.append(RadioSetting(
770
            "busy_lockout", "Busy Channel Lock-Out",
771
            RadioSettingValueList(opts, opts[_settings.busy_lockout])))
772

    
773
        # 6 BEEP
774
        opts = ["Off", "Key+Scan", "Key"]
775
        switch.append(RadioSetting(
776
            "beep", "Enable the Beeper",
777
            RadioSettingValueList(opts, opts[_settings.beep])))
778

    
779
        # 7 BELL
780
        opts = ["Off", "1", "3", "5", "8", "Continuous"]
781
        ctcss.append(RadioSetting("bell", "Bell Repetitions",
782
                                  RadioSettingValueList(opts, opts[
783
                                                        _settings.bell])))
784

    
785
        # 8 BNK.LNK
786
        for i in range(0, 8):
787
            opts = ["Off", "On"]
788
            mbs = (self._memobj.mbs >> i) & 1
789
            rs = RadioSetting("mbs%i" % i, "Bank %s Scan" % (i + 1),
790
                              RadioSettingValueList(opts, opts[mbs]))
791

    
792
            def apply_mbs(s, index):
793
                if int(s.value):
794
                    self._memobj.mbs |= (1 << index)
795
                else:
796
                    self._memobj.mbs &= ~(1 << index)
797
            rs.set_apply_callback(apply_mbs, i)
798
            mbls.append(rs)
799

    
800
        # 9 BNK.NM - A per-bank attribute, nothing to do here.
801

    
802
        # 10 CLK.SFT - A per-channel attribute, nothing to do here.
803

    
804
        # 11 CW.ID
805
        opts = ["Off", "On"]
806
        arts.append(RadioSetting("cw_id", "CW ID Enable",
807
                                 RadioSettingValueList(opts, opts[
808
                                                       _settings.cw_id])))
809

    
810
        cw_id_text = ""
811
        for i in _settings.cw_id_string:
812
            try:
813
                cw_id_text += CHARSET[i & 0x7F]
814
            except IndexError:
815
                if i != 0xff:
816
                    LOG.debug("unknown char index in cw id: %x " % (i))
817

    
818
        val = RadioSettingValueString(0, 16, cw_id_text, True)
819
        val.set_charset(CHARSET + "abcdefghijklmnopqrstuvwxyz")
820
        rs = RadioSetting("cw_id_string", "CW Identifier Text", val)
821

    
822
        def apply_cw_id(s):
823
            str = s.value.get_value().upper().rstrip()
824
            mval = ""
825
            mval = [chr(CHARSET.index(x)) for x in str]
826
            for x in range(len(mval), 16):
827
                mval.append(chr(0xff))
828
            for x in range(0, 16):
829
                _settings.cw_id_string[x] = ord(mval[x])
830
        rs.set_apply_callback(apply_cw_id)
831
        arts.append(rs)
832

    
833
        # 12 CWTRNG
834
        opts = ["Off", "4WPM", "5WPM", "6WPM", "7WPM", "8WPM", "9WPM",
835
                "10WPM", "11WPM", "12WPM", "13WPM", "15WPM", "17WPM",
836
                "20WPM", "24WPM", "30WPM", "40WPM"]
837
        misc.append(RadioSetting("cw_trng", "CW Training",
838
                                 RadioSettingValueList(opts, opts[
839
                                                       _settings.cw_trng])))
840

    
841
        # todo: make the setting of the units here affect the display
842
        # of the speed.  Not critical, but would be slick.
843
        opts = ["CPM", "WPM"]
844
        misc.append(RadioSetting("cw_trng_units", "CW Training Units",
845
                                 RadioSettingValueList(opts,
846
                                                       opts[_settings.
847
                                                            cw_trng_units])))
848

    
849
        # 13 DC VLT - a read-only status, so nothing to do here
850

    
851
        # 14 DCS CD - A per-channel attribute, nothing to do here
852

    
853
        # 15 DCS.RV
854
        opts = ["Disabled", "Enabled"]
855
        ctcss.append(RadioSetting(
856
                     "inverted_dcs",
857
                     "\"Inverted\" DCS Code Decoding",
858
                     RadioSettingValueList(opts,
859
                                           opts[_settings.inverted_dcs])))
860

    
861
        # 16 DIMMER
862
        opts = ["Off"] + ["Level %d" % (x) for x in range(1, 11)]
863
        disp.append(RadioSetting("dimmer", "Dimmer",
864
                                 RadioSettingValueList(opts,
865
                                                       opts[_settings
866
                                                            .dimmer])))
867

    
868
        # 17 DT.A/M
869
        opts = ["Manual", "Auto"]
870
        dtmf.append(RadioSetting("dtmf_mode", "DTMF Autodialer",
871
                                 RadioSettingValueList(opts,
872
                                                       opts[_settings
873
                                                            .dtmf_mode])))
874

    
875
        # 18 DT.DLY
876
        opts = ["50 ms", "250 ms", "450 ms", "750 ms", "1000 ms"]
877
        dtmf.append(RadioSetting("dtmf_delay", "DTMF Autodialer Delay Time",
878
                                 RadioSettingValueList(opts,
879
                                                       opts[_settings
880
                                                            .dtmf_delay])))
881

    
882
        # 19 DT.SET
883
        for memslot in range(0, 10):
884
            dtmf_memory = ""
885
            for i in _dtmf_strings[memslot].dtmf_string:
886
                if i != 0xFF:
887
                    try:
888
                        dtmf_memory += CHARSET[i]
889
                    except IndexError:
890
                        LOG.debug("unknown char index in dtmf: %x " % (i))
891

    
892
            val = RadioSettingValueString(0, 16, dtmf_memory, True)
893
            val.set_charset(CHARSET + "abcdef")
894
            rs = RadioSetting("dtmf_string_%d" % memslot,
895
                              "DTMF Memory %d" % memslot, val)
896

    
897
            def apply_dtmf(s, i):
898
                LOG.debug("applying dtmf for %x\n" % i)
899
                str = s.value.get_value().upper().rstrip()
900
                LOG.debug("str is %s\n" % str)
901
                mval = ""
902
                mval = [chr(CHARSET.index(x)) for x in str]
903
                for x in range(len(mval), 16):
904
                    mval.append(chr(0xff))
905
                for x in range(0, 16):
906
                    _dtmf_strings[i].dtmf_string[x] = ord(mval[x])
907
            rs.set_apply_callback(apply_dtmf, memslot)
908
            dtmf.append(rs)
909

    
910
        # 20 DT.SPD
911
        opts = ["50 ms", "100 ms"]
912
        dtmf.append(RadioSetting("dtmf_speed",
913
                                 "DTMF Autodialer Sending Speed",
914
                                 RadioSettingValueList(opts,
915
                                                       opts[_settings.
916
                                                            dtmf_speed])))
917

    
918
        # 21 EDG.BEP
919
        opts = ["Off", "On"]
920
        mbls.append(RadioSetting("edge_beep", "Band Edge Beeper",
921
                                 RadioSettingValueList(opts,
922
                                                       opts[_settings.
923
                                                            edge_beep])))
924

    
925
        # 22 INT.CD
926
        opts = ["DTMF %X" % (x) for x in range(0, 16)]
927
        wires.append(RadioSetting("int_cd", "Access Number for WiRES(TM)",
928
                                  RadioSettingValueList(opts, opts[
929
                                                        _settings.int_cd])))
930

    
931
        # 23 ING MD
932
        opts = ["Sister Radio Group", "Friends Radio Group"]
933
        wires.append(RadioSetting("wires_mode",
934
                                  "Internet Link Connection Mode",
935
                                  RadioSettingValueList(opts,
936
                                                        opts[_settings.
937
                                                             wires_mode])))
938

    
939
        # 24 INT.A/M
940
        opts = ["Manual", "Auto"]
941
        wires.append(RadioSetting("wires_auto", "Internet Link Autodialer",
942
                                  RadioSettingValueList(opts,
943
                                                        opts[_settings
944
                                                             .wires_auto])))
945
        # 25 INT.SET
946
        opts = ["F%d" % (x) for x in range(0, 10)]
947

    
948
        wires.append(RadioSetting("int_set", "Memory Register for "
949
                                  "non-WiRES Internet",
950
                                  RadioSettingValueList(opts,
951
                                                        opts[_settings
952
                                                             .int_set])))
953

    
954
        # 26 LOCK
955
        opts = ["Key", "Dial", "Key + Dial", "PTT",
956
                "Key + PTT", "Dial + PTT", "All"]
957
        switch.append(RadioSetting("lock", "Control Locking",
958
                                   RadioSettingValueList(opts,
959
                                                         opts[_settings
960
                                                              .lock])))
961

    
962
        # 27 MCGAIN
963
        opts = ["Level %d" % (x) for x in range(1, 10)]
964
        misc.append(RadioSetting("mic_gain", "Microphone Gain",
965
                                 RadioSettingValueList(opts,
966
                                                       opts[_settings
967
                                                            .mic_gain])))
968

    
969
        # 28 MEM.SCN
970
        opts = ["Tag 1", "Tag 2", "All Channels"]
971
        rs = RadioSetting("scan_mode", "Memory Scan Mode",
972
                          RadioSettingValueList(opts,
973
                                                opts[_settings
974
                                                     .scan_mode - 1]))
975
        # this setting is unusual in that it starts at 1 instead of 0.
976
        # that is, index 1 corresponds to "Tag 1", and index 0 is invalid.
977
        # so we create a custom callback to handle this.
978

    
979
        def apply_scan_mode(s):
980
            myopts = ["Tag 1", "Tag 2", "All Channels"]
981
            _settings.scan_mode = myopts.index(s.value.get_value()) + 1
982
        rs.set_apply_callback(apply_scan_mode)
983
        mbls.append(rs)
984

    
985
        # 29 MW MD
986
        opts = ["Lower", "Next"]
987
        mbls.append(RadioSetting("mw_mode", "Memory Write Mode",
988
                                 RadioSettingValueList(opts,
989
                                                       opts[_settings
990
                                                            .mw_mode])))
991

    
992
        # 30 NM SET - This is per channel, so nothing to do here
993

    
994
        # 31 OPN.MSG
995
        opts = ["Off", "DC Supply Voltage", "Text Message"]
996
        disp.append(RadioSetting("open_msg", "Opening Message Type",
997
                                 RadioSettingValueList(opts,
998
                                                       opts[_settings.
999
                                                            open_msg])))
1000

    
1001
        openmsg = ""
1002
        for i in _settings.openMsg_Text:
1003
            try:
1004
                openmsg += CHARSET[i & 0x7F]
1005
            except IndexError:
1006
                if i != 0xff:
1007
                    LOG.debug("unknown char index in openmsg: %x " % (i))
1008

    
1009
        val = RadioSettingValueString(0, 6, openmsg, True)
1010
        val.set_charset(CHARSET + "abcdefghijklmnopqrstuvwxyz")
1011
        rs = RadioSetting("openMsg_Text", "Opening Message Text", val)
1012

    
1013
        def apply_openmsg(s):
1014
            str = s.value.get_value().upper().rstrip()
1015
            mval = ""
1016
            mval = [chr(CHARSET.index(x)) for x in str]
1017
            for x in range(len(mval), 6):
1018
                mval.append(chr(0xff))
1019
            for x in range(0, 6):
1020
                _settings.openMsg_Text[x] = ord(mval[x])
1021
        rs.set_apply_callback(apply_openmsg)
1022
        disp.append(rs)
1023

    
1024
        # 32 PAGER - a per-channel attribute
1025

    
1026
        # 33 PAG.ABK
1027
        opts = ["Off", "On"]
1028
        ctcss.append(RadioSetting("pag_abk", "Paging Answer Back",
1029
                                  RadioSettingValueList(opts,
1030
                                                        opts[_settings
1031
                                                             .pag_abk])))
1032

    
1033
        # 34 PAG.CDR
1034
        opts = ["%2.2d" % (x) for x in range(1, 50)]
1035
        ctcss.append(RadioSetting("pag_cdr_1", "Receive Page Code 1",
1036
                                  RadioSettingValueList(opts,
1037
                                                        opts[_settings
1038
                                                             .pag_cdr_1])))
1039

    
1040
        ctcss.append(RadioSetting("pag_cdr_2", "Receive Page Code 2",
1041
                                  RadioSettingValueList(opts,
1042
                                                        opts[_settings
1043
                                                             .pag_cdr_2])))
1044

    
1045
        # 35 PAG.CDT
1046
        opts = ["%2.2d" % (x) for x in range(1, 50)]
1047
        ctcss.append(RadioSetting("pag_cdt_1", "Transmit Page Code 1",
1048
                                  RadioSettingValueList(opts,
1049
                                                        opts[_settings
1050
                                                             .pag_cdt_1])))
1051

    
1052
        ctcss.append(RadioSetting("pag_cdt_2", "Transmit Page Code 2",
1053
                                  RadioSettingValueList(opts,
1054
                                                        opts[_settings
1055
                                                             .pag_cdt_2])))
1056

    
1057
        # Common Button Options
1058
        button_opts = ["Squelch Off", "Weather", "Smart Search",
1059
                       "Tone Scan", "Scan", "T Call", "ARTS"]
1060

    
1061
        # 36 PRG P1
1062
        opts = button_opts + ["DC Volts"]
1063
        switch.append(RadioSetting(
1064
            "prog_p1", "P1 Button",
1065
            RadioSettingValueList(opts, opts[_settings.prog_p1])))
1066

    
1067
        # 37 PRG P2
1068
        opts = button_opts + ["Dimmer"]
1069
        switch.append(RadioSetting(
1070
            "prog_p2", "P2 Button",
1071
            RadioSettingValueList(opts, opts[_settings.prog_p2])))
1072

    
1073
        # 38 PRG P3
1074
        opts = button_opts + ["Mic Gain"]
1075
        switch.append(RadioSetting(
1076
            "prog_p3", "P3 Button",
1077
            RadioSettingValueList(opts, opts[_settings.prog_p3])))
1078

    
1079
        # 39 PRG P4
1080
        opts = button_opts + ["Skip"]
1081
        switch.append(RadioSetting(
1082
            "prog_p4", "P4 Button",
1083
            RadioSettingValueList(opts, opts[_settings.prog_p4])))
1084

    
1085
        # 40 PSWD
1086
        password = ""
1087
        for i in _passwd:
1088
            if i != 0xFF:
1089
                try:
1090
                    password += CHARSET[i]
1091
                except IndexError:
1092
                    LOG.debug("unknown char index in password: %x " % (i))
1093

    
1094
        val = RadioSettingValueString(0, 4, password, True)
1095
        val.set_charset(CHARSET[0:15] + "abcdef ")
1096
        rs = RadioSetting("passwd", "Password", val)
1097

    
1098
        def apply_password(s):
1099
            str = s.value.get_value().upper().rstrip()
1100
            mval = ""
1101
            mval = [chr(CHARSET.index(x)) for x in str]
1102
            for x in range(len(mval), 4):
1103
                mval.append(chr(0xff))
1104
            for x in range(0, 4):
1105
                _passwd[x] = ord(mval[x])
1106
        rs.set_apply_callback(apply_password)
1107
        misc.append(rs)
1108

    
1109
        # 41 RESUME
1110
        opts = ["3 Sec", "5 Sec", "10 Sec", "Busy", "Hold"]
1111
        scan.append(RadioSetting("resume", "Scan Resume Mode",
1112
                                 RadioSettingValueList(opts, opts[
1113
                                                       _settings.resume])))
1114

    
1115
        # 42 RF.SQL
1116
        opts = ["Off"] + ["S-%d" % (x) for x in range(1, 10)]
1117
        misc.append(RadioSetting("rf_sql", "RF Squelch Threshold",
1118
                                 RadioSettingValueList(opts, opts[
1119
                                                       _settings.rf_sql])))
1120

    
1121
        # 43 RPT - per channel attribute, nothing to do here
1122

    
1123
        # 44 RVRT
1124
        opts = ["Off", "On"]
1125
        misc.append(RadioSetting("revert", "Priority Revert",
1126
                                 RadioSettingValueList(opts, opts[
1127
                                                       _settings.revert])))
1128

    
1129
        # 45 S.SRCH
1130
        opts = ["Single", "Continuous"]
1131
        misc.append(RadioSetting("s_search", "Smart Search Sweep Mode",
1132
                                 RadioSettingValueList(opts, opts[
1133
                                                       _settings.s_search])))
1134

    
1135
        # 46 SHIFT - per channel setting, nothing to do here
1136

    
1137
        # 47 SKIP = per channel setting, nothing to do here
1138

    
1139
        # 48 SPLIT - per channel attribute, nothing to do here
1140

    
1141
        # 49 SQL.TYP - per channel attribute, nothing to do here
1142

    
1143
        # 50 STEP - per channel attribute, nothing to do here
1144

    
1145
        # 51 TEMP - read-only status, nothing to do here
1146

    
1147
        # 52 TN FRQ - per channel attribute, nothing to do here
1148

    
1149
        # 53 TOT
1150
        opts = ["Off", "1 Min", "3 Min", "5 Min", "10 Min"]
1151
        misc.append(RadioSetting("tot", "Timeout Timer",
1152
                                 RadioSettingValueList(opts,
1153
                                                       opts[_settings.tot])))
1154

    
1155
        # 54 TS MUT
1156
        opts = ["Off", "On"]
1157
        ctcss.append(RadioSetting("ts_mut", "Tone Search Mute",
1158
                                  RadioSettingValueList(opts,
1159
                                                        opts[_settings
1160
                                                             .ts_mut])))
1161

    
1162
        # 55 TS SPEED
1163
        opts = ["Fast", "Slow"]
1164
        ctcss.append(RadioSetting("ts_speed", "Tone Search Scanner Speed",
1165
                                  RadioSettingValueList(opts,
1166
                                                        opts[_settings
1167
                                                             .ts_speed])))
1168

    
1169
        # 56 VFO.SCN
1170
        opts = ["+/- 1MHz", "+/- 2MHz", "+/-5MHz", "All"]
1171
        scan.append(RadioSetting("vfo_scan", "VFO Scanner Width",
1172
                                 RadioSettingValueList(opts,
1173
                                                       opts[_settings
1174
                                                            .vfo_scan])))
1175

    
1176
        # 57 WX.ALT
1177
        opts = ["Off", "On"]
1178
        misc.append(RadioSetting("wx_alert", "Weather Alert Scan",
1179
                                 RadioSettingValueList(opts, opts[
1180
                                                       _settings.wx_alert])))
1181

    
1182
        # 58 WX.VOL
1183
        opts = ["Normal", "Maximum"]
1184
        misc.append(RadioSetting("wx_vol_max", "Weather Alert Volume",
1185
                                 RadioSettingValueList(opts, opts[
1186
                                                       _settings.wx_vol_max])))
1187

    
1188
        # 59 W/N DV - this is a per-channel attribute, nothing to do here
1189

    
1190
        return setmode
1191

    
1192
    def set_settings(self, uisettings):
1193
        _settings = self._memobj.settings
1194
        for element in uisettings:
1195
            if not isinstance(element, RadioSetting):
1196
                self.set_settings(element)
1197
                continue
1198
            if not element.changed():
1199
                continue
1200

    
1201
            try:
1202
                name = element.get_name()
1203
                value = element.value
1204

    
1205
                if element.has_apply_callback():
1206
                    LOG.debug("Using apply callback")
1207
                    element.run_apply_callback()
1208
                else:
1209
                    obj = getattr(_settings, name)
1210
                    setattr(_settings, name, value)
1211

    
1212
                LOG.debug("Setting %s: %s" % (name, value))
1213
            except Exception as e:
1214
                LOG.debug(element.get_name())
1215
                raise
1216

    
1217
    def get_bank_model(self):
1218
        return FT2900BankModel(self)
1219

    
1220
    @classmethod
1221
    def match_model(cls, filedata, filename):
1222
        return len(filedata) == cls._memsize
1223

    
1224
    @classmethod
1225
    def get_prompts(cls):
1226
        rp = chirp_common.RadioPrompts()
1227
        rp.pre_download = _(dedent("""\
1228
            1. Turn Radio off.
1229
            2. Connect data cable.
1230
            3. While holding "A/N LOW" button, turn radio on.
1231
            4. <b>After clicking OK</b>, press "SET MHz" to send image."""))
1232
        rp.pre_upload = _(dedent("""\
1233
            1. Turn Radio off.
1234
            2. Connect data cable.
1235
            3. While holding "A/N LOW" button, turn radio on.
1236
            4. Press "MW D/MR" to receive image.
1237
            5. Make sure display says "-WAIT-" (see note below if not)
1238
            6. Click OK to dismiss this dialog and start transfer.
1239

    
1240
            Note: if you don't see "-WAIT-" at step 5, try cycling
1241
                  power and pressing and holding red "*L" button to unlock
1242
                  radio, then start back at step 1."""))
1243
        return rp
1244

    
1245

    
1246
# the FT2900E is the European version of the radio, almost identical
1247
# to the R (USA) version, except for the model number and ID Block.  We
1248
# create and register a class for it, with only the needed overrides
1249
# NOTE: Disabled until detection is fixed
1250
# @directory.register
1251
class FT2900ERadio(FT2900Radio):
1252

    
1253
    """Yaesu FT-2900E"""
1254
    MODEL = "FT-2900E/1900E"
1255
    VARIANT = "E"
1256
    IDBLOCK = b"\x56\x43\x32\x33\x00\x02\x41\x02\x01\x01"
1257

    
1258

    
1259
# This class is for the TX Modified FT-1900/FT-2900 (MARS/CAP Mod).
1260
# Enabling out of band TX changes the header received by CHIRP
1261
@directory.register
1262
class FT2900ModRadio(FT2900Radio):
1263

    
1264
    """Yaesu FT-2900Mod"""
1265
    MODEL = "FT-2900R/1900R(TXMod)"
1266
    VARIANT = "Opened Xmit"
1267
    IDBLOCK = b"\x56\x43\x32\x33\x00\x02\xc7\x01\x01\x01"
1268

    
1269
    @classmethod
1270
    def match_model(cls, filedata, filename):
1271
        return False
(3-3/3)