Skip to content

Commit

Permalink
Fixed squelch mode settings for AnyTone devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Oct 2, 2021
1 parent 780b079 commit 518e0d3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
5 changes: 3 additions & 2 deletions doc/code/anytone_channel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
14 | Contact index 0-based, little endian |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
18 | Radio ID table index. | 0 0 0 |SQM| 0 0 0 0 | 0 0 |OptSig | 0 0 | TxPer | Scan list index |
18 | Radio ID table index. | 0 |SquelchMode| 0 0 0 0 | 0 0 |OptSig | 0 0 | TxPer | Scan list index |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1c | RX Group list index | 2-tone ID | 5-tone ID | DTMF ID |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Expand Down Expand Up @@ -40,7 +40,8 @@ Field description:
- TCT: Enable TX CTCSS tone.
- RDC: Enable RX DCS code.
- RCT: Enable RX CTCSS tone.
- SQM: Squelch mode 0=open, 1=silent.
- SquelchMode: Squelch mode 0=Carrier, 1=CTCSS/DCS, 2=Optional Signaling, 3=CTCSS/DCS and Optional Signaling,
4 = CTCSS/DCS or Optional Signaling
- OptSig: Optional signalling where 0=off, 1=DTMF, 2=2-tone, 3=5-tone
- TxPer: TX permit/admit criterion, 0=always, 1=colorcode, 2=channel free.
- LWK: Enable lone worker.
Expand Down
5 changes: 3 additions & 2 deletions doc/code/d578uv_channel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
14 | Contact index 0-based, little endian |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
18 | Radio ID table index. | 0 0 0 |SQM| 0 0 |PTT-ID | 0 0 |OptSig | 0 0 | TxPer | Scan list index |
18 | Radio ID table index. | 0 |SquelchMode| 0 0 |PTT-ID | 0 0 |OptSig | 0 0 | TxPer | Scan list index |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1c | RX Group list index | 2-tone ID | 5-tone ID | DTMF ID |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Expand Down Expand Up @@ -40,7 +40,8 @@ Field description:
- TCT: Enable TX CTCSS tone.
- RDC: Enable RX DCS code.
- RCT: Enable RX CTCSS tone.
- SQM: Squelch mode 0=open, 1=silent.
- SquelchMode: Squelch mode 0=Carrier, 1=CTCSS/DCS, 2=Optional Signaling, 3=CTCSS/DCS and Optional Signaling,
4 = CTCSS/DCS or Optional Signaling
- PTT-ID: When to send the PTT-ID, where 0=off, 1=start, 2=end, 3=both.
- OptSig: Optional signalling where 0=off, 1=DTMF, 2=2-tone, 3=5-tone
- TxPer: TX permit/admit criterion, 0=always, 1=colorcode, 2=channel free.
Expand Down
5 changes: 3 additions & 2 deletions doc/code/d878uv_channel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
14 | Contact index 0-based, little endian |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
18 | Radio ID table index. | 0 0 0 |SQM| 0 0 |PTT-ID | 0 0 |OptSig | 0 0 | TxPer | Scan list index |
18 | Radio ID table index. | 0 |SquelchMode| 0 0 |PTT-ID | 0 0 |OptSig | 0 0 | TxPer | Scan list index |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1c | RX Group list index | 2-tone ID | 5-tone ID | DTMF ID |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Expand Down Expand Up @@ -40,7 +40,8 @@ Field description:
- TCT: Enable TX CTCSS tone.
- RDC: Enable RX DCS code.
- RCT: Enable RX CTCSS tone.
- SQM: Squelch mode 0=open, 1=silent.
- SquelchMode: Squelch mode 0=Carrier, 1=CTCSS/DCS, 2=Optional Signaling, 3=CTCSS/DCS and Optional Signaling,
4 = CTCSS/DCS or Optional Signaling
- PTT-ID: When to send the PTT-ID, where 0=off, 1=start, 2=end, 3=both.
- OptSig: Optional signalling where 0=off, 1=DTMF, 2=2-tone, 3=5-tone
- TxPer: TX permit/admit criterion, 0=always, 1=colorcode, 2=channel free.
Expand Down
14 changes: 9 additions & 5 deletions lib/anytone_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,13 @@ AnytoneCodeplug::ChannelElement::setRadioIDIndex(unsigned idx) {
return setUInt8(0x0018, idx);
}

bool
AnytoneCodeplug::ChannelElement::silentSquelch() const {
return getBit(0x0019, 4);
AnytoneCodeplug::ChannelElement::SquelchMode
AnytoneCodeplug::ChannelElement::squelchMode() const {
return (SquelchMode)getUInt3(0x0019, 4);
}
void
AnytoneCodeplug::ChannelElement::enableSilentSquelch(bool enable) {
setBit(0x0019, 4, enable);
AnytoneCodeplug::ChannelElement::setSquelchMode(SquelchMode mode) {
setUInt3(0x0019, 4, (unsigned)mode);
}

AnytoneCodeplug::ChannelElement::Admit
Expand Down Expand Up @@ -770,6 +770,10 @@ AnytoneCodeplug::ChannelElement::fromChannelObj(const Channel *c, Context &ctx)
// squelch mode
setRXTone(ac->rxTone());
setTXTone(ac->txTone());
if (Signaling::SIGNALING_NONE != ac->rxTone())
setSquelchMode(SquelchMode::SubTone);
else
setSquelchMode(SquelchMode::Carrier);
// set bandwidth
setBandwidth(ac->bandwidth());
} else if (c->is<DigitalChannel>()) {
Expand Down
13 changes: 11 additions & 2 deletions lib/anytone_codeplug.hh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ public:
DCS = 2 ///< Use DCS codes.
};

/** Possible squelch mode settings. */
enum class SquelchMode {
Carrier = 0,
SubTone = 1,
OptSig = 2,
SubToneAndOptSig = 3,
SubToneOrOptSig = 4
};

/** Defines possible admit criteria. */
enum class Admit {
Always = 0, ///< For both channel types.
Expand Down Expand Up @@ -197,9 +206,9 @@ public:
virtual void setRadioIDIndex(unsigned idx);

/** Returns @c true if the sequelch is silent and @c false if open. */
virtual bool silentSquelch() const;
virtual SquelchMode squelchMode() const;
/** Enables/disables silent squelch. */
virtual void enableSilentSquelch(bool enable);
virtual void setSquelchMode(SquelchMode mode);

/** Returns the admit criterion. */
virtual Admit admit() const;
Expand Down

0 comments on commit 518e0d3

Please sign in to comment.