[chirp_devel] Baofeng UV-B5 Wide Splits and Cross-Band Programming
Marco Filippi IZ3GME
Thu Apr 30 03:46:16 PDT 2015
Hi Jim
in attach you can find a patch that add the check directly to
chirp_common, this way the check will be used by all radios.
Obviously the local validate_memory in uv5r driver is not needed anymore.
I also had to refine the bruteforce test which was using an invalid tx freq.
The patch is working and passes the automatic tests but I suggest you to
deeply test it.
73 de IZ3GME Marco
On 29/04/2015 12:33, Jim Unroe wrote:
> I didn't get to this until late (too late) last night. I should have
> waited until today after work because I can tell that I will pay for
> it at work today. ;-)
>
>> > And I'm not sure if the "_" prior to the "(" is
>>> intentional or a typo.
>>
>> It's intentional: it invokes the translation funtion for the string,
>> IMHO all strings visible to users should be passed to _
>
> I will check into this more to hopefully understand how this works. I
> just thought the _ was a convention and didn't realize it was being
> passed to anything. Thanks for the heads up.
>
>
>>> The one thing I noticed, and I may be overlooking something, is that
>>> when invoking " def validate_memory(self, mem):" locally, it seems
>>> to replace the "common" one. That's why I had code to check the Rx
>>> frequency as well. This seems to let me enter any Rx frequency.
>>
>> That's strange: in your validate_memory you call
>> chirp_common.CloneModeRadio.validate_memory which should check for the
>> rx freq to be withing ranges.
>
> Yes. If I key in 600. which is out of range, there is no error to the
> user. The row is greyed out an unusable, but no error.
>
> In the command window there is this error: "UnboundLocalError: local
> variable 'freq' referenced before assignment"
>
> I will repeat the current code below...
>
> def validate_memory(self, mem):
> msgs = chirp_common.CloneModeRadio.validate_memory(self, mem)
>
> if mem.duplex == "split":
> freq = mem.offset
> elif mem.duplex == "-":
> freq = mem.freq - mem.offset
> elif mem.duplex == "+":
> freq = mem.freq + mem.offset
> elif mem.duplex != "":
> msgs.append(chirp_common.ValidationError(
> _("Invalid duplex %s") % mem.duplex))
> return msgs
>
> valid = False
> for lo, hi in VALID_BANDS:
> if lo <= freq < hi:
> valid = True
> break
>
> if not valid:
> _msg = ("Tx freq %s is out of supported range") % \
> chirp_common.format_freq(freq)
> msgs.append(chirp_common.ValidationError(_msg))
>
> return msgs
>
> I believe that none of the initial if/elif statements are matched so
> when the code reaches " if lo <= freq < hi:", the variable "freq"
> hasn't been referenced.
>
> There is also nothing to deal with when Duplex is set to "off"
>
> I don't know if I will have time to look into this further after work
> tonight, but I will try.
>
> Thanks for you input and ideas with this Marco. I like where it is going.
>
> Jim KC9HI
> _______________________________________________
> chirp_devel mailing list
> chirp_devel at intrepid.danplanet.com
> http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
> Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: split.patch
Type: text/x-patch
Size: 1896 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20150430/cc5f8552/attachment-0001.bin
More information about the chirp_devel
mailing list