GPS: a sentence isn't restarted on `$`, so stray bytes on the GPS UART also cost the next sentence
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 69/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Read MicroNMEALocationProvider::loop() and waitFor() in MicroNMEALocationProvider.h, then check how MicroNMEA 2.0.6 handles $ in process(). Reproduce the issue with stray bytes before a valid NMEA sentence and verify the proposed resynchronization lets the following sentence parse; decide whether the bad counter should include discarded fragments. The report also notes a separate gps reply issue in CommonGpsPrefs.cpp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
MicroNMEALocationProvider::loop() feeds every UART byte to MicroNMEA (MicroNMEALocationProvider.h:387 at repeater-v1.19.0). MicroNMEA 2.0.6 ends a sentence only at CR, LF or NUL. A $ in the middle doesn't start a new one (MicroNMEA.cpp, process()).
So any non-NMEA bytes on the line stay in the buffer and get glued to the front of the next real sentence. That sentence then fails the *_buffer == '$' test and is dropped. Examples: binary output from the module, a partial line at power-on, line noise.
If the stray bytes always come at the same point in the receiver's one-second output, the same sentence is lost every time. When that sentence is GGA, the only source of the satellite count:
satellitesCount()stays 0, sosaveFix()never stores a fix (sats > 0check).- RMC still gets through, so
fix:1and the clock still syncs. Nothing looks wrong from outside. - In periodic mode the GPS stays on until the first-fix timeout (default 1 h) on every acquisition.
How I hit it
RAK4631 + RAK12501 (L76K), env RAK_4631_repeater_gps_power, gps period 1d.
A local test build of mine had enabled a CASIC binary message on the L76K. It survived in the module's battery-backed RAM after I moved to 1.19.0. Self-inflicted, but the same thing happens with any module that mixes binary into its NMEA stream.
gps diag a few minutes after boot on 1.19.0:
req:1 en:1 ub:488459 ua:69 ok:8014 bad:3931 na:105 sat:0 fix:1 fa:never bc:3 sc:1 fm:3
req:1 en:1 ub:760096 ua:188 ok:12272 bad:5890 na:224 sat:0 fix:1 fa:never bc:3 sc:1 fm:3
After resetting the module to its factory settings ($PCAS10,3), same firmware otherwise:
req:1 en:0 ub:22735 ua:165909 ok:547 bad:11 na:165909 sat:7 fix:0 fa:165909 bc:3 sc:1 fm:0
Suggested fix
In MicroNMEALocationProvider::loop() (and waitFor()), when $ arrives in the middle of a sentence, end the current fragment first:
// MicroNMEA doesn't restart on '$': end a fragment first, so stray bytes cost only themselves
if (c == '$' && _inSentence) nmea.process('\n'); // drops the fragment
_inSentence = !(c == '\0' || c == '\r' || c == '\n');
Then the junk is dropped on its own, and the real sentence after it parses. If the diag bad counter should keep counting it, it needs its own increment there. MicroNMEA itself has been quiet since 2022, so fixing it on our side seems more practical than waiting on the library.
Side note: the gps reply in this state
Without GPS_GUARD, gps printed on, active, 0 sats 1193046h ago, periodic (86400s).
hasValidFix()falls back to the parser's live flag (LocationProvider.h:58).- But
getLastFixAge()returnsUINT32_MAXwhen no fix was saved (LocationProvider.h:88-91). CommonGpsPrefs.cpp:105-108prints both.
Printing no fix when the age is UINT32_MAX would avoid it.
Happy to open a PR for the resync if that's welcome.
- Ngôn ngữ chính
- C
- Star
- 3.9k
- Fork
- 1.5k
- Merge trung bình
- 2 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 56
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của meshcore-dev/MeshCore
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
meshcore-dev/MeshCore#4015 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
CMD_SET_DEFAULT_FLOOD_SCOPE leaves an older, longer name's tail after the new nameCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
meshcore-dev/MeshCore#3891 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
meshcore-dev/MeshCore#3826 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
App Preset Australia: NTĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
meshcore-dev/MeshCore#3825 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
meshcore-dev/MeshCore#3781 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của meshcore-dev/MeshCore
Issue tương tự
-
CF_CFDP_S_SendFileData computes the file checksum from the SB buffer after CFE_SB_TransmitBufferĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
389ds/389-ds-base#8251 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug data-types
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/clickhouse-cpp#645 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ROCm/hrx-system#3628 ·
Maintainer thường phản hồi trong vòng 1 ngày