sparkfun / sparkfun/SparkFun_LG290P_GNSS_Arduino_Library

Unexpected behaviour of ensureEnabled within update

Open
#26 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
4
Forks
4
PR merge metrics
No merged PRs in 30d

Description

I'm writing a new example to test RTCM generation in Rover mode - specifically to test 1230 generation with v2.02 firmware

My loop() is simply:

void loop()
{
    myGNSS.update(); // Process bytes as they arrive from LG290P. Call rtcmCallback as needed
}

I have called myGNSS.rtcmSubscribeAll(rtcmCallback) to set up the callback for RTCM

update processes incoming RTCM and calls rtcmCallback as needed

update sets lg290PLibrarySemaphoreBlock true

In code below rtcmCallback, I want to use the GNSS time, which I get using myGNSS.getHour() etc.

getHour() ensures the PQTMPVT message is enabled by calling ensurePvtEnabled()

ensurePvtEnabled() calls ensureMsgEnabled to enable "PQTMPVT" if needed

ensureMsgEnabled calls setMessageRate

setMessageRate calls sendOkCommand to enable the PVT message

sendOkCommand calls sendCommand

sendCommand exits early because lg290PLibrarySemaphoreBlock is true because we are still inside update()

https://github.com/sparkfun/SparkFun_LG290P_GNSS_Arduino_Library/blob/1e5db69c9f763e22f0edaa11fd739098713a46eb/src/SparkFun_LG290P_GNSS.cpp#L1085-L1088

Long story short, PVT is never enabled and getHour etc. return zero

I'm still thinking about possible solutions...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/SparkFun_LG290P_GNSS.cpp at the linked sendCommand lines, then trace update(), rtcmCallback, ensurePvtEnabled(), ensureMsgEnabled(), setMessageRate(), and sendOkCommand(). Reproduce the Rover-mode RTCM 1230 example with v2.02 firmware and verify that getHour() and related time accessors return GNSS time while the callback runs during update().

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.