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@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@gmail.com wrote:
On Sat, Jan 12, 2013 at 8:38 PM, Andrew Errington erringtona@gmail.comwrote:
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
chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers