summaryrefslogtreecommitdiff
path: root/TxStartPolicy.hpp
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
committerhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
commitc25cbdf6fb6d946175f4335fab77bfea601b56db (patch)
tree6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /TxStartPolicy.hpp
parent71f5689252c9f13e70e1c24856904475b2307809 (diff)
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'TxStartPolicy.hpp')
-rw-r--r--TxStartPolicy.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/TxStartPolicy.hpp b/TxStartPolicy.hpp
new file mode 100644
index 00000000..2aef9a52
--- /dev/null
+++ b/TxStartPolicy.hpp
@@ -0,0 +1,46 @@
+#ifndef TXSTARTPOLICY_HPP__
+#define TXSTARTPOLICY_HPP__
+
+#include <QString>
+
+constexpr double TxStartLatestPeriodFraction = 0.75;
+
+inline bool requires_standard_tx_message (QString const& mode)
+{
+ // These modes synthesize their Tx payload outside the standard Tx1-Tx6 slots.
+ return mode != "Echo" && mode != "WSPR" && mode != "FST4W" && mode != "JTTY";
+}
+
+inline bool tx_payload_ready (QString const& mode, int standard_message_length)
+{
+ return !requires_standard_tx_message (mode) || standard_message_length > 0;
+}
+
+inline bool should_stop_for_missing_tx_payload (QString const& mode,
+ int standard_message_length,
+ bool tuning)
+{
+ return !tuning && !tx_payload_ready (mode, standard_message_length);
+}
+
+inline bool tx_start_window_open (QString const& mode, bool tx_time, double period_fraction)
+{
+ return mode == "JTTY"
+ || (tx_time && period_fraction < TxStartLatestPeriodFraction);
+}
+
+inline bool can_start_transmit (QString const& mode, bool tx_time,
+ double period_fraction, int standard_message_length,
+ bool tuning)
+{
+ return tuning || (tx_start_window_open (mode, tx_time, period_fraction)
+ && tx_payload_ready (mode, standard_message_length));
+}
+
+inline bool should_block_generated_transmit (QString const& generated_message, bool tuning)
+{
+ return !tuning
+ && generated_message.trimmed () == QStringLiteral ("*** bad message ***");
+}
+
+#endif