[chirp_devel] [PATCH] fix bad cable errors for some users on upload #1397 (2)
# HG changeset patch # User Jens Jensen kd4tjx@yahoo.com # Date 1391521135 21600 # Node ID 15921d1f283385b04fe8e52a44398c858d4f7684 # Parent 7ed1f8fad43b085b2339ffccafb17fcf0edbd446 fix bad cable errors for some users on upload #1397 (2)
Had port open logic backwards in first attempt. Always drink coffee beforehand!
diff -r 7ed1f8fad43b -r 15921d1f2833 chirpui/mainapp.py --- a/chirpui/mainapp.py Tue Feb 04 06:46:57 2014 -0600 +++ b/chirpui/mainapp.py Tue Feb 04 07:38:55 2014 -0600 @@ -656,9 +656,9 @@ if not settings: return prompts = radio.get_prompts() - - if prompts.open_port_before_upload_prompt == True: - print "Opening port before pre_upload prompt." + + if prompts.open_port_before_upload_prompt == False: + print "Opening port after pre_upload prompt." self._show_instructions(radio, prompts.pre_upload)
if isinstance(radio, chirp_common.ExperimentalRadio) and \ @@ -678,8 +678,8 @@ d.destroy() return
- if prompts.open_port_before_upload_prompt == False: - print "Opening port after pre_upload prompt." + if prompts.open_port_before_upload_prompt == True: + print "Opening port before pre_upload prompt." self._show_instructions(radio, prompts.pre_upload)
radio.set_pipe(ser)
if prompts.open_port_before_upload_prompt == True:
print "Opening port before pre_upload prompt."
if prompts.open_port_before_upload_prompt == False:
print "Opening port after pre_upload prompt." self._show_instructions(radio, prompts.pre_upload)
I'm confused. This looks wrong to me. "If open_before is False, then open (before)"
if prompts.open_port_before_upload_prompt == False:
print "Opening port after pre_upload prompt."
if prompts.open_port_before_upload_prompt == True:
print "Opening port before pre_upload prompt." self._show_instructions(radio, prompts.pre_upload)
"If open_before is true, then open (after)".
Didn't you have it right the first time?
--Dan
after looking at it a few times i _think_ i have it right…
the actual port open happens in between these statements the action of these statements is to display the pre_upload prompt (not open port!)
so sequence is: 1. if open_port_before_upload_prompt is False, then display pre_upload prompt 2. open port 3. if open_port_before_upload_prompt is True, then display pre_upload prompt
At first glance it is sort of confusing, but the reasoning for this approach was because it was the most straightforward, minimalist way i could think to do this without revamping the entire section. (I just got the logic backwards - at least i think its right this time.)
oh well, now that you got me thinking, perhaps the symbol name should be: display_pre_upload_prompt_before_port_open? maybe this would make it more straightforward (albeit a bit verbose, which imho would be preferred for maintainability and comprehensibility).
Have you already committed the related previous patch? Thoughts?
________________________________ From: Dan Smith dsmith@danplanet.com To: chirp_devel@intrepid.danplanet.com Sent: Wednesday, February 5, 2014 6:50 PM Subject: Re: [chirp_devel] [PATCH] fix bad cable errors for some users on upload #1397 (2)
- if prompts.open_port_before_upload_prompt == True: - print "Opening port before pre_upload prompt." + + if prompts.open_port_before_upload_prompt == False: + print "Opening port after pre_upload prompt." self._show_instructions(radio, prompts.pre_upload)
I'm confused. This looks wrong to me. "If open_before is False, then open (before)"
- if prompts.open_port_before_upload_prompt == False: - print "Opening port after pre_upload prompt." + if prompts.open_port_before_upload_prompt == True: + print "Opening port before pre_upload prompt." self._show_instructions(radio, prompts.pre_upload)
"If open_before is true, then open (after)".
Didn't you have it right the first time?
--Dan
_______________________________________________ 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
At first glance it is sort of confusing, but the reasoning for this approach was because it was the most straightforward, minimalist way i could think to do this without revamping the entire section. (I just got the logic backwards - at least i think its right this time.)
oh well, now that you got me thinking, perhaps the symbol name should be: display_pre_upload_prompt_before_port_open? maybe this would make it more straightforward (albeit a bit verbose, which imho would be preferred for maintainability and comprehensibility).
Ah, yeah, I think that's probably why you made the mistake in the first place, and why I tripped over the name in the same way. I think the change you propose above would make much more sense. I can see us (myself) tripping over that in the future for sure.
Have you already committed the related previous patch?
Nope, not yet, wanna respin the original?
Thanks!
--Dan
participants (3)
-
Dan Smith
-
Jens J.
-
Jens Jensen