<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Jim,<div><br></div><div>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.</div><div><br></div><div>Maybe you just need to divide the index by 16 when you access STEP_LIST: </div><div><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap: break-word; "><div class="h5"><blockquote type="cite">RadioSettingValueList(STEP_LIST,<br> STEP_LIST[self._memobj.vfoa.step/16])</blockquote></div></div></blockquote></div></blockquote></div><div><br></div><div>Or maybe a dictionary rather than an array would work better:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>STEP_LIST = {0x0: 2.5, 0x10: 5.0, 0x20: 6.25, … }</div><div><br></div><div><div>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. :)</div><div><br></div><div> -Les</div><div><br></div><div><br></div><div><div>On 13 Jan 2013, at 16:14, Jim Unroe <<a href="mailto:rock.unroe@gmail.com">rock.unroe@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Les,<br><br>OK. Let me try to say it another way<br><br>My STEP_LIST is a sequence of the available steps: 2.5, 5.0, 6.25, 10.0 etc.<br><br>The structure vfoa.step that I am reading from and writing to corresponds to 0x00, 0x10, 0x20, 0x30 etc.<br>
<br>So I'm thinking that somehow I read the value, divide by 16 and then display it in the settings tab.<br>Then if the user changes the setting, it get multiplied by 16 and get written back.<br><br>Do I make sense?<br>
<br>Jim<br><br><br><div class="gmail_quote">On Sun, Jan 13, 2013 at 6:04 PM, Les Niles <span dir="ltr"><<a href="mailto:les@2pi.org" target="_blank">les@2pi.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
<div style="word-wrap:break-word">If STEP_LIST is a sequence of the radio memory values 0x0, 0x10, 0x20, etc., then<div><span style="white-space:pre-wrap">        </span>map(lambda x: x/16, STEP_LIST)</div>will return a sequence [0, 1, 2, …]<div>
Is that what you're looking for?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div> -Les</div></font></span><div><div class="h5"><div><br></div><div><br><div><div><div>On 13 Jan 2013, at 6:29, Jim Unroe <<a href="mailto:rock.unroe@gmail.com" target="_blank">rock.unroe@gmail.com</a>> wrote:</div>
<blockquote type="cite"><br><div class="gmail_quote">On Sat, Jan 12, 2013 at 8:38 PM, Andrew Errington <span dir="ltr"><<a href="mailto:erringtona@gmail.com" target="_blank">erringtona@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
<br>
</div>What do you need to do? If you are writing software and you need to convert<br>
0, 1, 2, 3 ... 14 to 0x00, 0x10, 0x20, 0x30 ... 0xE0 then just multiply by<br>
16.<br>
<br>
0 x 16 = 0 = 0x00<br>
1 x 16 = 16 = 0x10<br>
2 x 16 = 32 = 0x20<br>
3 x 16 = 48 = 0x30<br>
.<br>
.<br>
.<br>
14 x 16 = 224 = 0xE0<br>
<br>
Is that what you need to do, or do I misunderstand your question?<br>
<br></blockquote></div>Andrew,<br><br>I want to use this in a scenario similar to this to create a menu setting item for 'step'<br><br> rs = RadioSetting("vfoa.step", "VFO A Tuning Step",<br>
RadioSettingValueList(STEP_LIST,<br> STEP_LIST[self._memobj.vfoa.step]))<br> vfopresets.append(rs)<br><br>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).<br>
<br>This is probably simple to implement but right now I can't see the forest for the trees.<br><br>73,<br>Jim<br></blockquote></div><br></div></div></div></div></div></blockquote></div></blockquote></div><br></div></body></html>