Compare commits
44
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53736ef750 | ||
|
|
6566eae2c7 | ||
|
|
f3eeddff7c | ||
|
|
1540ca5b4e | ||
|
|
e449704fd2 | ||
|
|
af74430551 | ||
|
|
d07dbdc645 | ||
|
|
d07a627508 | ||
|
|
9fbf90ee91 | ||
|
|
d393b3cefc | ||
|
|
35a492ec95 | ||
|
|
b20da5c541 | ||
|
|
a0bdaa2c4b | ||
|
|
6676b66993 | ||
|
|
412651d612 | ||
|
|
d347b493d9 | ||
|
|
39e59dca96 | ||
|
|
5654520901 | ||
|
|
ff75fcc692 | ||
|
|
4728b578ae | ||
|
|
7db7fad9b0 | ||
|
|
830f7299fe | ||
|
|
061738a63b | ||
|
|
e8bd97655f | ||
|
|
7d0b36450d | ||
|
|
b12c83e8b5 | ||
|
|
ff4e2a5c5d | ||
|
|
2ef9f80fc1 | ||
|
|
6fe549e34e | ||
|
|
406a8f86b1 | ||
|
|
4b17b4ac1d | ||
|
|
977f7b709e | ||
|
|
a2838b06a2 | ||
|
|
c6cd661676 | ||
|
|
bf08c7ebc0 | ||
|
|
c7470acc1c | ||
|
|
bcde03de38 | ||
|
|
63d46562c7 | ||
|
|
e575b3b365 | ||
|
|
2121817c04 | ||
|
|
d0bd38d7df | ||
|
|
bf9617e24d | ||
|
|
3c235fce5e | ||
|
|
ba48de2d30 |
@@ -1,3 +1,7 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Enable CPU optimizations for better performance
|
||||
# Set target-cpu to native to use all available CPU features on the build machine
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# CI for the self-hosted, host-executor Podman runners (see container/).
|
||||
# The runner image bakes in the Rust toolchain and all build dependencies,
|
||||
# so jobs go straight to cargo — no apt/rustup setup steps (which also
|
||||
# collided on the dpkg lock when jobs ran concurrently in the same runner).
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: rustfmt
|
||||
run: cargo fmt --all -- --check
|
||||
- name: clippy
|
||||
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo build --workspace --all-targets --locked
|
||||
- name: Test
|
||||
run: cargo test --workspace --locked
|
||||
|
||||
reuse:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: REUSE compliance
|
||||
# `reuse` CLI instead of fsfe/reuse-action: the latter is a Docker
|
||||
# action, which the host-executor runners cannot run. `reuse` is baked
|
||||
# into the runner image (see container/Containerfile).
|
||||
run: reuse lint
|
||||
@@ -1,39 +0,0 @@
|
||||
name: Sync docs to Wiki
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'docs/**'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
wiki:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout wiki
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}.wiki
|
||||
path: wiki
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Sync docs to wiki
|
||||
run: |
|
||||
rsync -av --delete --exclude='.git' docs/ wiki/
|
||||
cd wiki
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "No wiki changes to commit."
|
||||
else
|
||||
git commit -m "Sync docs from ${GITHUB_SHA::8}"
|
||||
git push
|
||||
fi
|
||||
+21
-1
@@ -18,7 +18,7 @@ When contributing to the project, please follow these guidelines:
|
||||
- Use a maximum of 80 characters per line.
|
||||
- Use a blank line between the commit message and the body.
|
||||
- Sign your commits with `git commit -s`.
|
||||
- Explicitly mark LLM usage in commit messages with 'Co-authored-by:'.
|
||||
- Disclose AI/LLM assistance with an `Assisted-By:` trailer (see below).
|
||||
|
||||
Use the format below for commit titles:
|
||||
[<type>](<crate>): <description>
|
||||
@@ -39,3 +39,23 @@ Allowed types:
|
||||
- chore: build or maintenance changes
|
||||
|
||||
Write isolated commits for each crate.
|
||||
|
||||
## Attribution trailers
|
||||
|
||||
This project follows the Linux kernel convention for crediting work.
|
||||
|
||||
The `Co-Authored-By:` and `Co-Developed-By:` trailers name **people** who
|
||||
authored the change. They are reserved for humans, and every person named
|
||||
this way must also add their own `Signed-off-by:` line. Never use these
|
||||
trailers for tools, assistants, or bots.
|
||||
|
||||
When a commit was produced with help from an AI assistant or LLM,
|
||||
disclose it with an `Assisted-By:` trailer naming the tool (and model,
|
||||
where relevant). The human committer remains the author of record and
|
||||
takes responsibility for the change through `Signed-off-by:`.
|
||||
|
||||
Example:
|
||||
|
||||
Assisted-By: Claude Code (claude-opus-4)
|
||||
Co-Authored-By: Jane Developer <jane@example.com>
|
||||
Signed-off-by: Your Name <you@example.com>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
|
||||
-143
@@ -1,143 +0,0 @@
|
||||
# Fix Plan
|
||||
|
||||
Current state analysis of trx-rs as of 2026-04-08.
|
||||
|
||||
## Overall Assessment
|
||||
|
||||
The codebase is in good shape. Clippy is clean, no `unsafe` code, no TODO/FIXME markers,
|
||||
robust error handling throughout. One broken test and several untested crates are the
|
||||
main weak spots.
|
||||
|
||||
---
|
||||
|
||||
## P0 — Broken Test
|
||||
|
||||
### 1. `test_toggle_ft8_decode` returns 500 instead of 200
|
||||
|
||||
**Location:** `src/trx-client/trx-frontend/trx-frontend-http/src/api/mod.rs:1016`
|
||||
|
||||
**Root cause:** The handler `toggle_ft8_decode` (decoder.rs:353) requires
|
||||
`context: web::Data<Arc<FrontendRuntimeContext>>` for multi-rig state resolution.
|
||||
The test registers `state_rx` and `rig_tx` but not `context`, so actix-web returns 500
|
||||
(missing app data). A `make_context()` helper already exists at line 757 but is unused
|
||||
by this test.
|
||||
|
||||
**Fix:** Add `.app_data(web::Data::new(make_context()))` to the test's `App` builder
|
||||
(line 1036-1041). ~1 line change.
|
||||
|
||||
**Impact:** This is the only failing test in the entire suite (50 pass, 1 fail).
|
||||
|
||||
---
|
||||
|
||||
## P1 — Test Coverage Gaps
|
||||
|
||||
### 2. trx-aprs decoder — 0 tests (596 LOC)
|
||||
|
||||
**Location:** `src/decoders/trx-aprs/src/lib.rs`
|
||||
|
||||
Bell 202 AFSK demodulator + AX.25 HDLC frame parser + CRC-16 validation.
|
||||
No `#[cfg(test)]` module at all.
|
||||
|
||||
**Suggested tests:**
|
||||
- CRC-16 computation on known frames
|
||||
- HDLC flag detection and bit-unstuffing
|
||||
- Full frame decode from synthetic AFSK audio (1200 baud sine pairs)
|
||||
- Rejection of corrupted frames (bad CRC, truncated)
|
||||
|
||||
### 3. trx-decode-log — 0 tests (226 LOC)
|
||||
|
||||
**Location:** `src/decoders/trx-decode-log/src/lib.rs`
|
||||
|
||||
JSON Lines file writer with date-based rotation. Pure I/O wrapper.
|
||||
|
||||
**Suggested tests:**
|
||||
- Write + read-back round-trip in a tempdir
|
||||
- Date rotation triggers new file creation
|
||||
- Flush error logging (mock writer)
|
||||
|
||||
### 4. trx-reporting — partial tests (1,065 LOC across 2 files)
|
||||
|
||||
**Location:** `src/trx-reporting/src/pskreporter.rs` (582 LOC),
|
||||
`src/trx-reporting/src/aprsfi.rs` (483 LOC)
|
||||
|
||||
Both files have `#[cfg(test)]` modules but coverage is limited to serialization.
|
||||
Network behavior (reconnect, rate-limit, batching) is untested.
|
||||
|
||||
**Suggested tests:**
|
||||
- PSKReporter UDP datagram encoding round-trip
|
||||
- APRS-IS login line formatting
|
||||
- Spot batching and dedup logic (unit-testable without network)
|
||||
|
||||
---
|
||||
|
||||
## P2 — Code Quality
|
||||
|
||||
### 5. `audio.rs` is 4,000 LOC
|
||||
|
||||
**Location:** `src/trx-server/src/audio.rs`
|
||||
|
||||
Houses all decoder task launchers (FT8, FT4, FT2, APRS, AIS, VDES, CW, WSPR, LRPT,
|
||||
WEFAX). Each launcher follows the same pattern. The file is coherent but large.
|
||||
|
||||
**Suggested improvement:** Extract decoder launchers into a `decoders/` submodule
|
||||
within trx-server, one file per decoder family (e.g., `ftx.rs`, `aprs.rs`, `wefax.rs`).
|
||||
Keep the audio pipeline and capture logic in `audio.rs`.
|
||||
|
||||
### 6. `scheduler.rs` is 1,585 LOC
|
||||
|
||||
**Location:** `src/trx-client/trx-frontend/trx-frontend-http/src/scheduler.rs`
|
||||
|
||||
Mixes grayline computation, timespan matching, satellite pass prediction, and the
|
||||
scheduler state machine. Well-tested but dense.
|
||||
|
||||
**Suggested improvement:** Extract grayline and satellite pass logic into separate
|
||||
modules (these are pure functions with no HTTP dependencies).
|
||||
|
||||
---
|
||||
|
||||
## P3 — Minor
|
||||
|
||||
### 7. `#[allow(dead_code)]` in soapysdr backend (4 annotations)
|
||||
|
||||
**Locations:**
|
||||
- `vchan_impl.rs:66,87` — `fixed_slot_count`, `process_pair`
|
||||
- `real_iq_source.rs:20` — `device`
|
||||
- `demod.rs:113` — lifetime anchor
|
||||
|
||||
All documented as intentional (lifetime anchors / reserved capacity). No action needed
|
||||
unless the fields can be converted to `PhantomData` or `_`-prefixed without breaking
|
||||
semantics.
|
||||
|
||||
### 8. FrontendRuntimeContext test helper duplication risk
|
||||
|
||||
**Location:** `src/trx-client/trx-frontend/trx-frontend-http/src/api/mod.rs:757`
|
||||
|
||||
`make_context()` and `spawn_rig_responder()` are good helpers but only used by some
|
||||
tests. As new endpoint tests are added, ensure they consistently use these helpers to
|
||||
avoid repeating the `test_toggle_ft8_decode` bug.
|
||||
|
||||
---
|
||||
|
||||
## Implementation Order
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
title Fix Plan
|
||||
dateFormat X
|
||||
axisFormat %s
|
||||
|
||||
section P0
|
||||
Fix test_toggle_ft8_decode :p0, 0, 1
|
||||
|
||||
section P1
|
||||
Add trx-aprs tests :p1a, 1, 3
|
||||
Add trx-decode-log tests :p1b, 1, 2
|
||||
Expand trx-reporting tests :p1c, 1, 3
|
||||
|
||||
section P2
|
||||
Split audio.rs decoder launchers :p2a, 3, 5
|
||||
Extract scheduler pure functions :p2b, 3, 5
|
||||
```
|
||||
|
||||
P0 is a one-line fix. P1 items are independent and can be parallelized. P2 items are
|
||||
refactors that should wait until P1 tests provide regression safety.
|
||||
@@ -0,0 +1,338 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
<https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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; either version 2 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Moe Ghoul>, 1 April 1989
|
||||
Moe Ghoul, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,43 @@
|
||||
SIL OPEN FONT LICENSE
|
||||
|
||||
Version 1.1 - 26 February 2007
|
||||
|
||||
PREAMBLE
|
||||
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
|
||||
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting, or substituting — in part or in whole — any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
|
||||
This license becomes null and void if any of the above conditions are not met.
|
||||
|
||||
DISCLAIMER
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
A modular amateur radio control stack written in Rust.
|
||||
|
||||
[](LICENSES)
|
||||
[](LICENSES)
|
||||
|
||||
</div>
|
||||
|
||||
@@ -64,9 +64,15 @@ brew install soapysdr
|
||||
```
|
||||
</details>
|
||||
|
||||
See [Build Requirements](https://github.com/sgrams/trx-rs/wiki/User-Manual#build-requirements)
|
||||
See [Build Requirements](https://git.haxx.space/sjg/trx-rs/wiki/User-Manual#build-requirements)
|
||||
in the wiki for details on each library.
|
||||
|
||||
> **Note:** `cmake` is required even when a system Opus library is installed.
|
||||
> The `audiopus_sys` crate probes for Opus via `pkg-config`; if it is not found
|
||||
> (or `pkg-config` is unavailable), it falls back to compiling a vendored copy
|
||||
> of Opus with CMake. A missing `cmake` therefore fails the build with
|
||||
> `is cmake not installed?` rather than a missing-Opus error.
|
||||
|
||||
### 2. Build
|
||||
|
||||
```bash
|
||||
@@ -127,12 +133,15 @@ a unified set of frontends.
|
||||
|
||||
| Resource | Description |
|
||||
|----------|-------------|
|
||||
| [User Manual](https://github.com/sgrams/trx-rs/wiki/User-Manual) | Configuration, features, and usage |
|
||||
| [Architecture](https://github.com/sgrams/trx-rs/wiki/Architecture) | System design, crate layout, data flow, and internals |
|
||||
| [Optimization Guidelines](https://github.com/sgrams/trx-rs/wiki/Optimization-Guidelines) | Performance guidelines for the real-time DSP pipeline |
|
||||
| [Planned Features](https://github.com/sgrams/trx-rs/wiki/Planned-Features) | Roadmap and design notes |
|
||||
| [User Manual](https://git.haxx.space/sjg/trx-rs/wiki/User-Manual) | Configuration, features, and usage |
|
||||
| [Architecture](https://git.haxx.space/sjg/trx-rs/wiki/Architecture) | System design, crate layout, data flow, and internals |
|
||||
| [Optimization Guidelines](https://git.haxx.space/sjg/trx-rs/wiki/Optimization-Guidelines) | Performance guidelines for the real-time DSP pipeline |
|
||||
| [Planned Features](https://git.haxx.space/sjg/trx-rs/wiki/Planned-Features) | Roadmap and design notes |
|
||||
| [Contributing](CONTRIBUTING.md) | Commit conventions, workflow, and code style |
|
||||
|
||||
## License
|
||||
|
||||
BSD-2-Clause. See [`LICENSES`](LICENSES) for bundled third-party license files.
|
||||
GPL-2.0-or-later. See [`LICENSES`](LICENSES) for the full license text and
|
||||
bundled third-party license files. Bundled third-party components retain their
|
||||
original licenses: Leaflet is BSD-2-Clause, DSEG is OFL-1.1, and opus-decoder
|
||||
is MIT.
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
version = 1
|
||||
|
||||
# Project-owned files without an in-file SPDX header (docs, config,
|
||||
# repo metadata, logos, and bespoke web assets).
|
||||
[[annotations]]
|
||||
path = [
|
||||
".gitattributes",
|
||||
".gitignore",
|
||||
"CLAUDE.md",
|
||||
"CONTRIBUTING.md",
|
||||
"README.md",
|
||||
"trx-rs.toml.example",
|
||||
"docs/**",
|
||||
"aidocs/**",
|
||||
"src/decoders/trx-ftx/README.md",
|
||||
"src/decoders/trx-wxsat/README.md",
|
||||
"assets/trx-logo.png",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/trx-favicon.png",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/trx-logo.png",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/bandplan.json",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/leaflet-ais-tracksymbol.js",
|
||||
]
|
||||
SPDX-FileCopyrightText = "2026 Stan Grams <sjg@haxx.space>"
|
||||
SPDX-License-Identifier = "GPL-2.0-or-later"
|
||||
|
||||
# Vendored Leaflet 1.9.4 (https://leafletjs.com), distributed under BSD-2-Clause.
|
||||
[[annotations]]
|
||||
path = [
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/leaflet.js",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/leaflet.css",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/layers.png",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/layers-2x.png",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/marker-icon.png",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/marker-icon-2x.png",
|
||||
"src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/marker-shadow.png",
|
||||
]
|
||||
SPDX-FileCopyrightText = "2010-2023 Vladimir Agafonkin, 2010-2011 CloudMade"
|
||||
SPDX-License-Identifier = "BSD-2-Clause"
|
||||
|
||||
# Vendored DSEG14 font (https://github.com/keshikan/DSEG), SIL OFL 1.1.
|
||||
[[annotations]]
|
||||
path = ["src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/dseg14-classic-latin-400-normal.woff2"]
|
||||
SPDX-FileCopyrightText = "2020 The DSEG Authors (https://github.com/keshikan/DSEG)"
|
||||
SPDX-License-Identifier = "OFL-1.1"
|
||||
|
||||
# Vendored opus-decoder 0.7.11 browser build
|
||||
# (https://github.com/eshaz/wasm-audio-decoders), MIT.
|
||||
# SHA-256: fd73ee0a9c8a5e233c0b88234df14f46003ad89bb4ba27435bc8714db2a6dc62
|
||||
[[annotations]]
|
||||
path = ["src/trx-client/trx-frontend/trx-frontend-http/assets/web/vendor/opus-decoder-0.7.11.min.js"]
|
||||
SPDX-FileCopyrightText = "2021-2025 Ethan Halsall"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
@@ -0,0 +1,89 @@
|
||||
# Work In Progress — Project Improvement Areas
|
||||
|
||||
Living tracker for engineering-infrastructure and hardening work identified
|
||||
during a July 2026 repo scan. The architecture-level backlog
|
||||
(`docs/Improvement-Areas.md`, P0–P3) is closed; these items focus on the
|
||||
tooling, robustness, and product concerns *around* the code.
|
||||
|
||||
Status legend: **Done** · **In progress** · **Not started**
|
||||
|
||||
| # | Tier | Area | Status |
|
||||
|----|------|------|--------|
|
||||
| 1 | 1 — Infrastructure | Gitea Actions CI (fmt, clippy, test, REUSE) | In progress |
|
||||
| 2 | 1 — Infrastructure | Supply-chain & lint governance (cargo-deny/audit, MSRV, `[workspace.lints]`) | Not started |
|
||||
| 3 | 1 — Infrastructure | Release & deployment (container image, systemd units, binary releases) | Not started |
|
||||
| 4 | 2 — Robustness | Panic-resilience audit (harden ~495 unwrap/expect/panic sites) | Not started |
|
||||
| 5 | 2 — Robustness | `unsafe` SIMD safety scaffolding (`# Safety` docs, scalar↔SIMD equivalence tests) | Not started |
|
||||
| 6 | 2 — Robustness | DSP performance benchmarks (criterion, guard optimization gains) | Not started |
|
||||
| 7 | 2 — Robustness | Test-coverage measurement & gap-filling (llvm-cov; CAT backends, server tasks) | Not started |
|
||||
| 8 | 3 — Product | Frontend modularization & tooling (split `app.js` into ES modules, ESLint, JS tests) | Not started |
|
||||
| 9 | 3 — Product | Runtime observability (`/health`, Prometheus metrics) | Not started |
|
||||
| 10 | 3 — Product | Documentation freshness & consolidation (reconcile `docs/` with code) | Not started |
|
||||
|
||||
## Tier 1 — Infrastructure gaps
|
||||
|
||||
### 1. Gitea Actions CI
|
||||
No `.gitea/` / `.github/` / Woodpecker workflows exist, despite 768 tests.
|
||||
Add a workflow running `cargo fmt --check`, `cargo clippy -D warnings`,
|
||||
`cargo build`/`cargo test`, and REUSE lint on push + pull_request.
|
||||
System deps: `pkg-config cmake libopus-dev libasound2-dev libsoapysdr-dev`
|
||||
(the `soapysdr` backend is a default feature).
|
||||
|
||||
Notes for the runner: assumes an `act_runner` registered with an
|
||||
`ubuntu-latest` label and GitHub-action proxying enabled (used by
|
||||
`actions/checkout`, `actions/cache`, `fsfe/reuse-action`). `clippy` runs
|
||||
with `-D warnings`; core crates are already clean, but if the first full
|
||||
`--all-features` run surfaces warnings in a less-travelled crate, fix them
|
||||
(preferred) or temporarily soften that step.
|
||||
|
||||
### 2. Supply-chain & lint governance
|
||||
No `deny.toml`, `cargo audit`, `rustfmt.toml`/`clippy.toml`, declared MSRV,
|
||||
or `[workspace.lints]`. Add dependency auditing to CI, pin an MSRV
|
||||
(`rust-version`), and centralize lint policy in the workspace manifest.
|
||||
|
||||
### 3. Release & deployment
|
||||
No `Dockerfile`, systemd units, packaging, or release automation (only
|
||||
`script/dummy-server.sh`). Add a container image, example systemd units for
|
||||
`trx-server`/`trx-client`, and a tag-triggered static-binary release job.
|
||||
|
||||
## Tier 2 — Robustness & correctness
|
||||
|
||||
### 4. Panic-resilience audit
|
||||
495 `unwrap()`/`expect()`/`panic!` sites, 11 in the hottest server files
|
||||
(`audio.rs`, `rig_task.rs`). A panic there can drop a rig task or the
|
||||
process. Convert hot-path panics to error propagation / graceful
|
||||
degradation; reserve `expect` for documented invariants.
|
||||
|
||||
### 5. `unsafe` SIMD safety scaffolding
|
||||
13 `unsafe` blocks (AVX2 DSP). Add `# Safety` docs stating invariants,
|
||||
confirm runtime feature detection is tested, and add property tests
|
||||
asserting SIMD output matches the scalar fallback across random inputs.
|
||||
|
||||
### 6. DSP performance benchmarks
|
||||
`docs/Optimization-Guidelines.md` documents NCO/polyphase/AVX2 gains, but no
|
||||
`criterion` benches guard them. Add benches for the demod/resample/FFT hot
|
||||
paths so regressions surface as numbers.
|
||||
|
||||
### 7. Test-coverage measurement & gap-filling
|
||||
67 of 146 Rust files have no test module. Protocol is well covered; backends
|
||||
(CAT BCD/ASCII encoding), `listener.rs`, and `config.rs` look thin. Wire up
|
||||
`cargo-llvm-cov` and target the CAT backends and server tasks first.
|
||||
|
||||
## Tier 3 — Product & maintainability
|
||||
|
||||
### 8. Frontend modularization & tooling
|
||||
`app.js` is 8,760 lines and `map-core.js` 3,515, with no modules, linter, or
|
||||
tests. Keeping vanilla HTML+JS (no framework), split into native ES modules
|
||||
by concern, add ESLint + Prettier, and add `node:test` unit tests for pure
|
||||
logic (frequency formatting, unit math, decode parsing).
|
||||
|
||||
### 9. Runtime observability
|
||||
`tracing` is set up, but there is no `/health` endpoint or metrics
|
||||
instrumentation. Add health/readiness endpoints and Prometheus-format
|
||||
metrics (decode rates, reconnects, audio underruns, per-rig state).
|
||||
|
||||
### 10. Documentation freshness & consolidation
|
||||
`docs/` (13 files) is mostly dated 2026-03-29 while code moved into July, and
|
||||
mixes planning artifacts with reference docs. Reconcile against current code,
|
||||
separate "plans" from "reference," and fold still-true content into the
|
||||
canonical docs.
|
||||
@@ -0,0 +1,61 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Gitea Actions runner image for trx-rs CI (host-executor / "Pattern B").
|
||||
#
|
||||
# All build dependencies, the Rust toolchain, Node.js (for JS actions such as
|
||||
# actions/checkout and actions/cache) and the `reuse` tool are baked in, so CI
|
||||
# runs skip the per-run apt/rustup install cost. `sudo` is present so the
|
||||
# existing workflow's `sudo apt-get ...` / rustup steps remain valid — they
|
||||
# just become fast no-ops because everything is already installed.
|
||||
FROM docker.io/library/debian:bookworm-slim
|
||||
|
||||
ARG ACT_RUNNER_VERSION=0.2.11
|
||||
ARG NODE_MAJOR=20
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
RUSTUP_HOME=/opt/rustup \
|
||||
CARGO_HOME=/opt/cargo \
|
||||
PATH=/opt/cargo/bin:/usr/local/bin:/usr/bin:/bin
|
||||
|
||||
# Base tooling + trx-rs build dependencies (mirrors .gitea/workflows/ci.yml).
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl xz-utils git sudo pipx \
|
||||
build-essential pkg-config cmake clang libclang-dev \
|
||||
libopus-dev libasound2-dev libsoapysdr-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Node.js (JS-based actions need node in PATH under the host executor).
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - \
|
||||
&& apt-get install -y --no-install-recommends nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# REUSE >= 3 (Debian's packaged reuse is too old for REUSE.toml).
|
||||
# The [charset-normalizer] extra provides an encoding-detection backend;
|
||||
# without it (and without libmagic) reuse fails to import at runtime.
|
||||
RUN PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install 'reuse[charset-normalizer]'
|
||||
|
||||
# Rust stable with rustfmt + clippy, installed system-wide.
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
||||
| sh -s -- -y --no-modify-path --profile minimal \
|
||||
--component rustfmt --component clippy \
|
||||
&& chmod -R a+rwX "$CARGO_HOME" "$RUSTUP_HOME"
|
||||
|
||||
# act_runner binary.
|
||||
RUN arch="$(dpkg --print-architecture)"; \
|
||||
case "$arch" in amd64) rarch=amd64;; arm64) rarch=arm64;; *) echo "unsupported arch $arch" >&2; exit 1;; esac; \
|
||||
curl -fsSL -o /usr/local/bin/act_runner \
|
||||
"https://gitea.com/gitea/act_runner/releases/download/v${ACT_RUNNER_VERSION}/act_runner-${ACT_RUNNER_VERSION}-linux-${rarch}" \
|
||||
&& chmod +x /usr/local/bin/act_runner
|
||||
|
||||
# Default config template (seeded into the /data volume on first boot).
|
||||
COPY config.yaml /etc/act_runner/config.yaml
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# /data holds the .runner registration, cache and workflow workspaces.
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
@@ -0,0 +1,118 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
-->
|
||||
|
||||
# Podman-based Gitea Actions runners
|
||||
|
||||
Run two independent Gitea Actions runners on one host as rootless Podman
|
||||
containers managed by systemd (Quadlet) — one per project — instead of two
|
||||
VMs. Uses the **host executor**: workflow steps run directly inside a
|
||||
purpose-built runner image that already has the Rust toolchain and all build
|
||||
dependencies baked in, so CI runs skip the per-run install cost and no
|
||||
Docker/Podman socket is needed.
|
||||
|
||||
## Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `Containerfile` | Runner image: Debian + build deps + clang + Rust + Node + `reuse` + `act_runner`. |
|
||||
| `entrypoint.sh` | Registers on first boot (if needed), then runs the daemon. |
|
||||
| `config.yaml` | act_runner config template (seeded into each runner's volume). |
|
||||
| `trx-rs-runner.container` | Quadlet unit for the trx-rs runner. |
|
||||
| `project2-runner.container` | Quadlet unit for the second project's runner. |
|
||||
|
||||
## Prerequisites (once per host)
|
||||
|
||||
Rootless Podman with cgroups v2 (default on modern distros). As the unprivileged
|
||||
user that will own the runners:
|
||||
|
||||
```bash
|
||||
# Survive logout / start on boot without an interactive session.
|
||||
loginctl enable-linger "$USER"
|
||||
```
|
||||
|
||||
No `podman.socket` is required for the host executor.
|
||||
|
||||
## 1. Build the image
|
||||
|
||||
```bash
|
||||
cd container
|
||||
podman build -t trx-rs-ci:latest .
|
||||
```
|
||||
|
||||
## 2. Get a registration token
|
||||
|
||||
For **each** repo: *Settings → Actions → Runners → Create new Runner* and copy
|
||||
the token. (Org- or instance-level tokens work too if you prefer wider scope.)
|
||||
|
||||
## 3. Install and start the runners
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/containers/systemd
|
||||
cp trx-rs-runner.container project2-runner.container ~/.config/containers/systemd/
|
||||
|
||||
# Paste each repo's token for the FIRST boot only:
|
||||
# Environment=GITEA_RUNNER_REGISTRATION_TOKEN=xxxx…
|
||||
$EDITOR ~/.config/containers/systemd/trx-rs-runner.container
|
||||
$EDITOR ~/.config/containers/systemd/project2-runner.container
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user start trx-rs-runner
|
||||
systemctl --user start project2-runner
|
||||
|
||||
systemctl --user status trx-rs-runner
|
||||
podman logs -f gitea-runner-trx-rs
|
||||
```
|
||||
|
||||
Once each runner shows **online** in the repo's runner list, blank out the
|
||||
`GITEA_RUNNER_REGISTRATION_TOKEN` line again (the registration is persisted in
|
||||
the `…-data` volume) and `systemctl --user daemon-reload`.
|
||||
|
||||
## Required workflow change: the `reuse` job
|
||||
|
||||
The host executor runs steps directly in the container and therefore **cannot
|
||||
run Docker-based actions**. The current `reuse` job uses `fsfe/reuse-action@v5`,
|
||||
which is a Docker action. `reuse` is baked into the image, so replace that job
|
||||
with a plain command:
|
||||
|
||||
```yaml
|
||||
reuse:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: REUSE compliance
|
||||
run: reuse lint
|
||||
```
|
||||
|
||||
The `lint` and `test` jobs need no changes: their `sudo apt-get …` and rustup
|
||||
steps still run, but become fast no-ops because the image already has those
|
||||
packages and the toolchain. (`sudo` is included in the image for exactly this
|
||||
reason.)
|
||||
|
||||
> If you would rather keep Docker-based actions and per-run images, use the
|
||||
> **Docker executor** instead: drop the `:host` suffix from the label in
|
||||
> `config.yaml`, enable `systemctl --user --now enable podman.socket`, mount it
|
||||
> into the container, and set `container.docker_host` to the socket path. That
|
||||
> trades the baked-in speed for stronger per-job isolation.
|
||||
|
||||
## Tuning
|
||||
|
||||
- **`capacity`** (in `config.yaml`) — concurrent jobs per runner. Rust builds
|
||||
are heavy; 1–2 is sensible when two runners share a host.
|
||||
- **`PodmanArgs=--cpus/--memory`** (in each `.container`) — hard resource caps
|
||||
so one project cannot starve the other.
|
||||
- **SELinux** — the `:Z` volume flag is already set; keep it if SELinux is
|
||||
enforcing.
|
||||
|
||||
## Committing these files
|
||||
|
||||
If you add this directory to a REUSE-checked repo, register the markdown in
|
||||
`REUSE.toml` (the other files carry inline SPDX headers):
|
||||
|
||||
```toml
|
||||
[[annotations]]
|
||||
path = ["container/**"]
|
||||
SPDX-FileCopyrightText = "2026 Stan Grams <sjg@haxx.space>"
|
||||
SPDX-License-Identifier = "GPL-2.0-or-later"
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# act_runner configuration template. Seeded into /data/config.yaml on first
|
||||
# boot; edit the copy inside the volume to change settings per runner.
|
||||
|
||||
log:
|
||||
level: info
|
||||
|
||||
runner:
|
||||
# Registration state. Relative to the daemon's working directory (/data).
|
||||
file: .runner
|
||||
# Concurrent jobs this runner will pick up. Rust builds are heavy — keep this
|
||||
# modest, especially if two runners share one host. The trx-rs workflow has
|
||||
# three parallel jobs (lint, test, reuse); capacity 2 lets two overlap.
|
||||
capacity: 2
|
||||
timeout: 3h
|
||||
# Map the workflow's `runs-on: ubuntu-latest` to the HOST executor, i.e. run
|
||||
# steps directly inside THIS container (which already has all the toolchain).
|
||||
# No Docker/Podman socket is required in this mode.
|
||||
labels:
|
||||
- "ubuntu-latest:host"
|
||||
|
||||
cache:
|
||||
# Built-in actions cache server (used by actions/cache). Stored in the volume.
|
||||
enabled: true
|
||||
dir: "/data/cache"
|
||||
|
||||
host:
|
||||
# Where per-job workspaces are created.
|
||||
workdir_parent: /data/workflows
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# Registers the runner on first boot (if no .runner state exists in /data),
|
||||
# then runs the act_runner daemon. Idempotent: on subsequent boots it reuses
|
||||
# the stored registration and ignores the token.
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_FILE="${CONFIG_FILE:-/data/config.yaml}"
|
||||
|
||||
cd /data
|
||||
|
||||
# Seed the config from the image's template on first boot so it lives in the
|
||||
# persistent volume and can be edited there.
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
cp /etc/act_runner/config.yaml "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
# runner.file in config.yaml is ".runner" (relative to this CWD => /data/.runner).
|
||||
if [ ! -f /data/.runner ]; then
|
||||
if [ -z "${GITEA_RUNNER_REGISTRATION_TOKEN:-}" ]; then
|
||||
echo "ERROR: no /data/.runner registration and GITEA_RUNNER_REGISTRATION_TOKEN is empty." >&2
|
||||
echo " Grab a token from the repo's Settings -> Actions -> Runners and set it" >&2
|
||||
echo " in the Quadlet unit for the first boot only." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Registering runner '${GITEA_RUNNER_NAME:-podman}' with ${GITEA_INSTANCE_URL} ..."
|
||||
act_runner register --no-interactive \
|
||||
--config "$CONFIG_FILE" \
|
||||
--instance "${GITEA_INSTANCE_URL:?set GITEA_INSTANCE_URL}" \
|
||||
--token "$GITEA_RUNNER_REGISTRATION_TOKEN" \
|
||||
--name "${GITEA_RUNNER_NAME:-podman}" \
|
||||
--labels "${GITEA_RUNNER_LABELS:-ubuntu-latest:host}"
|
||||
fi
|
||||
|
||||
exec act_runner daemon --config "$CONFIG_FILE"
|
||||
@@ -0,0 +1,40 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# Rootless Podman Quadlet for the SECOND project's Gitea Actions runner,
|
||||
# co-located on the same host as the trx-rs runner.
|
||||
#
|
||||
# It has its own name, its own data volume and its own registration token, so
|
||||
# the two runners are fully independent. They share the `ubuntu-latest` label,
|
||||
# but registration SCOPE (which repo each token came from) keeps their jobs
|
||||
# separate — neither will pick up the other's work.
|
||||
#
|
||||
# If project 2 needs different build dependencies, build it its own image from
|
||||
# an adjusted Containerfile and point Image= at that instead of reusing the
|
||||
# trx-rs image below.
|
||||
|
||||
[Unit]
|
||||
Description=Gitea Actions runner — project 2
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Container]
|
||||
Image=localhost/gitea-act-runner:latest
|
||||
ContainerName=gitea-runner-project2
|
||||
Volume=gitea-runner-project2-data:/data:Z
|
||||
|
||||
Environment=CONFIG_FILE=/data/config.yaml
|
||||
Environment=GITEA_INSTANCE_URL=https://git.haxx.space
|
||||
Environment=GITEA_RUNNER_NAME=project2-podman
|
||||
Environment=GITEA_RUNNER_LABELS=ubuntu-latest:host
|
||||
Environment=GITEA_RUNNER_REGISTRATION_TOKEN=
|
||||
|
||||
PodmanArgs=--cpus=4.0 --memory=6g
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -0,0 +1,41 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# Rootless Podman Quadlet for the trx-rs Gitea Actions runner.
|
||||
# Install to ~/.config/containers/systemd/trx-rs-runner.container then:
|
||||
# systemctl --user daemon-reload
|
||||
# systemctl --user start trx-rs-runner
|
||||
#
|
||||
# First boot only: paste a registration token (repo Settings -> Actions ->
|
||||
# Runners) into GITEA_RUNNER_REGISTRATION_TOKEN. After the runner appears
|
||||
# online you can blank it again — the registration is persisted in the volume.
|
||||
|
||||
[Unit]
|
||||
Description=Gitea Actions runner — trx-rs
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Container]
|
||||
Image=localhost/trx-rs-ci:latest
|
||||
ContainerName=gitea-runner-trx-rs
|
||||
# Persistent state: .runner registration, cache, workspaces.
|
||||
Volume=gitea-runner-trx-rs-data:/data:Z
|
||||
|
||||
Environment=CONFIG_FILE=/data/config.yaml
|
||||
Environment=GITEA_INSTANCE_URL=https://git.haxx.space
|
||||
Environment=GITEA_RUNNER_NAME=trx-rs-podman
|
||||
Environment=GITEA_RUNNER_LABELS=ubuntu-latest:host
|
||||
Environment=GITEA_RUNNER_REGISTRATION_TOKEN=
|
||||
|
||||
# Resource caps so a heavy Rust build here cannot starve the other project's
|
||||
# runner on the same host. Tune to your box.
|
||||
PodmanArgs=--cpus=4.0 --memory=6g
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
# A cold Rust build can be slow; don't let systemd consider startup failed.
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -1,9 +1,13 @@
|
||||
# RDS Parameter Tuning — Work in Progress
|
||||
# RDS Parameter Tuning Notes
|
||||
|
||||
*Decoder tuning rationale for `trx-rds`. Recorded 2026-03-27; reflects the
|
||||
shipped parameter set. Kept as a reference for why these constants were chosen —
|
||||
not an open work item.*
|
||||
|
||||
## Goal
|
||||
Maximum sensitivity (weak-signal decode) with zero false positive PI decodes.
|
||||
|
||||
## Changes Made
|
||||
## Changes Applied
|
||||
|
||||
### `src/decoders/trx-rds/src/lib.rs`
|
||||
|
||||
Executable → Regular
+4
@@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Run trx-server with the dummy backend for development and testing.
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-ais"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Basic AIS GMSK/HDLC decoder.
|
||||
//!
|
||||
@@ -243,7 +243,7 @@ fn parse_frame(frame: RawFrame, channel: &str) -> Option<AisMessage> {
|
||||
|
||||
let message_type = get_uint(&bits, 0, 6)? as u8;
|
||||
let repeat = get_uint(&bits, 6, 2)? as u8;
|
||||
let mmsi = get_uint(&bits, 8, 30)? as u32;
|
||||
let mmsi = get_uint(&bits, 8, 30)?;
|
||||
|
||||
let mut msg = AisMessage {
|
||||
rig_id: None,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-aprs"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Bell 202 AFSK demodulator + AX.25/APRS decoder.
|
||||
//!
|
||||
@@ -638,7 +638,7 @@ mod tests {
|
||||
for (i, &ch) in b"N0CALL".iter().enumerate() {
|
||||
addr[i] = ch << 1;
|
||||
}
|
||||
addr[6] = (0 << 1) | 1; // SSID=0, last=true
|
||||
addr[6] = 1; // SSID=0, last=true
|
||||
|
||||
let decoded = decode_ax25_address(&addr, 0);
|
||||
assert_eq!(decoded.call, "N0CALL");
|
||||
@@ -652,7 +652,7 @@ mod tests {
|
||||
for (i, &ch) in b"SP2SJG".iter().enumerate() {
|
||||
addr[i] = ch << 1;
|
||||
}
|
||||
addr[6] = (5 << 1) | 0; // SSID=5, last=false
|
||||
addr[6] = 5 << 1; // SSID=5, last=false
|
||||
|
||||
let decoded = decode_ax25_address(&addr, 0);
|
||||
assert_eq!(decoded.call, "SP2SJG");
|
||||
@@ -667,7 +667,7 @@ mod tests {
|
||||
for (i, &ch) in b"W1AW ".iter().enumerate() {
|
||||
addr[i] = ch << 1;
|
||||
}
|
||||
addr[6] = (0 << 1) | 1;
|
||||
addr[6] = 1;
|
||||
|
||||
let decoded = decode_ax25_address(&addr, 0);
|
||||
assert_eq!(decoded.call, "W1AW");
|
||||
@@ -691,7 +691,7 @@ mod tests {
|
||||
for &ch in src_bytes.as_bytes().iter().take(6) {
|
||||
frame.push(ch << 1);
|
||||
}
|
||||
frame.push((0 << 1) | 1); // SSID=0, last=true
|
||||
frame.push(1); // SSID=0, last=true
|
||||
// Control + PID
|
||||
frame.push(0x03); // UI frame
|
||||
frame.push(0xF0); // No layer-3 protocol
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-cw"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Goertzel-based CW (Morse code) decoder.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-decode-log"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Server-side decoder file logging (APRS / CW / FT8 / WSPR).
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-ftx"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Open-addressing hash table for callsign lookup during FTx decoding.
|
||||
//!
|
||||
@@ -160,8 +160,7 @@ impl CallsignHashTable {
|
||||
let mut idx = start_idx;
|
||||
|
||||
loop {
|
||||
match &self.entries[idx] {
|
||||
Some(entry) => {
|
||||
let entry = self.entries[idx].as_ref()?;
|
||||
let stored = (entry.hash & HASH22_MASK) >> shift;
|
||||
if stored == target {
|
||||
return Some(entry.callsign.clone());
|
||||
@@ -171,9 +170,6 @@ impl CallsignHashTable {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
None => return None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Age all entries and remove those older than `max_age`.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use super::protocol::{FTX_LDPC_K_BYTES, FTX_LDPC_M, FTX_LDPC_N};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use super::protocol::{FT8_CRC_POLYNOMIAL, FT8_CRC_WIDTH};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Candidate search, shared decode helpers, and dispatcher functions for FTx decoding.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Shared LDPC encoding functions used by all FTx protocols.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Pure Rust LDPC decoder for FTx protocols.
|
||||
//!
|
||||
@@ -42,8 +42,8 @@ pub(crate) fn ldpc_check(codeword: &[u8; FTX_LDPC_N]) -> i32 {
|
||||
for m in 0..FTX_LDPC_M {
|
||||
let mut x: u8 = 0;
|
||||
let num_rows = FTX_LDPC_NUM_ROWS[m] as usize;
|
||||
for i in 0..num_rows {
|
||||
x ^= codeword[FTX_LDPC_NM[m][i] as usize - 1];
|
||||
for &nm in FTX_LDPC_NM[m].iter().take(num_rows) {
|
||||
x ^= codeword[nm as usize - 1];
|
||||
}
|
||||
if x != 0 {
|
||||
errors += 1;
|
||||
@@ -81,11 +81,11 @@ pub fn ldpc_decode(
|
||||
for j in 0..FTX_LDPC_M {
|
||||
let num_rows = FTX_LDPC_NUM_ROWS[j] as usize;
|
||||
let m_row = j * FTX_LDPC_N;
|
||||
for ii1 in 0..num_rows {
|
||||
let i1 = FTX_LDPC_NM[j][ii1] as usize - 1;
|
||||
for &nm1 in FTX_LDPC_NM[j].iter().take(num_rows) {
|
||||
let i1 = nm1 as usize - 1;
|
||||
let mut a = 1.0f32;
|
||||
for ii2 in 0..num_rows {
|
||||
let i2 = FTX_LDPC_NM[j][ii2] as usize - 1;
|
||||
for &nm2 in FTX_LDPC_NM[j].iter().take(num_rows) {
|
||||
let i2 = nm2 as usize - 1;
|
||||
if i2 != i1 {
|
||||
a *= fast_tanh(-m_matrix[m_row + i2] / 2.0f32);
|
||||
}
|
||||
@@ -97,8 +97,8 @@ pub fn ldpc_decode(
|
||||
// Hard decisions
|
||||
for i in 0..FTX_LDPC_N {
|
||||
let mut l = codeword[i];
|
||||
for j in 0..3 {
|
||||
l += e_matrix[(FTX_LDPC_MN[i][j] as usize - 1) * FTX_LDPC_N + i];
|
||||
for &mn in FTX_LDPC_MN[i].iter().take(3) {
|
||||
l += e_matrix[(mn as usize - 1) * FTX_LDPC_N + i];
|
||||
}
|
||||
plain[i] = if l > 0.0 { 1 } else { 0 };
|
||||
}
|
||||
@@ -113,12 +113,12 @@ pub fn ldpc_decode(
|
||||
|
||||
// Update m[][] from e[][]
|
||||
for i in 0..FTX_LDPC_N {
|
||||
for ji1 in 0..3 {
|
||||
let j1 = FTX_LDPC_MN[i][ji1] as usize - 1;
|
||||
for (ji1, &mn1) in FTX_LDPC_MN[i].iter().enumerate().take(3) {
|
||||
let j1 = mn1 as usize - 1;
|
||||
let mut l = codeword[i];
|
||||
for ji2 in 0..3 {
|
||||
for (ji2, &mn2) in FTX_LDPC_MN[i].iter().enumerate().take(3) {
|
||||
if ji1 != ji2 {
|
||||
let j2 = FTX_LDPC_MN[i][ji2] as usize - 1;
|
||||
let j2 = mn2 as usize - 1;
|
||||
l += e_matrix[j2 * FTX_LDPC_N + i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! FTx message pack/unpack logic.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Common types, constants, and shared functions used across all FTx protocols.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Windowed FFT waterfall/spectrogram engine for FTx decoding.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! OSD-1/OSD-2 CRC-guided bit-flip decoder for the (174,91) LDPC code.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/// FTx protocol variants.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Character table lookup and string utility functions for FTx message
|
||||
//! encoding/decoding.
|
||||
@@ -64,11 +64,9 @@ pub fn charn(mut c: i32, table: CharTable) -> char {
|
||||
return EXTRAS[c as usize];
|
||||
}
|
||||
}
|
||||
CharTable::AlphanumSpaceSlash => {
|
||||
if c == 0 {
|
||||
CharTable::AlphanumSpaceSlash if c == 0 => {
|
||||
return '/';
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -116,11 +114,9 @@ pub fn nchar(c: char, table: CharTable) -> Option<i32> {
|
||||
'?' => return Some(n + 4),
|
||||
_ => {}
|
||||
},
|
||||
CharTable::AlphanumSpaceSlash => {
|
||||
if c == '/' {
|
||||
CharTable::AlphanumSpaceSlash if c == '/' => {
|
||||
return Some(n);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Top-level FTx decoder matching the `trx-ft8` public API.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Per-symbol FFT and multi-scale bit metrics extraction.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! FT2-specific waterfall sync scoring and likelihood extraction.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Frequency-domain downsampling via IFFT.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! FT2 pipeline orchestration.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! 2D sync scoring with complex Costas reference waveforms.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! FT4-specific sync scoring, likelihood extraction, and tone encoding.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! FT8-specific sync scoring, likelihood extraction, and tone encoding.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
pub mod common;
|
||||
mod decoder;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-rds"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use std::f32::consts::{PI, SQRT_2, TAU};
|
||||
use std::sync::Arc;
|
||||
@@ -632,33 +632,18 @@ impl Candidate {
|
||||
}
|
||||
let segment = usize::from((block_b & 0x0003) as u8);
|
||||
let di = ((block_b >> 2) & 0x1) != 0;
|
||||
match segment {
|
||||
0 => {
|
||||
if self.state.dynamic_pty != Some(di) {
|
||||
self.state.dynamic_pty = Some(di);
|
||||
let di_flag = Some(di);
|
||||
let slot = match segment {
|
||||
0 => &mut self.state.dynamic_pty,
|
||||
1 => &mut self.state.compressed,
|
||||
2 => &mut self.state.artificial_head,
|
||||
3 => &mut self.state.stereo,
|
||||
_ => unreachable!("segment is masked to two bits"),
|
||||
};
|
||||
if *slot != di_flag {
|
||||
*slot = di_flag;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
1 => {
|
||||
if self.state.compressed != Some(di) {
|
||||
self.state.compressed = Some(di);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
2 => {
|
||||
if self.state.artificial_head != Some(di) {
|
||||
self.state.artificial_head = Some(di);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
3 => {
|
||||
if self.state.stereo != Some(di) {
|
||||
self.state.stereo = Some(di);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let [b0, b1] = block_d.to_be_bytes();
|
||||
self.ps_bytes[segment * 2] = sanitize_text_byte(b0);
|
||||
self.ps_bytes[segment * 2 + 1] = sanitize_text_byte(b1);
|
||||
@@ -1458,9 +1443,9 @@ mod tests {
|
||||
}
|
||||
|
||||
// BPSK modulate onto the 57 kHz subcarrier.
|
||||
for t in 0..n {
|
||||
for (t, sample) in shaped.iter_mut().enumerate().take(n) {
|
||||
let phase = TAU * RDS_SUBCARRIER_HZ * t as f32 / sample_rate;
|
||||
shaped[t] *= phase.cos();
|
||||
*sample *= phase.cos();
|
||||
}
|
||||
shaped
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-vdes"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! CRC-16 for VDES link-layer frames.
|
||||
//!
|
||||
@@ -134,9 +134,7 @@ mod tests {
|
||||
.flat_map(|&b| (0..8).rev().map(move |i| (b >> i) & 1))
|
||||
.collect();
|
||||
// Append wrong CRC
|
||||
for _ in 0..16 {
|
||||
bits.push(0);
|
||||
}
|
||||
bits.resize(bits.len() + 16, 0);
|
||||
assert!(!check_crc16(&bits));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! VDES 100 kHz decoder for VDE-TER (ITU-R M.2092-1).
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! VDES link-layer frame parsing per ITU-R M.2092-1.
|
||||
//!
|
||||
@@ -346,8 +346,8 @@ mod tests {
|
||||
write_bits(&mut bits, 12, 32, 123456); // source_id
|
||||
write_bits(&mut bits, 44, 11, 20); // data_count = 20
|
||||
// Fill some payload
|
||||
for i in 55..75 {
|
||||
bits[i] = (i % 2) as u8;
|
||||
for (i, bit) in bits.iter_mut().enumerate().take(75).skip(55) {
|
||||
*bit = (i % 2) as u8;
|
||||
}
|
||||
append_crc(&mut bits);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Turbo FEC decoder for VDES TER-MCS-1 (100 kHz channel).
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-wefax"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! WEFAX decoder configuration.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Top-level WEFAX decoder state machine.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! FM discriminator for WEFAX demodulation.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Image buffer and PNG encoding for WEFAX decoded images.
|
||||
|
||||
@@ -274,7 +274,8 @@ mod tests {
|
||||
|
||||
// Pseudo-random noise vs gradient — correlation should be low.
|
||||
let noise: Vec<u8> = (0..256)
|
||||
.map(|i| ((i * 1103515245 + 12345) as u32 >> 8 & 0xff) as u8)
|
||||
.map(|i| (i as u32).wrapping_mul(1_103_515_245).wrapping_add(12_345))
|
||||
.map(|value| ((value >> 8) & 0xff) as u8)
|
||||
.collect();
|
||||
let r = asm.correlation_with_last(&noise).expect("r");
|
||||
assert!(
|
||||
@@ -374,8 +375,8 @@ mod tests {
|
||||
let (y, m, d, h, mi, _) = unix_to_utc(1775055000);
|
||||
assert_eq!(y, 2026);
|
||||
// Just verify reasonable values without asserting exact date.
|
||||
assert!(m >= 1 && m <= 12);
|
||||
assert!(d >= 1 && d <= 31);
|
||||
assert!((1..=12).contains(&m));
|
||||
assert!((1..=31).contains(&d));
|
||||
assert!(h < 24);
|
||||
assert!(mi < 60);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! WEFAX (Weather Facsimile) decoder.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Line slicer: pixel clock recovery and line buffer assembly.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Phasing signal detector and line-start alignment for WEFAX.
|
||||
//!
|
||||
@@ -161,10 +161,8 @@ mod tests {
|
||||
|
||||
for line_idx in 0..20 {
|
||||
let mut line = vec![1.0f32; spl];
|
||||
for j in pulse_start..pulse_start + pw {
|
||||
if j < spl {
|
||||
line[j] = 0.0;
|
||||
}
|
||||
for slot in line.iter_mut().skip(pulse_start).take(pw) {
|
||||
*slot = 0.0;
|
||||
}
|
||||
let result = det.process(&line);
|
||||
if let Some(offset) = result {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Polyphase rational resampler: 48000 Hz → 11025 Hz.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! APT tone detector for WEFAX start/stop signals.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-wspr"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use crate::protocol;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
mod decoder;
|
||||
mod protocol;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/// Decoded WSPR message payload.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -483,7 +483,7 @@ mod tests {
|
||||
let c4 = idx27(b'T');
|
||||
let c5 = idx27(b' ');
|
||||
let n1 = ((c0 * 36 + c1) * 10 + c2) * 27u32.pow(3) + c3 * 27u32.pow(2) + c4 * 27 + c5;
|
||||
let m1 = (179 - 10 * 5 - 2) * 180 + 10 * 13 + 0; // FN20
|
||||
let m1 = (179 - 10 * 5 - 2) * 180 + 10 * 13; // FN20 (final term is 0)
|
||||
let power_code = 37u32;
|
||||
|
||||
let mut input_bits = [0u8; NBITS];
|
||||
@@ -530,8 +530,8 @@ mod tests {
|
||||
fn interleave_deinterleave_roundtrip() {
|
||||
// Create a sequence of distinguishable values
|
||||
let mut original = [0u8; NSYMS];
|
||||
for i in 0..NSYMS {
|
||||
original[i] = (i % 256) as u8;
|
||||
for (i, slot) in original.iter_mut().enumerate() {
|
||||
*slot = (i % 256) as u8;
|
||||
}
|
||||
|
||||
let interleaved = interleave(&original);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-wxsat"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Shared PNG image encoding for weather satellite decoders.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Weather satellite image decoders.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! CCSDS CADU (Channel Access Data Unit) frame synchronisation and extraction.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! QPSK demodulator for Meteor-M LRPT.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! MCU (Minimum Coded Unit) assembly and multi-channel image composition.
|
||||
//!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Meteor-M LRPT (Low Rate Picture Transmission) satellite image decoder.
|
||||
//!
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-app"
|
||||
version.workspace = true
|
||||
edition = "2021"
|
||||
license = "BSD-2-Clause"
|
||||
license = "GPL-2.0-or-later"
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
pub mod config;
|
||||
pub mod logging;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::FmtSubscriber;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Shared configuration validation helpers used by both `trx-server` and
|
||||
//! `trx-client`.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/// Normalize a name to lowercase alphanumeric.
|
||||
pub fn normalize_name(name: &str) -> String {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-client"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Local audio bridge for trx-client.
|
||||
//!
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Audio TCP client that connects to the server's audio port and relays
|
||||
//! RX/TX Opus frames via broadcast/mpsc channels.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::time::Duration;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use bytes::Bytes;
|
||||
use flate2::read::GzDecoder;
|
||||
@@ -36,6 +36,13 @@ use trx_core::audio::{
|
||||
use trx_core::decode::DecodedMessage;
|
||||
use trx_frontend::VChanAudioCmd;
|
||||
|
||||
/// Minimum uptime before a connection is "stable" enough to reset the
|
||||
/// reconnect backoff. Connections that die before this threshold leave the
|
||||
/// exponential backoff climbing — protects the server from a tight reconnect
|
||||
/// storm when the peer is broken in some way that only manifests after the
|
||||
/// TCP handshake.
|
||||
const STABLE_CONNECTION_THRESHOLD: Duration = Duration::from_secs(30);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct ActiveVChanSub {
|
||||
freq_hz: u64,
|
||||
@@ -289,7 +296,7 @@ async fn run_single_rig_audio_client(
|
||||
info!("Audio client [{}]: connecting to {}", rig_id, server_addr);
|
||||
match TcpStream::connect(&server_addr).await {
|
||||
Ok(stream) => {
|
||||
reconnect_delay = Duration::from_secs(1);
|
||||
let connected_at = Instant::now();
|
||||
if let Err(e) = handle_single_rig_connection(
|
||||
stream,
|
||||
&rig_id,
|
||||
@@ -311,6 +318,13 @@ async fn run_single_rig_audio_client(
|
||||
{
|
||||
warn!("Audio connection [{}] dropped: {}", rig_id, e);
|
||||
}
|
||||
// Only reset the backoff after a connection survived long
|
||||
// enough to be considered stable. TCP `connect()` succeeding
|
||||
// is not enough — a peer that fails immediately after
|
||||
// accepting must not be hammered every second.
|
||||
if connected_at.elapsed() >= STABLE_CONNECTION_THRESHOLD {
|
||||
reconnect_delay = Duration::from_secs(1);
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Audio connect [{}] failed: {}", rig_id, e);
|
||||
@@ -342,59 +356,6 @@ async fn run_single_rig_audio_client(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{resolve_audio_addr, AudioConnectConfig};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[test]
|
||||
fn resolve_audio_addr_prefers_fixed_url() {
|
||||
let mut rig_connect = HashMap::new();
|
||||
rig_connect.insert(
|
||||
"home-hf".to_string(),
|
||||
AudioConnectConfig::fixed("audio.example.com:4700".to_string()),
|
||||
);
|
||||
|
||||
let addr = resolve_audio_addr(
|
||||
"home-hf",
|
||||
Some(4531),
|
||||
&rig_connect,
|
||||
&AudioConnectConfig::from_host_port("control.example.com".to_string(), 4531),
|
||||
);
|
||||
assert_eq!(addr, "audio.example.com:4700");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_audio_addr_uses_advertised_port_with_remote_host() {
|
||||
let mut rig_connect = HashMap::new();
|
||||
rig_connect.insert(
|
||||
"home-hf".to_string(),
|
||||
AudioConnectConfig::from_host_port("control.example.com".to_string(), 4531),
|
||||
);
|
||||
|
||||
let addr = resolve_audio_addr(
|
||||
"home-hf",
|
||||
Some(4600),
|
||||
&rig_connect,
|
||||
&AudioConnectConfig::from_host_port("fallback.example.com".to_string(), 4531),
|
||||
);
|
||||
assert_eq!(addr, "control.example.com:4600");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_audio_addr_falls_back_to_default_port() {
|
||||
let rig_connect = HashMap::new();
|
||||
|
||||
let addr = resolve_audio_addr(
|
||||
"home-hf",
|
||||
None,
|
||||
&rig_connect,
|
||||
&AudioConnectConfig::from_host_port("fallback.example.com".to_string(), 4531),
|
||||
);
|
||||
assert_eq!(addr, "fallback.example.com:4531");
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle a single TCP connection for one rig. Similar to `handle_audio_connection`
|
||||
/// but publishes to per-rig channels directly and mirrors to global when selected.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@@ -586,7 +547,10 @@ async fn handle_single_rig_connection(
|
||||
rig_id_for_rx, msg_type
|
||||
);
|
||||
}
|
||||
Err(_) => break,
|
||||
Err(e) => {
|
||||
warn!("Audio client [{}]: read error: {}", rig_id_for_rx, e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -750,3 +714,56 @@ async fn handle_single_rig_connection(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{resolve_audio_addr, AudioConnectConfig};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[test]
|
||||
fn resolve_audio_addr_prefers_fixed_url() {
|
||||
let mut rig_connect = HashMap::new();
|
||||
rig_connect.insert(
|
||||
"home-hf".to_string(),
|
||||
AudioConnectConfig::fixed("audio.example.com:4700".to_string()),
|
||||
);
|
||||
|
||||
let addr = resolve_audio_addr(
|
||||
"home-hf",
|
||||
Some(4531),
|
||||
&rig_connect,
|
||||
&AudioConnectConfig::from_host_port("control.example.com".to_string(), 4531),
|
||||
);
|
||||
assert_eq!(addr, "audio.example.com:4700");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_audio_addr_uses_advertised_port_with_remote_host() {
|
||||
let mut rig_connect = HashMap::new();
|
||||
rig_connect.insert(
|
||||
"home-hf".to_string(),
|
||||
AudioConnectConfig::from_host_port("control.example.com".to_string(), 4531),
|
||||
);
|
||||
|
||||
let addr = resolve_audio_addr(
|
||||
"home-hf",
|
||||
Some(4600),
|
||||
&rig_connect,
|
||||
&AudioConnectConfig::from_host_port("fallback.example.com".to_string(), 4531),
|
||||
);
|
||||
assert_eq!(addr, "control.example.com:4600");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_audio_addr_falls_back_to_default_port() {
|
||||
let rig_connect = HashMap::new();
|
||||
|
||||
let addr = resolve_audio_addr(
|
||||
"home-hf",
|
||||
None,
|
||||
&rig_connect,
|
||||
&AudioConnectConfig::from_host_port("fallback.example.com".to_string(), 4531),
|
||||
);
|
||||
assert_eq!(addr, "fallback.example.com:4531");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Configuration file support for trx-client.
|
||||
//!
|
||||
@@ -1110,8 +1110,8 @@ url = "remote.example.com:4530"
|
||||
|
||||
#[test]
|
||||
fn test_validate_rejects_duplicate_remote_names() {
|
||||
let mut config = ClientConfig::default();
|
||||
config.remotes = vec![
|
||||
let config = ClientConfig {
|
||||
remotes: vec![
|
||||
RemoteEntry {
|
||||
name: "dup".to_string(),
|
||||
url: "a:4530".to_string(),
|
||||
@@ -1126,20 +1126,24 @@ url = "remote.example.com:4530"
|
||||
auth: RemoteAuthConfig::default(),
|
||||
poll_interval_ms: 750,
|
||||
},
|
||||
];
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
assert!(config.validate().unwrap_err().contains("duplicate name"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_validate_rejects_empty_remote_name() {
|
||||
let mut config = ClientConfig::default();
|
||||
config.remotes = vec![RemoteEntry {
|
||||
let config = ClientConfig {
|
||||
remotes: vec![RemoteEntry {
|
||||
name: "".to_string(),
|
||||
url: "a:4530".to_string(),
|
||||
rig_id: None,
|
||||
auth: RemoteAuthConfig::default(),
|
||||
poll_interval_ms: 750,
|
||||
}];
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
assert!(config
|
||||
.validate()
|
||||
.unwrap_err()
|
||||
@@ -1148,14 +1152,16 @@ url = "remote.example.com:4530"
|
||||
|
||||
#[test]
|
||||
fn test_validate_rejects_empty_remote_url() {
|
||||
let mut config = ClientConfig::default();
|
||||
config.remotes = vec![RemoteEntry {
|
||||
let config = ClientConfig {
|
||||
remotes: vec![RemoteEntry {
|
||||
name: "hf".to_string(),
|
||||
url: " ".to_string(),
|
||||
rig_id: None,
|
||||
auth: RemoteAuthConfig::default(),
|
||||
poll_interval_ms: 750,
|
||||
}];
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
assert!(config
|
||||
.validate()
|
||||
.unwrap_err()
|
||||
@@ -1164,14 +1170,16 @@ url = "remote.example.com:4530"
|
||||
|
||||
#[test]
|
||||
fn test_validate_rejects_zero_remote_poll_interval() {
|
||||
let mut config = ClientConfig::default();
|
||||
config.remotes = vec![RemoteEntry {
|
||||
let config = ClientConfig {
|
||||
remotes: vec![RemoteEntry {
|
||||
name: "hf".to_string(),
|
||||
url: "a:4530".to_string(),
|
||||
rig_id: None,
|
||||
auth: RemoteAuthConfig::default(),
|
||||
poll_interval_ms: 0,
|
||||
}];
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
assert!(config
|
||||
.validate()
|
||||
.unwrap_err()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
mod audio_bridge;
|
||||
mod audio_client;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
@@ -1678,7 +1678,7 @@ mod tests {
|
||||
#[test]
|
||||
fn global_target_for_snapshot_skips_other_server_selection() {
|
||||
let snapshot = sample_snapshot();
|
||||
let rigs = vec![RigEntry {
|
||||
let rigs = [RigEntry {
|
||||
rig_id: "hf".to_string(),
|
||||
display_name: Some("Gdansk HF".to_string()),
|
||||
state: snapshot,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-frontend"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
use std::net::SocketAddr;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-frontend-http-json"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
pub mod server;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[package]
|
||||
name = "trx-frontend-http"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// --- Decoder registry (fetched from /decoders on load) ---
|
||||
/** @type {Array<{id:string,label:string,activation:string,active_modes:string[],background_decode:boolean,bookmark_selectable:boolean}>} */
|
||||
let decoderRegistry = [];
|
||||
@@ -19,6 +23,7 @@ window.onDecoderRegistryReady = function (fn) {
|
||||
for (const fn of _decoderRegistryReadyCallbacks) fn();
|
||||
_decoderRegistryReadyCallbacks.length = 0;
|
||||
hideUnsupportedDecoderTabs();
|
||||
refreshOperatorLayoutCapabilities();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch decoder registry:", e);
|
||||
@@ -329,8 +334,19 @@ function applyCapabilities(caps) {
|
||||
const txAudioBtn = document.getElementById("tx-audio-btn");
|
||||
const txVolSlider = document.getElementById("tx-vol");
|
||||
const txVolControl = txVolSlider ? txVolSlider.closest(".vol-label") : null;
|
||||
if (txPowerCol) txPowerCol.style.display = caps.tx ? "" : "none";
|
||||
const hasPowerControl = !caps.filter_controls;
|
||||
if (txPowerCol) {
|
||||
txPowerCol.style.display = (caps.tx || hasPowerControl || caps.lockable) ? "" : "none";
|
||||
const label = txPowerCol.querySelector(".label span");
|
||||
if (label) {
|
||||
label.textContent = caps.tx && hasPowerControl ? "Transmit / Power"
|
||||
: caps.tx ? "Transmit / Tuning"
|
||||
: hasPowerControl ? "Power / Tuning" : "Tuning";
|
||||
}
|
||||
}
|
||||
if (pttBtn) pttBtn.style.display = caps.tx ? "" : "none";
|
||||
if (powerBtn) powerBtn.style.display = hasPowerControl ? "" : "none";
|
||||
if (lockBtn) lockBtn.style.display = caps.lockable ? "" : "none";
|
||||
if (txMetersRow) txMetersRow.style.display = caps.tx ? "" : "none";
|
||||
if (txAudioBtn) txAudioBtn.style.display = caps.tx ? "" : "none";
|
||||
if (txVolControl) txVolControl.style.display = caps.tx ? "" : "none";
|
||||
@@ -340,7 +356,7 @@ function applyCapabilities(caps) {
|
||||
|
||||
// TX limit row
|
||||
const txLimitRow = document.getElementById("tx-limit-row");
|
||||
if (txLimitRow && !caps.tx_limit) txLimitRow.style.display = "none";
|
||||
if (txLimitRow) txLimitRow.style.display = caps.tx_limit ? "" : "none";
|
||||
|
||||
// VFO row
|
||||
const vfoRow = document.getElementById("vfo-row");
|
||||
@@ -432,6 +448,7 @@ const signalSplitValueEl = document.getElementById("signal-split-value");
|
||||
const overviewPeakHoldEl = document.getElementById("overview-peak-hold");
|
||||
const themeToggleBtn = document.getElementById("theme-toggle");
|
||||
const headerRigSwitchSelect = document.getElementById("header-rig-switch-select");
|
||||
const headerRigSummary = document.getElementById("header-rig-summary");
|
||||
const headerStylePickSelect = document.getElementById("header-style-pick-select");
|
||||
const rdsPsOverlay = document.getElementById("rds-ps-overlay");
|
||||
const tabMainEl = document.getElementById("tab-main");
|
||||
@@ -641,7 +658,7 @@ function flushDeferredDecodeMapSync() {
|
||||
if (!decodeMapSyncPending || decodeHistoryReplayActive || !window.trx?.map?.aprsMap) return;
|
||||
decodeMapSyncPending = false;
|
||||
scheduleUiFrameJob("decode-map-maintenance", () => {
|
||||
window.trx.map?.pruneMapHistory();
|
||||
window.trx.modules.map?.pruneMapHistory();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -836,6 +853,8 @@ let jogMult = loadSetting("jogMult", 1); // divisor: 1, 10, 100
|
||||
let jogStep = Math.max(Math.round(jogUnit / jogMult), 1);
|
||||
let minFreqStepHz = 1;
|
||||
let lastModeName = "";
|
||||
let lastWfmCci = 0;
|
||||
let lastWfmAci = 0;
|
||||
const VFO_COLORS = ["var(--accent-green)", "var(--accent-yellow)"];
|
||||
function vfoColor(idx) {
|
||||
if (idx < VFO_COLORS.length) return VFO_COLORS[idx];
|
||||
@@ -889,6 +908,7 @@ async function restorePreviousTuneState() {
|
||||
let lastRigIds = [];
|
||||
let lastRigDisplayNames = {};
|
||||
let lastActiveRigId = null;
|
||||
let rigSwitchInProgress = false;
|
||||
let lastCityLabel = "";
|
||||
let sseSessionId = null;
|
||||
const originalTitle = document.title;
|
||||
@@ -1233,6 +1253,20 @@ function populateRigPicker(selectEl, rigIds, activeRigId, disabled) {
|
||||
selectEl.disabled = disabled;
|
||||
}
|
||||
|
||||
function updateRigIdentitySummary(rigId, pending = false) {
|
||||
if (!headerRigSummary) return;
|
||||
const rig = serverRigs.find((entry) => entry?.remote === rigId);
|
||||
if (!rig) {
|
||||
headerRigSummary.textContent = pending ? "Switching rigs…" : "No rig details available";
|
||||
return;
|
||||
}
|
||||
const hardware = [rig.manufacturer, rig.model].map(value => String(value || "").trim()).filter(Boolean).join(" ") || rig.remote;
|
||||
const modes = Array.isArray(rig.supported_modes) ? rig.supported_modes.map(normalizeMode).filter(Boolean) : [];
|
||||
const features = [rig.tx ? "TX" : "RX", rig.filter_controls ? "SDR filters" : null, ...modes.slice(0, 5)];
|
||||
if (modes.length > 5) features.push(`+${modes.length - 5} modes`);
|
||||
headerRigSummary.textContent = `${pending ? "Switching to " : ""}${hardware} · ${features.filter(Boolean).join(" · ")}`;
|
||||
}
|
||||
|
||||
function updateRigSubtitle(activeRigId) {
|
||||
if (!rigSubtitle) return;
|
||||
const name = (activeRigId && lastRigDisplayNames[activeRigId]) || activeRigId || "--";
|
||||
@@ -1269,13 +1303,15 @@ function applyRigList(activeRigId, rigIds, displayNames) {
|
||||
const disableSwitch = lastRigIds.length === 0 || !authRole || authRole === "rx";
|
||||
populateRigPicker(headerRigSwitchSelect, lastRigIds, lastActiveRigId, disableSwitch);
|
||||
updateRigSubtitle(lastActiveRigId);
|
||||
updateRigIdentitySummary(lastActiveRigId);
|
||||
window.trxUi?.setActiveRig(lastActiveRigId);
|
||||
if (rigListChanged) {
|
||||
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
|
||||
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
|
||||
if (typeof bmPopulateScopePicker === "function") bmPopulateScopePicker();
|
||||
if (typeof bmFetch === "function") bmFetch(document.getElementById("bm-category-filter")?.value || "");
|
||||
}
|
||||
window.trx.map?.updateMapRigFilter();
|
||||
window.trx.modules.map?.updateMapRigFilter();
|
||||
}
|
||||
|
||||
|
||||
@@ -1299,18 +1335,35 @@ async function refreshRigList() {
|
||||
}
|
||||
});
|
||||
serverRigs = rigs;
|
||||
refreshOperatorLayoutCapabilities();
|
||||
serverActiveRigId = data.active_remote || null;
|
||||
applyRigList(data.active_remote, rigIds, displayNames);
|
||||
window.trx.map?.syncAprsReceiverMarker();
|
||||
window.trx.modules.map?.syncAprsReceiverMarker();
|
||||
} catch (e) {
|
||||
// Non-fatal: SSE/status path still drives main UI.
|
||||
}
|
||||
}
|
||||
|
||||
function refreshOperatorLayoutCapabilities() {
|
||||
const rigModes = serverRigs.map((rig) =>
|
||||
Array.isArray(rig?.supported_modes) ? rig.supported_modes.map(normalizeMode).filter(Boolean) : []
|
||||
);
|
||||
const decoderModes = new Set(decoderRegistry.flatMap((decoder) =>
|
||||
Array.isArray(decoder?.active_modes) ? decoder.active_modes.map(normalizeMode).filter(Boolean) : []
|
||||
));
|
||||
window.trxUi?.setLayoutCapabilities({
|
||||
broadcast: rigModes.some((modes) => modes.includes("WFM")),
|
||||
digital: decoderModes.size > 0 && rigModes.some((modes) => modes.some((mode) => decoderModes.has(mode))),
|
||||
});
|
||||
}
|
||||
|
||||
function showHint(msg, duration) {
|
||||
powerHint.textContent = msg;
|
||||
if (hintTimer) clearTimeout(hintTimer);
|
||||
if (duration) hintTimer = setTimeout(() => { powerHint.textContent = readyText(); }, duration);
|
||||
if (/failed|missing|unavailable|unknown|lost|required/i.test(msg)) {
|
||||
window.trxUi?.notify(msg, { kind: "error" });
|
||||
}
|
||||
}
|
||||
let supportedModes = [];
|
||||
let supportedBands = [];
|
||||
@@ -2825,7 +2878,7 @@ function showUnsupportedFreqPopup(hz) {
|
||||
const now = Date.now();
|
||||
if (now - lastUnsupportedFreqPopupAt < 1200) return;
|
||||
lastUnsupportedFreqPopupAt = now;
|
||||
window.alert(message);
|
||||
window.trxUi?.notify(message.replaceAll("\n", " "), { kind: "error", duration: 7000 });
|
||||
}
|
||||
|
||||
// Convert dBm (wire format) to S-units (S1=-121dBm, S9=-73dBm, 6dB/S-unit).
|
||||
@@ -3139,9 +3192,9 @@ function render(update) {
|
||||
const grid = latLonToMaidenhead(serverLat, serverLon);
|
||||
locationSubtitle.textContent = `Location: ${grid}`;
|
||||
locationSubtitle.style.display = "";
|
||||
window.trx.map?.reverseGeocodeLocation(serverLat, serverLon, grid);
|
||||
window.trx.modules.map?.reverseGeocodeLocation(serverLat, serverLon, grid);
|
||||
}
|
||||
window.trx.map?.syncAprsReceiverMarker();
|
||||
window.trx.modules.map?.syncAprsReceiverMarker();
|
||||
if (typeof update.initial_map_zoom === "number" && Number.isFinite(update.initial_map_zoom)) {
|
||||
initialMapZoom = Math.max(1, Math.round(update.initial_map_zoom));
|
||||
}
|
||||
@@ -3289,8 +3342,14 @@ function render(update) {
|
||||
wfmStFlagEl.classList.toggle("wfm-st-flag-stereo", detected);
|
||||
wfmStFlagEl.classList.toggle("wfm-st-flag-mono", !detected);
|
||||
}
|
||||
if (typeof update.filter.wfm_cci === "number") updateIntfBar(wfmCciFillEl, wfmCciValEl, update.filter.wfm_cci);
|
||||
if (typeof update.filter.wfm_aci === "number") updateIntfBar(wfmAciFillEl, wfmAciValEl, update.filter.wfm_aci);
|
||||
if (typeof update.filter.wfm_cci === "number") {
|
||||
lastWfmCci = Math.max(0, Math.min(100, update.filter.wfm_cci));
|
||||
updateIntfBar(wfmCciFillEl, wfmCciValEl, lastWfmCci);
|
||||
}
|
||||
if (typeof update.filter.wfm_aci === "number") {
|
||||
lastWfmAci = Math.max(0, Math.min(100, update.filter.wfm_aci));
|
||||
updateIntfBar(wfmAciFillEl, wfmAciValEl, lastWfmAci);
|
||||
}
|
||||
if (samStereoWidthEl && typeof update.filter.sam_stereo_width === "number") {
|
||||
samStereoWidthEl.value = String(Math.round(update.filter.sam_stereo_width * 100));
|
||||
}
|
||||
@@ -3417,7 +3476,11 @@ function render(update) {
|
||||
if (update.status && typeof update.status.tx_en === "boolean" && update.status.tx_en !== prevRenderData.txEn) {
|
||||
prevRenderData.txEn = update.status.tx_en;
|
||||
lastTxEn = update.status.tx_en;
|
||||
pttBtn.textContent = update.status.tx_en ? "PTT On" : "PTT Off";
|
||||
window.trxUi?.setButtonState(pttBtn, {
|
||||
active: update.status.tx_en,
|
||||
activeLabel: "Stop TX",
|
||||
inactiveLabel: "Start TX",
|
||||
});
|
||||
if (update.status.tx_en) {
|
||||
pttBtn.style.background = "var(--accent-red)";
|
||||
pttBtn.style.borderColor = "var(--accent-red)";
|
||||
@@ -3526,11 +3589,15 @@ function render(update) {
|
||||
bandLabel.textContent = typeof update.band === "string" ? update.band : "--";
|
||||
}
|
||||
if (typeof update.enabled === "boolean") {
|
||||
powerBtn.disabled = false;
|
||||
powerBtn.textContent = update.enabled ? "Power Off" : "Power On";
|
||||
window.trxUi?.setButtonState(powerBtn, {
|
||||
active: update.enabled,
|
||||
activeLabel: "Power Off",
|
||||
inactiveLabel: "Power On",
|
||||
});
|
||||
} else {
|
||||
powerBtn.disabled = true;
|
||||
powerBtn.textContent = "Toggle Power";
|
||||
powerBtn.textContent = "Power unavailable";
|
||||
powerBtn.setAttribute("aria-pressed", "false");
|
||||
powerHint.textContent = "State unknown";
|
||||
}
|
||||
lastControl = update.enabled;
|
||||
@@ -3645,7 +3712,11 @@ function render(update) {
|
||||
}
|
||||
powerHint.textContent = readyText();
|
||||
lastLocked = update.status && update.status.lock === true;
|
||||
lockBtn.textContent = lastLocked ? "Unlock" : "Lock";
|
||||
window.trxUi?.setButtonState(lockBtn, {
|
||||
active: lastLocked,
|
||||
activeLabel: "Unlock Tuning",
|
||||
inactiveLabel: "Lock Tuning",
|
||||
});
|
||||
|
||||
const tx = update.status && update.status.tx ? update.status.tx : null;
|
||||
txMeters.style.display = lastHasTx ? "" : "none";
|
||||
@@ -3832,12 +3903,16 @@ function scheduleUiFrameJob(key, job) {
|
||||
|
||||
window.trxScheduleUiFrameJob = scheduleUiFrameJob;
|
||||
|
||||
async function postPath(path) {
|
||||
async function postPath(path, options = {}) {
|
||||
if (rigSwitchInProgress && !options.allowDuringRigSwitch) {
|
||||
throw new Error("Wait for the rig switch to finish");
|
||||
}
|
||||
const targetRigId = options.remote === undefined ? lastActiveRigId : options.remote;
|
||||
// Auto-append remote so each tab targets its own rig.
|
||||
// Skip when the caller already included remote (e.g. /select_rig).
|
||||
if (lastActiveRigId && !path.includes("remote=")) {
|
||||
if (targetRigId && !path.includes("remote=")) {
|
||||
const sep = path.includes("?") ? "&" : "?";
|
||||
path = `${path}${sep}remote=${encodeURIComponent(lastActiveRigId)}`;
|
||||
path = `${path}${sep}remote=${encodeURIComponent(targetRigId)}`;
|
||||
}
|
||||
const resp = await fetch(path, { method: "POST" });
|
||||
if (authEnabled && resp.status === 401) {
|
||||
@@ -3882,44 +3957,60 @@ async function switchRigFromSelect(selectEl) {
|
||||
return;
|
||||
}
|
||||
const prevRig = lastActiveRigId;
|
||||
lastActiveRigId = selectEl.value;
|
||||
if (prevRig && prevRig !== lastActiveRigId) {
|
||||
const nextRig = selectEl.value;
|
||||
if (nextRig === prevRig || rigSwitchInProgress) return;
|
||||
rigSwitchInProgress = true;
|
||||
setControlPending(selectEl, true);
|
||||
selectEl.closest(".header-rig-switch")?.classList.add("is-switching");
|
||||
updateRigIdentitySummary(nextRig, true);
|
||||
showHint(`Switching to ${lastRigDisplayNames[nextRig] || nextRig}…`);
|
||||
try {
|
||||
const sidParam = sseSessionId ? `&session_id=${encodeURIComponent(sseSessionId)}` : "";
|
||||
await postPath(`/select_rig?remote=${encodeURIComponent(nextRig)}${sidParam}`, { allowDuringRigSwitch: true, remote: null });
|
||||
lastActiveRigId = nextRig;
|
||||
resetDecoderStateOnRigSwitch();
|
||||
}
|
||||
updateRigSubtitle(lastActiveRigId);
|
||||
updateRigIdentitySummary(lastActiveRigId);
|
||||
window.trxUi?.setActiveRig(lastActiveRigId);
|
||||
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
|
||||
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
|
||||
if (typeof bmFetch === "function") bmFetch(document.getElementById("bm-category-filter")?.value || "");
|
||||
window.trx.map?.syncAprsReceiverMarker();
|
||||
// Switch this session's rig and reconnect SSE to the new rig's
|
||||
// state channel.
|
||||
try {
|
||||
const sidParam = sseSessionId ? `&session_id=${encodeURIComponent(sseSessionId)}` : "";
|
||||
await postPath(`/select_rig?remote=${encodeURIComponent(selectEl.value)}${sidParam}`);
|
||||
window.trx.modules.map?.syncAprsReceiverMarker();
|
||||
connect();
|
||||
} catch (err) {
|
||||
console.error("select_rig failed:", err);
|
||||
}
|
||||
// Reconnect spectrum SSE to the new rig's spectrum channel.
|
||||
stopSpectrumStreaming();
|
||||
startSpectrumStreaming();
|
||||
// Reconnect meter SSE to the new rig's meter channel.
|
||||
stopMeterStreaming();
|
||||
startMeterStreaming();
|
||||
// Reconnect audio to the new rig if audio is active.
|
||||
if (rxActive) {
|
||||
stopRxAudio();
|
||||
startRxAudio();
|
||||
}
|
||||
showHint(`Rig: ${lastActiveRigId}`, 1500);
|
||||
showHint(`Rig: ${lastRigDisplayNames[lastActiveRigId] || lastActiveRigId}`, 1500);
|
||||
} catch (err) {
|
||||
console.error("select_rig failed:", err);
|
||||
selectEl.value = prevRig || "";
|
||||
updateRigIdentitySummary(prevRig);
|
||||
window.trxUi?.notify("Rig could not be switched", { kind: "error" });
|
||||
} finally {
|
||||
rigSwitchInProgress = false;
|
||||
setControlPending(selectEl, false);
|
||||
selectEl.closest(".header-rig-switch")?.classList.remove("is-switching");
|
||||
}
|
||||
}
|
||||
|
||||
if (headerRigSwitchSelect) {
|
||||
headerRigSwitchSelect.addEventListener("change", () => { switchRigFromSelect(headerRigSwitchSelect); });
|
||||
}
|
||||
|
||||
function setControlPending(control, pending) {
|
||||
if (!control) return;
|
||||
control.disabled = pending;
|
||||
control.classList.toggle("is-busy", pending);
|
||||
control.setAttribute("aria-busy", String(pending));
|
||||
}
|
||||
|
||||
powerBtn.addEventListener("click", async () => {
|
||||
powerBtn.disabled = true;
|
||||
setControlPending(powerBtn, true);
|
||||
showHint("Sending...");
|
||||
try {
|
||||
await postPath("/toggle_power");
|
||||
@@ -3928,12 +4019,12 @@ powerBtn.addEventListener("click", async () => {
|
||||
showHint("Toggle failed", 2000);
|
||||
console.error(err);
|
||||
} finally {
|
||||
powerBtn.disabled = false;
|
||||
setControlPending(powerBtn, false);
|
||||
}
|
||||
});
|
||||
|
||||
pttBtn.addEventListener("click", async () => {
|
||||
pttBtn.disabled = true;
|
||||
setControlPending(pttBtn, true);
|
||||
showHint("Toggling PTT…");
|
||||
try {
|
||||
const desired = lastTxEn ? "false" : "true";
|
||||
@@ -3943,7 +4034,7 @@ pttBtn.addEventListener("click", async () => {
|
||||
showHint("PTT toggle failed", 2000);
|
||||
console.error(err);
|
||||
} finally {
|
||||
pttBtn.disabled = false;
|
||||
setControlPending(pttBtn, false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3976,7 +4067,7 @@ async function applyCenterFreqFromInput() {
|
||||
return;
|
||||
}
|
||||
centerFreqDirty = false;
|
||||
centerFreqEl.disabled = true;
|
||||
setControlPending(centerFreqEl, true);
|
||||
showHint("Setting central frequency…");
|
||||
try {
|
||||
await postPath(`/set_center_freq?hz=${parsed}`);
|
||||
@@ -3985,7 +4076,7 @@ async function applyCenterFreqFromInput() {
|
||||
showHint("Set central freq failed", 2000);
|
||||
console.error(err);
|
||||
} finally {
|
||||
centerFreqEl.disabled = false;
|
||||
setControlPending(centerFreqEl, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4186,7 +4277,7 @@ async function applyModeFromPicker() {
|
||||
return;
|
||||
}
|
||||
updateWfmControls();
|
||||
modeEl.disabled = true;
|
||||
setControlPending(modeEl, true);
|
||||
showHint("Setting mode…");
|
||||
try {
|
||||
if (typeof vchanInterceptMode === "function" && await vchanInterceptMode(mode)) {
|
||||
@@ -4204,7 +4295,7 @@ async function applyModeFromPicker() {
|
||||
showHint("Set mode failed", 2000);
|
||||
console.error(err);
|
||||
} finally {
|
||||
modeEl.disabled = false;
|
||||
setControlPending(modeEl, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4223,7 +4314,7 @@ txLimitBtn.addEventListener("click", async () => {
|
||||
showHint("Limit missing", 1500);
|
||||
return;
|
||||
}
|
||||
txLimitBtn.disabled = true;
|
||||
setControlPending(txLimitBtn, true);
|
||||
showHint("Setting TX limit…");
|
||||
try {
|
||||
await postPath(`/set_tx_limit?limit=${encodeURIComponent(limit)}`);
|
||||
@@ -4232,22 +4323,22 @@ txLimitBtn.addEventListener("click", async () => {
|
||||
showHint("TX limit failed", 2000);
|
||||
console.error(err);
|
||||
} finally {
|
||||
txLimitBtn.disabled = false;
|
||||
setControlPending(txLimitBtn, false);
|
||||
}
|
||||
});
|
||||
|
||||
lockBtn.addEventListener("click", async () => {
|
||||
lockBtn.disabled = true;
|
||||
setControlPending(lockBtn, true);
|
||||
showHint("Toggling lock…");
|
||||
try {
|
||||
const nextLock = lockBtn.textContent === "Lock";
|
||||
const nextLock = !lastLocked;
|
||||
await postPath(nextLock ? "/lock" : "/unlock");
|
||||
showHint("Lock toggled", 1500);
|
||||
} catch (err) {
|
||||
showHint("Lock toggle failed", 2000);
|
||||
console.error(err);
|
||||
} finally {
|
||||
lockBtn.disabled = false;
|
||||
setControlPending(lockBtn, false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4264,7 +4355,7 @@ const MODE_BW_DEFAULTS = {
|
||||
FM: [12_500, 2_500, 25_000, 500],
|
||||
AIS: [25_000, 12_500, 50_000, 500],
|
||||
VDES: [100_000, 25_000, 200_000, 1_000],
|
||||
WFM: [180_000, 50_000,300_000,5_000],
|
||||
WFM: [180_000, 60_000,300_000,5_000],
|
||||
DIG: [3_000, 300, 6_000, 100],
|
||||
PKT: [25_000, 300, 50_000, 500],
|
||||
};
|
||||
@@ -4314,7 +4405,8 @@ async function applyBwDefaultForMode(mode, sendToServer) {
|
||||
scheduleSpectrumDraw();
|
||||
}
|
||||
if (sendToServer) {
|
||||
try { await postPath(`/set_bandwidth?hz=${def}`); } catch (_) {}
|
||||
try { await postPath(`/set_bandwidth?hz=${def}`); }
|
||||
catch (error) { window.trxUi?.notify("Default bandwidth could not be applied", { kind: "error", action: { label: "Retry", run: () => applyBwDefaultForMode(mode, true) } }); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4341,67 +4433,115 @@ async function applyBandwidthFromInput() {
|
||||
if (Number.isFinite(lastFreqHz)) {
|
||||
await ensureTunedBandwidthCoverage(lastFreqHz);
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (error) {
|
||||
window.trxUi?.notify("Bandwidth could not be changed", { kind: "error", action: { label: "Retry", run: applyBandwidthFromInput } });
|
||||
}
|
||||
}
|
||||
|
||||
function estimateBandwidthAroundPeak(data, centerHz) {
|
||||
function estimateOccupiedBandwidth(data, centerHz, interference = {}) {
|
||||
if (!data || !isBinsArray(data.bins) || data.bins.length < 3 || !Number.isFinite(centerHz)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const bins = data.bins;
|
||||
const maxIdx = bins.length - 1;
|
||||
const hzPerBin = data.sample_rate / maxIdx;
|
||||
const fullLoHz = data.center_hz - data.sample_rate / 2;
|
||||
const centerIdx = Math.max(
|
||||
1,
|
||||
Math.min(maxIdx - 1, Math.round(((centerHz - fullLoHz) / data.sample_rate) * maxIdx)),
|
||||
);
|
||||
const searchRadius = Math.max(6, Math.min(120, Math.round(maxIdx * 0.03)));
|
||||
const searchLo = Math.max(1, centerIdx - searchRadius);
|
||||
const searchHi = Math.min(maxIdx - 1, centerIdx + searchRadius);
|
||||
const mode = (modeEl ? modeEl.value : "USB").toUpperCase();
|
||||
const [defaultBw, minBw, maxBw, stepBw] = mwDefaultsForMode(mode);
|
||||
const oneSided = mode === "USB" || mode === "DIG" || mode === "CW"
|
||||
? 1
|
||||
: mode === "LSB" || mode === "CWR" ? -1 : 0;
|
||||
const isWfm = mode === "WFM";
|
||||
|
||||
let peakIdx = centerIdx;
|
||||
for (let i = searchLo; i <= searchHi; i++) {
|
||||
if (bins[i] > bins[peakIdx]) peakIdx = i;
|
||||
// Reduce single-bin peaks and holes before finding occupied-channel edges.
|
||||
// WFM needs a wider smoothing window because its energy is noise-like and
|
||||
// spread across the entire channel rather than concentrated at a carrier.
|
||||
const smoothRadius = isWfm ? 3 : 1;
|
||||
const smoothed = bins.map((_, i) => {
|
||||
let sum = 0;
|
||||
let count = 0;
|
||||
for (let j = Math.max(0, i - smoothRadius); j <= Math.min(maxIdx, i + smoothRadius); j++) {
|
||||
sum += bins[j];
|
||||
count += 1;
|
||||
}
|
||||
|
||||
return sum / count;
|
||||
});
|
||||
const sorted = [...bins].sort((a, b) => a - b);
|
||||
const noise = sorted[Math.floor(sorted.length * 0.2)];
|
||||
const peak = bins[peakIdx];
|
||||
const threshold = Math.max(noise + 4, peak - Math.max(8, (peak - noise) * 0.35));
|
||||
const maxSpanBins = Math.max(2, Math.ceil(maxBw / hzPerBin));
|
||||
const searchHalfBins = oneSided === 0 ? Math.ceil(maxSpanBins / 2) : maxSpanBins;
|
||||
const searchLo = Math.max(1, centerIdx - (oneSided > 0 ? 2 : searchHalfBins));
|
||||
const searchHi = Math.min(maxIdx - 1, centerIdx + (oneSided < 0 ? 2 : searchHalfBins));
|
||||
let peak = -Infinity;
|
||||
for (let i = searchLo; i <= searchHi; i++) peak = Math.max(peak, smoothed[i]);
|
||||
const snr = peak - noise;
|
||||
if (!Number.isFinite(snr) || snr < (isWfm ? 5 : 4)) return isWfm ? minBw : defaultBw;
|
||||
|
||||
let left = peakIdx;
|
||||
let right = peakIdx;
|
||||
let belowCount = 0;
|
||||
for (let i = peakIdx; i > 1; i--) {
|
||||
if (bins[i] < threshold) belowCount += 1;
|
||||
else belowCount = 0;
|
||||
if (belowCount >= 2) break;
|
||||
left = i;
|
||||
// A threshold relative to the noise floor finds occupied bandwidth much
|
||||
// more reliably than one relative to the peak. The latter fails for WFM,
|
||||
// whose multiplex spectrum has peaks, notches, and no narrow centre carrier.
|
||||
const threshold = noise + Math.max(3, Math.min(isWfm ? 6 : 10, snr * (isWfm ? 0.18 : 0.28)));
|
||||
const allowedGap = Math.max(isWfm ? 4 : 2, Math.ceil((isWfm ? 12_000 : stepBw) / hzPerBin));
|
||||
|
||||
function occupiedExtent(direction, limitBins) {
|
||||
let lastOccupied = centerIdx;
|
||||
let gap = 0;
|
||||
for (let n = 0; n <= limitBins; n++) {
|
||||
const i = centerIdx + direction * n;
|
||||
if (i <= 0 || i >= maxIdx) break;
|
||||
if (smoothed[i] >= threshold) {
|
||||
lastOccupied = i;
|
||||
gap = 0;
|
||||
} else if (++gap > allowedGap) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Math.abs(lastOccupied - centerIdx) * hzPerBin;
|
||||
}
|
||||
|
||||
belowCount = 0;
|
||||
for (let i = peakIdx; i < maxIdx - 1; i++) {
|
||||
if (bins[i] < threshold) belowCount += 1;
|
||||
else belowCount = 0;
|
||||
if (belowCount >= 2) break;
|
||||
right = i;
|
||||
let rawBw;
|
||||
if (oneSided !== 0) {
|
||||
rawBw = occupiedExtent(oneSided, maxSpanBins);
|
||||
} else {
|
||||
const leftHz = occupiedExtent(-1, searchHalfBins);
|
||||
const rightHz = occupiedExtent(1, searchHalfBins);
|
||||
// A symmetric RF filter must contain the larger of the two sidebands.
|
||||
rawBw = 2 * Math.max(leftHz, rightHz);
|
||||
}
|
||||
|
||||
const shoulderPad = Math.max(1, Math.round((right - left) * 0.08));
|
||||
left = Math.max(0, left - shoulderPad);
|
||||
right = Math.min(maxIdx, right + shoulderPad);
|
||||
|
||||
const hzPerBin = data.sample_rate / maxIdx;
|
||||
const rawBw = Math.max(hzPerBin, (right - left) * hzPerBin);
|
||||
const [, minBw, maxBw, stepBw] = mwDefaultsForMode(modeEl ? modeEl.value : "USB");
|
||||
// Add a transition-band margin. Weak WFM deliberately falls back to the
|
||||
// 60 kHz mode floor above: a narrower filter trades stereo/RDS content for
|
||||
// a useful improvement in intelligibility when the signal is very poor.
|
||||
rawBw *= isWfm ? 1.08 : 1.12;
|
||||
if (isWfm) {
|
||||
const aci = Math.max(0, Math.min(100, Number(interference.aci) || 0)) / 100;
|
||||
const cci = Math.max(0, Math.min(100, Number(interference.cci) || 0)) / 100;
|
||||
// Adjacent-channel energy is outside the wanted modulation, so ACI can
|
||||
// safely drive the cap all the way from the 300 kHz ceiling to 60 kHz.
|
||||
const aciCap = maxBw - (maxBw - minBw) * aci;
|
||||
// CCI overlaps the wanted station and cannot be removed by an RF filter.
|
||||
// Only distrust the widest edge estimates, retaining at least 65% of the
|
||||
// useful range between the weak-signal floor and nominal WFM bandwidth.
|
||||
const cciFloor = minBw + (defaultBw - minBw) * 0.65;
|
||||
const cciCap = maxBw - (maxBw - cciFloor) * cci;
|
||||
rawBw = Math.min(rawBw, aciCap, cciCap);
|
||||
}
|
||||
const clamped = Math.max(minBw, Math.min(maxBw, rawBw));
|
||||
return Math.max(stepBw, Math.round(clamped / stepBw) * stepBw);
|
||||
}
|
||||
|
||||
async function applyAutoBandwidth() {
|
||||
if (!lastSpectrumData || lastFreqHz == null) return;
|
||||
const estimated = estimateBandwidthAroundPeak(lastSpectrumData, lastFreqHz);
|
||||
// WFM interference telemetry belongs to the primary DSP channel. Do not
|
||||
// apply it to a virtual channel, where it would describe the wrong signal.
|
||||
const onVirtual = typeof vchanIsOnVirtual === "function" && vchanIsOnVirtual();
|
||||
const interference = onVirtual ? {} : { cci: lastWfmCci, aci: lastWfmAci };
|
||||
const estimated = estimateOccupiedBandwidth(lastSpectrumData, lastFreqHz, interference);
|
||||
if (!Number.isFinite(estimated) || estimated <= 0) {
|
||||
syncBandwidthInput(currentBandwidthHz);
|
||||
return;
|
||||
@@ -4413,13 +4553,24 @@ async function applyAutoBandwidth() {
|
||||
if (lastSpectrumData) {
|
||||
scheduleSpectrumDraw();
|
||||
}
|
||||
const mode = (modeEl?.value || "").toUpperCase();
|
||||
let reason = "measured occupied spectrum";
|
||||
if (mode === "WFM") {
|
||||
if (estimated === 60_000 && lastWfmAci >= 20) reason = `high adjacent-channel interference (${Math.round(lastWfmAci)}% ACI)`;
|
||||
else if (estimated === 60_000) reason = "weak-signal noise rejection";
|
||||
else if (lastWfmAci >= lastWfmCci && lastWfmAci >= 10) reason = `${Math.round(lastWfmAci)}% ACI cap`;
|
||||
else if (lastWfmCci >= 10) reason = `${Math.round(lastWfmCci)}% CCI confidence cap`;
|
||||
}
|
||||
window.trxUi?.notify(`Auto BW: ${formatBwLabel(estimated)} — ${reason}`, { kind: "success", duration: 5000 });
|
||||
try {
|
||||
if (typeof vchanInterceptBandwidth === "function" && await vchanInterceptBandwidth(estimated)) return;
|
||||
await postPath(`/set_bandwidth?hz=${estimated}`);
|
||||
if (Number.isFinite(lastFreqHz)) {
|
||||
await ensureTunedBandwidthCoverage(lastFreqHz);
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (error) {
|
||||
window.trxUi?.notify("Automatic bandwidth could not be applied", { kind: "error", action: { label: "Retry", run: applyAutoBandwidth } });
|
||||
}
|
||||
}
|
||||
|
||||
if (spectrumBwInput) {
|
||||
@@ -4476,23 +4627,23 @@ function updateTabHistory(name, replaceHistory = false) {
|
||||
}
|
||||
|
||||
// Initialise the Leaflet map, waiting for both Leaflet (L) and map-core.js
|
||||
// (window.trx.map) if they haven't loaded yet.
|
||||
// (window.trx.modules.map) if they haven't loaded yet.
|
||||
let _mapInitTimer = null;
|
||||
function _initMapWhenReady() {
|
||||
const loadingEl = document.getElementById("map-loading");
|
||||
if (window.trx.map && typeof L !== "undefined") {
|
||||
if (window.trx.modules.map && typeof L !== "undefined") {
|
||||
if (_mapInitTimer) { clearInterval(_mapInitTimer); _mapInitTimer = null; }
|
||||
if (loadingEl) loadingEl.classList.add("is-hidden");
|
||||
window.trx.map.initAprsMap();
|
||||
window.trx.map.sizeAprsMapToViewport();
|
||||
window.trx.modules.map.initAprsMap();
|
||||
window.trx.modules.map.sizeAprsMapToViewport();
|
||||
// The map panel was just made visible (display:none → ""); the browser
|
||||
// may not have laid it out yet, so getBoundingClientRect() can return
|
||||
// stale/zero dimensions. Double-rAF ensures a full layout pass has
|
||||
// completed before we re-measure and tell Leaflet about its real size.
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
window.trx.map.sizeAprsMapToViewport();
|
||||
if (window.trx.map.aprsMap) window.trx.map.aprsMap.invalidateSize();
|
||||
window.trx.modules.map.sizeAprsMapToViewport();
|
||||
if (window.trx.modules.map.aprsMap) window.trx.modules.map.aprsMap.invalidateSize();
|
||||
});
|
||||
});
|
||||
return;
|
||||
@@ -4508,6 +4659,7 @@ function _initMapWhenReady() {
|
||||
}
|
||||
|
||||
function navigateToTab(name, options = {}) {
|
||||
window.trxUi?.closeMobileOverlays?.();
|
||||
const { updateHistory = true, replaceHistory = false } = options;
|
||||
if (authEnabled && !authRole && name !== "main") {
|
||||
showAuthGate(false);
|
||||
@@ -4518,6 +4670,7 @@ function navigateToTab(name, options = {}) {
|
||||
_activeTab = name;
|
||||
document.querySelectorAll(".tab-bar .tab").forEach((t) => t.classList.remove("active"));
|
||||
btn.classList.add("active");
|
||||
window.trxUi?.syncSelectedTab(document.querySelector(".tab-bar-nav"), btn);
|
||||
document.querySelectorAll(".tab-panel").forEach((p) => p.style.display = "none");
|
||||
const panel = document.getElementById(`tab-${name}`);
|
||||
panel.style.display = "";
|
||||
@@ -4540,12 +4693,13 @@ function navigateToTab(name, options = {}) {
|
||||
_initMapWhenReady();
|
||||
}
|
||||
if (name === "statistics") {
|
||||
window.trx.map?.scheduleStatsRender();
|
||||
window.trx.modules.map?.scheduleStatsRender();
|
||||
}
|
||||
if (name === "recorder") {
|
||||
refreshRecorderStatus();
|
||||
}
|
||||
}
|
||||
window.navigateToTab = navigateToTab;
|
||||
|
||||
document.querySelector(".tab-bar").addEventListener("click", (e) => {
|
||||
const btn = e.target.closest(".tab[data-tab]");
|
||||
@@ -4704,7 +4858,7 @@ if (headerAuthBtn) {
|
||||
headerAuthBtn.addEventListener("click", async () => {
|
||||
if (authRole) {
|
||||
// Logged in - show logout confirmation
|
||||
if (confirm("Are you sure you want to logout?")) {
|
||||
if (await window.trxUi.confirm({ title: "Log out?", message: "Audio and control access for this browser session will end.", confirmLabel: "Log out", danger: false })) {
|
||||
await authLogout();
|
||||
}
|
||||
} else {
|
||||
@@ -4717,10 +4871,11 @@ if (headerAuthBtn) {
|
||||
// ── Shared namespace for lazy-loaded modules ────────────────────────────────
|
||||
// Modules (map-core.js, screenshot.js) access core state and utilities via
|
||||
// window.trx. Modules register their own APIs as sub-namespaces
|
||||
// (e.g. window.trx.map, window.trx.screenshot).
|
||||
window.trx = Object.create(null);
|
||||
// (e.g. window.trx.modules.map, window.trx.modules.screenshot).
|
||||
const trxState = Object.create(null);
|
||||
const trxModules = Object.create(null);
|
||||
// -- State getters (backed by core-scoped variables) --
|
||||
Object.defineProperties(window.trx, {
|
||||
Object.defineProperties(trxState, {
|
||||
serverLat: { get() { return serverLat; }, set(v) { serverLat = v; } },
|
||||
serverLon: { get() { return serverLon; }, set(v) { serverLon = v; } },
|
||||
lastFreqHz: { get() { return lastFreqHz; } },
|
||||
@@ -4758,7 +4913,7 @@ Object.defineProperties(window.trx, {
|
||||
signalOverlayGl: { get() { return signalOverlayGl; } },
|
||||
});
|
||||
// -- Shared utility functions --
|
||||
Object.assign(window.trx, {
|
||||
const trxCore = Object.freeze({
|
||||
saveSetting, loadSetting, showHint, escapeMapHtml, formatFreq, formatFreqForHumans,
|
||||
formatWavelength, formatBwLabel, formatUptime, formatSigStrength, formatSignal,
|
||||
postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor,
|
||||
@@ -4768,18 +4923,19 @@ Object.assign(window.trx, {
|
||||
currentTheme, canvasPalette, currentStyle,
|
||||
cssColorToRgba, rgbaWithAlpha, isBinsArray, estimateNoiseFloorDb,
|
||||
spectrumVisibleRange, drawSpectrum,
|
||||
bandForHz: function(hz) { return window.trx.map?.bandForHz?.(hz); },
|
||||
bandForHz: function(hz) { return trxModules.map?.bandForHz?.(hz); },
|
||||
markDecodeMapSyncPending,
|
||||
decodeHistoryMapRenderingDeferred,
|
||||
updateDocumentTitle,
|
||||
activeChannelRds,
|
||||
});
|
||||
Object.defineProperties(window.trx, {
|
||||
Object.defineProperties(trxState, {
|
||||
decodeHistoryReplayActive: { get() { return decodeHistoryReplayActive; } },
|
||||
decodeMapSyncPending: { get() { return decodeMapSyncPending; } },
|
||||
_activeTab: { get() { return _activeTab; } },
|
||||
locationSubtitle: { get() { return locationSubtitle; } },
|
||||
});
|
||||
window.trx = Object.freeze({ state: trxState, core: trxCore, modules: trxModules });
|
||||
|
||||
// Load plugin scripts now that window.trx is populated. Dynamic scripts are
|
||||
// async so they must not be created before the namespace they depend on exists.
|
||||
@@ -4793,7 +4949,7 @@ window.addEventListener("resize", resizeHeaderSignalCanvas);
|
||||
// ── Map module (extracted to map-core.js, lazy-loaded) ──────────────────────
|
||||
// The map, statistics, and geolocation code (~3,450 lines) has been moved to
|
||||
// map-core.js and is loaded on demand when the Map tab is first activated.
|
||||
// Core communicates with the map module via window.trx.map.* namespace.
|
||||
// Core communicates with the map module via window.trx.modules.map.* namespace.
|
||||
|
||||
// ── Geo utilities (shared with map-core.js via window.trx) ─────────────────
|
||||
function haversineKm(lat1, lon1, lat2, lon2) {
|
||||
@@ -4903,11 +5059,15 @@ function latLonToMaidenhead(lat, lon) {
|
||||
function _wireSubTabBar(bar) {
|
||||
if (bar._subtabWired) return;
|
||||
bar._subtabWired = true;
|
||||
window.trxUi?.prepareTabList(bar, "secondary");
|
||||
bar.addEventListener("click", (e) => {
|
||||
const btn = e.target.closest(".sub-tab[data-subtab]");
|
||||
if (!btn) return;
|
||||
bar.querySelectorAll(".sub-tab").forEach((t) => t.classList.remove("active"));
|
||||
btn.classList.add("active");
|
||||
window.trxUi?.syncSelectedTab(bar, btn);
|
||||
const decoderPicker = document.getElementById("decoder-tab-select");
|
||||
if (decoderPicker && btn.closest("#tab-digital-modes")) decoderPicker.value = btn.dataset.subtab;
|
||||
const parent = bar.parentElement;
|
||||
parent.querySelectorAll(".sub-tab-panel").forEach((p) => p.style.display = "none");
|
||||
const nextPanel = parent.querySelector(`#subtab-${btn.dataset.subtab}`);
|
||||
@@ -4928,7 +5088,7 @@ document.querySelectorAll(".sub-tab-bar").forEach(_wireSubTabBar);
|
||||
window.addEventListener("resize", () => {
|
||||
const mapTab = document.getElementById("tab-map");
|
||||
if (!mapTab || mapTab.style.display === "none") return;
|
||||
window.trx.map?.sizeAprsMapToViewport();
|
||||
window.trx.modules.map?.sizeAprsMapToViewport();
|
||||
});
|
||||
|
||||
// --- Signal measurement ---
|
||||
@@ -5398,6 +5558,7 @@ function configureRxStream(nextInfo) {
|
||||
ensureRxAudioContext(nextSampleRate);
|
||||
rxGainNode.gain.value = rxVolSlider.value / 100;
|
||||
rxActive = true;
|
||||
window.trxUi?.setButtonState(rxAudioBtn, { active: true, activeLabel: "Stop Audio", inactiveLabel: "Play Audio" });
|
||||
setAudioLevel(0);
|
||||
rxAudioBtn.style.borderColor = "#00d17f";
|
||||
rxAudioBtn.style.color = "#00d17f";
|
||||
@@ -5599,6 +5760,7 @@ function startRxAudio() {
|
||||
// If TX was active when WS closed, release PTT
|
||||
if (txActive) { stopTxAudio(); }
|
||||
rxActive = false;
|
||||
window.trxUi?.setButtonState(rxAudioBtn, { active: false, activeLabel: "Stop Audio", inactiveLabel: "Play Audio" });
|
||||
streamInfo = null;
|
||||
updateWfmControls();
|
||||
rxAudioBtn.style.borderColor = "";
|
||||
@@ -5625,6 +5787,7 @@ function startRxAudio() {
|
||||
|
||||
function stopRxAudio() {
|
||||
rxActive = false;
|
||||
window.trxUi?.setButtonState(rxAudioBtn, { active: false, activeLabel: "Stop Audio", inactiveLabel: "Play Audio" });
|
||||
streamInfo = null;
|
||||
if (audioWs) { audioWs.close(); audioWs = null; }
|
||||
if (audioCtx) { audioCtx.close(); audioCtx = null; }
|
||||
@@ -5663,6 +5826,7 @@ function startTxAudio() {
|
||||
}).then(async (stream) => {
|
||||
txStream = stream;
|
||||
txActive = true;
|
||||
window.trxUi?.setButtonState(txAudioBtn, { active: true, activeLabel: "Stop Transmitting", inactiveLabel: "Transmit Audio" });
|
||||
txAudioBtn.style.borderColor = "#e55353";
|
||||
txAudioBtn.style.color = "#e55353";
|
||||
audioStatus.textContent = "RX+TX";
|
||||
@@ -5740,6 +5904,7 @@ function startTxAudio() {
|
||||
async function stopTxAudio() {
|
||||
if (!txActive) return;
|
||||
txActive = false;
|
||||
window.trxUi?.setButtonState(txAudioBtn, { active: false, activeLabel: "Stop Transmitting", inactiveLabel: "Transmit Audio" });
|
||||
clearTxTimeout();
|
||||
|
||||
// Release PTT automatically
|
||||
@@ -5985,7 +6150,7 @@ function renderRecorderFiles() {
|
||||
el.querySelectorAll(".rec-delete-btn").forEach(function (btn) {
|
||||
btn.addEventListener("click", async function () {
|
||||
const name = btn.dataset.name;
|
||||
if (!confirm("Delete recording " + name + "?")) return;
|
||||
if (!await window.trxUi.confirm({ title: "Delete recording?", message: `${name} will be permanently removed.`, confirmLabel: "Delete" })) return;
|
||||
try {
|
||||
const resp = await fetch("/api/recorder/files/" + encodeURIComponent(name), { method: "DELETE" });
|
||||
if (!resp.ok) throw new Error("HTTP " + resp.status);
|
||||
@@ -5993,6 +6158,7 @@ function renderRecorderFiles() {
|
||||
renderRecorderFiles();
|
||||
} catch (e) {
|
||||
console.error("Delete failed", e);
|
||||
window.trxUi?.notify("Recording could not be deleted", { kind: "error" });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -6098,8 +6264,8 @@ function dispatchDecodeMessage(msg, skipStats) {
|
||||
if (msg.type === "wefax" && window.onServerWefax) window.onServerWefax(msg);
|
||||
if (msg.type === "wefax_progress" && window.onServerWefaxProgress) window.onServerWefaxProgress(msg);
|
||||
if (!skipStats && msg.type && msg.type !== "lrpt_image" && msg.type !== "lrpt_progress" && msg.type !== "wefax" && msg.type !== "wefax_progress") {
|
||||
window.trx.map?.statsRecordDecode(msg.type, msg.rig_id || msg.remote || null);
|
||||
window.trx.map?.scheduleStatsRender();
|
||||
window.trx.modules.map?.statsRecordDecode(msg.type, msg.rig_id || msg.remote || null);
|
||||
window.trx.modules.map?.scheduleStatsRender();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6108,10 +6274,10 @@ function dispatchDecodeBatch(batch) {
|
||||
// Record statistics for every message in the batch regardless of dispatch path.
|
||||
for (const msg of batch) {
|
||||
if (msg.type && msg.type !== "lrpt_image" && msg.type !== "lrpt_progress" && msg.type !== "wefax" && msg.type !== "wefax_progress") {
|
||||
window.trx.map?.statsRecordDecode(msg.type, msg.rig_id || msg.remote || null);
|
||||
window.trx.modules.map?.statsRecordDecode(msg.type, msg.rig_id || msg.remote || null);
|
||||
}
|
||||
}
|
||||
window.trx.map?.scheduleStatsRender();
|
||||
window.trx.modules.map?.scheduleStatsRender();
|
||||
const type = String(batch[0]?.type || "");
|
||||
const uniformType = batch.every((msg) => String(msg?.type || "") === type);
|
||||
if (uniformType) {
|
||||
@@ -6196,9 +6362,9 @@ function restoreDecodeHistoryGroup(kind, messages) {
|
||||
// Record statistics for restored history messages.
|
||||
if (kind !== "lrpt_image" && kind !== "lrpt_progress" && kind !== "wefax" && kind !== "wefax_progress") {
|
||||
for (const msg of messages) {
|
||||
window.trx.map?.statsRecordDecode(kind, msg.rig_id || msg.remote || null, msg.ts_ms || undefined);
|
||||
window.trx.modules.map?.statsRecordDecode(kind, msg.rig_id || msg.remote || null, msg.ts_ms || undefined);
|
||||
}
|
||||
window.trx.map?.scheduleStatsRender();
|
||||
window.trx.modules.map?.scheduleStatsRender();
|
||||
}
|
||||
if (kind === "ais") {
|
||||
if (window.restoreAisHistory) { window.restoreAisHistory(messages); }
|
||||
@@ -6929,6 +7095,13 @@ function startSpectrumStreaming() {
|
||||
const rds = lastSpectrumData?.rds;
|
||||
lastSpectrumData = { bins, center_hz: centerHz, sample_rate: sampleRate, rds };
|
||||
window.lastSpectrumData = lastSpectrumData;
|
||||
const spectrumSummary = document.getElementById("spectrum-text-summary");
|
||||
if (spectrumSummary && bins.length) {
|
||||
let peakIndex = 0;
|
||||
for (let i = 1; i < bins.length; i += 1) if (bins[i] > bins[peakIndex]) peakIndex = i;
|
||||
const peakHz = centerHz - sampleRate / 2 + (peakIndex / Math.max(1, bins.length - 1)) * sampleRate;
|
||||
spectrumSummary.textContent = `Spectrum centered at ${formatFreqForHumans(centerHz)}, spanning ${formatFreqForHumans(sampleRate)}. Strongest visible bin near ${formatFreqForHumans(peakHz)} at ${bins[peakIndex]} dB.`;
|
||||
}
|
||||
// Server confirmed a new center — clear optimistic pending value.
|
||||
if (spectrumCenterPendingHz !== null && Math.abs(centerHz - spectrumCenterPendingHz) < 1000) {
|
||||
spectrumCenterPendingHz = null;
|
||||
@@ -7996,12 +8169,12 @@ window.addEventListener("keydown", (event) => {
|
||||
// S — spectrum screenshot (lazy-loads screenshot.js on first use)
|
||||
if (key === "s") {
|
||||
event.preventDefault();
|
||||
if (window.trx.screenshot) {
|
||||
void window.trx.screenshot.captureSpectrumScreenshot();
|
||||
if (window.trx.modules.screenshot) {
|
||||
void window.trx.modules.screenshot.captureSpectrumScreenshot();
|
||||
} else {
|
||||
const s = document.createElement("script");
|
||||
s.src = "/screenshot.js";
|
||||
s.onload = () => { void window.trx.screenshot?.captureSpectrumScreenshot(); };
|
||||
s.onload = () => { void window.trx.modules.screenshot?.captureSpectrumScreenshot(); };
|
||||
document.body.appendChild(s);
|
||||
}
|
||||
return;
|
||||
@@ -8391,7 +8564,12 @@ if (spectrumCanvas || overviewCanvas) {
|
||||
await ensureTunedBandwidthCoverage(lastFreqHz, currentBandwidthHz);
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (error) {
|
||||
window.trxUi?.notify("Bandwidth could not be changed", {
|
||||
kind: "error",
|
||||
action: { label: "Retry", run: () => postPath(`/set_bandwidth?hz=${Math.round(currentBandwidthHz)}`) },
|
||||
});
|
||||
}
|
||||
_bwDragEdge = null;
|
||||
_bwDragCanvas = null;
|
||||
return;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
const textDecoder = typeof TextDecoder === "function" ? new TextDecoder() : null;
|
||||
const HISTORY_GROUP_KEYS = ["ais", "vdes", "aprs", "hf_aprs", "cw", "ft8", "ft4", "ft2", "wspr", "wefax"];
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@@ -38,7 +43,7 @@
|
||||
<div class="subtitle" id="location-subtitle" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-bar-nav">
|
||||
<div class="tab-bar-nav" aria-label="Primary navigation">
|
||||
<button class="tab active" data-tab="main">
|
||||
<svg class="tab-icon" aria-hidden="true"><use href="#icon-home"/></svg>
|
||||
<span class="tab-label">Main</span>
|
||||
@@ -80,6 +85,7 @@
|
||||
<button id="header-rec-btn" class="header-bar-btn header-rec-btn" type="button" aria-label="Toggle recording" title="Toggle recording">REC</button>
|
||||
<div class="header-rig-switch">
|
||||
<select id="header-rig-switch-select" aria-label="Select active rig"></select>
|
||||
<span id="header-rig-summary" class="header-rig-summary" aria-live="polite"></span>
|
||||
</div>
|
||||
<div class="header-style-pick">
|
||||
<select id="header-style-pick-select" aria-label="Select UI style">
|
||||
@@ -99,24 +105,24 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Auth gate (hidden by default, shown if auth is required) -->
|
||||
<div id="auth-gate" style="display:none; max-width: 30rem; margin: 0 auto 0.9rem; padding: 1.25rem 0 1.5rem; text-align: center;">
|
||||
<div style="margin-bottom: 1.5rem;">
|
||||
<div style="font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem;">Access Required</div>
|
||||
<div style="color: var(--text-muted);">Enter passphrase to continue</div>
|
||||
<div id="auth-gate" class="auth-gate" style="display:none;">
|
||||
<div class="auth-gate-head">
|
||||
<div class="auth-gate-title">Access Required</div>
|
||||
<div class="auth-gate-sub">Enter passphrase to continue</div>
|
||||
</div>
|
||||
<form id="auth-form" style="margin: 1rem 0 0.35rem;">
|
||||
<input type="password" id="auth-passphrase" placeholder="Passphrase" autocomplete="off" style="width: 100%; padding: 0.65rem 0.75rem; margin-bottom: 1rem; border: 1px solid var(--border-light); border-radius: 0.45rem; background: var(--input-bg); color: var(--text); font-size: 1rem; box-sizing: border-box;" />
|
||||
<button type="submit" style="width: 100%; padding: 0.65rem 0.75rem; background: var(--accent-green); color: #fff; border: none; border-radius: 0.45rem; font-weight: 700; cursor: pointer; font-size: 1rem; box-sizing: border-box;">Login</button>
|
||||
<form id="auth-form" class="auth-form">
|
||||
<input type="password" id="auth-passphrase" class="auth-input" placeholder="Passphrase" autocomplete="off" />
|
||||
<button type="submit" class="auth-submit">Login</button>
|
||||
</form>
|
||||
<button id="auth-guest-btn" type="button" style="width: 100%; padding: 0.65rem 0.75rem; background: var(--btn-bg); color: var(--text); border: 1px solid var(--border-light); border-radius: 0.45rem; font-weight: 600; cursor: pointer; font-size: 1rem; box-sizing: border-box; margin-top: 0; display: none;">Continue as Guest</button>
|
||||
<div id="auth-error" style="color: #ff6b6b; font-size: 0.9rem; margin-top: 1rem; display: none;"></div>
|
||||
<div id="auth-role" style="margin-top: 1rem; color: var(--text-muted); font-size: 0.85rem; display: none;"></div>
|
||||
<button id="auth-guest-btn" type="button" class="auth-guest" style="display: none;">Continue as Guest</button>
|
||||
<div id="auth-error" class="auth-error" style="display: none;"></div>
|
||||
<div id="auth-role" class="auth-role" style="display: none;"></div>
|
||||
</div>
|
||||
<div id="tab-main" class="tab-panel">
|
||||
<div id="server-lost-banner" aria-live="assertive"><span class="banner-dot"></span>trx-server connection lost — waiting for reconnect</div>
|
||||
<div id="loading" role="status" aria-live="polite" style="text-align:center; padding:2rem 0;">
|
||||
<div id="loading-title" style="margin-bottom:0.4rem; font-size:1.1rem; font-weight:600;">Initializing (rig)…</div>
|
||||
<div id="loading-sub" style="color:#9aa4b5;"></div>
|
||||
<div id="loading-sub" style="color:var(--text-muted);"></div>
|
||||
</div>
|
||||
<div id="content" style="display:none;">
|
||||
<div class="signal-visual-block">
|
||||
@@ -135,13 +141,14 @@
|
||||
<div class="spectrum-wrap">
|
||||
<div id="spectrum-bookmark-axis"></div>
|
||||
<div id="spectrum-bookmark-side-left" class="spectrum-bookmark-side spectrum-bookmark-side-left" aria-hidden="true"></div>
|
||||
<canvas id="spectrum-canvas" tabindex="0" role="img" aria-label="Spectrum display"></canvas>
|
||||
<canvas id="spectrum-canvas" tabindex="0" role="img" aria-label="Spectrum display" aria-describedby="spectrum-text-summary"></canvas>
|
||||
<p id="spectrum-text-summary" class="visually-hidden">Spectrum data is waiting for the receiver.</p>
|
||||
<div id="spectrum-zoom-indicator" aria-hidden="true"></div>
|
||||
<div id="spectrum-minimap" aria-hidden="true"><div class="minimap-view"></div></div>
|
||||
<div id="spectrum-db-axis" aria-hidden="true"></div>
|
||||
<div id="spectrum-bookmark-side-right" class="spectrum-bookmark-side spectrum-bookmark-side-right" aria-hidden="true"></div>
|
||||
<div id="spectrum-tooltip"></div>
|
||||
<canvas id="spectrum-waterfall-canvas" tabindex="0" role="img" aria-label="Waterfall display" style="display:none;"></canvas>
|
||||
<canvas id="spectrum-waterfall-canvas" tabindex="0" role="img" aria-label="Waterfall display" aria-describedby="spectrum-text-summary" style="display:none;"></canvas>
|
||||
<div id="spectrum-freq-axis">
|
||||
<button id="spectrum-center-left-btn" class="spectrum-edge-shift spectrum-edge-shift-left" type="button" aria-label="Shift spectrum center left">‹</button>
|
||||
<button id="spectrum-center-right-btn" class="spectrum-edge-shift spectrum-edge-shift-right" type="button" aria-label="Shift spectrum center right">›</button>
|
||||
@@ -199,12 +206,12 @@
|
||||
<div class="label"><span>Signal strength</span></div>
|
||||
</div>
|
||||
<div class="freq-field frequency-col">
|
||||
<input class="status-input" id="freq" type="text" value="--" />
|
||||
<div class="label"><span>Frequency</span></div>
|
||||
<input class="status-input" id="freq" type="text" value="--" aria-describedby="freq-label" aria-label="Tuned frequency" />
|
||||
<div class="label" id="freq-label"><span>Frequency</span></div>
|
||||
</div>
|
||||
<div class="freq-field frequency-col center-frequency-col" id="center-freq-field" style="display:none;">
|
||||
<input class="status-input" id="center-freq" type="text" value="--" />
|
||||
<div class="label"><span>Center Frequency</span></div>
|
||||
<input class="status-input" id="center-freq" type="text" value="--" aria-describedby="center-freq-label" aria-label="SDR center frequency" />
|
||||
<div class="label" id="center-freq-label"><span>Center Frequency</span></div>
|
||||
</div>
|
||||
<div class="freq-field unit-col">
|
||||
<div class="jog-step" id="jog-step">
|
||||
@@ -230,7 +237,7 @@
|
||||
<div class="controls-col label-below-col">
|
||||
<div class="label"><span>Mode</span></div>
|
||||
<div class="inline">
|
||||
<select class="status-input" id="mode"></select>
|
||||
<select class="status-input" id="mode" aria-label="Demodulation mode"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls-col controls-col-center">
|
||||
@@ -302,9 +309,9 @@
|
||||
<div class="controls-col controls-col-power label-below-col" id="tx-power-col">
|
||||
<div class="label"><span>Transmit / Power</span></div>
|
||||
<div class="btn-grid">
|
||||
<button id="ptt-btn" type="button">Toggle PTT</button>
|
||||
<button id="power-btn" type="button">Toggle Power</button>
|
||||
<button id="lock-btn" type="button">Lock</button>
|
||||
<button id="ptt-btn" type="button" aria-pressed="false">Start TX</button>
|
||||
<button id="power-btn" type="button" aria-pressed="false">Power On</button>
|
||||
<button id="lock-btn" type="button" aria-pressed="false">Lock Tuning</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -490,6 +497,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="bm-form-actions">
|
||||
<div id="bm-form-error" class="form-error" role="alert" aria-live="polite"></div>
|
||||
<button type="submit" class="bm-save-btn">Save</button>
|
||||
<button type="button" id="bm-form-cancel">Cancel</button>
|
||||
</div>
|
||||
@@ -525,7 +533,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-digital-modes" class="tab-panel" style="display:none;">
|
||||
<div class="sub-tab-bar">
|
||||
<div class="sub-tab-bar" aria-label="Decoder views">
|
||||
<button class="sub-tab active" data-subtab="overview">Overview</button>
|
||||
<button class="sub-tab" data-subtab="ais">AIS</button>
|
||||
<button class="sub-tab" data-subtab="vdes">VDES</button>
|
||||
@@ -1576,7 +1584,7 @@
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="copyright">
|
||||
Built by <a href="https://www.qrzcq.com/call/SP2SJG" target="_blank" rel="noopener">SP2SJG</a> from <a href="https://haxx.space" target="_blank" rel="noopener">haxx.space</a> · <span class="gh-link-wrap"><a class="gh-link" href="https://github.com/sgrams/trx-rs" target="_blank" rel="noopener" aria-label="Open trx-rs on GitHub"><svg class="gh-link-icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 0.2a8 8 0 0 0-2.53 15.59c0.4 0.07 0.55-0.17 0.55-0.39l-0.01-1.37c-2.23 0.49-2.7-0.95-2.7-0.95-0.36-0.91-0.89-1.15-0.89-1.15-0.73-0.49 0.06-0.48 0.06-0.48 0.8 0.06 1.22 0.82 1.22 0.82 0.72 1.22 1.88 0.87 2.34 0.67 0.07-0.51 0.28-0.86 0.5-1.06-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.58 0.81-2.14-0.08-0.2-0.35-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82a7.56 7.56 0 0 1 4.01 0c1.53-1.03 2.2-0.82 2.2-0.82 0.43 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.81 1.27 0.81 2.14 0 3.07-1.87 3.75-3.66 3.95 0.29 0.25 0.54 0.73 0.54 1.48l-0.01 2.2c0 0.22 0.14 0.47 0.55 0.39A8 8 0 0 0 8 0.2Z"></path></svg><span>trx-rs on GitHub</span></a></span> — <span id="copyright-year"></span>
|
||||
Built by <a href="https://www.qrzcq.com/call/SP2SJG" target="_blank" rel="noopener">SP2SJG</a> from <a href="https://haxx.space" target="_blank" rel="noopener">haxx.space</a> · <span class="gh-link-wrap"><a class="gh-link" href="https://git.haxx.space/sjg/trx-rs" target="_blank" rel="noopener" aria-label="Open trx-rs source repository"><svg class="gh-link-icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg><span>trx-rs source</span></a></span> — <span id="copyright-year"></span>
|
||||
</div>
|
||||
<div class="hint" id="power-hint" aria-live="polite">Connecting…</div>
|
||||
</div>
|
||||
@@ -1618,8 +1626,11 @@
|
||||
<div id="decode-history-overlay-sub" class="decode-history-overlay-sub">Preparing recent decodes for the UI</div>
|
||||
</div>
|
||||
</div>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/opus-decoder@0.7.11/dist/opus-decoder.min.js" charset="UTF-8"></script>
|
||||
<script defer src="/vendor/opus-decoder-0.7.11.min.js" charset="UTF-8"></script>
|
||||
<script defer src="/vendor/leaflet.js"></script>
|
||||
<script defer src="/leaflet-ais-tracksymbol.js"></script>
|
||||
<script defer src="/webgl-renderer.js"></script>
|
||||
<script defer src="/ui-core.js"></script>
|
||||
<script defer src="/app.js"></script>
|
||||
<script>
|
||||
// Lazy plugin loader: loads plugin scripts when their tab/feature is first activated
|
||||
@@ -1627,41 +1638,67 @@
|
||||
var pluginScripts = {
|
||||
'digital-modes': ['/ft8.js', '/ft4.js', '/ft2.js', '/wspr.js', '/cw.js', '/background-decode.js', '/sat.js', '/wefax.js'],
|
||||
'map-data': ['/map-core.js', '/ais.js', '/vdes.js', '/aprs.js', '/hf-aprs.js'],
|
||||
'map': ['/map-core.js', '/leaflet-ais-tracksymbol.js', '/ais.js', '/vdes.js', '/aprs.js', '/hf-aprs.js', '/sat.js', '/sat-scheduler.js'],
|
||||
'map': ['/map-core.js', '/ais.js', '/vdes.js', '/aprs.js', '/hf-aprs.js', '/sat.js', '/sat-scheduler.js'],
|
||||
'statistics': ['/map-core.js'],
|
||||
'bookmarks': ['/bookmarks.js'],
|
||||
'recorder': [],
|
||||
'settings': ['/vchan.js', '/scheduler.js']
|
||||
};
|
||||
var loaded = new Set();
|
||||
function loadPlugins(tab) {
|
||||
var scripts = pluginScripts[tab];
|
||||
if (!scripts) return;
|
||||
scripts.forEach(function(src) {
|
||||
if (loaded.has(src)) return;
|
||||
loaded.add(src);
|
||||
var loading = new Map();
|
||||
|
||||
function loadScript(src) {
|
||||
if (loaded.has(src)) return Promise.resolve();
|
||||
if (loading.has(src)) return loading.get(src);
|
||||
|
||||
var request = new Promise(function(resolve, reject) {
|
||||
var s = document.createElement('script');
|
||||
s.src = src;
|
||||
s.defer = true;
|
||||
s.onload = function() {
|
||||
loaded.add(src);
|
||||
loading.delete(src);
|
||||
resolve();
|
||||
};
|
||||
s.onerror = function() {
|
||||
loading.delete(src);
|
||||
reject(new Error('Failed to load plugin script: ' + src));
|
||||
};
|
||||
document.body.appendChild(s);
|
||||
});
|
||||
loading.set(src, request);
|
||||
return request;
|
||||
}
|
||||
|
||||
function loadPlugins(tab) {
|
||||
var scripts = pluginScripts[tab];
|
||||
if (!scripts) return Promise.resolve();
|
||||
return scripts.reduce(function(sequence, src) {
|
||||
return sequence.then(function() { return loadScript(src); });
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
function requestPlugins(tab) {
|
||||
return loadPlugins(tab).catch(function(err) {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
// Eager plugin loading is triggered by app.js (after window.trx is set up)
|
||||
// via window.loadEagerPlugins(). Dynamic scripts are effectively async, so
|
||||
// loading them before app.js would cause map-core.js to crash when
|
||||
// window.trx is not yet defined.
|
||||
window.loadEagerPlugins = function() {
|
||||
['digital-modes', 'map-data', 'bookmarks', 'settings'].forEach(loadPlugins);
|
||||
return Promise.all(
|
||||
['digital-modes', 'map-data', 'bookmarks', 'settings'].map(requestPlugins)
|
||||
);
|
||||
};
|
||||
// Load others on tab switch
|
||||
document.addEventListener('click', function(e) {
|
||||
var tab = e.target.closest('[data-tab]');
|
||||
if (tab) loadPlugins(tab.dataset.tab);
|
||||
if (tab) requestPlugins(tab.dataset.tab);
|
||||
});
|
||||
window.loadPluginsForTab = loadPlugins;
|
||||
})();
|
||||
</script>
|
||||
<!-- Template cloning is handled by navigateToTab() in app.js -->
|
||||
<script defer src="/vendor/leaflet.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user