Yeah, take a look with what I did with bjuv55.py
I did that because there was a significant enough difference to put the subclass in a new module, but enough similarities to inherit from uv5r and not just copy it.
i think the way that bitwise memory map definitions are setup today (basically structures) make it difficult to do Object oriented
stuff to it like inheritance and overriding just parts.
It seems that if there are any differences in your custom model's memmap, some choices are:
1. make a separate complete copy of the memory map for that model and modify slightly (like I did in bjuv55.py). This is good for a large amount of
differences. But as this is lots of code real estate its best suited for subclassing in another module
2. if there are just differences in the offsets of certain parts of the memory map, but otherwise are the same, use a print format hack to set the offset when MEM_FORMAT is bitwise.parse'd. You can see this in action with the poweron_msg struct of the memmap that I did (based upon the idea from some other radio classes doing similar.)
3. statically create slightly differently named sections of the memory map unique to each radio, and then elsewhere detect and dynamically change the memory object property name to match the setting you are looking at. Looks like you might have already done this from looking at things like "sixpoweron_msg" vs "poweron_msg".
I think as we see more and more of UV-5R clones with ever-so-slight differences it will become more critical to
streamline this class.
Dan,
this reminds me - is there a way to "incrementally" load the bitwise structures into the memory map. The thought here was we could have a "common" channel map, and then might have custom settings, or event sections of settings depending upon model, and load the ones needed into the radio
class.
(This could be thought of as a piecemeal approach to populating the memory map?)
From: Jim Unroe
<rock.unroe@gmail.com>
To: chirp-devel <chirp_devel@intrepid.danplanet.com>
Sent: Tuesday, February 4, 2014 1:23 PM
Subject: Re: [chirp_devel] Baofeng UV-6 Radio