gnss-js 1.36.0 → 1.38.0

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.
@@ -5,17 +5,17 @@ import {
5
5
  bdsSubframeParityOk,
6
6
  galInavPageCrcOk,
7
7
  testGloString
8
- } from "./chunk-5AUK42AL.js";
8
+ } from "./chunk-FA2UTLEQ.js";
9
9
  import {
10
10
  CnavAssembler,
11
11
  cnavCrcOk
12
- } from "./chunk-726LQBGM.js";
12
+ } from "./chunk-YUW33VXK.js";
13
13
  import {
14
- decodeGpsLnavFrame,
14
+ GpsLnavAssembler,
15
15
  getBitS,
16
16
  getBitU,
17
17
  setBitU
18
- } from "./chunk-IQ5OIMQD.js";
18
+ } from "./chunk-V2D5KUKH.js";
19
19
 
20
20
  // src/ubx/frame.ts
21
21
  function* ubxFrames(data, stats = { badChecksums: 0 }) {
@@ -92,38 +92,19 @@ function parseUbxNav(data, opts = {}) {
92
92
  }
93
93
  }
94
94
  if (refWeek === void 0) return { ephemerides, badParity };
95
- const subframes = /* @__PURE__ */ new Map();
96
- const last = /* @__PURE__ */ new Map();
95
+ const assembler = new GpsLnavAssembler();
97
96
  for (const f of ubxFrames(data)) {
98
97
  if (f.msgClass !== 2 || f.msgId !== 19) continue;
99
98
  const lnav = readLnavSubframe(view, f);
100
99
  if (!lnav) continue;
101
- const { prn, gnssId, svId, buff, id } = lnav;
100
+ const { prn, buff, id } = lnav;
102
101
  if (id < 1 || id > 5) {
103
102
  badParity++;
104
103
  continue;
105
104
  }
106
- if (id > 3) continue;
107
- const key = gnssId * 256 + svId;
108
- let sf = subframes.get(key);
109
- if (!sf) {
110
- sf = { buf: new Uint8Array(90), have: 0 };
111
- subframes.set(key, sf);
112
- }
113
- sf.buf.set(buff, (id - 1) * 30);
114
- sf.have |= 1 << id - 1;
115
- if (id !== 3 || sf.have !== 7) continue;
116
- const eph = decodeGpsLnavFrame(sf.buf, { prn, refWeek });
117
- if (!eph) {
118
- badParity++;
119
- continue;
120
- }
121
- const prev = last.get(prn);
122
- if (prev && prev.iode === eph.iode && prev.tocDate.getTime() === eph.tocDate.getTime()) {
123
- continue;
124
- }
125
- last.set(prn, eph);
126
- ephemerides.push(eph);
105
+ const r = assembler.push(prn, buff, refWeek);
106
+ if (r.kind === "eph") ephemerides.push(r.eph);
107
+ else if (r.kind === "decodeFailed") badParity++;
127
108
  }
128
109
  return { ephemerides, badParity };
129
110
  }