[chirp_devel] Clarification about the implementation of template.py

Dan Smith
Tue Feb 25 15:00:40 PST 2020


> Hello, it seems that there's a problem in the implementation of
> template.py, or perhaps I'm not understanding it correctly.
> 
> self._memobj is populated in the self.sync_in function, but that
> function is only called when the image is downloaded from the radio, and
> not when a file is loaded by hand. In other words, the template.py
> implementation will crash when a file is loaded because self._memobj
> won't be defined by the time the memories are read.
> 
> It looks like most radio drivers have fixed this by populating
> self._memobj in a function called self.process_mmap, and then calling
> self.process_mmap from self.sync_in.

Right and load_mmap(), called from load(), calls process_mmap() to initialize the memobj when loading from a file. This hasn't really changed, it's just that the template is never really tested because it's not real. I just pushed this to clear it up:

https://chirp.danplanet.com/projects/chirp/repository/revisions/b96f891fab28/diff

Thanks!

--Dan


More information about the chirp_devel mailing list