Project

General

Profile

Bug #10274 » ft2900.py

Dan Smith, 01/15/2023 02:00 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
    NEEDS_COMPAT_SERIAL = False
504

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

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

    
511
        rf.memory_bounds = (0, 199)
512

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

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

    
533
        return rf
534

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

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

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

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

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

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

    
573
        mem = chirp_common.Memory()
574

    
575
        mem.number = number
576

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

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

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

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

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

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

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

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

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

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

    
625
        return mem
626

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

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

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

    
636
        if not valid:
637
            _wipe_memory(_mem)
638

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

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

    
645
        if mem.empty:
646
            return
647

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1025
        # 32 PAGER - a per-channel attribute
1026

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1191
        return setmode
1192

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

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

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

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

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

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

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

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

    
1246

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

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

    
1259

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

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

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