[chirp_devel] [PATCH] [btech] Delayed retry on writing to radio in case of errornous response. Needed mostly on linux. Fixes issue #3993

Dan Smith
Thu Sep 22 17:11:06 PDT 2016


>  # this var controls the verbosity in the debug and by default it's low (False)
>  # make it True and you will to get a very verbose debug.log
> -debug = False
> +debug = True

You don't want to leave this on for all chirp users.

> +# this variables controls the forced delay and retry on Linux OS mainly. Added by OE4AMW to workaround Issue 3993
> +NEEDS_DELAY = False
> +RETRY_DELAYED = False

These being module-level means they'll live for the lifetime of the
running process.

> +            # Some OS (mainly Linux ones) are two fast on the serial and
> +            # get the MCU inside the radio stuck in the early stages, this
> +            # hits some models more than others.
> +            #
> +            # To cope with that we introduce a delay on the writes but only if
> +            # we detect this problem, this was found by Michael Wagner who
> +            # proposed a patch for it, well done.
> +            if NEEDS_DELAY:
> +                # 10 msec is proved to be safe, is better to be slow and right
> +                # than fast and some times wrong. (5 msec is tested ok)
> +                sleep(0.010)

10ms inter-byte latency is crazy high. I also don't like making this
different on different platforms, even if we're doing it in response to
a short read.

I would rather we try things like writing eight bytes followed by a
delay or something like that.

> +            if NEEDS_DELAY:
> +                LOG.debug("This write was delayed")
> +

This will spam everyone's logs with one line for each byte of the memory
map. That's not reasonable, IMHO.

>              LOG.debug("==> (%d) bytes:\n\n%s" %
>                        (len(data), util.hexprint(data)))
> +

Stray whitespace damage here.

> @@ -1284,7 +1339,7 @@
>          if self.MODEL in ("UV-2501", "UV-5001"):
>              vfomren = RadioSetting("settings2.vfomren", "VFO/MR switching",
>                                     RadioSettingValueBoolean(
> -                                       _mem.settings2.vfomren))
> +                                       not _mem.settings2.vfomren))
>              advanced.append(vfomren)
>  
>              reseten = RadioSetting("settings2.reseten", "RESET",
> @@ -1569,6 +1624,8 @@
>                      if element.has_apply_callback():
>                          LOG.debug("Using apply callback")
>                          element.run_apply_callback()
> +                    elif setting == "vfomren":
> +                        setattr(obj, setting, not int(element.value))

These hunks appear unrelated to the rest of the change?

--Dan



More information about the chirp_devel mailing list