[chirp_devel] [UV-5R] Looking for Advice

Jim Unroe
Sat Feb 23 19:32:43 PST 2013


On Sat, Feb 23, 2013 at 7:03 PM, Dan Smith <dsmith at danplanet.com> wrote:

> > I want to create a selection for the UV-5R that depending the the
> > users' selection (either tick like Boolean, or a two choice list),
> > one or the other of the following is written.
> >
> > "\x0E\x0F\x10\x11\x15"
> > "\x00\x00\x00\x00\x00"
>
> You mean a RadioSetting? Maybe something like this untested snipped:
>
>  def apply_foobar(setting, obj):
>      if setting.value == True:
>          obj.foobar = "\x0E\x0F\x10\x11\x15"
>      else:
>          obj.foobar = "\x00\x00\x00\x00\x00"
>
>  rs = RadioSetting("foobar", "Enable Foobar", RadioSettingBoolean(False))
>  rs.set_apply_callback(apply_foobar, self._memobj)
>
>
> Thanks Dan. That is what I am looking for. I don't have it working yet,
though.

Here is my structure...

#seekto 0x0F08;
struct {
  u8 foobar[5];
} test;


Here is my RadioSetting() code...

        def apply_txinhibit(setting, obj):
            if setting.value == True:
                obj.foobar = "\x00\x00\x00\x00\x00"
            else:
                obj.foobar = "\x0E\x0F\x10\x11\x15"

        rs = RadioSetting("test.foobar", "TX Inhibit",
                          RadioSettingValueBoolean(False))
        rs.set_apply_callback(apply_txinhibit, self._memobj.test)
        other.append(rs)


Here is my error...

Setting enable = True
Using apply callback
test.foobar
Exception running RadioJob: invalid literal for int() with base 10: '\x0e'
-- Exception: --
Traceback (most recent call last):
  File "C:\Users\Root\chirp.hg\chirpui\common.py", line 97, in _execute
    result = func(*self.args, **self.kwargs)
  File "C:\Users\Root\chirp.hg\chirp\uv5r.py", line 1160, in set_settings
    self.set_settings(element)
  File "C:\Users\Root\chirp.hg\chirp\uv5r.py", line 1181, in set_settings
    element.run_apply_callback()
  File "C:\Users\Root\chirp.hg\chirp\settings.py", line 288, in
run_apply_callba
ck
    return self._apply_callback()
  File "C:\Users\Root\chirp.hg\chirp\settings.py", line 282, in <lambda>
    self._apply_callback = lambda: callback(self, *args)
  File "C:\Users\Root\chirp.hg\chirp\uv5r.py", line 916, in apply_txinhibit
    obj.foobar = "\x0E\x0F\x10\x11\x15"
  File "C:\Users\Root\chirp.hg\chirp\bitwise.py", line 591, in __setattr__
    self.__dict__["_generators"][name].set_value(value)
  File "C:\Users\Root\chirp.hg\chirp\bitwise.py", line 238, in set_value
    self.__items[i].set_value(value[i])
  File "C:\Users\Root\chirp.hg\chirp\bitwise.py", line 381, in set_value
    self._data[self._offset] = (int(value) & 0xFF)
ValueError: invalid literal for int() with base 10: '\x0e'
------
Job Args:   (<chirp.settings.RadioSettingGroup object at 0x03B1A490>,)
Job KWArgs: {}
Job Called from:
  File "chirpw", line 144, in <module>
    gtk.main()
  File "C:\Users\Root\chirp.hg\chirpui\settingsedit.py", line 119, in
_save_sett
ing
    self._do_save_setting(widget, value)
  File "C:\Users\Root\chirp.hg\chirpui\settingsedit.py", line 115, in
_do_save_s
etting
    self._save_settings()
  File "C:\Users\Root\chirp.hg\chirpui\settingsedit.py", line 71, in
_save_setti
ngs
    self._top_setting_group)


I think I will sleep on it and study it some more in the morning.

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130223/9150a3f4/attachment-0001.html 


More information about the chirp_devel mailing list