Skip to content

Commit

Permalink
Added TyT extension to set DMR squelch for TyT MD-UV390 and MD-2017 r…
Browse files Browse the repository at this point in the history
…adios. Addresses #307.
  • Loading branch information
hmatuschek committed Feb 21, 2023
1 parent 6261917 commit a9b4396
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 9 deletions.
11 changes: 9 additions & 2 deletions doc/manual/codeplug/tyt/channel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
</variablelist>

<variablelist>
<title>Channel settings for <trademark>TyT</trademark> <productname>MD-390</productname> and
<trademark>Retevis</trademark> <productname>RT8</productname></title>
<title>Channel settings for <trademark>TyT</trademark> <productname>MD-UV390</productname> and
<trademark>Retevis</trademark> <productname>DM-2017</productname></title>
<varlistentry>
<term><token>killTone</token></term>
<listitem>
Expand Down Expand Up @@ -163,5 +163,12 @@
is, if this radio provides the clock for the time-slots.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><token>dmrSquelch</token></term>
<listitem>
<para>Allows to set the squelch level for DMR channels. This prevents the LED to light all
the time. The radio, however, remains silent irrespective of this setting. </para>
</listitem>
</varlistentry>
</variablelist>
</section>
1 change: 0 additions & 1 deletion lib/tyt_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ TyTCodeplug::ChannelElement::toChannelObj(const ErrorStack &err) const {
ex->enablePrivateCallConfirmed(privateCallConfirm());
ex->enableDataCallConfirmed(dataCallConfirm());
ex->enableEmergencyAlarmConfirmed(emergencyAlarmACK());

// If encryption is enabled, Add commercial extension to channel if needed
// the key will be linked later
if ((PRIV_NONE != privacyType()) && (nullptr == dch->commercialExtension()))
Expand Down
14 changes: 13 additions & 1 deletion lib/tyt_extensions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TyTChannelExtension::TyTChannelExtension(QObject *parent)
_displayPTTId(true), _rxRefFrequency(RefFrequency::Low), _txRefFrequency(RefFrequency::Low),
_tightSquelch(false), _compressedUDPHeader(false), _reverseBurst(true),
_killTone(KillTone::Off), _inCallCriterion(InCallCriterion::Always), _allowInterrupt(false),
_dcdm(false), _dcdmLeader(false)
_dcdm(false), _dcdmLeader(false), _dmrSquelch(1)
{
// pass...
}
Expand Down Expand Up @@ -134,6 +134,18 @@ TyTChannelExtension::setTXRefFrequency(RefFrequency ref) {
emit modified(this);
}

unsigned int
TyTChannelExtension::dmrSquelch() const {
return _dmrSquelch;
}
void
TyTChannelExtension::setDMRSquelch(unsigned int sq) {
if (_dmrSquelch == sq)
return;
_dmrSquelch = sq;
emit modified(this);
}

bool
TyTChannelExtension::tightSquelch() const {
return _tightSquelch;
Expand Down
20 changes: 15 additions & 5 deletions lib/tyt_extensions.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class TyTChannelExtension: public ConfigExtension
{
Q_OBJECT

Q_CLASSINFO("description", "Settings for MD-390, RT8, MD-UV390, RT3S, MD-2017, RT82, DM-1701, RT84.")
Q_CLASSINFO("longDescription", "Device specific channel settings for TyT and Retevis devices."
"Including TyT MD-390, MD-UV390, MD-2017, Retevis RT8, RT3S and RT82"
" as well as Baofeng DM-1701.")

/** The lone worker feature. */
Q_PROPERTY(bool loneWorker READ loneWorker WRITE enableLoneWorker)
/** The auto scan feature. */
Expand Down Expand Up @@ -49,11 +54,10 @@ class TyTChannelExtension: public ConfigExtension
Q_PROPERTY(bool dcdm READ dcdm WRITE enableDCDM)
/** If @c true, and dcdm is enabled, this radio is the leader, specifying the clock. */
Q_PROPERTY(bool dcdmLeader READ dcdmLeader WRITE enableDCDMLeader)

Q_CLASSINFO("description", "Settings for MD-390, RT8, MD-UV390, RT3S, MD-2017, RT82, DM-1701, RT84.")
Q_CLASSINFO("longDescription", "Device specific channel settings for TyT and Retevis devices."
"Including TyT MD-390, MD-UV390, MD-2017, Retevis RT8, RT3S and RT82"
" as well as Baofeng DM-1701.")
/** The squelch level for DMR channels. */
Q_PROPERTY(unsigned int dmrSquelch READ dmrSquelch WRITE setDMRSquelch)
Q_CLASSINFO("dmrSquelchDescription", "Sets the squelch level for DMR channels. "
"Only applicable for MD-UV390 and MD-2017")

public:
/** Possible reference frequency settings for RX & TX. */
Expand Down Expand Up @@ -150,6 +154,10 @@ public:
bool dcdmLeader() const;
/** Enables/disables this radio to be the leader on a DCDM simplex channel. */
void enableDCDMLeader(bool enable);
/** Squelch level for DMR channels. */
unsigned int dmrSquelch() const;
/** Sets the squelch-level for DMR channels. */
void setDMRSquelch(unsigned int sq);

public:
/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
Expand Down Expand Up @@ -195,6 +203,8 @@ protected:
bool _dcdm;
/** Holds the DCDM-leader flag. */
bool _dcdmLeader;
/** The squelch level [0-10] for DMR channels. */
unsigned int _dmrSquelch;
};


Expand Down
4 changes: 4 additions & 0 deletions lib/uv390_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ UV390Codeplug::ChannelElement::toChannelObj(const ErrorStack &err) const {
ex->enableAllowInterrupt(allowInterrupt());
ex->enableDCDM(dualCapacityDirectMode());
ex->enableDCDMLeader(dcdmLeader());
if (ch->is<DMRChannel>())
ex->setDMRSquelch(squelch());
}

return ch;
Expand Down Expand Up @@ -219,6 +221,8 @@ UV390Codeplug::ChannelElement::fromChannelObj(const Channel *chan, Context &ctx)
enableAllowInterrupt(ex->allowInterrupt());
enableDualCapacityDirectMode(ex->dcdm());
enableDCDMLeader(ex->dcdmLeader());
if (chan->is<DMRChannel>())
setSquelch(ex->dmrSquelch());
}
}

Expand Down

0 comments on commit a9b4396

Please sign in to comment.