summaryrefslogtreecommitdiff
path: root/Transceiver/TransceiverBase.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2025-09-15 23:04:33 +0200
committerChristoph Berg <myon@debian.org>2025-09-15 23:04:33 +0200
commite1c678ef00f0159bbeb5571e5ebb0d4697121334 (patch)
tree6547edef81a62a812a4d0f64e03fda226b5f0a7e /Transceiver/TransceiverBase.cpp
parentb9daa22c4c3ad51cd4bc0ef624a19f21d01c9305 (diff)
parent0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff)
Update upstream source from tag 'upstream/3.0.0_rc1+repack'
Update to upstream version '3.0.0~rc1+repack' with Debian dir 68c212e23136fecf9ebc6f12ff355579224d27ee
Diffstat (limited to 'Transceiver/TransceiverBase.cpp')
-rwxr-xr-xTransceiver/TransceiverBase.cpp146
1 files changed, 117 insertions, 29 deletions
diff --git a/Transceiver/TransceiverBase.cpp b/Transceiver/TransceiverBase.cpp
index 9f11380c..c0107835 100755
--- a/Transceiver/TransceiverBase.cpp
+++ b/Transceiver/TransceiverBase.cpp
@@ -47,6 +47,14 @@ void TransceiverBase::set (TransceiverState const& s,
{
CAT_TRACE ("#: " << s);
+ try {
+ do_txvolume (s.txvolume());
+ } catch(...) {printf("Setting tx attenuation failed");}
+
+ try {
+ do_volume (s.volume());
+ } catch(...) {printf("Setting rx attenuation failed");}
+
QString message;
try
{
@@ -64,25 +72,84 @@ void TransceiverBase::set (TransceiverState const& s,
}
if (requested_.online ())
{
- bool ptt_on {false};
- bool ptt_off {false};
- if (s.ptt () != requested_.ptt ())
- {
- ptt_on = s.ptt ();
- ptt_off = !s.ptt ();
- }
- if (ptt_off)
- {
- do_ptt (false);
- do_post_ptt (false);
- QThread::msleep (100); // some rigs cannot process CAT
- // commands while switching from
- // Tx to Rx
+ bool audio_cmd {false};
+ if (requested_.blocksize() != s.blocksize()) {
+ do_blocksize (s.blocksize());
+ audio_cmd = true;
+ requested_.blocksize (s.blocksize ());
+ }
+ if (requested_.period() != s.period()) {
+ do_period (s.period());
+ audio_cmd = true;
+ requested_.period (s.period ());
+ }
+ if (requested_.spread() != s.spread()) {
+ do_spread (s.spread());
+ audio_cmd = true;
+ requested_.spread (s.spread ());
+ }
+ if (requested_.nsym() != s.nsym()) {
+ do_nsym (s.nsym());
+ audio_cmd = true;
+ requested_.nsym (s.nsym ());
+ }
+ if (requested_.trfrequency() != s.trfrequency()) {
+ do_trfrequency (s.trfrequency());
+ audio_cmd = true;
+ requested_.trfrequency (s.trfrequency ());
+ }
+ if (requested_.audio() != s.audio()) {
+ do_audio (s.audio());
+ audio_cmd = true;
+ requested_.audio (s.audio ());
+ }
+ if (requested_.tx_audio() != s.tx_audio()) {
+ if (s.tx_audio()) {
+ do_modulator_start(s.jtmode(), s.symbolslength (), s.framespersymbol (), s.trfrequency (), s.tonespacing (), s.synchronize (),s.fastmode(), s.dbsnr (), s.trperiod ());
+ requested_.symbolslength(s.symbolslength ());
+ requested_.framespersymbol(s.framespersymbol ());
+ requested_.trfrequency(s.trfrequency ());
+ requested_.tonespacing(s.tonespacing ());
+ requested_.synchronize(s.synchronize ());
+ requested_.dbsnr(s.dbsnr ());
+ requested_.trperiod(s.trperiod ());
+ } else {
+ do_modulator_stop(s.quick ());
+ requested_.quick (s.quick ());
}
+ audio_cmd = true;
+
+ requested_.tx_audio (s.tx_audio ());
+ }
+
+ if (requested_.tune() != s.tune()) {
+ do_tune (s.tune());
+ audio_cmd = true;
+ requested_.tune (s.tune ());
+ }
+ if (!audio_cmd) {
+ bool ptt_on {false};
+ bool ptt_off {false};
+ if (s.ptt () != requested_.ptt ())
+ {
+ ptt_on = s.ptt ();
+ ptt_off = !s.ptt ();
+ }
+ if (ptt_off)
+ {
+ do_ptt (false);
+ do_post_ptt (false);
+ if (!requested_.audio()) QThread::msleep (100); // some rigs cannot process CAT
+ // commands while switching from
+ // Tx to Rx
+ }
+
if (s.frequency () // ignore bogus zero frequencies
&& ((s.frequency () != requested_.frequency () // and QSY
|| (s.mode () != UNK && s.mode () != requested_.mode ())))) // or mode change
{
+ requested_.frequency (s.frequency ());
+ requested_.mode (s.mode ());
do_frequency (s.frequency (), s.mode (), ptt_off);
do_post_frequency (s.frequency (), s.mode ());
@@ -90,15 +157,17 @@ void TransceiverBase::set (TransceiverState const& s,
requested_.frequency (actual_.frequency ());
requested_.mode (actual_.mode ());
}
- if (!s.tx_frequency ()
+ else if (!s.tx_frequency ()
|| (s.tx_frequency () > 10000 // ignore bogus startup values
&& s.tx_frequency () < std::numeric_limits<Frequency>::max () - 10000))
{
if ((s.tx_frequency () != requested_.tx_frequency () // and QSY
|| (s.mode () != UNK && s.mode () != requested_.mode ())) // or mode change
// || s.split () != requested_.split ())) // or split change
- || (s.tx_frequency () && ptt_on)) // or about to tx split
+ || (s.tx_frequency () && ptt_on)) // or about to tx split
{
+ requested_.tx_frequency (s.tx_frequency ());
+ requested_.split (s.tx_frequency () != 0);
do_tx_frequency (s.tx_frequency (), s.mode (), ptt_on);
do_post_tx_frequency (s.tx_frequency (), s.mode ());
@@ -117,9 +186,10 @@ void TransceiverBase::set (TransceiverState const& s,
}
// record what actually changed
- requested_.ptt (actual_.ptt ());
+ if (ptt_on || ptt_off) requested_.ptt (actual_.ptt ());
}
}
+ }
catch (std::exception const& e)
{
CAT_TRACE ("#: " << sequence_number << " what: " << e.what ());
@@ -138,7 +208,7 @@ void TransceiverBase::set (TransceiverState const& s,
void TransceiverBase::startup ()
{
- CAT_TRACE ("startup");
+ CAT_TRACE ("startup\n");
QString message;
try
{
@@ -150,12 +220,12 @@ void TransceiverBase::startup ()
}
catch (std::exception const& e)
{
- CAT_TRACE ("startup" << " what: " << e.what ());
+ CAT_TRACE ("startup" << " what: " << e.what () << '\n');
message = e.what ();
}
catch (...)
{
- CAT_TRACE ("startup");
+ CAT_TRACE ("startup error: unexpected\n");
message = unexpected;
}
if (!message.isEmpty ())
@@ -166,7 +236,7 @@ void TransceiverBase::startup ()
void TransceiverBase::shutdown ()
{
- CAT_TRACE ("shutdown");
+ CAT_TRACE ("shutdown\n");
may_update u {this};
if (requested_.online ())
{
@@ -180,16 +250,17 @@ void TransceiverBase::shutdown ()
// try and reset split mode
do_tx_frequency (0, UNK, true);
do_post_tx_frequency (0, UNK);
+ update_split(false); //w3sz tci
}
- do_stop ();
- do_post_stop ();
}
catch (...)
{
- CAT_TRACE ("shutdown");
+ CAT_TRACE ("shutdown\n");
// don't care about exceptions
}
}
+ do_stop();
+ do_post_stop ();
actual_ = TransceiverState {};
requested_ = TransceiverState {};
}
@@ -257,12 +328,29 @@ void TransceiverBase::update_PTT (bool state)
actual_.ptt (state);
}
+void TransceiverBase::update_level (int l)
+{
+ CAT_TRACE ("level: " << l);
+ actual_.level (l);
+ // requested_.level (l); // track rig changes
+}
+
+void TransceiverBase::update_power (unsigned int p)
+{
+ CAT_TRACE ("power: " << p);
+ actual_.power (p);
+}
+
+void TransceiverBase::update_swr (unsigned int p)
+{
+ CAT_TRACE ("swr: " << p);
+ actual_.swr (p);
+}
+
void TransceiverBase::update_complete (bool force_signal)
{
- CAT_TRACE ("force signal: " << force_signal);
- if ((do_pre_update ()
- && actual_ != last_)
- || force_signal)
+ CAT_TRACE ("force signal: " << force_signal) << '\n';
+ if ((do_pre_update () && actual_ != last_) || force_signal)
{
Q_EMIT update (actual_, last_sequence_number_);
last_ = actual_;
@@ -271,7 +359,7 @@ void TransceiverBase::update_complete (bool force_signal)
void TransceiverBase::offline (QString const& reason)
{
- CAT_TRACE ("reason: " << reason);
+ CAT_TRACE ("reason: " << reason << '\n');
Q_EMIT failure (reason);
try
{