Project

General

Profile

New Model #1469 » ftm400.patch

Updated patch, reads both types of file from SD card - Tom Hayward, 03/14/2014 01:58 PM

View differences:

/dev/null Thu Jan 01 00:00:00 1970 +0000 → chirp/ftm400.py Fri Mar 14 13:51:53 2014 -0700
# Copyright 2014 Tom Hayward <tom@tomh.us>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import bitwise, directory, ftm350
mem_struct = """
struct mem {
u8 used:1,
skip:2,
unknown1:5;
u8 unknown2:1,
mode:3,
unknown8:1,
oddsplit:1,
duplex:2;
bbcd freq[3];
u8 unknownA:1,
tmode:3,
unknownB:4;
bbcd split[3];
u8 power:2,
tone:6;
u8 unknownC:1,
dtcs:7;
u8 showalpha:1,
unknown5:7;
u8 unknown6;
u8 offset;
u8 unknown7[2];
};
struct lab {
u8 string[8];
};
struct callsign {
char call[6];
u8 ssid;
};
"""
mem_file_offsets_full = mem_struct + """
#seekto 0x0508;
struct callsign aprs_my_callsign;
#seekto 0x00b0;
struct mem left_memory_zero;
#seekto 0x01b0;
struct lab left_label_zero;
#seekto 0x00b0;
struct mem right_memory_zero;
#seekto 0x01b0;
struct lab right_label_zero;
#seekto 0x0800;
struct mem left_memory[500];
#seekto 0x0800;
struct mem right_memory[500];
#seekto 0x48C0;
struct lab left_label[518];
struct lab right_label[518];
"""
mem_file_offsets_memory_only = mem_struct + """
#seekto 0x00b0;
struct mem left_memory_zero;
#seekto 0x01b0;
struct lab left_label_zero;
#seekto 0x00b0;
struct mem right_memory_zero;
#seekto 0x01b0;
struct lab right_label_zero;
#seekto 0x0200;
struct mem left_memory[500];
#seekto 0x0200;
struct mem right_memory[500];
#seekto 0x42C0;
struct lab left_label[518];
struct lab right_label[518];
"""
@directory.register
class FTM400Radio(ftm350.FTM350Radio):
"""Yaesu FTM-400"""
BAUD_RATE = 48000
VENDOR = "Yaesu"
MODEL = "FTM-400"
_model = "AH034$"
def get_sub_devices(self):
return [FTM400RadioLeft(self._mmap), FTM400RadioRight(self._mmap)]
def process_mmap(self):
for cls in [FTM400FileMemory, FTM400FileFull]:
if cls._memsize == len(self._mmap):
self._memobj = bitwise.parse(cls._mem_format, self._mmap)
return
@classmethod
def match_model(self, filedata, filename):
print filename, len(filedata)
return len(filedata) == self._memsize \
and filedata.startswith(self._model)
class FTM400RadioLeft(FTM400Radio):
VARIANT = "Left"
_vfo = "left"
class FTM400RadioRight(FTM400Radio):
VARIANT = "Right"
_vfo = "right"
@directory.register
class FTM400FileFull(FTM400Radio):
"""Yaesu FTM-400 memory + settings file from SD card"""
VENDOR = "Yaesu"
MODEL = "FTM-400 full file"
_memsize = 76800
_mem_format = mem_file_offsets_full
@directory.register
class FTM400FileMemory(FTM400Radio):
"""Yaesu FTM-400 memories-only file from SD card"""
VENDOR = "Yaesu"
MODEL = "FTM-400 memory file"
_memsize = 25600
_mem_format = mem_file_offsets_memory_only
chirpui/mainapp.py Sun Mar 02 19:37:13 2014 -0500 → chirpui/mainapp.py Fri Mar 14 13:51:53 2014 -0700
types = [(_("CHIRP Radio Images") + " (*.img)", "*.img"),
(_("CHIRP Files") + " (*.chirp)", "*.chirp"),
(_("CSV Files") + " (*.csv)", "*.csv"),
(_("FTM-400 Files") + " (*.dat)", "*.dat"),
(_("EVE Files (VX5)") + " (*.eve)", "*.eve"),
(_("ICF Files") + " (*.icf)", "*.icf"),
(_("VX5 Commander Files") + " (*.vx5)", "*.vx5"),
......
types = [(_("CHIRP Files") + " (*.chirp)", "*.chirp"),
(_("CHIRP Radio Images") + " (*.img)", "*.img"),
(_("CSV Files") + " (*.csv)", "*.csv"),
(_("FTM-400 Files") + " (*.dat)", "*.dat"),
(_("EVE Files (VX5)") + " (*.eve)", "*.eve"),
(_("ICF Files") + " (*.icf)", "*.icf"),
(_("Kenwood HMK Files") + " (*.hmk)", "*.hmk"),
(3-3/6)