@e04/ft8ts 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e04/ft8ts",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "FT8 encoder/decoder in pure TypeScript",
5
5
  "keywords": [
6
6
  "ft8",
@@ -154,7 +154,6 @@ function parseCallsign(raw: string): {
154
154
  iarea <= 2 && // Fortran: iarea (1-indexed) must be 2 or 3 → 0-indexed: 1 or 2
155
155
  nplet >= 1 && // at least one letter before area digit
156
156
  npdig < iarea && // not all digits before area
157
- nslet >= 1 && // must have at least one letter after area digit
158
157
  nslet <= 3; // at most 3 suffix letters
159
158
 
160
159
  return { basecall: call, isStandard: standard, suffix };
@@ -200,7 +199,20 @@ function pack28(token: string): number {
200
199
  // Standard callsign
201
200
  const { basecall, isStandard } = parseCallsign(t);
202
201
  if (isStandard) {
203
- const cs = basecall.length === 5 ? ` ${basecall}` : basecall;
202
+ // Fortran pack28 layout:
203
+ // iarea==2 (0-based 1): callsign=' '//c13(1:5)
204
+ // iarea==3 (0-based 2): callsign= c13(1:6)
205
+ let iareaD = -1;
206
+ for (let ii = basecall.length - 1; ii >= 1; ii--) {
207
+ const c = basecall[ii] ?? "";
208
+ if (c >= "0" && c <= "9") {
209
+ iareaD = ii;
210
+ break;
211
+ }
212
+ }
213
+ let cs = basecall;
214
+ if (iareaD === 1) cs = ` ${basecall.slice(0, 5)}`;
215
+ if (iareaD === 2) cs = basecall.slice(0, 6);
204
216
  const i1 = A1.indexOf(cs[0] ?? " ");
205
217
  const i2 = A2.indexOf(cs[1] ?? "0");
206
218
  const i3 = A3.indexOf(cs[2] ?? "0");