Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue Report pile up in indi_gpsd #180

Closed
rtlprmft opened this issue Aug 3, 2020 · 6 comments
Closed

Queue Report pile up in indi_gpsd #180

rtlprmft opened this issue Aug 3, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@rtlprmft
Copy link
Contributor

rtlprmft commented Aug 3, 2020

I am not sure whether this is a general issue or depends on my configuration. I am using a ublox7-usb module with indi_gpsd. When I enable the automatic refresh (1s, 5s, or even manually), for every refresh, the time only increases by only one second. To my understanding, this is because the gpsd delivers a continuous stream and buffers this stream. When the buffer is then read with gps->read() only the next (but not the most recent report gets read. Therefore, I suggest the following change (works for me flewlessly):

Wrap the gps->read() in w a while loop which makes sure that the queue is empty:

while (1)
{
    if ((gpsData = gps->read()) == nullptr)
    {
        LOG_ERROR("GPSD read error.");
        IDSetText(&GPSstatusTP, nullptr);
        return IPS_ALERT;
    }

    if (!gps->waiting(0))
        break;
}
@rtlprmft rtlprmft added the bug Something isn't working label Aug 3, 2020
@knro
Copy link
Collaborator

knro commented Aug 3, 2020

Thank you, I noticed this issue too.

@rkaczorek What do you think?

@rkaczorek
Copy link
Contributor

Seems reasonable to me. @rtlprmft could you submit PR so I can review complete change?

@jochym
Copy link
Contributor

jochym commented Aug 4, 2020

That is an obvious bug. I second the need for a fix. If you have a a patch for that @rtlprmft please submit a PR, otherwise we (authors of gpsd) need to fix this.

@rtlprmft
Copy link
Contributor Author

rtlprmft commented Aug 4, 2020

I am sorry, but I have no idea how to do so. Code snippet that solves the problem (empties the queue) is above. I am happy for any advice.

@rkaczorek
Copy link
Contributor

@jochym are you going to handle it?

@jochym
Copy link
Contributor

jochym commented Aug 5, 2020

@rkaczorek I'll do it today

jochym added a commit that referenced this issue Aug 5, 2020
Empty the buffer of gpsd daemon and keep just last segment of data. Fix suggested by @rtlprmft in #180
knro pushed a commit that referenced this issue Aug 7, 2020
Empty the buffer of gpsd daemon and keep just last segment of data. Fix suggested by @rtlprmft in #180
@knro knro closed this as completed Aug 8, 2020
lboclboc pushed a commit to lboclboc/indi-3rdparty that referenced this issue Sep 13, 2020
Empty the buffer of gpsd daemon and keep just last segment of data. Fix suggested by @rtlprmft in indilib#180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants