diff --git a/plugins/channelrx/radioclock/CMakeLists.txt b/plugins/channelrx/radioclock/CMakeLists.txt index 461f9a308..31b67fc8c 100644 --- a/plugins/channelrx/radioclock/CMakeLists.txt +++ b/plugins/channelrx/radioclock/CMakeLists.txt @@ -7,6 +7,7 @@ set(radioclock_SOURCES radioclocksink.cpp radioclockplugin.cpp radioclockwebapiadapter.cpp + pcsk225decoder.cpp ) set(radioclock_HEADERS @@ -16,6 +17,7 @@ set(radioclock_HEADERS radioclocksink.h radioclockplugin.h radioclockwebapiadapter.h + pcsk225decoder.h ) include_directories( diff --git a/plugins/channelrx/radioclock/pcsk225decoder.cpp b/plugins/channelrx/radioclock/pcsk225decoder.cpp new file mode 100644 index 000000000..7c6ec8ad2 --- /dev/null +++ b/plugins/channelrx/radioclock/pcsk225decoder.cpp @@ -0,0 +1,304 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2026 Jon Beniston, M7RCE // +// Some code by AI // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "pcsk225decoder.h" + +namespace { + +constexpr quint8 scrambler[5] = {0x0a, 0x47, 0x55, 0x4d, 0x2b}; + +} + +quint8 PCSK225Decoder::gfMultiply(quint8 a, quint8 b) +{ + quint8 value = 0; + + while (b != 0) + { + if (b & 1) { + value ^= a; + } + + b >>= 1; + a <<= 1; + + if (a & 0x10) { + a ^= 0x13; // x^4 + x + 1 + } + } + + return value & 0x0f; +} + +quint8 PCSK225Decoder::gfPower(int power) +{ + quint8 value = 1; + + for (int i = 0; i < (power % 15); i++) { + value = gfMultiply(value, 2); + } + + return value; +} + +void PCSK225Decoder::syndromes(const std::array& codeword, std::array& result) +{ + // The on-air shortened RS(15,9) code uses roots alpha^9 through alpha^14. + for (int rootIndex = 0; rootIndex < 6; rootIndex++) + { + const int root = 9 + rootIndex; + quint8 syndrome = 0; + + for (int position = 0; position < 15; position++) + { + int degree = 14 - position; + syndrome ^= gfMultiply(codeword[position], gfPower(degree * root)); + } + + result[rootIndex] = syndrome; + } +} + +bool PCSK225Decoder::allZero(const std::array& values) +{ + quint8 combined = 0; + + for (quint8 value : values) { + combined |= value; + } + + return combined == 0; +} + +int PCSK225Decoder::correct(std::array& codeword) +{ + std::array receivedSyndromes; + syndromes(codeword, receivedSyndromes); + + if (allZero(receivedSyndromes)) { + return 0; + } + + // There are only 15 symbols. Precomputing each possible error's syndrome + // makes an exhaustive search through the code's three-symbol correction + // radius small, deterministic and considerably simpler than a general RS + // implementation. + quint8 contribution[15][16][6]{}; + + for (int position = 0; position < 15; position++) + { + int degree = 14 - position; + + for (int errorValue = 1; errorValue < 16; errorValue++) + { + for (int rootIndex = 0; rootIndex < 6; rootIndex++) + { + contribution[position][errorValue][rootIndex] = gfMultiply( + errorValue, + gfPower(degree * (9 + rootIndex)) + ); + } + } + } + + auto matches = [&receivedSyndromes, &contribution](int p1, int e1, int p2, int e2, int p3, int e3) { + for (int i = 0; i < 6; i++) + { + quint8 value = contribution[p1][e1][i]; + if (p2 >= 0) { + value ^= contribution[p2][e2][i]; + } + if (p3 >= 0) { + value ^= contribution[p3][e3][i]; + } + if (value != receivedSyndromes[i]) { + return false; + } + } + return true; + }; + + for (int p1 = 0; p1 < 15; p1++) + { + for (int e1 = 1; e1 < 16; e1++) + { + if (matches(p1, e1, -1, 0, -1, 0)) + { + codeword[p1] ^= e1; + return 1; + } + } + } + + for (int p1 = 0; p1 < 14; p1++) + { + for (int p2 = p1 + 1; p2 < 15; p2++) + { + for (int e1 = 1; e1 < 16; e1++) + { + for (int e2 = 1; e2 < 16; e2++) + { + if (matches(p1, e1, p2, e2, -1, 0)) + { + codeword[p1] ^= e1; + codeword[p2] ^= e2; + return 2; + } + } + } + } + } + + for (int p1 = 0; p1 < 13; p1++) + { + for (int p2 = p1 + 1; p2 < 14; p2++) + { + for (int p3 = p2 + 1; p3 < 15; p3++) + { + for (int e1 = 1; e1 < 16; e1++) + { + for (int e2 = 1; e2 < 16; e2++) + { + for (int e3 = 1; e3 < 16; e3++) + { + if (matches(p1, e1, p2, e2, p3, e3)) + { + codeword[p1] ^= e1; + codeword[p2] ^= e2; + codeword[p3] ^= e3; + return 3; + } + } + } + } + } + } + } + + return -1; +} + +quint8 PCSK225Decoder::crc8(const quint8 *data, int count) +{ + quint8 crc = 0; + + for (int i = 0; i < count; i++) + { + crc ^= data[i]; + + for (int bitIndex = 0; bitIndex < 8; bitIndex++) { + crc = crc & 0x80 ? static_cast((crc << 1) ^ 0x07) : static_cast(crc << 1); + } + } + + return crc; +} + +int PCSK225Decoder::bit(const std::array& data, int index) +{ + return (data[index / 8] >> (7 - index % 8)) & 1; +} + +bool PCSK225Decoder::decode(std::array& frame, Result& result, QString& error) +{ + if ((frame[0] != 0x55) || (frame[1] != 0x55) || (frame[2] != 0x60)) + { + error = "Invalid PCSK-225 header"; + return false; + } + + std::array codeword{}; + int codeBit = 0; + + // The protected data begins after the three timing bits in byte 4 and + // ends at SK0. It is protected in its transmitted (scrambled) form. + for (int frameBit = 3; frameBit < 39; frameBit += 4) + { + quint8 symbol = 0; + for (int i = 0; i < 4; i++, codeBit++) { + symbol = static_cast((symbol << 1) | ((frame[3 + (frameBit + i) / 8] >> (7 - (frameBit + i) % 8)) & 1)); + } + codeword[codeBit / 4 - 1] = symbol; + } + + for (int i = 0; i < 3; i++) + { + codeword[9 + 2*i] = frame[8 + i] >> 4; + codeword[10 + 2*i] = frame[8 + i] & 0x0f; + } + + int correctedSymbols = correct(codeword); + + if (correctedSymbols < 0) + { + error = "Uncorrectable Reed-Solomon error"; + return false; + } + + codeBit = 0; + for (int frameBit = 3; frameBit < 39; frameBit++) + { + int symbolIndex = codeBit / 4; + int symbolBit = 3 - codeBit % 4; + quint8 value = (codeword[symbolIndex] >> symbolBit) & 1; + quint8 mask = static_cast(1U << (7 - frameBit % 8)); + quint8& byte = frame[3 + frameBit / 8]; + byte = value ? static_cast(byte | mask) : static_cast(byte & ~mask); + codeBit++; + } + + for (int i = 0; i < 3; i++) { + frame[8 + i] = static_cast((codeword[9 + 2*i] << 4) | codeword[10 + 2*i]); + } + + if (crc8(&frame[3], 5) != frame[11]) + { + error = "CRC error"; + return false; + } + + std::array data{}; + for (int i = 0; i < 5; i++) { + data[i] = frame[3 + i] ^ scrambler[i]; + } + + if ((data[0] & 0xe0) != 0xa0) + { + error = "Invalid PCSK-225 timing marker"; + return false; + } + + quint32 periods = 0; + for (int i = 3; i < 33; i++) { + periods = (periods << 1) | bit(data, i); + } + + const int utcOffsetHours = bit(data, 33) + 2 * bit(data, 34); + const QDateTime epoch(QDate(2000, 1, 1), QTime(0, 0), Qt::UTC); + + result.m_dateTimeUtc = epoch.addSecs(static_cast(periods) * 3); + result.m_utcOffsetHours = utcOffsetHours; + result.m_leapSecondPending = bit(data, 35); + result.m_leapSecondDelete = bit(data, 36); + result.m_timeChangePending = bit(data, 37); + result.m_transmitterStatus = bit(data, 38) | (bit(data, 39) << 1); + result.m_correctedSymbols = correctedSymbols; + + error.clear(); + return true; +} diff --git a/plugins/channelrx/radioclock/pcsk225decoder.h b/plugins/channelrx/radioclock/pcsk225decoder.h new file mode 100644 index 000000000..25b707397 --- /dev/null +++ b/plugins/channelrx/radioclock/pcsk225decoder.h @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2026 Jon Beniston, M7RCE // +// Some code by AI // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef INCLUDE_PCSK225DECODER_H +#define INCLUDE_PCSK225DECODER_H + +#include + +#include +#include +#include + +class PCSK225Decoder +{ +public: + static constexpr int FrameBytes = 12; + + struct Result + { + QDateTime m_dateTimeUtc; + int m_utcOffsetHours; + bool m_leapSecondPending; + bool m_leapSecondDelete; + bool m_timeChangePending; + int m_transmitterStatus; + int m_correctedSymbols; + }; + + static bool decode(std::array& frame, Result& result, QString& error); + +private: + static quint8 gfMultiply(quint8 a, quint8 b); + static quint8 gfPower(int power); + static void syndromes(const std::array& codeword, std::array& result); + static bool allZero(const std::array& values); + static int correct(std::array& codeword); + static quint8 crc8(const quint8 *data, int count); + static int bit(const std::array& data, int index); +}; + +#endif // INCLUDE_PCSK225DECODER_H diff --git a/plugins/channelrx/radioclock/radioclockgui.cpp b/plugins/channelrx/radioclock/radioclockgui.cpp index 3011ab1b2..c1740e26f 100644 --- a/plugins/channelrx/radioclock/radioclockgui.cpp +++ b/plugins/channelrx/radioclock/radioclockgui.cpp @@ -261,7 +261,32 @@ void RadioClockGUI::on_threshold_valueChanged(int value) void RadioClockGUI::on_modulation_currentIndexChanged(int index) { m_settings.m_modulation = (RadioClockSettings::Modulation)index; - applySettings(QStringList({"modulation"})); + QStringList settingsKeys({"modulation"}); + + // Select a usable bandwidth when changing from one of the narrow-band + // clock formats. The channel filter uses RF bandwidth / 2.2 as its cutoff. + if ((m_settings.m_modulation == RadioClockSettings::RBU) && (m_settings.m_rfBandwidth < 700.0f)) + { + m_settings.m_rfBandwidth = 1000.0f; + ui->rfBW->blockSignals(true); + ui->rfBW->setValue(1000); + ui->rfBW->blockSignals(false); + ui->rfBWText->setText("1000 Hz"); + m_channelMarker.setBandwidth(1000.0f); + settingsKeys.append("rfBandwidth"); + } + else if ((m_settings.m_modulation == RadioClockSettings::PCSK225) && (m_settings.m_rfBandwidth < 450.0f)) + { + m_settings.m_rfBandwidth = 500.0f; + ui->rfBW->blockSignals(true); + ui->rfBW->setValue(500); + ui->rfBW->blockSignals(false); + ui->rfBWText->setText("500 Hz"); + m_channelMarker.setBandwidth(500.0f); + settingsKeys.append("rfBandwidth"); + } + + applySettings(settingsKeys); } void RadioClockGUI::on_timezone_currentIndexChanged(int index) diff --git a/plugins/channelrx/radioclock/radioclockgui.ui b/plugins/channelrx/radioclock/radioclockgui.ui index 3e9d25287..90ef6cd82 100644 --- a/plugins/channelrx/radioclock/radioclockgui.ui +++ b/plugins/channelrx/radioclock/radioclockgui.ui @@ -259,7 +259,7 @@ 1 - 100 + 1000 1 @@ -387,10 +387,20 @@ - - JJY - - + + JJY + + + + + RBU + + + + + PCSK-225 + + diff --git a/plugins/channelrx/radioclock/radioclocksettings.h b/plugins/channelrx/radioclock/radioclocksettings.h index 95b9c03f9..2e91f58c7 100644 --- a/plugins/channelrx/radioclock/radioclocksettings.h +++ b/plugins/channelrx/radioclock/radioclocksettings.h @@ -37,13 +37,15 @@ struct RadioClockSettings qint32 m_inputFrequencyOffset; qint64 m_frequency; Real m_rfBandwidth; - Real m_threshold; //!< For MSF and DCF in dB + Real m_threshold; //!< Carrier threshold in dB enum Modulation { MSF, DCF77, TDF, WWVB, - JJY + JJY, + RBU, + PCSK225 } m_modulation; enum DisplayTZ { BROADCAST, diff --git a/plugins/channelrx/radioclock/radioclocksink.cpp b/plugins/channelrx/radioclock/radioclocksink.cpp index c0d98a61d..656bd5f6c 100644 --- a/plugins/channelrx/radioclock/radioclocksink.cpp +++ b/plugins/channelrx/radioclock/radioclocksink.cpp @@ -18,12 +18,15 @@ #include +#include #include +#include #include "dsp/scopevis.h" #include "util/db.h" #include "radioclock.h" +#include "pcsk225decoder.h" #include "radioclocksink.h" RadioClockSink::RadioClockSink() : @@ -52,7 +55,46 @@ RadioClockSink::RadioClockSink() : m_zeroCount(0), m_bits{}, m_sampleBufferIndex(0), - m_gotMarker(false) + m_gotMarker(false), + m_rbuPrevSample(0.0f, 0.0f), + m_rbuHavePrevSample(false), + m_rbuHaveSymbolTiming(false), + m_rbuSymbolSample(0), + m_rbuCarrierLowCount(0), + m_rbuTimingErrors(0), + m_rbu100Real(0.0), + m_rbu100Imag(0.0), + m_rbu312Real(0.0), + m_rbu312Imag(0.0), + m_rbuCorrelationSamples(0), + m_rbuRecentBits(0), + m_rbuRecentBitCount(0), + m_rbuBit(0), + m_rbuSecondValid(true), + m_rbuInvalidSeconds(0), + m_pcskPrevSample(0.0f, 0.0f), + m_pcskHavePrevSample(false), + m_pcskUnwrappedPhase(0.0), + m_pcskPhaseHistory{}, + m_pcskSampleCount(0), + m_pcskSyncCandidate(false), + m_pcskSyncQuietSamples(0), + m_pcskSyncScore(0.0), + m_pcskSyncEndSample(0), + m_pcskSyncIntercept(0.0), + m_pcskSyncSlope(0.0), + m_pcskSyncSeparation(0.0), + m_pcskCollectingFrame(false), + m_pcskBit(0), + m_pcskFrameStartSample(0), + m_pcskNextSymbolSample(0), + m_pcskPhaseIntercept(0.0), + m_pcskPhaseSlope(0.0), + m_pcskPhaseSeparation(0.0), + m_pcskFrame{}, + m_pcskReferenceSample(0), + m_pcskNextTimeReportSample(0), + m_pcskLastValidFrameSample(0) { m_phaseDiscri.setFMScaling(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / (2.0f * 20.0/M_PI)); applySettings(QStringList(), m_settings, true); @@ -949,6 +991,635 @@ void RadioClockSink::jjy() m_prevData = m_data; } +// Russian RBU 66.666...kHz +// GOST 8.515-2016 and ITU-R TF.2487-0 +// Each 100ms symbol contains 80ms of phase modulation at 100Hz (0) or +// 312.5Hz (1), followed by a 5ms carrier interruption used for timing. +void RadioClockSink::rbu(Complex& ci, Real magsq) +{ + const int symbolSamples = RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / 10; + const int correlationStart = RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / 100; + const int correlationEnd = 9 * RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / 100; + const double twoPi = 2.0 * M_PI; + + Real averagePower = m_thresholdMovingAverage.instantAverage(); + m_threshold = averagePower * m_linearThreshold; + bool carrierPresent = magsq > m_threshold; + + Real phaseDelta = 0.0f; + if (m_rbuHavePrevSample) { + phaseDelta = std::arg(ci * std::conj(m_rbuPrevSample)); + } + m_rbuPrevSample = ci; + m_rbuHavePrevSample = true; + m_fmDemodMovingAverage(phaseDelta); + + // Accept a carrier recovery after an interruption as a symbol edge. Once + // timing is acquired the clock free-runs at 10Hz, with valid interruptions + // correcting its phase. This avoids losing a whole frame on a single faded + // or noise-filled 5ms notch. + if (!carrierPresent) + { + m_rbuCarrierLowCount++; + } + else if (m_rbuCarrierLowCount > 0) + { + bool validDrop = (m_rbuCarrierLowCount >= 2) && (m_rbuCarrierLowCount <= 30); + bool expectedEdge = !m_rbuHaveSymbolTiming + || (m_rbuSymbolSample >= symbolSamples - 15) + || (m_rbuSymbolSample <= 15); + + if (validDrop && expectedEdge) + { + m_rbuHaveSymbolTiming = true; + m_rbuTimingErrors = 0; + m_rbuSymbolSample = 0; + m_rbu100Real = 0.0; + m_rbu100Imag = 0.0; + m_rbu312Real = 0.0; + m_rbu312Imag = 0.0; + m_rbuCorrelationSamples = 0; + } + else if (validDrop) + { + m_rbuTimingErrors++; + } + + m_rbuCarrierLowCount = 0; + } + + m_sample = false; + + if (!m_rbuHaveSymbolTiming) { + return; + } + + if ((m_rbuSymbolSample >= correlationStart) && (m_rbuSymbolSample < correlationEnd)) + { + int n = m_rbuSymbolSample - correlationStart; + double phase100 = twoPi * 100.0 * n / RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE; + double phase312 = twoPi * 312.5 * n / RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE; + m_rbu100Real += phaseDelta * std::cos(phase100); + m_rbu100Imag -= phaseDelta * std::sin(phase100); + m_rbu312Real += phaseDelta * std::cos(phase312); + m_rbu312Imag -= phaseDelta * std::sin(phase312); + m_rbuCorrelationSamples++; + } + else if (m_rbuSymbolSample == correlationEnd) + { + if (m_rbuCorrelationSamples == correlationEnd - correlationStart) + { + double power100 = m_rbu100Real * m_rbu100Real + m_rbu100Imag * m_rbu100Imag; + double power312 = m_rbu312Real * m_rbu312Real + m_rbu312Imag * m_rbu312Imag; + m_data = power312 > power100 ? 1 : 0; + m_sample = true; + rbuProcessBit(m_data); + } + } + + m_rbuSymbolSample++; + + if (m_rbuTimingErrors >= 3) + { + qDebug() << "RadioClockSink::rbu - Repeated symbol timing errors"; + rbuReset(true); + } + else if (m_rbuSymbolSample >= symbolSamples) + { + m_rbuSymbolSample = 0; + m_rbu100Real = 0.0; + m_rbu100Imag = 0.0; + m_rbu312Real = 0.0; + m_rbu312Imag = 0.0; + m_rbuCorrelationSamples = 0; + } +} + +void RadioClockSink::rbuProcessBit(int bit) +{ + m_rbuRecentBits = ((m_rbuRecentBits << 1) | (bit & 1)) & 0x3ff; + if (m_rbuRecentBitCount < 10) { + m_rbuRecentBitCount++; + } + + if (!m_gotMinuteMarker) + { + // Second 59 contains five fixed zero symbols followed by the three + // marker ones; the first two symbols of second 00 are also ones. + // Matching the full 0000011111 sequence avoids false locks on noise. + if ((m_rbuRecentBitCount == 10) && (m_rbuRecentBits == 0x1f)) + { + qDebug() << "RadioClockSink::rbu - Minute marker"; + m_gotMinuteMarker = true; + m_second = 0; + m_rbuBit = 2; // Bits 0 and 1 of second 00 formed the marker. + m_timeCode[0] = 1; + m_timeCodeB[0] = 1; + m_rbuSecondValid = true; + m_rbuInvalidSeconds = 0; + m_dst = RadioClockSettings::UNKNOWN; + if (getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create("Got minute marker")); + } + } + return; + } + + if (m_rbuBit == 0) + { + m_timeCode[m_second] = bit; + if ((m_second == 0) && (bit != 1)) { + m_rbuSecondValid = false; + } + } + else if (m_rbuBit == 1) + { + m_timeCodeB[m_second] = bit; + if ((m_second == 0) && (bit != 1)) { + m_rbuSecondValid = false; + } + } + else if ((m_rbuBit >= 2) && (m_rbuBit <= 6)) + { + if (bit != 0) { + m_rbuSecondValid = false; + } + } + else if ((m_rbuBit == 7) || (m_rbuBit == 8)) + { + int expected = m_second == 59 ? 1 : 0; + if (bit != expected) { + m_rbuSecondValid = false; + } + } + else if ((m_rbuBit == 9) && (bit != 1)) + { + m_rbuSecondValid = false; + } + + if (m_rbuBit == 9) + { + if (m_rbuSecondValid) { + m_rbuInvalidSeconds = 0; + } else { + m_rbuInvalidSeconds++; + } + + if (m_rbuInvalidSeconds >= 3) + { + qDebug() << "RadioClockSink::rbu - Lost lock: invalid second structure"; + rbuReset(false); + return; + } + + if (m_second == 59) + { + QString error; + if (rbuDecodeTimeCode(error)) + { + if (getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create("OK")); + } + } + else if (getMessageQueueToChannel()) + { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create(error)); + } + m_second = 0; + } + else + { + m_second++; + if (m_dateTime.isValid()) { + m_dateTime = m_dateTime.addSecs(1); + } + } + + if (getMessageQueueToChannel() && m_dateTime.isValid()) { + getMessageQueueToChannel()->push(RadioClock::MsgDateTime::create(m_dateTime, m_dst)); + } + + m_rbuBit = 0; + m_rbuSecondValid = true; + } + else + { + m_rbuBit++; + } +} + +bool RadioClockSink::rbuDecodeTimeCode(QString& error) +{ + auto weightedValue = [](const int *code, int firstBit, const int *weights, int count) { + int value = 0; + for (int i = 0; i < count; i++) { + value += code[firstBit + i] ? weights[i] : 0; + } + return value; + }; + auto parity = [](const int *code, int firstBit, int lastBit, int parityBit) { + int value = parityBit; + for (int i = firstBit; i <= lastBit; i++) { + value ^= code[i]; + } + return value == 0; + }; + + bool parityOK = parity(m_timeCodeB, 18, 25, m_timeCodeB[49]) + && parity(m_timeCodeB, 26, 33, m_timeCodeB[50]) + && parity(m_timeCode, 18, 23, m_timeCodeB[53]) + && parity(m_timeCode, 25, 32, m_timeCodeB[54]) + && parity(m_timeCode, 33, 40, m_timeCodeB[55]) + && parity(m_timeCode, 41, 46, m_timeCodeB[56]) + && parity(m_timeCode, 47, 52, m_timeCodeB[57]) + && parity(m_timeCode, 53, 59, m_timeCodeB[58]); + + if (!parityOK) + { + error = "Parity error"; + return false; + } + + static const int yearWeights[] = {80, 40, 20, 10, 8, 4, 2, 1}; + static const int monthWeights[] = {10, 8, 4, 2, 1}; + static const int weekdayWeights[] = {4, 2, 1}; + static const int dayWeights[] = {20, 10, 8, 4, 2, 1}; + static const int hourWeights[] = {20, 10, 8, 4, 2, 1}; + static const int minuteWeights[] = {40, 20, 10, 8, 4, 2, 1}; + static const int offsetWeights[] = {10, 8, 4, 2, 1}; + static const int tjdWeights[] = {8000, 4000, 2000, 1000, 800, 400, 200, 100, 80, 40, 20, 10, 8, 4, 2, 1}; + + int year = 2000 + weightedValue(m_timeCode, 25, yearWeights, 8); + int month = weightedValue(m_timeCode, 33, monthWeights, 5); + int weekday = weightedValue(m_timeCode, 38, weekdayWeights, 3); + int day = weightedValue(m_timeCode, 41, dayWeights, 6); + int hour = weightedValue(m_timeCode, 47, hourWeights, 6); + int minute = weightedValue(m_timeCode, 53, minuteWeights, 7); + int offsetHours = weightedValue(m_timeCode, 19, offsetWeights, 5); + int tjd = weightedValue(m_timeCodeB, 18, tjdWeights, 16); + if (m_timeCode[18]) { + offsetHours = -offsetHours; + } + + QDate date(year, month, day); + QTime time(hour, minute); + int expectedTJD = date.isValid() ? static_cast((date.toJulianDay() - 2400001) % 10000) : -1; + + if (!date.isValid() || !time.isValid() || (weekday != date.dayOfWeek()) || (tjd != expectedTJD) + || (offsetHours < -12) || (offsetHours > 14)) + { + qDebug() << "RadioClockSink::rbu - Invalid timecode:" + << year << month << day << weekday << hour << minute + << "offset" << offsetHours << "TJD" << tjd << "expected" << expectedTJD; + error = "Invalid timecode"; + return false; + } + + // The frame carries Moscow civil time for the minute beginning immediately + // after this frame and explicitly supplies its offset from UTC. + m_dateTime = QDateTime(date, time, Qt::OffsetFromUTC, offsetHours * 3600); + m_dst = RadioClockSettings::UNKNOWN; + error.clear(); + return true; +} + +void RadioClockSink::rbuReset(bool resetTiming) +{ + bool hadMinuteMarker = m_gotMinuteMarker; + m_gotMinuteMarker = false; + m_rbuRecentBits = 0; + m_rbuRecentBitCount = 0; + m_rbuBit = 0; + m_rbuSecondValid = true; + m_rbuInvalidSeconds = 0; + m_second = 0; + m_dst = RadioClockSettings::UNKNOWN; + + if (resetTiming) + { + m_rbuHaveSymbolTiming = false; + m_rbuSymbolSample = 0; + m_rbuCarrierLowCount = 0; + m_rbuTimingErrors = 0; + m_rbuHavePrevSample = false; + } + + if (hadMinuteMarker && getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create("Looking for minute marker")); + } +} + +// Polish PCSK-225 time signal on the 225kHz carrier of Polish Radio. +// Frames use 50bit/s NRZ phase states separated by approximately 36 degrees. +// The fixed 0x55 0x55 0x60 header supplies both symbol timing and per-frame +// carrier phase/frequency estimates, so no wall-clock timing is required. +void RadioClockSink::pcsk225(Complex& ci, Real magsq) +{ + constexpr int samplesPerBit = RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / 50; + const qint64 currentSample = m_pcskSampleCount++; + + Real averagePower = m_thresholdMovingAverage.instantAverage(); + m_threshold = averagePower * 0.01f; // Reject only very deep carrier fades (-20dB). + + Real phaseDelta = 0.0f; + if (m_pcskHavePrevSample) { + phaseDelta = std::arg(ci * std::conj(m_pcskPrevSample)); + } + m_pcskPrevSample = ci; + m_pcskHavePrevSample = true; + m_pcskUnwrappedPhase += phaseDelta; + m_pcskPhaseHistory[currentSample % m_pcskPhaseHistorySize] = m_pcskUnwrappedPhase; + m_fmDemodMovingAverage(phaseDelta); + m_sample = false; + + if (m_pcskCollectingFrame && (currentSample >= m_pcskNextSymbolSample)) + { + double phase0 = m_pcskPhaseIntercept + m_pcskPhaseSlope * m_pcskBit; + double phase1 = phase0 + m_pcskPhaseSeparation; + double phase = m_pcskUnwrappedPhase; + int decodedBit = std::abs(phase - phase1) < std::abs(phase - phase0) ? 1 : 0; + int byteIndex = m_pcskBit / 8; + int bitIndex = 7 - m_pcskBit % 8; + + if (decodedBit) { + m_pcskFrame[byteIndex] |= static_cast(1U << bitIndex); + } else { + m_pcskFrame[byteIndex] &= static_cast(~(1U << bitIndex)); + } + + m_data = decodedBit; + m_sample = true; + m_pcskBit++; + m_pcskNextSymbolSample += samplesPerBit; + + if (m_pcskBit == 96) { + pcskCompleteFrame(currentSample); + } + } + else if (!m_pcskCollectingFrame) + { + if (magsq > m_threshold) { + pcskTryFrameSync(currentSample); + } else { + m_pcskSyncCandidate = false; + m_pcskSyncQuietSamples = 0; + } + } + + if (m_pcskReferenceDateTime.isValid() && (currentSample >= m_pcskNextTimeReportSample)) + { + qint64 elapsedMSecs = (currentSample - m_pcskReferenceSample) * 1000 + / RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE; + m_dateTime = m_pcskReferenceDateTime.addMSecs(elapsedMSecs); + + if (getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgDateTime::create(m_dateTime, m_dst)); + } + + do { + m_pcskNextTimeReportSample += RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE; + } while (m_pcskNextTimeReportSample <= currentSample); + } + + if (m_gotMinuteMarker && (m_pcskLastValidFrameSample > 0) + && (currentSample - m_pcskLastValidFrameSample > 125LL * RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE)) + { + m_gotMinuteMarker = false; + m_pcskReferenceDateTime = QDateTime(); + if (getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create("Looking for PCSK-225 frame")); + } + } +} + +bool RadioClockSink::pcskTryFrameSync(qint64 currentSample) +{ + constexpr int headerBits = 24; + constexpr int samplesPerBit = RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / 50; + constexpr quint32 header = 0x555560; + + if (currentSample < (headerBits - 1) * samplesPerBit) { + return false; + } + + // Least-squares fit: phase(bit) = intercept + slope*bit + separation*knownBit. + // This removes residual carrier offset while measuring the two NRZ states. + double matrix[3][4]{}; + + for (int i = 0; i < headerBits; i++) + { + qint64 sample = currentSample - (headerBits - 1 - i) * samplesPerBit; + double phase = m_pcskPhaseHistory[sample % m_pcskPhaseHistorySize]; + double knownBit = (header >> (headerBits - 1 - i)) & 1; + double x[3] = {1.0, static_cast(i), knownBit}; + + for (int row = 0; row < 3; row++) + { + for (int column = 0; column < 3; column++) { + matrix[row][column] += x[row] * x[column]; + } + matrix[row][3] += x[row] * phase; + } + } + + for (int pivot = 0; pivot < 3; pivot++) + { + int bestRow = pivot; + for (int row = pivot + 1; row < 3; row++) { + if (std::abs(matrix[row][pivot]) > std::abs(matrix[bestRow][pivot])) { + bestRow = row; + } + } + + if (std::abs(matrix[bestRow][pivot]) < 1.0e-9) { + return false; + } + + if (bestRow != pivot) { + for (int column = pivot; column < 4; column++) { + std::swap(matrix[pivot][column], matrix[bestRow][column]); + } + } + + double divisor = matrix[pivot][pivot]; + for (int column = pivot; column < 4; column++) { + matrix[pivot][column] /= divisor; + } + + for (int row = 0; row < 3; row++) + { + if (row == pivot) { + continue; + } + double multiplier = matrix[row][pivot]; + for (int column = pivot; column < 4; column++) { + matrix[row][column] -= multiplier * matrix[pivot][column]; + } + } + } + + double intercept = matrix[0][3]; + double slope = matrix[1][3]; + double separation = matrix[2][3]; + double squaredError = 0.0; + + for (int i = 0; i < headerBits; i++) + { + qint64 sample = currentSample - (headerBits - 1 - i) * samplesPerBit; + double phase = m_pcskPhaseHistory[sample % m_pcskPhaseHistorySize]; + double knownBit = (header >> (headerBits - 1 - i)) & 1; + double error = phase - (intercept + slope * i + separation * knownBit); + squaredError += error * error; + } + + double rmsError = std::sqrt(squaredError / headerBits); + double phaseDepth = std::abs(separation); + + const bool validCandidate = (phaseDepth >= 0.4) && (phaseDepth <= 0.85) + && (rmsError <= 0.08) && (phaseDepth / std::max(rmsError, 1.0e-6) >= 6.0); + + if (validCandidate) + { + double score = rmsError / phaseDepth; + + if (!m_pcskSyncCandidate || (score < m_pcskSyncScore)) + { + m_pcskSyncCandidate = true; + m_pcskSyncQuietSamples = 0; + m_pcskSyncScore = score; + m_pcskSyncEndSample = currentSample; + m_pcskSyncIntercept = intercept; + m_pcskSyncSlope = slope; + m_pcskSyncSeparation = separation; + } + else { + m_pcskSyncQuietSamples++; + } + } + else if (m_pcskSyncCandidate) { + m_pcskSyncQuietSamples++; + } + + // A threshold crossing can occur almost one bit before the optimum symbol + // centre. Wait for ten samples without a better fit and use the local best + // candidate. This still completes before the first payload bit is due. + if (!m_pcskSyncCandidate || (m_pcskSyncQuietSamples < samplesPerBit / 2)) { + return false; + } + + m_pcskCollectingFrame = true; + m_pcskSyncCandidate = false; + m_pcskBit = headerBits; + m_pcskFrameStartSample = m_pcskSyncEndSample - (headerBits - 1) * samplesPerBit; + m_pcskNextSymbolSample = m_pcskSyncEndSample + samplesPerBit; + m_pcskPhaseIntercept = m_pcskSyncIntercept; + m_pcskPhaseSlope = m_pcskSyncSlope; + m_pcskPhaseSeparation = m_pcskSyncSeparation; + m_pcskFrame.fill(0); + m_pcskFrame[0] = 0x55; + m_pcskFrame[1] = 0x55; + m_pcskFrame[2] = 0x60; + m_data = 0; + m_sample = true; + + qDebug() << "RadioClockSink::pcsk225 - Frame sync, phase depth" + << std::abs(m_pcskPhaseSeparation) * 180.0 / M_PI + << "degrees, normalized RMS" << m_pcskSyncScore; + + if (!m_gotMinuteMarker && getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create("Got PCSK-225 frame sync")); + } + + return true; +} + +void RadioClockSink::pcskCompleteFrame(qint64 currentSample) +{ + constexpr int samplesPerBit = RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / 50; + PCSK225Decoder::Result result{}; + QString error; + m_pcskCollectingFrame = false; + + if (!PCSK225Decoder::decode(m_pcskFrame, result, error)) + { + qDebug() << "RadioClockSink::pcsk225 -" << error; + if (getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create(error)); + } + return; + } + + // The encoded time applies at the documented timing point 25 bits after + // the first symbol centre. Keep that sample as the reference so reports + // account for the 1.4 seconds spent receiving the rest of the frame. + m_pcskReferenceSample = m_pcskFrameStartSample + 25 * samplesPerBit; + m_pcskReferenceDateTime = result.m_dateTimeUtc.toOffsetFromUtc(result.m_utcOffsetHours * 3600); + m_pcskNextTimeReportSample = currentSample; + m_pcskLastValidFrameSample = currentSample; + m_gotMinuteMarker = true; + + if (result.m_timeChangePending && (result.m_utcOffsetHours == 1)) { + m_dst = RadioClockSettings::STARTING; + } else if (result.m_timeChangePending && (result.m_utcOffsetHours == 2)) { + m_dst = RadioClockSettings::ENDING; + } else if (result.m_utcOffsetHours == 2) { + m_dst = RadioClockSettings::IN_EFFECT; + } else if (result.m_utcOffsetHours == 1) { + m_dst = RadioClockSettings::NOT_IN_EFFECT; + } else { + m_dst = RadioClockSettings::UNKNOWN; + } + + QString status = "OK"; + if (result.m_correctedSymbols > 0) { + status += QString(" (%1 RS symbol%2 corrected") + .arg(result.m_correctedSymbols) + .arg(result.m_correctedSymbols == 1 ? "" : "s"); + status += ")"; + } + if (result.m_leapSecondPending) { + status += result.m_leapSecondDelete ? "; negative leap second pending" : "; leap second pending"; + } + if (result.m_transmitterStatus != 0) { + status += QString("; transmitter status %1").arg(result.m_transmitterStatus); + } + + qDebug() << "RadioClockSink::pcsk225 -" << status + << result.m_dateTimeUtc << "UTC offset" << result.m_utcOffsetHours; + + if (getMessageQueueToChannel()) { + getMessageQueueToChannel()->push(RadioClock::MsgStatus::create(status)); + } +} + +void RadioClockSink::pcskReset() +{ + m_pcskPrevSample = Complex(0.0f, 0.0f); + m_pcskHavePrevSample = false; + m_pcskUnwrappedPhase = 0.0; + m_pcskPhaseHistory.fill(0.0); + m_pcskSampleCount = 0; + m_pcskSyncCandidate = false; + m_pcskSyncQuietSamples = 0; + m_pcskSyncScore = 0.0; + m_pcskSyncEndSample = 0; + m_pcskSyncIntercept = 0.0; + m_pcskSyncSlope = 0.0; + m_pcskSyncSeparation = 0.0; + m_pcskCollectingFrame = false; + m_pcskBit = 0; + m_pcskFrameStartSample = 0; + m_pcskNextSymbolSample = 0; + m_pcskPhaseIntercept = 0.0; + m_pcskPhaseSlope = 0.0; + m_pcskPhaseSeparation = 0.0; + m_pcskFrame.fill(0); + m_pcskReferenceDateTime = QDateTime(); + m_pcskReferenceSample = 0; + m_pcskNextTimeReportSample = 0; + m_pcskLastValidFrameSample = 0; +} + void RadioClockSink::processOneSample(Complex &ci) { // Calculate average and peak levels for level meter @@ -974,6 +1645,10 @@ void RadioClockSink::processOneSample(Complex &ci) wwvb(); } else if (m_settings.m_modulation == RadioClockSettings::JJY) { jjy(); + } else if (m_settings.m_modulation == RadioClockSettings::RBU) { + rbu(ci, magsq); + } else if (m_settings.m_modulation == RadioClockSettings::PCSK225) { + pcsk225(ci, magsq); } else { msf60(); } @@ -1029,6 +1704,8 @@ void RadioClockSink::applySettings(const QStringList& settingsKeys, const RadioC m_zeroCount = 0; m_second = 0; m_dst = RadioClockSettings::UNKNOWN; + rbuReset(true); + pcskReset(); if (getMessageQueueToChannel()) { getMessageQueueToChannel()->push(RadioClock::MsgStatus::create("Looking for minute marker")); } diff --git a/plugins/channelrx/radioclock/radioclocksink.h b/plugins/channelrx/radioclock/radioclocksink.h index 8088411c6..e54f0e10f 100644 --- a/plugins/channelrx/radioclock/radioclocksink.h +++ b/plugins/channelrx/radioclock/radioclocksink.h @@ -33,6 +33,7 @@ #include "radioclocksettings.h" #include +#include #include #include @@ -141,6 +142,51 @@ private: // WWVB state bool m_gotMarker; //!< Marker in previous second + // RBU state + Complex m_rbuPrevSample; + bool m_rbuHavePrevSample; + bool m_rbuHaveSymbolTiming; + int m_rbuSymbolSample; + int m_rbuCarrierLowCount; + int m_rbuTimingErrors; + double m_rbu100Real; + double m_rbu100Imag; + double m_rbu312Real; + double m_rbu312Imag; + int m_rbuCorrelationSamples; + quint32 m_rbuRecentBits; + int m_rbuRecentBitCount; + int m_rbuBit; + bool m_rbuSecondValid; + int m_rbuInvalidSeconds; + + // PCSK-225 state + static constexpr int m_pcskPhaseHistorySize = 512; + Complex m_pcskPrevSample; + bool m_pcskHavePrevSample; + double m_pcskUnwrappedPhase; + std::array m_pcskPhaseHistory; + qint64 m_pcskSampleCount; + bool m_pcskSyncCandidate; + int m_pcskSyncQuietSamples; + double m_pcskSyncScore; + qint64 m_pcskSyncEndSample; + double m_pcskSyncIntercept; + double m_pcskSyncSlope; + double m_pcskSyncSeparation; + bool m_pcskCollectingFrame; + int m_pcskBit; + qint64 m_pcskFrameStartSample; + qint64 m_pcskNextSymbolSample; + double m_pcskPhaseIntercept; + double m_pcskPhaseSlope; + double m_pcskPhaseSeparation; + std::array m_pcskFrame; + QDateTime m_pcskReferenceDateTime; + qint64 m_pcskReferenceSample; + qint64 m_pcskNextTimeReportSample; + qint64 m_pcskLastValidFrameSample; + void processOneSample(Complex &ci); MessageQueue *getMessageQueueToChannel() { return m_messageQueueToChannel; } void sampleToScope(Complex sample); @@ -155,6 +201,14 @@ private: void msf60(); void wwvb(); void jjy(); + void rbu(Complex& ci, Real magsq); + void rbuProcessBit(int bit); + bool rbuDecodeTimeCode(QString& error); + void rbuReset(bool resetTiming); + void pcsk225(Complex& ci, Real magsq); + bool pcskTryFrameSync(qint64 currentSample); + void pcskCompleteFrame(qint64 currentSample); + void pcskReset(); }; #endif // INCLUDE_RADIOCLOCKSINK_H diff --git a/plugins/channelrx/radioclock/readme.md b/plugins/channelrx/radioclock/readme.md index 7ce0d8b8a..1bf5ba3cf 100644 --- a/plugins/channelrx/radioclock/readme.md +++ b/plugins/channelrx/radioclock/readme.md @@ -9,6 +9,8 @@ This plugin can be used to receive the time and date as broadcast on Low Frequen * [TDF](https://en.wikipedia.org/wiki/TDF_time_signal) - France - 162kHz * [WWVB](https://en.wikipedia.org/wiki/WWVB) - USA - 60kHz * [JJY](https://en.wikipedia.org/wiki/JJY) - Japan - 40kHz +* [RBU](https://en.wikipedia.org/wiki/RBU) - Russia - 66.666kHz +* [PCSK-225](https://e-czas.gum.gov.pl/e-czas-radio/) - Poland - 225kHz If you'd like other transmitters to be supported, please upload a .sdriq file to SDRangel's [github issue tracker](https://github.com/f4exb/sdrangel/issues). @@ -50,9 +52,15 @@ Average total power in dB relative to a +/- 1.0 amplitude signal received in the This specifies the bandwidth of a LPF that is applied to the input signal to limit the RF bandwidth. +* For MSF, DCF77, TDF, WWBV and JJY, this can be 50Hz. +* For RBU, this should be 1000Hz. +* For PCSK-225 this should be 500Hz. +

6: TH - Threshold

-For MSF, DCF77, WWVB and JJY, specifies the threshold in dB below the average carrier power level that determines a binary 0 or 1. +* For MSF, DCF77, WWVB, JJY and RBU, specifies the threshold in dB below the average carrier power level. +* For RBU this is used to detect the 5ms carrier interruptions that provide symbol timing. +* PCSK-225 uses a fixed deep-fade gate 20dB below the average carrier level, so this setting does not affect it.

7: Modulation

@@ -63,6 +71,8 @@ Specifies the modulation and timecode encoding used: * TDF - PM (Phase modulation) * WWVB - OOK (On-off keying) * JJY - OOK (On-off keying) +* RBU - PM (Phase modulation with 100Hz and 312.5Hz subcarriers) +* PCSK-225 - NRZ phase modulation at 50 bit/s

8: Display Time Zone

@@ -102,7 +112,11 @@ Displays the daylight savings state: * Starting * Ending -For MSF, DCF77 and TDF, starting/ending is indicated one hour before the change. For WWVB it is set for the whole day. Japan does not use daylight savings. +For MSF, DCF77 and TDF, starting/ending is indicated one hour before the change. +For WWVB it is set for the whole day. +Japan does not use daylight savings. +RBU broadcasts the offset between Moscow time and UTC rather than a daylight-savings flag, so this field is blank for RBU. +PCSK-225 broadcasts the UTC offset and an advance time-zone-change flag, which are used to derive this field.

Waveforms

@@ -113,12 +127,16 @@ The signals available include: - IQ - IQ data at channel sample rate (1kHz). - MagSq - Magnitude squared (power) of received signal after being filtered with a moving average filter. - TH - Current threshold, which is moving average of MagSq - TH setting. -- FM - Output of FM demodulator for TDF demodulator only. +- FM - Output of the phase/frequency demodulator for TDF, RBU and PCSK-225. - Data - Demodulated data. For MSF/DCF77, this data=MagSq>TH. - Samp - Indicates when data is sampled (either for the second marker or for a timecode data bit). - GotMM - Indicates whether the minute marker has been received. Cleared when synchronization to second marker is lost. - GotM - Indicates when a marker is detected. For WWVB only. +For RBU, Data is the decoded 100ms symbol (100Hz is 0 and 312.5Hz is 1), Samp pulses when a symbol decision is made, and GotMM indicates that the five-symbol minute marker has been received. + +For PCSK-225, Data is the decoded 50 bit/s phase symbol, Samp pulses at the bit decision point, and GotMM indicates that a valid Reed-Solomon and CRC-protected time message has been received. The transport is organized as a repeating one-minute frame of twenty three-second slots; the displayed time runs locally between valid messages. + As an example of how this can be used, we can plot the MagSq as X and the calculated TH as Y, which can help to set the value of the TH setting to an appropriate level. diff --git a/plugins/feature/mcpserver/bandguide.md b/plugins/feature/mcpserver/bandguide.md index ac99eb9e0..082f7c52b 100644 --- a/plugins/feature/mcpserver/bandguide.md +++ b/plugins/feature/mcpserver/bandguide.md @@ -66,7 +66,7 @@ Minimum device sample rates: |------|---------|-----------|-------| | Radiosondes (RS41) | `RadiosondeDemod` | 400 to 406 MHz | Balloons are up around 00:00 and 12:00 UTC. The Radiosonde feature decodes and maps them; `listen` with mode `sonde` adds it | | NOAA APT weather images | `APTDemod` | NOAA 15 at 137.620 MHz, NOAA 18 at 137.912 MHz, NOAA 19 at 137.100 MHz | Historical: the NOAA APT satellites were retired in 2025, so there is nothing live to receive. The demodulator still decodes recordings | -| Time signals | `RadioClock` | MSF 60 kHz, DCF77 77.5 kHz, TDF 162 kHz, WWVB 60 kHz, JJY 40 kHz | Needs a receiver that covers VLF or LF | +| Time signals | `RadioClock` | MSF 60 kHz, DCF77 77.5 kHz, TDF 162 kHz, WWVB 60 kHz, JJY 40 kHz, RBU 66.666 kHz, PCSK-225 225 kHz | Needs a receiver that covers VLF or LF | | Inmarsat STD-C | `InmarsatDemod` | 1537.70, 1541.45, 1537.10 MHz | L band, needs a suitable antenna and often an LNA | ## Broadcast diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 25a9a0d55..0fa25cc5d 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -18620,9 +18620,9 @@ margin-bottom: 20px; }, "modulation" : { "type" : "integer", - "description" : "0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY", + "description" : "0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY, 5 - RBU, 6 - PCSK-225", "minimum" : 0, - "maximum" : 4 + "maximum" : 6 }, "timezone" : { "type" : "integer", diff --git a/sdrbase/resources/webapi/doc/swagger/include/RadioClock.yaml b/sdrbase/resources/webapi/doc/swagger/include/RadioClock.yaml index ac1b1e42b..815f56a9b 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/RadioClock.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/RadioClock.yaml @@ -15,7 +15,7 @@ RadioClockSettings: type: integer format: int64 rfBandwidth: - description: channel RF bandwidth in Hz + description: "Channel RF bandwidth in Hz. Should be 50 Hz for MSF, DCF77, TDF, WWVB or JJY. Should be 1000 Hz for RBU. Should be 500 Hz for PCSK-225" type: number format: float threshold: @@ -23,10 +23,10 @@ RadioClockSettings: format: float description: "Threshold setting for Radio clock." modulation: - description: 0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY + description: 0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY, 5 - RBU, 6 - PCSK-225 type: integer minimum: 0 - maximum: 4 + maximum: 6 timezone: description: 0 - Broadcast, 1 - Local, 2 - UTC type: integer diff --git a/swagger/sdrangel/api/swagger/include/RadioClock.yaml b/swagger/sdrangel/api/swagger/include/RadioClock.yaml index 3e1cc0ed9..3db2cd762 100644 --- a/swagger/sdrangel/api/swagger/include/RadioClock.yaml +++ b/swagger/sdrangel/api/swagger/include/RadioClock.yaml @@ -15,7 +15,7 @@ RadioClockSettings: type: integer format: int64 rfBandwidth: - description: channel RF bandwidth in Hz + description: "Channel RF bandwidth in Hz. Should be 50 Hz for MSF, DCF77, TDF, WWVB or JJY. Should be 1000 Hz for RBU. Should be 500 Hz for PCSK-225" type: number format: float threshold: @@ -23,10 +23,10 @@ RadioClockSettings: format: float description: "Threshold setting for Radio clock." modulation: - description: 0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY + description: 0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY, 5 - RBU, 6 - PCSK-225 type: integer minimum: 0 - maximum: 4 + maximum: 6 timezone: description: 0 - Broadcast, 1 - Local, 2 - UTC type: integer diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 25a9a0d55..0fa25cc5d 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -18620,9 +18620,9 @@ margin-bottom: 20px; }, "modulation" : { "type" : "integer", - "description" : "0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY", + "description" : "0 - MSF, 1 - DCF77, 2 - TDF, 3 - WWVB, 4 - JJY, 5 - RBU, 6 - PCSK-225", "minimum" : 0, - "maximum" : 4 + "maximum" : 6 }, "timezone" : { "type" : "integer",