Git Product home page Git Product logo

Comments (6)

mazgch avatar mazgch commented on June 19, 2024 1

Some of the issues are just in test code, so will not affect a real application.

from ubxlib.

RobMeades avatar RobMeades commented on June 19, 2024

Very useful indeed, thanks Michael, give me time to absorb and I will comment here, tagging issue #209 so that warasilapm sees this.

from ubxlib.

mazgch avatar mazgch commented on June 19, 2024

Here is some more:

  1. if ((pInstance->startTimeMs > 0) &&

    likely a bad idea, just remove?: (pInstance->startTimeMs > 0) &&
    either you need an extra bool flag to indicate that startTimeMs was never set.
    all the startTimeMs = 0 in this file are very supicious ... values <0 are valid values that uPortGetTickTimeMs can return

  2. int32_t startTimeMs = 0;

    probably better to init with uPortGetTickTimeMs or maybe this = 0 is not needed at all, but seting 0 here is not better than having a random value.
    same here...
    int32_t startTimeMs = 0;

  3. pInstance->startTimeMs = 500;

    looks suspicious but not sure ...

  4. static int32_t gStartTimeMs = -1;

    again supicious probably need a separate flag to track if gStartTimeMs was ever set.

  5. int32_t ticksLastRestart;

    reconsider if this is needed: ticksLastRestart
    it does not really do something maybe just there for debugging and can be removed:
    pInstance->ticksLastRestart = uPortGetTickTimeMs();

    pInstance->ticksLastRestart = 0;

from ubxlib.

warasilapm avatar warasilapm commented on June 19, 2024

Yeah I've been noticing this repeatedly as well - though we've not been reviewing the test code applications. Zephyr does something similar as suggested by wrapping all "times" in an "opaque" (but not really) struct that is supposed to be passed into macros/static inlines to handle the encapsulated values. You can see the encapsulation in k_timeout_t here. I imagine you'd end up with a uTick_t struct similar to this.

Note Zephyr does some things differently as it generally leverages int64_t to avoid any wraparound issues. We've found a couple more edge cases to share on the other issue later today after we do some more investigation.

from ubxlib.

RobMeades avatar RobMeades commented on June 19, 2024

Implementation in #225.

from ubxlib.

RobMeades avatar RobMeades commented on June 19, 2024

The fix for this issue, as proposed (and reviewed) by @mazgch, can be found in commit 79e808e.

from ubxlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.