Wykres commitów

114 Commity (master)

Autor SHA1 Wiadomość Data
Shawn Rutledge 9fec6ca398
non-standard callsigns; special CQ; field type annotation (#47)
* Fix CLOCK_REALTIME

* Get Makefile working with both C and C++ compilers

We need HAVE_STPCPY defined to avoid duplicating it.

We shouldn't depend on CPPFLAGS if building with gcc.
It may be necessary to build with a C++ compiler when using portaudio
or integrating into a C++ project. Now it builds either way.

* Build static lib by default; FT8_DEBUG for ASAN and debug symbols

kiss_fft is omitted for now: not every program needs it, and the object file
can still be linked separately, as before.

`FT8_DEBUG=1 make` builds with `-fsanitize=address -ggdb3`
and without `-O3` for debugging purposes.

* copy_token(): save space for the null terminator

If the given string is longer than the given length (available space),
copy one less than the length and then append a null terminator.
This guarantees that token will always be null-terminated, to avoid
buffer overflow.

For example in ftx_message_encode(), if message_text is excessively-long
free text with no spaces, we attempt to copy it to call_to, which is
12 bytes long. We must copy only 11 bytes, so that it can be
null-terminated. (In this case call_to is not really used anyway: it's
not a callsign, and after failing the other encodings, we will call
ftx_message_encode_free(msg, message_text), and then fail because it's
too long. But don't crash on the way, either.) Discovered with ASAN.

* Fix ftx_message_print()

* Add support of non-standard callsigns with prefixes

Closes kgoba/ft8_lib#44

* ftx_message_encode_free(): set all payload bytes; debug parsed words

If a ftx_message_t struct is reused for all outgoing messages, it may
have leftover i3.n3 values. Make sure to overwrite those. (Although,
"telemetry" should really be type 0.5; but we are reusing
ftx_message_encode_telemetry() in ftx_message_encode_free(), so
I guess the caller who calls ftx_message_encode_telemetry() should set
that byte itself.)

Also output the "parsed '...' ..." debug log message before checking
for errors, to help clarify why the error occurred.

* Decode message field types and offsets

The user of this library should not need to re-tokenize the plain-text
message and guess again which field is a callsign, special-token, grid
etc.: it's redundant and relatively failure-prone, whereas libft8
already has all the information. It already needed to decode individual
tokens out of the bitstream and construct plain text from that. But some
users (such as sbitx) color-code the message, and IMO it's best not to
invent some ad-hoc markup language. So the message is kept as plain
text, and its "metadata" is kept separate, in the form of a start
position and a type enum for each recognizable span found in the message
text.

It could be argued that this could go further, such as splitting
"CQ POTA" into two fields, FTX_FIELD_TOKEN and FTX_FIELD_TOKEN_ARG;
however, the internal model so far that a std or nonstd message can
contain only 3 fields, so we treat the whole thing as a "callsign",
then pack28() detects CQ and calls parse_cq_modifier(). And
FTX_MAX_MESSAGE_FIELDS is 3 because of this. Likewise, we could separate
FTX_FIELD_CALL_TO and FTX_FIELD_CALL_DE: but they have positional
meaning anyway. This could be reexamined later.

* Use type 4 message for nonstandard CQ; get tests passing

We need trim_brackets() for the tests, and it may be useful in
user programs too.

When a CHECK(this == that) test fails, it's helpful to see the values
that were not equal; so add and use the CHECK_EQ_VAL(this, that) macro.

A failed test needs to end with an extra newline to separate the output
from the next test. And FAIL! is subtly better than FAIL: for searching
in the terminal (also, I have muscle memory for it, from Qt work).

* Fall back to free text to encode more than 3 tokens

"TNX BOB 73 GL" (an example from WSJT-X tests) contains 4 tokens (which
are not callsigns), but ft8_lib would have previously tried to compose a
standard type 1 message.

If a program that uses ft8_lib has paid attention to the field types and
offsets from previous messages, and has UI for the user to select
(for example) a FTX_FIELD_CALL field and start a new QSO, then it has
enough information to call a type-specific function. pack_basecall()
can be used to disambiguate whether the callsign is standard or not:
then the program can call ftx_message_encode_std(), or
ftx_message_encode_nonstd() if it detects a non-standard callsign or if
ftx_message_encode_std() fails. Likewise, it can call
ftx_message_encode_free() if it already knows the message must be sent
as free text, or as a fallback if the other encode functions fail.

ftx_message_encode() does this fallback sequence already, but it is not
given field types to indicate what the message contains, so it could
potentially make a mistake (e.g. with "THX BOB 73"). But it is retained
for backwards compatibility, and also because it's easier to use; and
now it gets more cases right than it did before.

* Add pack_basecall() to public API

A program could use it to pre-check whether a callsign is standard or not.
(But if it's not standard, it may not be a callsign at all.)

* Fix CQ_nnn and CQ_a[bcd] encoding

Figured out how by reading subroutine pack28(c13,n28) in WSJT-X.

The decoding already works, it seems.

We now use space as the delimiter between CQ and the modifier,
rather than underscore. An end user composing a message by hand
would use space, so it must be detectable that way; and BTW
CQ may also be a callsign prefix (Portugal, Azores, Madeira),
so we cannot simply detect CQ without checking the following delimiter,
and assume that it's a CQ message. nnn and a[bcd] are unlike callsigns
(a CQ modifier can have letters OR numbers, but not both, whereas a
callsign ALWAYS has both); so we can reliably detect modifiers without
needing underscore as a delimiter.

---------

Co-authored-by: Georgy Dyuldin <g.dyuldin@gmail.com>
2025-08-24 07:55:25 +03:00
Kārlis Goba 50ee0c0636
Merge pull request #37 from kgoba/update_to_0_2
Update to 0.2
2023-10-31 08:19:40 +02:00
Karlis Goba 5f512a2f89 Added Waterfall class and candidate search+decoding 2022-08-15 12:22:58 +03:00
Karlis Goba aec8f7677a Added more files/dirs 2022-08-12 23:30:52 +03:00
Karlis Goba d2b9790fd6 Added fine/coarse sync search 2022-08-12 23:30:21 +03:00
Karlis Goba 2683de6c92 Updated decode processing 2022-08-10 23:21:48 +03:00
Karlis Goba 56c0e34d95 Initial version of python decoder 2022-08-09 11:41:49 +03:00
Karlis Goba 757948b33f Code sanitization 2022-08-07 14:02:42 +03:00
Karlis Goba 62ee4533b5 Added relative dB lookup table (for SNR) 2022-08-07 13:58:42 +03:00
Karlis Goba 62f7aeecac Added mag/phase data in waterfall and resynth function 2022-08-03 16:01:52 +03:00
Karlis Goba aea0ed85b0 Added mag/phase data in waterfall and resynth function 2022-08-03 15:57:03 +03:00
Karlis Goba a28593682e Naming consistency + time slot display in decode_ft8 2022-06-28 09:07:52 +03:00
Karlis Goba 7dc84b972a Naming consistency; removed legacy pack/unpack 2022-06-26 10:47:46 +03:00
Karlis Goba 6f528128ee Added live decoding based on Portaudio 2022-06-19 20:01:21 +03:00
Karlis Goba a05dbae957 Added initial message interface, moved demo/example code, initial portaudio support 2022-06-16 12:28:07 +03:00
Karlis Goba 72754d02f0 Some code cleanup 2022-05-11 15:33:26 +03:00
Karlis Goba 7d534db0db Added extern C around function prototypes for C++ compatibility 2022-04-23 17:40:30 +03:00
Kārlis Goba cd0dc2eca3
Merge pull request #20 from kholia/master
Fix a memory leak in decode_ft8.c
2022-02-06 21:28:43 +02:00
Dhiru Kholia 5fb933b0d4 Fix a memory leak in decode_ft8.c
This fix is useful when ft8_lib is used as a library.
2022-02-06 13:34:20 +05:30
Kārlis Goba 95473cda53
Merge pull request #17 from kholia/master
Allow compilation on Android as ISO C++ code
2021-12-18 09:59:19 +02:00
Dhiru Kholia 759f59d960 Allow compilation on Android as ISO C++ code 2021-12-18 12:06:46 +05:30
Kārlis Goba e7c23cb46c
Update README.md 2021-12-14 22:14:10 +02:00
Kārlis Goba 6fb6c2d5cd
Update README.md 2021-12-14 22:10:13 +02:00
Kārlis Goba 569d1f6c3e
Update README.md 2021-12-14 22:07:53 +02:00
Karlis Goba cbc656c375 Added FT4 decoding 2021-12-14 10:38:07 +02:00
Karlis Goba 927fae9d3a Updated the decoder from whole signal processing to frame processing 2021-12-11 07:48:15 +02:00
Karlis Goba acea17221e Further steps towards FT4 decoding 2021-12-08 23:33:52 +02:00
Karlis Goba 26decf92f7 Added prefixes to ft8/ft4/ftx functions and clang-formatted code 2021-11-17 10:31:01 +02:00
Kārlis Goba 550f3dc29c
Merge pull request #15 from kholia/master
Misc. fixes required on Ubuntu 21.04 (Linux)
2021-11-07 11:30:45 +02:00
Dhiru Kholia 23247aa471 Misc. fixes required on Ubuntu 21.04 (Linux) 2021-11-07 14:41:07 +05:30
Kārlis Goba c21ef4500b
Merge pull request #14 from kholia/master
Fix M_PI related compilation isues on Linux
2021-11-07 10:31:40 +02:00
Dhiru Kholia 7e9926f1bd Fix M_PI related compilation isues on Linux 2021-11-01 16:38:36 +05:30
Karlis Goba ee9567ab1d Minor tweaks for performance 2021-08-18 11:07:12 +03:00
Karlis Goba 78c3e25a08 Added FT4 encoding 2021-08-16 20:02:52 +03:00
Karlis Goba 456eefede4 Minor cleanup in encoding, more documentation 2021-08-16 12:49:32 +03:00
Karlis Goba f7ca67be9f Further minor updates and cleanup 2021-08-13 12:39:37 +03:00
Karlis Goba d46686bccc Merge branch 'master' of https://github.com/kgoba/ft8_lib 2021-08-12 15:04:20 +03:00
Karlis Goba 67ff4b95e7 Improved decoding slightly 2021-08-12 15:04:15 +03:00
Kārlis Goba 5a44db939f
Update README.md 2021-08-12 14:36:35 +03:00
Karlis Goba 89c1cd90ec Cleanup of code 2021-08-12 14:32:49 +03:00
Karlis Goba 7d57d9e855 Merge branch 'master' of https://github.com/kgoba/ft8_lib 2021-08-12 13:43:33 +03:00
Karlis Goba ac9510b993 Simplified decoder interface and decode_ft8.c 2021-08-12 13:43:25 +03:00
Kārlis Goba c0ad8145e5
Update README.md 2021-08-11 00:17:16 +03:00
Karlis Goba 1690b55a62 Cleanup and a little documentation 2021-08-10 13:37:54 +03:00
Karlis Goba 271756b4c7 Some cleanup 2021-08-06 09:57:08 +03:00
Karlis Goba 74ff78663b Renaming constants to use less generic names 2021-08-05 14:21:07 +03:00
Karlis Goba 3418b64b08 Fixed compilation errors 2021-08-05 14:11:21 +03:00
Karlis Goba 5c33a6e8bb Renamed .cpp to .c 2021-08-05 14:10:03 +03:00
Karlis Goba dd43982dbd Second step to moving to C 2021-08-05 14:07:31 +03:00
Karlis Goba 2dbaa4672b First step of moving to C 2021-08-05 13:56:35 +03:00