[chirp_devel] Style query
Brian Dickman
Mon Oct 8 20:29:56 PDT 2018
Hey Declan,
Since the memory map is just a big string, you can format it before
parsing. For example:
#############################
MEM_FORMAT = """
#seekto 0x%(memstart_address)x
struct { ...
"""
_myclass_mem_formatter = { 'memstart_address': 0xffff }
self._memobj = bitwise.parse( MEM_FORMAT % _myclass_mem_formatter,
self._mmap )
#################################
Now each of your classes can define their own mem_formatter values, but
keep the same MEM_FORMAT. This is used in the leixen.py driver for
reference, and probably a few others by now.
--
Brian AF7MD
On Mon, Oct 8, 2018 at 5:09 PM NNN Wx via chirp_devel <
chirp_devel at intrepid.danplanet.com> wrote:
> Sorry to bother all developers, but I’ve a question about mechanism (maybe
> it’s Python, probably it’s CHIRP):
>
> I’ve another FT2D patch in mind: Chirp doesn’t correctly handle DTMF
> definitions for this radio.
> I’ve tracked it down to the memory location defined in the FT1D driver
> (which FT2D inherits.)
> Does the FT1D correctly display and modify the DTMF definitions (perhaps
> the address is incorrect in the FT1D as well)???
>
> What is the correct way to change a memory definition in a child driver?
>
> - I can change the parent driver’s seekto address to be a variable. But
> then I’ll need to change the parent and EVERY child driver to include its
> variable definition. My present candidate driver does it this way (mods to
> Yaesu ft1d, ft2d, and ftm3000). If I use my changes, the driver correctly
> displays and allows changes to DTMF definitions.
> - Is there a better way to override part of the parent’s memory map? I’d
> think it’d be a smaller change if I could simply modify the ft2d.py driver.
>
> ft1d: _____________
> #seekto 0x0e4a #<- see the address change
> struct {
> u8 memory[16];
> } dtmf[10];
>
> ft2d: _____________
> #seekto 0x094a #<-
> struct {
> u8 memory[16];
> } dtmf[10];
> _______________
> Declan Rieb WD5EQY
> wd5eqy at arrl.net
>
>
>
>
>
> _______________________________________________
> chirp_devel mailing list
> chirp_devel at intrepid.danplanet.com
> http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
> Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20181008/e6187dd4/attachment-0001.html
More information about the chirp_devel
mailing list