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
On Tue, Feb 4, 2014 at 1:34 PM, Dan Smith dsmith@danplanet.com wrote:
I've attached what I've done in the hope that it would help with giving
me direction.
I just diffed that with the UV5 driver and it looks really close. I think it would be best to unify them if at all possible. If I get you started on a subclass that can override things for the UV6 where they differ from the UV5, would you be okay taking a stab at finishing them?
--Dan
Yes. I'm sure that with a little guidance, I can handle it. I believe Jens was doing some of that when he was originally adding the BJ UV-55 to uv5r.py.
Jim
_______________________________________________ chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers