Hello all, TIA for any help you can give me below ;)
Firstly, great software, really useful, Thanks! Secondly, I'm not an accomplished python programmer, but have spend a while doing embedded C on micro's. So most likely I'm going to ask a naive question. Third, I'm attempting to get a new driver for an ICOM M710, it's a commercial HF Marine SSB radio that has limited support, but there are a few of us still using them.
That said, I've got part of the driver stood up, I can query it over the UART and get the memory dump. I've done a fair amount of sleuthing through the data and have a mild handle on the formatting of the data blob that comes out during download. I get a little less that 10,000 8 bit bytes from the rig, it's almost like a memory dump.
Is the intent of MemoryMapBytes to hold an "image" of that dump, but provide some structure to the blob for easier access?
It appears there are two channels per "record", there seems to be a record start marker with some channel information, 2x rx frequency, mode, name, and tx frequency then a checksum and end of record marker.
I've setup my memory format like this: MEM_FORMAT = """ struct mem_struct{ char rx_freq[9]; char mode; char name[14]; char tx_freq[8]; };
seekto 0x0000; struct { char unknown_SOR[11]; struct mem_struct channels[2]; char checksum[2]; char unknown_EOR; }memory[2]; """
So, to detail my question a bit more. I have a byte array that holds the incoming image that might look something like this: annotated with comments
#Channel 0 RX 12345.6 TX 27654.3 USB ABCDEFG FE FE EF EE E4 45 30 32 30 32 30 #?? start of record?? 31 32 33 34 35 36 30 30 30 #12345.6 30 #USB = 30, R3E = 31, AM = 32, LSB = 33, AFS = 34, FSK = 35, CW = 36 34 31 34 32 34 33 34 34 34 35 34 36 34 37 #ABCDEFG 32 37 36 35 34 33 30 30 #27654.3
#channel 1 RX 11111,1 TX 22222.2 31 31 31 31 31 31 30 30 30 #11111.1 30 #USB = 30 LSB = 33 34 38 34 39 34 41 34 42 34 43 34 44 34 45 #HIJKLMN 32 32 32 32 32 32 30 30 #22222.2 46 30 #?? this chaned when the mode changed checksum? FD #?? end of record ???
def do_download(radio): """This is your download function"""
#this is working, but no reason to keep hammering the radio right now #todo uncomment this later #init_download = bytes([0xFE, 0xFE, 0xEE, 0xEF, 0xE2, 0x16, 0x32, 0x00, 0x01, 0xFD]) #send(radio, init_download) #ack = radio.pipe.read(10) #check the ack
#todo read until FDFEFEEFEEE5FD is received. #data = bytes() #for _i in range(0, 9838): # data += radio.pipe.read(1)
# this is just what part of what the incoming data looks like, this is record 1 memory_image = ( [0xFE,0xFE,0xEF,0xEE,0xE4,0x45,0x30,0x32,0x30,0x32,0x30,0x31,0x32,0x33,0x34,0x35, 0x36,0x30,0x30,0x30,0x30,0x34,0x31,0x34,0x32,0x34,0x33,0x34,0x34,0x34,0x35,0x34, 0x36,0x34,0x37,0x32,0x37,0x36,0x35,0x34,0x33,0x30,0x30,0x31,0x31,0x31,0x31,0x31, 0x31,0x30,0x30,0x30,0x30,0x34,0x38,0x34,0x39,0x34,0x41,0x34,0x42,0x34,0x43,0x34, 0x44,0x34,0x45,0x32,0x32,0x32,0x32,0x32,0x33,0x30,0x30,0x46,0x32,0xFD])
print(memory_image) data = b"" data = memory_image
print(data) #return data return memmap.MemoryMapBytes(data)
//////////////////////////// output //////////////////////////////
[254, 254, 239, 238, 228, 69, 48, 50, 48, 50, 48, 49, 50, 51, 52, 53, 54, 48, 48, 48, 48, 52, 49, 52, 50, 52, 51, 52, 52, 52, 53, 52, 54, 52, 55, 50, 55, 54, 53, 52, 51, 48, 48, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 52, 56, 52, 57, 52, 65, 52, 66, 52, 67, 52, 68, 52, 69, 50, 50, 50, 50, 50, 51, 48, 48, 70, 50, 253] [254, 254, 239, 238, 228, 69, 48, 50, 48, 50, 48, 49, 50, 51, 52, 53, 54, 48, 48, 48, 48, 52, 49, 52, 50, 52, 51, 52, 52, 52, 53, 52, 54, 52, 55, 50, 55, 54, 53, 52, 51, 48, 48, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 52, 56, 52, 57, 52, 65, 52, 66, 52, 67, 52, 68, 52, 69, 50, 50, 50, 50, 50, 51, 48, 48, 70, 50, 253] ERROR: Failed to clone: Traceback (most recent call last): File "G:\Projects\HamRadio\Repo\chirp\chirp\wxui\clone.py", line 93, in run self._fn() File "G:\Projects\HamRadio\Repo\chirp\chirp\drivers\icom_m710.py", line 202, in sync_in self._mmap = do_download(self) ^^^^^^^^^^^^^^^^^ File "G:\Projects\HamRadio\Repo\chirp\chirp\drivers\icom_m710.py", line 121, in do_download return memmap.MemoryMapBytes(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\Projects\HamRadio\Repo\chirp\chirp\memmap.py", line 26, in __init__ assert isinstance(data, bytes) ^^^^^^^^^^^^^^^^^^^^^^^ AssertionError WARNING: Stopping clone thread