On Sun, Feb 16, 2014 at 7:00 PM, Jim Unroe <rock.unroe@gmail.com> wrote:



On Wed, Feb 5, 2014 at 8:17 PM, Dan Smith <dsmith@danplanet.com> wrote:

It also looks like the two radios count their memories differently, one
being from zero and the other from one. In that case, you might just add
a method like this for the uv5:

  def _get_mem(self, number):
      return self._memobj.memory[number]

and then override it in the UV6 class like this:

  def _get_mem(self, number):
      return self._memobj.memory[number - 1]

then in get_memory(), you can do this:

  mem = self._get_mem(number)

and it will do the right thing in each class.

Apparently I need to do something similar for set_memory(). I've tried to do it similar to the above but can't quite get it. Here are the original lines...

    def set_memory(self, mem):
        _mem = self._memobj.memory[mem.number]

I think I may have figure it out on my own.

    def _set_mem(self, number):
        return self._memobj.memory[number]

     def set_memory(self, mem):
        _mem = self._get_mem(mem.number)
 
Jim