This removes the per-instance clone exit commands and implements them
properly in a finally: block on sync_in and sync_out so that unexpected
failures also clean up the radio state.
For these radios, if the baud rate is too low, the 250ms default
serial timeout will result in failure to read entire blocks right
off the bat. Increase it so it's always reasonable.
With this commit, the _set_tone_val() function now properly creates
binary-coded decimal (BCD) numbers, depending on how dcs_enc_base and
tone_enc_base are set when constructing a tone model.
The test cases were expanded to cover all permutations of valid values
for dcs_enc_base (8, 10, and 16) and tone_enc_base (10 and 16). All of
these test cases allow testing new inputs and outputs, as well as
validating that the new settings do not interfere with parsing when it
is not expected to.
As part of the 5RH driver work, it was suggested to look at using the
kenwood_tone functions as the data appeared to be similar. A closer
look showed that they were similar, but not enough to be functional.
The existing Kenwood function puts the tone frequency * 10 into a 16-bit
integer, such that 100.0 Hz becomes 1000 which becomes 0x03E8.
For the 5RH, the tone frequency * 10 is stored as a BCD (which is
effectively hexadecimal with six digits ignored). In this case, 100.0 Hz
becomes 1000 which becomes 0x1000.
In the process of testing the code, I modified the h777 driver to use it,
and discovered that those radios also stored the DCS code as BCD. Meaning
that a DCS code of 031, which would be stored as 0x0019 in octal or 0x001F
in decimal, would instead be stored as 0x0031.
The addition of the tone_enc_base variable for processing tone frequencies
as BCD, and the ability to set dcs_enc_base to 16 (effectively processing
as BCD), should widen the pool of potential users for this function, and
cut down on the number of separate tone implemenations and their tests.
With Dan's suggestion, this PR has been split into two parts: implementing
the first half (decoding with _get_tone_val()) to test against existing
code for encoding. The next commit will then implement the encoding half.
All test cases were duplicated using two tone models; model_dec with
dcs_enc_base defaulted to 8 and tone_enc_base defaulted to 10, and
model_bcd with dcs_enc_base and tone_enc_base both set to 16.
Both models allow testing new inputs and outputs, as well as validating
that the new settings do not interfere with parsing when it is not
expected to.
This should make the proper keys appear for mobiles and portables,
and also implements the E-model distinction which lets you configure
buttons and threshold for "hold" triggers, effectively giving the
US models an extra set of buttons. It also removes the restriction
on some of the functions not being assignable as secondary, which
the radio seems to not care about.
Note that this allows configuring buttons in a way that the radio will
honor but cause KPG-89D to blank your button config if you do things
it doesn't allow you to do.
Fixes#11865
The OEM software sends a special command to indicate an entire block
is empty. The code in CHIRP to do this was wrong, causing it to not
accelerate as expected.
This flips the polarity here, allowing opting into the compat
behavior instead of defaulting to it. On current wx, GTK, and Wayland,
the compat behavior is (much) slower than native and brings some
input weirdness as well.
Document every setting the 16 channel model exposes, based on its
English manual (FCC ID 2AJGM-T20). This is the RT22 clone handled in
this driver and a different radio from the 22 channel BF-T20FRS in
radtel_t18.py, as confirmed in issue #9821: its factory programming
software identifies itself as the WLN KD-C1 software.
All of these settings are shared with the other radios in this driver,
so the wording is cross-checked against the Retevis RT22P manual and
avoids details that hold for one model only. Two descriptions follow
sources outside the manual: Local and Remote Alarm are mutually
exclusive rather than cumulative, with Remote Alarm staying silent
locally (Radtel RT-4D menu reference), and the embedded message pair
matches the dealer comment fields in tk280.py.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Document every setting the 22 channel FRS model exposes, plus the
per-memory Busy Channel Lockout, based on its English manual and
cross-checked against the manuals of the radios that share these code
paths: Retevis RT68 and RT22P, and Baofeng BF-888S/666S/777S.
The wording therefore avoids details that hold for one model only, and
leaves the VOX level direction unstated: RT22P documents the highest
level as the most sensitive, while the BF-T20 manual contradicts
itself. Scanning needs at least two channels in the list (RT68,
BF-888S) and resumes a few seconds after the channel clears.
RX emergency is the one setting no manual documents. It is described
here as reacting to an alarm received from another radio, which fits
the name but is not confirmed by a source.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A missing event skip on the colheader mouse motion event handlerwas
preventing the normal mechanics from working (i.e. showing the correct
resize cursor and live resize of the columns).
Add set_doc() tooltips to the H777/BF-888S settings, sourced from the
BaoFeng BF-888S user manual, covering voice prompt, scan, VOX, alarm,
FM, beep, battery saver, squelch, timeout timer and busy channel
lockout.
The strings are not marked for translation. Many of these describe
common concepts (BCL, VOX, squelch, timeout timer) that appear in a
lot of drivers, and marking slightly different wordings of each in
every driver would generate a large amount of duplicated work for
translators. These are better unified into a shared set of strings
first, and translated from there.
The Alarm tooltip is deliberately worded to cover both variants: on
the Baofeng 1900 series Alarm is a Local/Remote list where Remote does
transmit the alarm to other radios, so the alarm cannot be described
as a receive-only, non-transmitting function. The Retevis H777 manual
only describes the side-key toggle in its Emergency Alert section.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Commit fbcca4a9d1 changed a grep command in an attempt to prevent a
false positive, that is, to prevent grep from matching python code not
actually using the banned 'past' module. Problem is, (?!e) is not valid
syntax unless grep was compiled with support for Perl Compatible Regular
Expressions. However, we can use extended regexp syntax to avoid the
false positive. While we're at it, let's make similar improvements to
the other regular expressions to prevent more false positives.
In set_settings(), the elname guards for these two settings carried a
stray "_mem."/"mem." prefix that does not match the names assigned in
get_settings() ("battery_text" and "mic_bar"). The branches therefore
never matched, so both settings were silently dropped on upload and
reverted on the radio after a restart.
Drop the prefixes so each guard matches its setting name.
Fixes#12534
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The structured string that is required for the open dialog to
specify a file type should not include one of the special characters
(i.e. the "|") in the translated string. Removing this from the
translation will then break the structure and prevent it from working
properly. The pt_BR translation did just that and resulted in the
referenced bug. This removes the | from the marked string and the
other translations.
Fixes#12531
Clear the immutable list on the duped memory before modifying the name field during CSV export. This avoids ImmutableValueError on radios that mark memory name fields as immutable (e.g. FT-60).
Fixes#10437