[chirp_devel] Need help with UV-5R reading/writing

Les Niles
Sun Jan 13 17:52:16 PST 2013


Jim,

In that case, what I suggested won't work.  Especially if the mapping is non-uniform, that is, the freq steps are all integer multiples of the smallest step.

Maybe you just need to divide the index by 16 when you access STEP_LIST: 
>> RadioSettingValueList(STEP_LIST,
>>                                                     STEP_LIST[self._memobj.vfoa.step/16])


Or maybe a dictionary rather than an array would work better:
	STEP_LIST = {0x0: 2.5, 0x10: 5.0, 0x20: 6.25, … }

It's hard to tell what the best method would be, without seeing all of the related code.  And no, I'm not asking to join the UV-5R driver team. :)

  -Les


On 13 Jan 2013, at 16:14, Jim Unroe <rock.unroe at gmail.com> wrote:

> Les,
> 
> OK. Let me try to say it another way
> 
> My STEP_LIST is a sequence of the available steps: 2.5, 5.0, 6.25, 10.0 etc.
> 
> The structure vfoa.step that I am reading from and writing to corresponds to 0x00, 0x10, 0x20, 0x30 etc.
> 
> So I'm thinking that somehow I read the value, divide by 16 and then display it in the settings tab.
> Then if the user changes the setting, it get multiplied by 16 and get written back.
> 
> Do I make sense?
> 
> Jim
> 
> 
> On Sun, Jan 13, 2013 at 6:04 PM, Les Niles <les at 2pi.org> wrote:
> If STEP_LIST is a sequence of the radio memory values 0x0, 0x10, 0x20, etc., then
> 	map(lambda x: x/16, STEP_LIST)
> will return a sequence [0, 1, 2, …]
> Is that what you're looking for?
> 
>   -Les
> 
> 
> On 13 Jan 2013, at 6:29, Jim Unroe <rock.unroe at gmail.com> wrote:
>> 
>> On Sat, Jan 12, 2013 at 8:38 PM, Andrew Errington <erringtona at gmail.com> wrote:
>> 
>> 
>> What do you need to do?  If you are writing software and you need to convert
>> 0, 1, 2, 3 ... 14 to 0x00, 0x10, 0x20, 0x30 ... 0xE0 then just multiply by
>> 16.
>> 
>> 0 x 16 = 0 = 0x00
>> 1 x 16 = 16 = 0x10
>> 2 x 16 = 32 = 0x20
>> 3 x 16 = 48 = 0x30
>> .
>> .
>> .
>> 14 x 16 = 224 = 0xE0
>> 
>> Is that what you need to do, or do I misunderstand your question?
>> 
>> Andrew,
>> 
>> I want to use this in a scenario similar to this to create a menu setting item for 'step'
>> 
>>             rs = RadioSetting("vfoa.step", "VFO A Tuning Step",
>>                               RadioSettingValueList(STEP_LIST,
>>                                                     STEP_LIST[self._memobj.vfoa.step]))
>>             vfopresets.append(rs)
>> 
>> The structure 'vfoa' has 'step' in it but the above doesn't work (out of range) because of the difference between the 0, 1, 2, 3 ... 14 vs. the 0x00, 0x01, 0x02, 0x03 ... 0xE0 (or 0, 16, 32, 48 ... 224).
>> 
>> This is probably simple to implement but right now I can't see the forest for the trees.
>> 
>> 73,
>> Jim
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130113/24128753/attachment-0001.html 


More information about the chirp_devel mailing list