[chirp_devel] Need help with UV-5R reading/writing
Hi all,
I wish I new the correct terms to use to ask this question, but I don't. I have a value that I need to read and write to a UV-5R memory location. It appears that the values for 0, 1, 2, 3 ... 14 are hex 00, 10, 20, 30 ... E0 in the image file.
Would someone get me pointed in the right direction?
Thanks, Jim
On Sun, 13 Jan 2013 09:54:42 Jim Unroe wrote:
Hi all,
I wish I new the correct terms to use to ask this question, but I don't. I have a value that I need to read and write to a UV-5R memory location. It appears that the values for 0, 1, 2, 3 ... 14 are hex 00, 10, 20, 30 ... E0 in the image file.
Would someone get me pointed in the right direction?
Thanks, Jim
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?
73,
Andrew
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
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.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
Hi Les, I'm not sure, but I think so. I'll play around with. That will at least give me something to look for in other drivers to maybe see other examples. Thanks. 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
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
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@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@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.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
Les, Half way there...
On Sun, Jan 13, 2013 at 8:52 PM, Les Niles les@2pi.org wrote:
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])
The "STEP_LIST[self._memobj.vfoa.step/16])" works for reading the values
from the UV-5R. Now I just have to figure out the right way to *16 the other direction.
Jim
I can't understand which is the reason not to define step as
u8 step:4, unknown:4;
73 de IZ3GME Marco
On 14/01/2013 03:50, Jim Unroe wrote:
Les, Half way there...
On Sun, Jan 13, 2013 at 8:52 PM, Les Niles <les@2pi.org mailto:les@2pi.org> wrote:
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])
The "STEP_LIST[self._memobj.vfoa.step/16])" works for reading the values from the UV-5R. Now I just have to figure out the right way to *16 the other direction.
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
Hi Marco, Thanks. That was way too simple. Jim
On Mon, Jan 14, 2013 at 3:24 AM, IZ3GME Marco iz3gme.marco@gmail.comwrote:
I can't understand which is the reason not to define step as
u8 step:4, unknown:4;
73 de IZ3GME Marco
On 14/01/2013 03:50, Jim Unroe wrote:
Les, Half way there...
On Sun, Jan 13, 2013 at 8:52 PM, Les Niles <les@2pi.org mailto:les@2pi.org> wrote:
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])
The "STEP_LIST[self._memobj.vfoa.step/16])" works for reading the values from the UV-5R. Now I just have to figure out the right way to *16 the other direction.
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
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
participants (4)
-
Andrew Errington
-
IZ3GME Marco
-
Jim Unroe
-
Les Niles